当前位置: 首页 > news >正文 网站建设的课件常德网站优化 news 2025/11/3 21:06:42 网站建设的课件,常德网站优化,英文网站 字体大小,wordpress在文章中加背景FreeRTOS列表和列表项 1. 什么是列表和列表项#xff1f;1.1 列表list1.2 列表项list item 2. 列表和列表项的初始化2.1 列表的初始化2.2 列表项的初始化 3. 列表项的插入4. 列表项末尾插入5. 列表项的删除6. 列表的遍历 列表和列表项是FreeRTOS的一个数据结构#xff0c;是F… FreeRTOS列表和列表项 1. 什么是列表和列表项1.1 列表list1.2 列表项list item 2. 列表和列表项的初始化2.1 列表的初始化2.2 列表项的初始化 3. 列表项的插入4. 列表项末尾插入5. 列表项的删除6. 列表的遍历 列表和列表项是FreeRTOS的一个数据结构是FreeRTOS的基石。 1. 什么是列表和列表项 1.1 列表list 列表在概念上类似双向链表用来追踪FreeRTOS中的任务。 /** Definition of the type of queue used by the scheduler.* 任务调度器使用的队列的定义*/ typedef struct xLIST {listFIRST_LIST_INTEGRITY_CHECK_VALUEvolatile UBaseType_t uxNumberOfItems; /* 用来记录列表中列表项的个数其中不包含末尾列表项。 */ListItem_t * configLIST_VOLATILE pxIndex; /* 用来记录当前列表项的索引号用于遍历列表。 */MiniListItem_t xListEnd; /* 末尾列表项迷你列表项用来表示列表的结束。 */listSECOND_LIST_INTEGRITY_CHECK_VALUE } List_t;1.2 列表项list item 列表项指存放在列表中的对象FreeRTOS提供了2个类型列表项和迷你列表项。 /** Definition of the only type of object that a list can contain.* 定义列表可以包含的唯一对象类型*/ struct xLIST_ITEM {listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUEconfigLIST_VOLATILE TickType_t xItemValue; /* 列表项的值这用于按升序对列表进行排序 */struct xLIST_ITEM * configLIST_VOLATILE pxNext; /* 指向下一个列表项 */struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /* 指向上一个列表项 */void * pvOwner; /* 指向包含列表项的对象通常是TCB的指针。*/struct xLIST * configLIST_VOLATILE pxContainer; /* 用来记录此列表项属于哪个列表。 */listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE }; typedef struct xLIST_ITEM ListItem_t;#if ( configUSE_MINI_LIST_ITEM 1 ) /* 若为1则为普通列表项若为0则为迷你列表项。 */struct xMINI_LIST_ITEM{listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUEconfigLIST_VOLATILE TickType_t xItemValue; /* 列表项的值这用于按升序对列表进行排序 */struct xLIST_ITEM * configLIST_VOLATILE pxNext; /* 指向下一个列表项 */struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /* 指向上一个列表项 */};typedef struct xMINI_LIST_ITEM MiniListItem_t; #elsetypedef struct xLIST_ITEM MiniListItem_t; #endif2. 列表和列表项的初始化 2.1 列表的初始化 void vListInitialise( List_t * const pxList ) {/* The list structure contains a list item which is used to mark the* end of the list. To initialise the list the list end is inserted* as the only list entry. * 列表结构体中包含一个用于标记列表的结束的列表项即末尾列表项。* 为了初始化列表末尾列表项被插入作为唯一的列表条目。*/pxList-pxIndex ( ListItem_t * ) ( pxList-xListEnd ); /* 列表的列表项索引号指向末尾列表项。*/listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( ( pxList-xListEnd ) );/* The list end value is the highest possible value in the list to* ensure it remains at the end of the list. * 末尾列表项的列表项值是列表中可能的最高值以确保它保持在列表的末尾。*/pxList-xListEnd.xItemValue portMAX_DELAY; /* 0xFFFFFFFFUL *//* The list end next and previous pointers point to itself so we know* when the list is empty. * 末尾列表项的下一个和前一个列表项指针指向自身因此我们知道列表何时为空。*/pxList-xListEnd.pxNext ( ListItem_t * ) ( pxList-xListEnd );pxList-xListEnd.pxPrevious ( ListItem_t * ) ( pxList-xListEnd );/* Initialize the remaining fields of xListEnd when it is a proper ListItem_t * 当末尾列表项是普通列表项时初始化其剩余字段。*/#if ( configUSE_MINI_LIST_ITEM 0 ){pxList-xListEnd.pvOwner NULL;pxList-xListEnd.pxContainer NULL;listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( ( pxList-xListEnd ) );}#endifpxList-uxNumberOfItems ( UBaseType_t ) 0U; /* 末尾列表项不算在列表项个数中。 *//* Write known values into the list if* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ); }2.2 列表项的初始化 列表项的初始化此处只对pxContainer设置了初始值其他成员变量需要根据实际使用情况初始化。 void vListInitialiseItem( ListItem_t * const pxItem ) {/* Make sure the list item is not recorded as being on a list. * 确保列表项未被记录为在列表中。*/pxItem-pxContainer NULL;listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); }3. 列表项的插入 注意列表项的常规插入方式指的是在待插入的列表List中找到比待插入的列表项ListItem的列表项值xItemValue大的列表项前边插入该列表项列表中的所有列表项是按照其列表项值的大小手拉手链接在一起的。 void vListInsert( List_t * const pxList, /* 决定列表项要插入到哪一个列表中。 */ListItem_t * const pxNewListItem ) /* 准备插入列表中的列表项。要插入的位置由列表项中的成员变量xItemValue决定 */ {ListItem_t * pxIterator;const TickType_t xValueOfInsertion pxNewListItem-xItemValue; /* 获取要插入列表中的列表项的列表项值。 */listTEST_LIST_INTEGRITY( pxList );listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );if( xValueOfInsertion portMAX_DELAY ){pxIterator pxList-xListEnd.pxPrevious;}else{for( pxIterator ( ListItem_t * ) ( pxList-xListEnd ); pxIterator-pxNext-xItemValue xValueOfInsertion; pxIterator pxIterator-pxNext ){/* There is nothing to do here, just iterating to the wanted* insertion position. */}}pxNewListItem-pxNext pxIterator-pxNext;pxNewListItem-pxNext-pxPrevious pxNewListItem;pxNewListItem-pxPrevious pxIterator;pxIterator-pxNext pxNewListItem;/* Remember which list the item is in. This allows fast removal of the* item later. */pxNewListItem-pxContainer pxList; /* 将列表项的成员变量pxContainer赋值为插入的列表。 */( pxList-uxNumberOfItems ); /* 列表的列表项总个数自增1 */ }4. 列表项末尾插入 注意列表项末尾插入的方式指的是在列表的成员变量pxIndex所指向位置的前边插入待插入的列表项与列表项的列表项值没有关系。 void vListInsertEnd( List_t * const pxList,ListItem_t * const pxNewListItem ) {ListItem_t * const pxIndex pxList-pxIndex;listTEST_LIST_INTEGRITY( pxList );listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );pxNewListItem-pxNext pxIndex;pxNewListItem-pxPrevious pxIndex-pxPrevious;mtCOVERAGE_TEST_DELAY();pxIndex-pxPrevious-pxNext pxNewListItem;pxIndex-pxPrevious pxNewListItem;/* Remember which list the item is in. */pxNewListItem-pxContainer pxList;( pxList-uxNumberOfItems ); }5. 列表项的删除 如果这个列表项是动态分配内存的列表项的删除只是将指定的列表项从列表中删除掉并不会将这个列表项的内存释放掉。 UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) {List_t * const pxList pxItemToRemove-pxContainer;pxItemToRemove-pxNext-pxPrevious pxItemToRemove-pxPrevious;pxItemToRemove-pxPrevious-pxNext pxItemToRemove-pxNext;mtCOVERAGE_TEST_DELAY();if( pxList-pxIndex pxItemToRemove ){pxList-pxIndex pxItemToRemove-pxPrevious;}else{mtCOVERAGE_TEST_MARKER();}pxItemToRemove-pxContainer NULL;( pxList-uxNumberOfItems )--;return pxList-uxNumberOfItems; }6. 列表的遍历 列表结构体中的成员变量pxIndex是用来遍历列表的。FreeRTOS提供了一个函数来完成列表的遍历函数是listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )。每调用一次这个函数列表的pxIndex变量就会指向下一个列表项并且返回这个列表项的pvOwner变量值。 #define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \{ \List_t * const pxConstList ( pxList ); \/* Increment the index to the next item and return the item, ensuring */ \/* we dont return the marker used at the end of the list. */ \( pxConstList )-pxIndex ( pxConstList )-pxIndex-pxNext; \if( ( void * ) ( pxConstList )-pxIndex ( void * ) ( ( pxConstList )-xListEnd ) ) \{ \( pxConstList )-pxIndex ( pxConstList )-pxIndex-pxNext; \} \( pxTCB ) ( pxConstList )-pxIndex-pvOwner; \} 文章转载自: http://www.morning.bxqpl.cn.gov.cn.bxqpl.cn http://www.morning.rsnd.cn.gov.cn.rsnd.cn http://www.morning.fstdf.cn.gov.cn.fstdf.cn http://www.morning.yfqhc.cn.gov.cn.yfqhc.cn http://www.morning.jrqw.cn.gov.cn.jrqw.cn http://www.morning.rbffj.cn.gov.cn.rbffj.cn http://www.morning.dtfgr.cn.gov.cn.dtfgr.cn http://www.morning.langlaitech.cn.gov.cn.langlaitech.cn http://www.morning.rrbhy.cn.gov.cn.rrbhy.cn http://www.morning.bzcjx.cn.gov.cn.bzcjx.cn http://www.morning.dwfxl.cn.gov.cn.dwfxl.cn http://www.morning.qlxgc.cn.gov.cn.qlxgc.cn http://www.morning.xldpm.cn.gov.cn.xldpm.cn http://www.morning.hyhqd.cn.gov.cn.hyhqd.cn http://www.morning.blxlf.cn.gov.cn.blxlf.cn http://www.morning.fldsb.cn.gov.cn.fldsb.cn http://www.morning.mzhhr.cn.gov.cn.mzhhr.cn http://www.morning.fpjxs.cn.gov.cn.fpjxs.cn http://www.morning.mlfmj.cn.gov.cn.mlfmj.cn http://www.morning.spftz.cn.gov.cn.spftz.cn http://www.morning.rkypb.cn.gov.cn.rkypb.cn http://www.morning.fssjw.cn.gov.cn.fssjw.cn http://www.morning.tbplf.cn.gov.cn.tbplf.cn http://www.morning.bmts.cn.gov.cn.bmts.cn http://www.morning.huayaosteel.cn.gov.cn.huayaosteel.cn http://www.morning.xcszl.cn.gov.cn.xcszl.cn http://www.morning.tndxg.cn.gov.cn.tndxg.cn http://www.morning.bojkosvit.com.gov.cn.bojkosvit.com http://www.morning.xptkl.cn.gov.cn.xptkl.cn http://www.morning.wpmqq.cn.gov.cn.wpmqq.cn http://www.morning.cmcjp.cn.gov.cn.cmcjp.cn http://www.morning.jqkrt.cn.gov.cn.jqkrt.cn http://www.morning.klyzg.cn.gov.cn.klyzg.cn http://www.morning.lgmgn.cn.gov.cn.lgmgn.cn http://www.morning.ypbdr.cn.gov.cn.ypbdr.cn http://www.morning.tgbx.cn.gov.cn.tgbx.cn http://www.morning.wmdbn.cn.gov.cn.wmdbn.cn http://www.morning.qyqdz.cn.gov.cn.qyqdz.cn http://www.morning.c7500.cn.gov.cn.c7500.cn http://www.morning.ljqd.cn.gov.cn.ljqd.cn http://www.morning.rkyw.cn.gov.cn.rkyw.cn http://www.morning.jqpq.cn.gov.cn.jqpq.cn http://www.morning.snkry.cn.gov.cn.snkry.cn http://www.morning.qrksj.cn.gov.cn.qrksj.cn http://www.morning.rkwlg.cn.gov.cn.rkwlg.cn http://www.morning.qkrqt.cn.gov.cn.qkrqt.cn http://www.morning.qgjxt.cn.gov.cn.qgjxt.cn http://www.morning.kryr.cn.gov.cn.kryr.cn http://www.morning.drtgt.cn.gov.cn.drtgt.cn http://www.morning.kzhgy.cn.gov.cn.kzhgy.cn http://www.morning.21r000.cn.gov.cn.21r000.cn http://www.morning.zylrk.cn.gov.cn.zylrk.cn http://www.morning.qydgk.cn.gov.cn.qydgk.cn http://www.morning.xmnlc.cn.gov.cn.xmnlc.cn http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn http://www.morning.kdrjd.cn.gov.cn.kdrjd.cn http://www.morning.mzkn.cn.gov.cn.mzkn.cn http://www.morning.rhlhk.cn.gov.cn.rhlhk.cn http://www.morning.fgppj.cn.gov.cn.fgppj.cn http://www.morning.qbdqc.cn.gov.cn.qbdqc.cn http://www.morning.fbmzm.cn.gov.cn.fbmzm.cn http://www.morning.kstlm.cn.gov.cn.kstlm.cn http://www.morning.pznnt.cn.gov.cn.pznnt.cn http://www.morning.chehb.com.gov.cn.chehb.com http://www.morning.xqbgm.cn.gov.cn.xqbgm.cn http://www.morning.jwqqd.cn.gov.cn.jwqqd.cn http://www.morning.qjngk.cn.gov.cn.qjngk.cn http://www.morning.nqyzg.cn.gov.cn.nqyzg.cn http://www.morning.xqbbc.cn.gov.cn.xqbbc.cn http://www.morning.twmp.cn.gov.cn.twmp.cn http://www.morning.ccffs.cn.gov.cn.ccffs.cn http://www.morning.qwbht.cn.gov.cn.qwbht.cn http://www.morning.fkyqt.cn.gov.cn.fkyqt.cn http://www.morning.rlqml.cn.gov.cn.rlqml.cn http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn http://www.morning.twfdm.cn.gov.cn.twfdm.cn http://www.morning.wwwghs.com.gov.cn.wwwghs.com http://www.morning.xqcbz.cn.gov.cn.xqcbz.cn http://www.morning.rwmq.cn.gov.cn.rwmq.cn http://www.morning.fhqdb.cn.gov.cn.fhqdb.cn 查看全文 http://www.tj-hxxt.cn/news/274739.html 相关文章: 商务网站制作公司wordpress wordpress 济南美赞网站建设公司开发一个软件需要什么过程 昆明网站优化建设创科手机网站 手机制作网站wordpress 主题 500 永顺网站建设哪个公司的app开发公司 做网站字体一般设置泰安网上车管所 长沙专业的网站建设企业网站伪静态 9元建站节wordpress重装主题 左右网站模版Wordpress怎么连接百度网盘 页面设计制作网站wordpress链接 阿里巴巴网站图片如何做白wordpress dux qq登录 wordpress建站后发布开发微信微网站建设 阿里巴巴网站怎么做推广方案联影uct528中标价 肇东网站制作小程序和h5的区别和优势 自己做简单网站价格wordpress 多说 登陆 彩票网站开发多少钱行业网站 cms 网站设配色咸阳鑫承网站建设 网站后缀pw网站建设在哪里备案 做啥网站赚钱?整合营销方案怎么写 建设网站需要哪些步骤环球旅行卡怎么用 百度站长电脑版机关局域网网站建设 高邮做网站加盟微信小程序代理 个人站长做什么类型的网站首钢水钢赛德建设有限公司网站 不会写程序如何做网站wordpress视频类主题 好的做外贸的网站上海专业网站建设价 杭州广众建设工程有限公司网站在浏览器上建设网站 广汉移动网站建设wordpress中文标题转换拼音插件 网站设计和平面设计打开一个网站慢 天娇易业网站建设公司遂宁模板建站公司 做热点链接的网站wordpress 第一张图片 get first