1 #ifndef EVE_RTOS_H_INCLUDED 2 #define EVE_RTOS_H_INCLUDED 80 #include <sys/types.h> 93 #define IPPROTO_UDP 17 95 #define SO_RCVTIMEO 20 96 #define SO_SNDTIMEO 21 98 #define FIONBIO 0x5421 116 #define portYIELD_FROM_ISR(woken) do { } while (0) 127 const char *
const pcName,
128 unsigned short usStackDepth,
252 struct DummySemaphoreQueue_t;
262 #define vSemaphoreCreateBinary(xSemaphore) \ 264 (xSemaphore) = xSemaphoreCreateBinary(); \ 265 xSemaphoreGive(xSemaphore); \ 395 const char *
const pcTimerName,
398 void *
const pvTimerID,
545 #define xTimerGetTimerDaemonTaskHandle() (!!! "Not implemented" !!!) 554 uint32_t ulParameter2,
567 uint32_t ulParameter2,
679 extern const struct md_heap_t RtosSocketRxHeap;
680 extern const struct md_heap_t RtosSocketTxHeap;
682 enum rtos_socket_swap_direction_t
685 RTOS_SOCKET_SWAP_OUT,
688 enum rtos_socket_swap_target_t
694 struct rtos_socket_swap_params_t
696 enum rtos_socket_swap_direction_t Dir;
697 enum rtos_socket_swap_target_t Target;
703 extern bool RtosSocketSwapCallback(
const struct rtos_socket_swap_params_t *Params);
705 bool RtosSocketRxHeapSwapOut(
const struct md_heap_t *RxHeap, uint32_t Pos,
const uint8_t **DataPtr, uint32_t Size);
706 bool RtosSocketRxHeapSwapIn(
const struct md_heap_t *RxHeap, uint8_t **DataPtr, uint32_t Pos, uint32_t Size);
707 bool RtosSocketTxHeapSwapOut(
const struct md_heap_t *TxHeap, uint32_t Pos,
const uint8_t **DataPtr, uint32_t Size);
708 bool RtosSocketTxHeapSwapIn(
const struct md_heap_t *TxHeap, uint8_t **DataPtr, uint32_t Pos, uint32_t Size);
710 #define RTOS_SOCKET_HEAP_NUM_ENTRIES(NumSockets) \ 713 #define RTOS_SOCKET_HEAP_RAM_BUFFER_SIZE(NumSockets) \ 714 ((NumSockets) * (1500 + 4) + 4) 716 #define RTOS_SOCKET_HEAP_TINY_RAM_BUFFER_SIZE(NumSockets) \ 717 ((NumSockets) * 4 + 1500 + 4) 719 #define RTOS_SOCKET_HEAP_EXT_RAM_SIZE(NumSockets) \ 720 ((NumSockets) * 1500) 722 #define RTOS_SOCKET_HEAP_IMPL(NumSockets, Direction) \ 723 static struct md_descriptor_t RtosSocket ## Direction ## HeapEntries[RTOS_SOCKET_HEAP_NUM_ENTRIES(NumSockets)]; \ 724 static uint8_t RtosSocket ## Direction ## HeapRamBuffer[RTOS_SOCKET_HEAP_RAM_BUFFER_SIZE(NumSockets)]; \ 725 static struct md_state_t RtosSocket ## Direction ## HeapState; \ 726 const struct md_heap_t RtosSocket ## Direction ## Heap; \ 727 static void RtosSocket ## Direction ## HeapCtor(void) __attribute__((constructor)); \ 728 static void RtosSocket ## Direction ## HeapCtor(void) \ 730 MemInit(&RtosSocket ## Direction ## Heap); \ 732 const struct md_heap_t RtosSocket ## Direction ## Heap = \ 734 .Entries = RtosSocket ## Direction ## HeapEntries, \ 735 .NumEntries = RTOS_SOCKET_HEAP_NUM_ENTRIES(NumSockets), \ 736 .RamBuffer = RtosSocket ## Direction ## HeapRamBuffer, \ 737 .RamBufferSize = RTOS_SOCKET_HEAP_RAM_BUFFER_SIZE(NumSockets), \ 738 .State = &RtosSocket ## Direction ## HeapState, \ 743 #define RTOS_SOCKET_HEAP(NumSockets) \ 744 RTOS_SOCKET_HEAP_IMPL(NumSockets, Rx); \ 745 RTOS_SOCKET_HEAP_IMPL(NumSockets, Tx) 747 #define RTOS_SOCKET_TINY_HEAP_IMPL(NumSockets, Direction) \ 748 static struct md_descriptor_t RtosSocket ## Direction ## HeapEntries[RTOS_SOCKET_HEAP_NUM_ENTRIES(NumSockets)]; \ 749 static uint8_t RtosSocket ## Direction ## HeapRamBuffer[RTOS_SOCKET_HEAP_TINY_RAM_BUFFER_SIZE(NumSockets)]; \ 750 static struct md_state_t RtosSocket ## Direction ## HeapState; \ 751 const struct md_heap_t RtosSocket ## Direction ## Heap; \ 752 static void RtosSocket ## Direction ## HeapCtor(void) __attribute__((constructor)); \ 753 static void RtosSocket ## Direction ## HeapCtor(void) \ 755 MemInit(&RtosSocket ## Direction ## Heap); \ 757 const struct md_heap_t RtosSocket ## Direction ## Heap = \ 759 .Entries = RtosSocket ## Direction ## HeapEntries, \ 760 .NumEntries = RTOS_SOCKET_HEAP_NUM_ENTRIES(NumSockets), \ 761 .RamBuffer = RtosSocket ## Direction ## HeapRamBuffer, \ 762 .RamBufferSize = RTOS_SOCKET_HEAP_TINY_RAM_BUFFER_SIZE(NumSockets), \ 763 .State = &RtosSocket ## Direction ## HeapState, \ 764 .ExtRamSize = RTOS_SOCKET_HEAP_EXT_RAM_SIZE(NumSockets), \ 765 .SwapOut = RtosSocket ## Direction ## HeapSwapOut, \ 766 .SwapIn = RtosSocket ## Direction ## HeapSwapIn, \ 768 #define RTOS_SOCKET_TINY_HEAP(NumSockets) \ 769 RTOS_SOCKET_TINY_HEAP_IMPL(NumSockets, Rx); \ 770 RTOS_SOCKET_TINY_HEAP_IMPL(NumSockets, Tx) 810 #define HTONS(hostshort) UIP_HTONS(hostshort) 818 static inline uint16_t
htons(uint16_t hostshort)
831 int socket(
int domain,
int type,
int protocol);
888 ssize_t
recv(
int sockfd,
void *buf,
size_t len,
int flags);
900 int poll_recv(
int sockfd, uint32_t timeout);
911 ssize_t
send(
int sockfd,
const void *buf,
size_t len,
int flags);
923 int poll_send(
int sockfd, uint32_t timeout);
935 int select(
int nfds, fd_set *readfds, fd_set *writefds,
936 fd_set *exceptfds,
struct timeval *timeout);
951 int ioctlsocket(
int sockfd,
int request,
const void *opt);
static BaseType_t xTimerStartFromISR(TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken)
int closesocket(int sockfd)
static SemaphoreHandle_t xSemaphoreCreateBinary(void)
ssize_t send(int sockfd, const void *buf, size_t len, int flags)
const char * pcTimerGetTimerName(TimerHandle_t xTimer)
static UBaseType_t uxTaskPriorityGet(TaskHandle_t xTask)
static BaseType_t xSemaphoreGiveRecursive(SemaphoreHandle_t xSemaphore)
EventBits_t xEventGroupClearBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear)
struct Task_t * TaskHandle_t
void vTaskDelay(const TickType_t xTicksToDelay)
int socket(int domain, int type, int protocol)
BaseType_t xSemaphoreGive(SemaphoreHandle_t xSemaphore)
struct EventGroup_t * EventGroupHandle_t
static BaseType_t xTimerReset(TimerHandle_t xTimer, TickType_t xBlockTime)
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
ssize_t recv(int sockfd, void *buf, size_t len, int flags)
static EventBits_t xEventGroupGetBitsFromISR(EventGroupHandle_t xEventGroup)
void taskENABLE_INTERRUPTS(void)
void vSemaphoreDelete(SemaphoreHandle_t xSemaphore)
void * pvTimerGetTimerID(TimerHandle_t xTimer)
int setsockopt(int sockfd, int level, int request, const void *opt, socklen_t length)
struct Timer_t * TimerHandle_t
void(* TimerCallbackFunction_t)(TimerHandle_t pxTimer)
EventGroupHandle_t xEventGroupCreate(void)
SemaphoreHandle_t xSemaphoreCreateImpl(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, bool xRecursive)
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
void vTaskDelayUntil(TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement)
void taskDISABLE_INTERRUPTS(void)
void vEventGroupDelete(EventGroupHandle_t xEventGroup)
int listen(int sockfd, int backlog)
struct DummySemaphoreQueue_t * QueueHandle_t
static uint16_t htons(uint16_t hostshort)
void vTaskSuspend(TaskHandle_t xTaskToSuspend)
static SemaphoreHandle_t xSemaphoreCreateMutex(void)
void taskEXIT_CRITICAL(void)
BaseType_t xTaskCreate(TaskFunction_t pvTaskCode, const char *const pcName, unsigned short usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pvCreatedTask)
void vTimerSetTimerID(TimerHandle_t xTimer, void *pvNewID)
static BaseType_t xSemaphoreTakeRecursive(SemaphoreHandle_t xSemaphore, TickType_t xTicksToWait)
static BaseType_t xTimerResetFromISR(TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken)
int poll_send(int sockfd, uint32_t timeout)
BaseType_t xTimerStop(TimerHandle_t xTimer, TickType_t xBlockTime)
void(* PendedFunction_t)(void *pvParameter1, uint32_t ulParameter2)
void vTaskResume(TaskHandle_t xTaskToResume)
void(* TaskFunction_t)(void *pvParameters)
EventBits_t xEventGroupWaitBits(const EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait)
EventBits_t xEventGroupGetBits(EventGroupHandle_t xEventGroup)
BaseType_t xTimerChangePeriod(TimerHandle_t xTimer, TickType_t xNewPeriod, TickType_t xBlockTime)
EventBits_t xEventGroupSetBits(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet)
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
EventBits_t xEventGroupSync(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait)
int ioctlsocket(int sockfd, int request, const void *opt)
static BaseType_t xEventGroupSetBitsFromISR(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken)
int poll_recv(int sockfd, uint32_t timeout)
void taskENTER_CRITICAL(void)
void vTaskStartScheduler(void)
TaskHandle_t xSemaphoreGetMutexHolder(SemaphoreHandle_t xSemaphore)
static BaseType_t xTimerChangePeriodFromISR(TimerHandle_t xTimer, TickType_t xNewPeriod, BaseType_t *pxHigherPriorityTaskWoken)
BaseType_t xTimerIsTimerActive(TimerHandle_t xTimer)
static BaseType_t xSemaphoreTakeFromISR(SemaphoreHandle_t xSemaphore, BaseType_t *const pxHigherPriorityTaskWoken)
BaseType_t xSemaphoreTake(SemaphoreHandle_t xSemaphore, TickType_t xTicksToWait)
void vTaskCancelBlockingCall(TaskHandle_t xTaskToWakeup)
static BaseType_t xTaskResumeFromISR(TaskHandle_t xTaskToResume)
static SemaphoreHandle_t xSemaphoreCreateRecursiveMutex(void)
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
static SemaphoreHandle_t xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount)
static EventBits_t xEventGroupClearBitsFromISR(EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear)
static BaseType_t xTimerPendFunctionCallFromISR(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken)
struct DummySemaphoreQueue_t * SemaphoreHandle_t
TimerHandle_t xTimerCreate(const char *const pcTimerName, const TickType_t xTimerPeriod, const UBaseType_t uxAutoReload, void *const pvTimerID, TimerCallbackFunction_t pxCallbackFunction)
BaseType_t xTimerStart(TimerHandle_t xTimer, TickType_t xBlockTime)
BaseType_t xTimerDelete(TimerHandle_t xTimer, TickType_t xBlockTime)
static BaseType_t xTimerStopFromISR(TimerHandle_t xTimer, BaseType_t *pxHigherPriorityTaskWoken)
void vTaskDelete(TaskHandle_t xTask)
BaseType_t xTimerPendFunctionCall(PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait)
static void vTaskPrioritySet(TaskHandle_t xTask, UBaseType_t uxNewPriority)
static BaseType_t xSemaphoreGiveFromISR(SemaphoreHandle_t xSemaphore, BaseType_t *const pxHigherPriorityTaskWoken)