diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2012-09-13 10:42:25 -0400 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2012-09-13 10:42:25 -0400 |
commit | bd45bf50c7c68ec35c3aad8c5e7bf4d3db9cafc1 (patch) | |
tree | c02065cc7b15ce5f0a8eaa9f0030a268b37c89bb /firmwares/wifishield/wifiHD/src/owl_os.c | |
parent | 6225a8596005bfb0be68fa641f5b47d01a95c12d (diff) | |
parent | 0d9a111face4f3629bcae8e52af843792af3b453 (diff) |
Merge branch 'master' of ../wifishield
Diffstat (limited to 'firmwares/wifishield/wifiHD/src/owl_os.c')
-rw-r--r-- | firmwares/wifishield/wifiHD/src/owl_os.c | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/firmwares/wifishield/wifiHD/src/owl_os.c b/firmwares/wifishield/wifiHD/src/owl_os.c new file mode 100644 index 0000000..d17d8ce --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/owl_os.c @@ -0,0 +1,140 @@ +#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <wl_os.h>
+
+void *owl_os_alloc(size_t size)
+{
+ return malloc(size);
+}
+
+void *owl_os_realloc(void *ptr, size_t size)
+{
+ return realloc(ptr, size);
+}
+
+void owl_os_free(void *p)
+{
+ free(p);
+}
+
+void *owl_os_memcpy(void *dst, const void *src, size_t n)
+{
+ return memcpy(dst, src, n);
+}
+
+void *owl_os_memset(void *s, int c, size_t n)
+{
+ return memset(s, c, n);
+}
+
+void *owl_os_memmove(void *dst, const void *src, size_t n)
+{
+ return memmove(dst, src, n);
+}
+
+size_t owl_os_strlen(char *s)
+{
+ return strlen(s);
+}
+
+char *owl_os_strncpy(char *dst, const char *src, size_t n)
+{
+ return strncpy(dst, src, n);
+}
+
+int owl_os_strncmp(const char *s1, const char *s2, size_t n)
+{
+ return strncmp(s1, s2, n);
+}
+
+int owl_os_strcmp(const char *s1, const char *s2)
+{
+ return strcmp(s1, s2);
+}
+
+char *owl_os_strcpy(char *dst, const char *src)
+{
+ return strcpy(dst, src);
+}
+
+char *owl_os_strdup(const char *s)
+{
+ return strdup(s);
+}
+
+char *owl_os_strndup(const char *s, size_t n)
+{
+ return strndup(s, n);
+}
+
+int owl_os_memcmp(const void *s1, const void *s2, size_t n)
+{
+ return memcmp(s1, s2, n);
+}
+
+long int owl_os_strtol(const char *nptr, char **endptr, int base)
+{
+ return strtol(nptr, endptr, base);
+}
+
+char *owl_os_strchr(const char *s, int c)
+{
+ return strchr(s, c);
+}
+
+char *owl_os_strrchr(const char *s, int c)
+{
+ return strrchr(s, c);
+}
+
+int owl_os_strcasecmp(const char *s1, const char *s2)
+{
+ return strcasecmp(s1, s2);
+}
+
+char *owl_os_strstr(const char *haystack, const char *needle)
+{
+ return strstr(haystack, needle);
+}
+
+int owl_os_snprintf(char *str, size_t size, const char *format, ...)
+{
+ int ret;
+ va_list ap;
+ va_start(ap, format);
+ ret = vsniprintf(str, size, format, ap);
+ va_end(ap);
+ return ret;
+}
+
+/* for debugging only, never called if wl_api was built without debug */
+#ifdef CONFIG_OWL
+#include "owl_env.h"
+int owl_os_printf(const char *fmt, ...)
+{
+ char *str = NULL;
+ va_list args;
+ int len;
+ char *iter;
+
+ va_start(args, fmt);
+
+ if ((str = malloc(160)) == NULL)
+ return -1;
+
+ if ((len = vsniprintf(str, 160, fmt, args)) < 0) {
+ free(str);
+ return -1;
+ }
+
+ iter = str;
+ while (*iter)
+ owl_putc(*iter++);
+
+ free(str);
+ return len;
+}
+#endif
|