FreeRTOS 框架

1 篇文章 2 订阅
1 篇文章 0 订阅

官网

章节目录规划

  • 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系统架构
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

demo中的函数原型(prototype)与上面的(官网介绍)不大相同

几个关键点

sourcedescription
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_Typestruct一个很好的外设Tx Rx Control模板。
Peripheral_Control_tstruct很好的 外设 模板
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;
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值