monoZ docs
MZ_sys_cmsis_os2.h
Go to the documentation of this file.
1
11#include "cmsis_os2.h"
12#include "MZ_common.h"
13#include "FreeRTOSConfig.h"
14#include "projdefs.h"
15#include "portmacro.h"
16#include "FreeRTOS.h"
17#include "timers.h"
18#include "MZ_error_handler.h"
19
20
21#ifndef MZ_SYS_CMSIS_OS2_H_
22#define MZ_SYS_CMSIS_OS2_H_
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#define CMSISOS2_INFINITE32 (0xFFFFFFFF)
28
29#define SEMA_TIMEOUT (CMSISOS2_INFINITE32)
30
31#define MAILBOX_TIMEOUT (CMSISOS2_INFINITE32)
32
33#define DEFAULT_STACK_SIZE (256)
34
35
37typedef osMutexId_t mz_mutex_t;
39typedef osSemaphoreId_t mz_semaphore_t;
41typedef osMessageQueueId_t mz_mailbox_t;
43typedef osThreadId_t mz_thread_t;
45typedef osPriority_t mz_thread_prio_t;
47typedef TimerHandle_t mz_timer_t;
49typedef TimerCallbackFunction_t mz_timer_fp;
50
51
60uint32_t mz_sys_now(void);
63// CMSIS V2 mutex related Abstraction
74
83
92
101
110
121// CMSIS V2 semaphore related Abstraction
134uint8_t mz_sem_create(mz_semaphore_t * c, uint8_t cnt, uint8_t init);
135
144
153uint32_t mz_sem_wait(mz_semaphore_t * c, uint32_t timeout);
154
163
172
183// CMSIS V2 message queue related Abstraction
196uint8_t mz_mailbox_create(mz_mailbox_t * c, size_t no_of_mail, size_t mail_size);
197
206
217
228mz_error_t mz_mailbox_get(mz_mailbox_t * c, void* m, uint32_t timeout);
229
241
252
261
272// CMSIS V2 thread related Abstraction
290uint8_t mz_thread_create(mz_thread_t* t,const char* name,mz_fn thread_func,void* const arg,mz_thread_prio_t prio,StackType_t * stack_mem,size_t stack_size,StaticTask_t * cb_mem,uint32_t cb_size);
291
300
307uint8_t mz_thread_yield(void);
319void * mz_malloc(size_t size);
320
327void mz_free(void * _ptr);
329#ifdef __cplusplus
330}
331#endif
332#endif /* MZ_SYS_CMSIS_OS2_H_ */
monoZ Lib Common.
_mz_fp mz_fn
1 Byte data type
Definition: MZ_common.h:39
monoZ Error Handler
mz_error_t
Enumeration of monoZ Error Flags.
mzUint8 cnt
osSemaphoreId_t mz_semaphore_t
mz_semaphore_t variable of type osSemaphoreId_t
osMessageQueueId_t mz_mailbox_t
mz_mailbox_t variable of type osMessageQueueId_t
TimerCallbackFunction_t mz_timer_fp
mz_timer_fp variable of type TimerCallbackFunction_t
osThreadId_t mz_thread_t
mz_thread_t variable of type osThreadId_t
osMutexId_t mz_mutex_t
mz_mutex_t variable of type osMutexId_t
TimerHandle_t mz_timer_t
mz_timer_t variable of type TimerHandle_t
osPriority_t mz_thread_prio_t
mz_thread_prio_t variable of type osPriority_t
uint8_t mz_mailbox_invalid(mz_mailbox_t *c)
This function is used to check the message queue object validity Message queue object is invalid.
uint8_t mz_mailbox_delete(mz_mailbox_t *c)
This function is used to delete the message queue object Delete message queue object.
uint8_t mz_mailbox_create(mz_mailbox_t *c, size_t no_of_mail, size_t mail_size)
This function is used to create and initialize the message queue object Create and initialize a messa...
mz_error_t mz_mailbox_put(mz_mailbox_t *c, void *m)
This function is used to put a message into the queue or timeout if queue is full Put a message into ...
mz_error_t mz_mailbox_putnow(mz_mailbox_t *c, void *m)
This function is used to put a message now into the queue or timeout if queue is full Put a message i...
mz_error_t mz_mailbox_get(mz_mailbox_t *c, void *m, uint32_t timeout)
This function is used to put a message into the queue or timeout if queue is full Get a message from ...
uint8_t mz_mailbox_isvalid(mz_mailbox_t *c)
This function is used to check the message queue object validity Check the message queue object valid...
mz_error_t mz_mailbox_getnow(mz_mailbox_t *c, void *m)
This function is used to get the message now from the queue or timeout if queue is empty Get a messag...
void * mz_malloc(size_t size)
This function is used to allocate and map the required memory.
void mz_free(void *_ptr)
This function is used to free the mapped memory Map to the memory management routines required for th...
uint8_t mz_mutex_create(mz_mutex_t *c)
This function is used to create and initialize the mutex object Create and Initialize a Mutex object.
uint8_t mz_mutex_unlock(mz_mutex_t *c)
This function is used to release the mutex Release a Mutex that was acquired by.
uint8_t mz_mutex_delete(mz_mutex_t *c)
This function is used to delete the mutex object Delete a Mutex object.
uint8_t mz_mutex_isvalid(mz_mutex_t *c)
This function is used to check the mutex object validity Check the Mutex Object Validation.
uint8_t mz_mutex_lock(mz_mutex_t *c)
This function is used to acquire the mutex or timeout if it is locked Acquire a Mutex or timeout if i...
uint8_t mz_mutex_invalid(mz_mutex_t *c)
This function is used to invalidate the created mutex object Mutex Object created is invalid.
uint8_t mz_sem_isvalid(mz_semaphore_t *c)
This functiion is used to check the semaphore object validity Check the Semaphore object validation.
uint32_t mz_sem_wait(mz_semaphore_t *c, uint32_t timeout)
This function is used to acquire a semaphore token or timout if no tokens are available Acquire a Sem...
uint8_t mz_sem_create(mz_semaphore_t *c, uint8_t cnt, uint8_t init)
This function is used to create and initialize the semaphore object Create and Initialize a Semaphore...
uint8_t mz_sem_invalid(mz_semaphore_t *c)
This function is used to invalidate the created semaphore Semaphore object is invalid.
uint8_t mz_sem_delete(mz_semaphore_t *c)
This function is used to delete a semaphore object Delete a Semaphore object.
uint8_t mz_sem_release(mz_semaphore_t *c)
This function is used to acquire a semaphore token or timout if no tokens are available Release a Sem...
uint32_t mz_sys_now(void)
This function returns the RTOS system timer count as 32 bit value.
uint8_t mz_thread_terminate(mz_thread_t *t)
This function is used to terminate the execution of thread Terminate the execution of thread.
uint8_t mz_thread_create(mz_thread_t *t, const char *name, mz_fn thread_func, void *const arg, mz_thread_prio_t prio, StackType_t *stack_mem, size_t stack_size, StaticTask_t *cb_mem, uint32_t cb_size)
This function is used to check the message queue object validity Create a thread and add it to Active...
uint8_t mz_thread_yield(void)
This function is used to pass control to the next thread that is in ready state.