15#ifndef MX_WIFI_CMSIS_OS_H
16#define MX_WIFI_CMSIS_OS_H
19#include "CacheAlignedBuffer.h"
31#include "mbed_assert.h"
34#define MX_WIFI_MALLOC malloc
38#define MX_WIFI_FREE free
55 DynamicCacheAlignedBuffer<uint8_t> buffer;
56 uint32_t header_len = 0;
78#define MX_NET_BUFFER_ALLOC(len) mx_buf_alloc(len)
79#define MX_NET_BUFFER_FREE(p) mx_buf_free((p))
80#define MX_NET_BUFFER_HIDE_HEADER(p, n) mx_buf_hide_header((p),(n))
81#define MX_NET_BUFFER_PAYLOAD(p) mx_buf_payload((p))
82#define MX_NET_BUFFER_SET_PAYLOAD_SIZE(p, size) mx_buf_set_size((p),(size))
83#define MX_NET_BUFFER_GET_PAYLOAD_SIZE(p) mx_buf_get_size((p))
87void mx_buf_hide_header(
mx_buf_t *p, int32_t n);
89uint32_t mx_buf_get_size(
mx_buf_t *p);
90void mx_buf_set_size(
mx_buf_t *p, int32_t n);
92void mbed_delay(uint32_t delay);
93void *mbed_mutex_new(
void);
94void mbed_mutex_delete(
void *);
95void mbed_mutex_lock(
void *);
96void mbed_mutex_unlock(
void *);
99void *mbed_sem_new(uint32_t count);
100void mbed_sem_delete(
void *sem);
101bool mbed_sem_signal(
void *sem);
102bool mbed_sem_wait(
void *sem, uint32_t timeout);
104void *mbed_queue_new(uint32_t count);
105void mbed_queue_delete(
void *sem);
106void *mbed_queue_pop(
void *sem, uint32_t timeout);
109bool mbed_queue_push(
void *sem,
void *value, uint32_t timeout);
111void *mbed_thread_new(
void (*thread_entry)(
void), uint32_t stacksize, uint32_t priority);
112void mbed_thread_delete(
void *thread);
113void mbed_thread_terminate(
void *thread);
116#define MX_ASSERT(a) MBED_ASSERT(a)
118#define LOCK_DECLARE(A) void* A
119#define LOCK_INIT(A) A = mbed_mutex_new()
120#define LOCK_DEINIT(A) mbed_mutex_delete(A)
121#define LOCK(A) mbed_mutex_lock(A)
122#define UNLOCK(A) mbed_mutex_unlock(A)
124#define SEM_DECLARE(A) void *A
125#define SEM_INIT(A,COUNT) A = mbed_sem_new(COUNT);
126#define SEM_DEINIT(A) mbed_sem_delete(A)
127#define SEM_SIGNAL(A) mbed_sem_signal(A)
128#define SEM_WAIT(A,TIMEOUT,IDLE_FUNC) mbed_sem_wait(A,TIMEOUT)
130#define THREAD_DECLARE(A) void *A
131#define THREAD_INIT(A, THREAD_FUNC, THREAD_CONTEXT, STACKSIZE, PRIORITY) (((A = mbed_thread_new((THREAD_CONTEXT_FUNC_TYPE)THREAD_FUNC,STACKSIZE, PRIORITY))!= NULL)?true:false)
132#define THREAD_DEINIT(A) mbed_thread_delete(A)
133#define THREAD_TERMINATE(A) mbed_thread_terminate(A)
134#define THREAD_CONTEXT_TYPE void
135#define THREAD_CONTEXT_FUNC_TYPE void (*)(void)
137#define FIFO_DECLARE(QUEUE) void* QUEUE
138#define FIFO_PUSH(QUEUE, VALUE, TIMEOUT, IDLE_FUNC) mbed_queue_push(QUEUE, VALUE, TIMEOUT)
139#define FIFO_POP(QUEUE, TIMEOUT, IDLE_FUNC) mbed_queue_pop(QUEUE, TIMEOUT)
140#define FIFO_INIT(QUEUE,QSIZE) QUEUE = mbed_queue_new(QSIZE)
141#define FIFO_DEINIT(QUEUE) mbed_queue_delete(QUEUE)
144#define WAIT_FOREVER 0xffffffff
146#define THREAD_OK true
149#define OSPRIORITYNORMAL 1
150#define OSPRIORITYREALTIME 2
151#define OSPRIORITYABOVENORMAL 3
152#define DELAYms(n) mbed_delay(n)
Structure for an MX wifi buffer.