FreeRTOS 中的数据类型重定义
FreeRTOS 中的数据类型重定义
|
新定义的数据类型
|
实际的数据类型(C 标准类型) | |
| portCHAR | char | |
|
portSHORT
|
short
|
|
|
portLONG
|
long
|
|
|
portTickType
|
unsigned short int
|
用于定义系统时基计数器的值和阻塞时间的值。当 FreeRTOSConfig.h 头文件中的宏configUSE_16_BIT_TICKS 为 1 时则为 16位。
|
|
unsigned int
|
用于定义系统时基计数器的值和阻塞时间的值。 FreeRTOSConfig.h 头 文 件 中 的宏configUSE_16_BIT_TICKS 为 0 时则为 32位。
|
|
|
portBASE_TYPE
|
long
|
根据处理器的架构来决定是多少位的,如果是 32/16/8bit 的处理器则是 32/16/8bit 的数据类型。一般用于定义函数的返回值或者布尔类型。
|
代码清单:FreeRTOS 中的数据类型重定义
1 #define portCHAR char 2 #define portFLOAT float 3 #define portDOUBLE double 4 #define portLONG long 5 #define portSHORT short 6 #define portSTACK_TYPE uint32_t 7 #define portBASE_TYPE long 8 9 typedef portSTACK_TYPE StackType_t; 10 typedef long BaseType_t; 11 typedef unsigned long UBaseType_t; 12 13 #if( configUSE_16_BIT_TICKS == 1 ) 14 typedef uint16_t TickType_t; 15 #define portMAX_DELAY ( TickType_t ) 0xffff 16 #else 17 typedef uint32_t TickType_t; 18 #define portMAX_DELAY ( TickType_t ) 0xffffffffUL

浙公网安备 33010602011771号