b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

freertos操作系统_仓储系统_学ucos还是free rtos(8)

电脑杂谈  发布时间:2017-02-05 14:18:38  来源:网络整理

图3.4:系统节拍计时器下的FreeRTOS就绪列表全貌

图3.4:系统节拍计时器下的FreeRTOS就绪列表全貌

pxReadyTasksLists[]列出了在vTaskSwitchContext()中已经操纵完成的内容,是如何使用pxIndex的一个很好的例子。让我们假设我们仅有一个优先级,优先级0,并且有三个任务在此优先级上。这与我们之前看到的基本就绪列表图相,但这一次我们将包括所有的数据结构和字段。

就如你在图3.3中所见,pxCurrentTCB显示我们当前正在运行任务B。下一个时刻,vTaskSwitchContext()运行,它调用listGET_OWNER_OF_NEXT_ENTRY()载入下一个任务来运行。如图3.4所示,这个函数使用pxIndex->pxNext找出下一个任务是任务C,并且pxIndex指向任务C的列表元素,同时pxCurrentTCB指向任务C的TCB。

请注意,每个struct xlistitem对象实际上都是来自相关TCB的xGenericListItem对象。

3.6. 队列

FreeRTOS允许任务使用队列来互相间通信和同步。中断服务程序(ISRs)同样使用队列来通信和同步。

基本队列数据结构如下:

typedef struct QueueDefinition

{

signed char *pcHead; /* Points to the beginning of the queue

storage area. */

signed char *pcTail; /* Points to the byte at the end of the

queue storage area. One more byte is

allocated than necessary to store the

queue items; this is used as a marker. */

signed char *pcWriteTo; /* Points to the free next place in the

storage area. */

signed char *pcReadFrom; /* Points to the last place that a queued

item was read from. */

xList xTasksWaitingToSend; /* List of tasks that are blocked waiting

to post onto this queue. Stored in

priority order. */

xList xTasksWaitingToReceive; /* List of tasks that are blocked waiting

to read from this queue. Stored in

priority order. */

volatile unsigned portBASE_TYPE uxMessagesWaiting; /* The number of items currently

in the queue. */

unsigned portBASE_TYPE uxLength; /* The length of the queue

defined as the number of

items it will hold, not the

number of bytes. */

unsigned portBASE_TYPE uxItemSize; /* The size of each items that


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-30698-8.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 王园
      王园

      踏踏实实对你一百个放心

    • 张文博
      张文博

      扔股市是血本无归

    • 顾卞
      顾卞

      距离你生日只有一个月啦

    每日福利
    热点图片
    拼命载入中...