章节目录规划
- Kernel
- task
- memory management
- queue, mutex, semaphore
- time manage
- software timer
- interrupt process
- FreeRTOS plus
- FreeRTOS + IO
- FreeRTOS + TCP
- FreeRTOS + CLI
- JSON
- application protocols: MQTT & HTTP
Kernel
task
- task scheduler
- stack
- task switch
- idle task
memory management
多种方案
queue, mutex, semaphore
time manage
延时与唤醒
定时器
FreeRTOS+IO
A POSIX “style” peripheral driver extension for FreeRTOS
官网
FreeRTOS+IO层在Peripheral Driver Library 层和Application层之间。
/* open() */
Peripheral_Descriptor_t FreeRTOS_open( const int8_t *pcPath, const uint32_t ulFlags );
其中, @pcPath: 是目标IO的名称字符串,例如"SPI2",这些名字应该是BSP已经定义的。
/* read() */
size_t FreeRTOS_read( Peripheral_Descriptor_t const pxPeripheral,
void * const pvBuffer,
const size_t xBytes );
/* write */
size_t FreeRTOS_write( Peripheral_Descriptor_t const pxPeripheral,
const void *pvBuffer,
const size_t xBytes );
/* IO control */
BaseType_t FreeRTOS_ioctl( Peripheral_Descriptor_t const xPeripheral,
uint32_t ulRequest,
void *pvValue );
驱动库:The current BSP implementation(s) support UART, I2C and SPI operation, in both polled and interrupt driven modes. Support for non-serial peripherals will be added soon.
demo
demo中的函数原型(prototype)与上面的(官网介绍)不大相同
几个关键点
source | description | |
---|---|---|
FreeRTOS_open | 函数 | 其中 vFreeRTOS_lpc17xx_PopulateFunctionPointers 执行外设类型对应的open,例如FreeRTOS_UART_open() |
FreeRTOS_write/read | 宏 | 指向外设结构体open wirte()方法 |
FreeRTOS_ioctl | 函数 | 与FreeRTOS_open()类似,根据外设类型执行各自的ioctl()方法 |
boardAVAILABLE_DEVICES_LIST | 宏 | 定义了外设列表 xAvailablePeripherals |
I2C_M_SETUP_Type | struct | 一个很好的外设Tx Rx Control模板。 |
Peripheral_Control_t | struct | 很好的 外设 模板 |
FreeRTOS_DriverInterface.h | .h | 可做参考 |
typedef struct xPERIPHREAL_CONTROL
{
Peripheral_write_Function_t write; /* The function used to write to the peripheral. */
Peripheral_read_Function_t read; /* The function used to read from the peripheral. */
Peripheral_ioctl_Function_t ioctl; /* The function used for ioctl access to the peripheral. */
Transfer_Control_t *pxTxControl; /* Pointer to the transfer control structure used to manage transmissions through the peripheral. */
Transfer_Control_t *pxRxControl; /* Pointer to the transfer control structure used to manage receptions from the peripheral. */
const Available_Peripherals_t *pxDevice; /* Pointer to the structure that defines the name and base address of the open peripheral. */
int8_t cPeripheralNumber; /* Where more than one peripheral of the same kind is available, this holds the number of the peripheral this structure is used to control. */
} Peripheral_Control_t;