1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
31
36
41
46
51
58
59
60
61
62
63
64
65
66
67
68
77
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* ... */
#ifndef __APP_THREADX_H__
#define __APP_THREADX_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "tx_api.h"
Includes
#include "main.h"
Private includes
Exported types
Exported constants
Exported macro
UINT App_ThreadX_Init(VOID *memory_ptr);
void MX_ThreadX_Init(void);
Exported functions prototypes
#define USE_TX_MUTEX
#if defined(USE_TX_MUTEX) && defined(USE_TX_SEMAPHORE)
#error "Only one synchronization API must be enabled"
#endif
#ifdef USE_TX_MUTEX
#define APP_SYNC_TYPE TX_MUTEX
#define TX_SYNC_ERROR TX_MUTEX_ERROR
#define APP_SYNC_GET tx_mutex_get
#define APP_SYNC_PUT tx_mutex_put
#define APP_SYNC_CREATE(a) tx_mutex_create((a),"App Mutex", TX_NO_INHERIT)
5 defines
/* ... */#else
#define APP_SYNC_TYPE TX_SEMAPHORE
#define TX_SYNC_ERROR TX_SEMAPHORE_ERROR
#define APP_SYNC_GET tx_semaphore_get
#define APP_SYNC_PUT(a) tx_semaphore_ceiling_put((a), 1)
#define APP_SYNC_CREATE(a) tx_semaphore_create((a),"App Binary Semaphore", 1)
5 defines#endif/* ... */
#define APP_STACK_SIZE 512
#define APP_BYTE_POOL_SIZE (2 * 1024)
#define THREAD_ONE_PRIO 10
#define THREAD_ONE_PREEMPTION_THRESHOLD THREAD_ONE_PRIO
#define THREAD_TWO_PRIO 10
#define THREAD_TWO_PREEMPTION_THRESHOLD THREAD_TWO_PRIO
#define DEFAULT_TIME_SLICE 5
7 defines
#ifdef __cplusplus
}extern "C" { ... }
#endif/* ... */
#endif