⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 2 页
字号:
//  101 }
        RET
        CFI EndBlock cfiBlock0
//  102 /*-----------------------------------------------------------*/
//  103 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  104 void vListInitialiseItem( xListItem *pxItem )
vListInitialiseItem:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function vListInitialiseItem
//  105 {
//  106 	/* Make sure the list item is not recorded as being on a list. */
//  107 	pxItem->pvContainer = NULL;
        MOV.W   #0x0, 0x8(R12)
//  108 }
        RET
        CFI EndBlock cfiBlock1
//  109 /*-----------------------------------------------------------*/
//  110 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  111 void vListInsertEnd( xList *pxList, xListItem *pxNewListItem )
vListInsertEnd:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function vListInsertEnd
//  112 {
//  113 volatile xListItem * pxIndex;
//  114 
//  115 	/* Insert a new list item into pxList, but rather than sort the list,
//  116 	makes the new list item the last item to be removed by a call to
//  117 	pvListGetOwnerOfNextEntry.  This means it has to be the item pointed to by
//  118 	the pxIndex member. */
//  119 	pxIndex = pxList->pxIndex;
        MOV.W   0x2(R12), R13
//  120 
//  121 	pxNewListItem->pxNext = pxIndex->pxNext;
        MOV.W   0x2(R13), 0x2(R14)
//  122 	pxNewListItem->pxPrevious = pxList->pxIndex;
        MOV.W   0x2(R12), 0x4(R14)
//  123 	pxIndex->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem;
        MOV.W   0x2(R13), R15
        MOV.W   R14, 0x4(R15)
//  124 	pxIndex->pxNext = ( volatile xListItem * ) pxNewListItem;
        MOV.W   R14, 0x2(R13)
//  125 	pxList->pxIndex = ( volatile xListItem * ) pxNewListItem;
        MOV.W   R14, 0x2(R12)
//  126 
//  127 	/* Remember which list the item is in. */
//  128 	pxNewListItem->pvContainer = ( void * ) pxList;
        MOV.W   R12, 0x8(R14)
//  129 
//  130 	( pxList->uxNumberOfItems )++;
        MOV.W   R12, R15
        ADD.W   #0x1, 0(R15)
//  131 }
        RET
        CFI EndBlock cfiBlock2
//  132 /*-----------------------------------------------------------*/
//  133 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  134 void vListInsert( xList *pxList, xListItem *pxNewListItem )
vListInsert:
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function vListInsert
//  135 {
        PUSH.W  R10
        CFI R10 Frame(CFA, -4)
        CFI CFA SP+4
//  136 volatile xListItem *pxIterator;
//  137 portTickType xValueOfInsertion;
//  138 
//  139 	/* Insert the new list item into the list, sorted in ulListItem order. */
//  140 	xValueOfInsertion = pxNewListItem->xItemValue;
        MOV.W   @R14, R10
//  141 
//  142 	/* If the list already contains a list item with the same item value then
//  143 	the new list item should be placed after it.  This ensures that TCB's which
//  144 	are stored in ready lists (all of which have the same ulListItem value)
//  145 	get an equal share of the CPU.  However, if the xItemValue is the same as 
//  146 	the back marker the iteration loop below will not end.  This means we need
//  147 	to guard against this by checking the value first and modifying the 
//  148 	algorithm slightly if necessary. */
//  149 	if( xValueOfInsertion == portMAX_DELAY )
        CMP.W   #0xffff, R10
        JNE     ??vListInsert_2
//  150 	{
//  151 		for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue < xValueOfInsertion; pxIterator = pxIterator->pxNext )
        MOV.W   R12, R15
        ADD.W   #0x4, R15
        MOV.W   R15, R13
??vListInsert_0:
        MOV.W   0x2(R13), R15
        CMP.W   R10, 0(R15)
        JC      ??vListInsert_3
        MOV.W   R13, R15
        MOV.W   0x2(R15), R13
        JMP     ??vListInsert_0
//  152 		{
//  153 			/* There is nothing to do here, we are just iterating to the
//  154 			wanted insertion position. */
//  155 		}
//  156 	}
//  157 	else
//  158 	{
//  159 		for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
??vListInsert_2:
        MOV.W   R12, R15
        ADD.W   #0x4, R15
        MOV.W   R15, R13
??vListInsert_1:
        MOV.W   0x2(R13), R15
        CMP.W   @R15, R10
        JNC     ??vListInsert_3
        MOV.W   R13, R15
        MOV.W   0x2(R15), R13
        JMP     ??vListInsert_1
//  160 		{
//  161 			/* There is nothing to do here, we are just iterating to the
//  162 			wanted insertion position. */
//  163 		}
//  164 	}
//  165 
//  166 	pxNewListItem->pxNext = pxIterator->pxNext;
??vListInsert_3:
        MOV.W   0x2(R13), 0x2(R14)
//  167 	pxNewListItem->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem;
        MOV.W   0x2(R14), R15
        MOV.W   R14, 0x4(R15)
//  168 	pxNewListItem->pxPrevious = pxIterator;
        MOV.W   R13, 0x4(R14)
//  169 	pxIterator->pxNext = ( volatile xListItem * ) pxNewListItem;
        MOV.W   R14, 0x2(R13)
//  170 
//  171 	/* Remember which list the item is in.  This allows fast removal of the
//  172 	item later. */
//  173 	pxNewListItem->pvContainer = ( void * ) pxList;
        MOV.W   R12, 0x8(R14)
//  174 
//  175 	( pxList->uxNumberOfItems )++;
        MOV.W   R12, R15
        ADD.W   #0x1, 0(R15)
//  176 }
        POP.W   R10
        CFI R10 SameValue
        CFI CFA SP+2
        RET
        CFI EndBlock cfiBlock3
//  177 /*-----------------------------------------------------------*/
//  178 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  179 void vListRemove( xListItem *pxItemToRemove )
vListRemove:
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function vListRemove
//  180 {
//  181 xList * pxList;
//  182 
//  183 	pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
        MOV.W   0x2(R12), R15
        MOV.W   0x4(R12), 0x4(R15)
//  184 	pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
        MOV.W   0x4(R12), R15
        MOV.W   0x2(R12), 0x2(R15)
//  185 	
//  186 	/* The list item knows which list it is in.  Obtain the list from the list
//  187 	item. */
//  188 	pxList = ( xList * ) pxItemToRemove->pvContainer;
        MOV.W   0x8(R12), R14
//  189 
//  190 	/* Make sure the index is left pointing to a valid item. */
//  191 	if( pxList->pxIndex == pxItemToRemove )
        CMP.W   R12, 0x2(R14)
        JNE     ??vListRemove_0
//  192 	{
//  193 		pxList->pxIndex = pxItemToRemove->pxPrevious;
        MOV.W   0x4(R12), 0x2(R14)
//  194 	}
//  195 
//  196 	pxItemToRemove->pvContainer = NULL;
??vListRemove_0:
        MOV.W   #0x0, 0x8(R12)
//  197 	( pxList->uxNumberOfItems )--;
        MOV.W   R14, R15
        ADD.W   #0xffff, 0(R15)
//  198 }
        RET
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r4:
        REQUIRE ?setjmp_r4
        REQUIRE ?longjmp_r4

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r5:
        REQUIRE ?setjmp_r5
        REQUIRE ?longjmp_r5

        END
//  199 /*-----------------------------------------------------------*/
//  200 
// 
// 222 bytes in segment CODE
// 
// 222 bytes of CODE memory
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -