mongoose/src/arch_freertos_lwip.h

44 lines
889 B
C
Raw Normal View History

2021-05-29 06:49:26 +08:00
#pragma once
#if MG_ARCH == MG_ARCH_FREERTOS_LWIP
#include <ctype.h>
2021-05-29 06:49:26 +08:00
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
2021-09-29 17:13:02 +08:00
#include <stdio.h>
2022-01-14 20:33:06 +08:00
#include <string.h>
2021-05-29 06:49:26 +08:00
#if defined(__GNUC__)
2021-07-24 10:44:00 +08:00
#include <sys/stat.h>
2021-05-29 06:49:26 +08:00
#include <sys/time.h>
#else
struct timeval {
time_t tv_sec;
2022-01-14 20:33:06 +08:00
long tv_usec;
2021-05-29 06:49:26 +08:00
};
#endif
#include <FreeRTOS.h>
#include <task.h>
#include <lwip/sockets.h>
2021-08-11 14:56:46 +08:00
#if LWIP_SOCKET != 1
2021-09-15 14:43:48 +08:00
// Sockets support disabled in LWIP by default
2021-08-11 14:56:46 +08:00
#error Set LWIP_SOCKET variable to 1 (in lwipopts.h)
#endif
2021-05-29 06:49:26 +08:00
// Re-route calloc/free to the FreeRTOS's functions, don't use stdlib
static inline void *mg_calloc(int cnt, size_t size) {
void *p = pvPortMalloc(cnt * size);
if (p != NULL) memset(p, 0, size);
return p;
}
#define calloc(a, b) mg_calloc((a), (b))
#define free(a) vPortFree(a)
#define malloc(a) pvPortMalloc(a)
2022-01-19 03:31:10 +08:00
#define mkdir(a, b) (-1)
2021-05-29 06:49:26 +08:00
#endif // MG_ARCH == MG_ARCH_FREERTOS_LWIP