SSCMA-Micro CPP SDK  v2.0.0
SSCMA-Micro is a cross-platform machine learning inference framework designed for embedded devices.
ma_osal_freertos.h
Go to the documentation of this file.
1 #ifndef _MA_OSAL_FREERTOS_H_
2 #define _MA_OSAL_FREERTOS_H_
3 
4 #include <core/ma_common.h>
5 
6 #include <ma_config_board.h>
7 
8 #if MA_OSAL_FREERTOS
9 
10  #ifdef __cplusplus
11 extern "C" {
12  #endif
13 
14  // #if __cplusplus >= 201703L
15  #if __has_include(<freertos/FreeRTOS.h>)
16  #include <freertos/FreeRTOS.h>
17  #include <freertos/event_groups.h>
18  #include <freertos/portmacro.h>
19  #include <freertos/queue.h>
20  #include <freertos/semphr.h>
21  #include <freertos/task.h>
22  #include <freertos/timers.h>
23  #elif __has_include(<FreeRTOS.h>)
24  #include <FreeRTOS.h>
25  #include <event_groups.h>
26  #include <portmacro.h>
27  #include <queue.h>
28  #include <semphr.h>
29  #include <task.h>
30  #include <timers.h>
31  #endif
32  // #else
33  // #include <FreeRTOS.h>
34  // #include <event_groups.h>
35  // #include <portmacro.h>
36  // #include <queue.h>
37  // #include <semphr.h>
38  // #include <task.h>
39  // #include <timers.h>
40  // #endif
41 
42  #define MA_WAIT_FOREVER portMAX_DELAY
43 
44 typedef TickType_t ma_tick_t;
45 typedef SemaphoreHandle_t ma_mutex_t;
46 typedef TaskHandle_t ma_thread_t;
47 typedef SemaphoreHandle_t ma_sem_t;
48 typedef EventGroupHandle_t ma_event_t;
49 typedef QueueHandle_t ma_mbox_t;
50 typedef StackType_t ma_stack_t;
51 
52 typedef struct ma_timer {
53  TimerHandle_t handle;
54  void (*fn)(struct ma_timer*, void* arg);
55  void* arg;
56  uint32_t us;
57  bool oneshot;
58  char name[16];
59 } ma_timer_t;
60 
61  #ifdef __cplusplus
62 }
63  #endif
64 
65 #endif
66 
67 #endif // _MA_OSAL_FREERTOS_H_
struct ma_mbox ma_mbox_t
void * ma_stack_t
Definition: ma_osal_pthread.h:19
pthread_t ma_thread_t
Definition: ma_osal_pthread.h:17
pthread_mutex_t ma_mutex_t
Definition: ma_osal_pthread.h:18
struct ma_timer ma_timer_t
struct ma_event ma_event_t
struct ma_sem ma_sem_t
uint64_t ma_tick_t
Definition: ma_osal_pthread.h:16
Definition: ma_osal_pthread.h:40
void(* fn)(struct ma_timer *, void *arg)
Definition: ma_osal_pthread.h:43
bool oneshot
Definition: ma_osal_pthread.h:46
void * arg
Definition: ma_osal_pthread.h:44