Add RTX-RTOS support

This commit is contained in:
Alex Alashkin authored and Alex Alashkin committed 2022-02-23 19:56:37 +02:00
1 parent 42ba1e4aed
commit 412f5cf3e0
7 files changed
+99 -2

No files matched your search

+1
View File
@@ -8,6 +8,7 @@
#define MG_ARCH_FREERTOS_TCP 5
#define MG_ARCH_FREERTOS_LWIP 6
#define MG_ARCH_AZURERTOS 7
#define MG_ARCH_RTX_LWIP 8
#if !defined(MG_ARCH)
#if defined(__unix__) || defined(__APPLE__)
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#if MG_ARCH == MG_ARCH_RTX_LWIP
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#if defined(__GNUC__)
#include <sys/stat.h>
#include <sys/time.h>
#else
struct timeval {
time_t tv_sec;
long tv_usec;
};
#endif
#include <lwip/sockets.h>
#if LWIP_SOCKET != 1
// Sockets support disabled in LWIP by default
#error Set LWIP_SOCKET variable to 1 (in lwipopts.h)
#endif
#define mkdir(a, b) (-1)
#ifndef MG_IO_SIZE
#define MG_IO_SIZE 512
#endif
#ifndef MG_PATH_MAX
#define MG_PATH_MAX 128
#endif
#endif
+1 -1
View File
@@ -170,7 +170,7 @@ static void mg_set_non_blocking_mode(SOCKET fd) {
const BaseType_t off = 0;
if (setsockopt(fd, 0, FREERTOS_SO_RCVTIMEO, &off, sizeof(off)) != 0) (void) 0;
if (setsockopt(fd, 0, FREERTOS_SO_SNDTIMEO, &off, sizeof(off)) != 0) (void) 0;
#elif MG_ARCH == MG_ARCH_FREERTOS_LWIP
#elif MG_ARCH == MG_ARCH_FREERTOS_LWIP || MG_ARCH == MG_ARCH_RTX_LWIP
lwip_fcntl(fd, F_SETFL, O_NONBLOCK);
#elif MG_ARCH == MG_ARCH_AZURERTOS
fcntl(fd, F_SETFL, O_NONBLOCK);