📄 croutine.s43
字号:
MOV.W #0x0, 0x1a(R6)
// 120 pxCoRoutine->uxPriority = uxPriority;
MOV.W R11, 0x16(R6)
// 121 pxCoRoutine->uxIndex = uxIndex;
MOV.W R8, 0x18(R6)
// 122 pxCoRoutine->pxCoRoutineFunction = pxCoRoutineCode;
MOV.W R10, 0(R6)
// 123
// 124 /* Initialise all the other co-routine control block parameters. */
// 125 vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) );
MOV.W R6, R12
ADD.W #0x2, R12
CALL #vListInitialiseItem
// 126 vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );
MOV.W R6, R12
ADD.W #0xc, R12
CALL #vListInitialiseItem
// 127
// 128 /* Set the co-routine control block as a link back from the xListItem.
// 129 This is so we can get back to the containing CRCB from a generic item
// 130 in a list. */
// 131 listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );
MOV.W R6, 0x8(R6)
// 132 listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
MOV.W R6, 0x12(R6)
// 133
// 134 /* Event lists are always in priority order. */
// 135 listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );
MOV.W #0x4, R15
SUB.W R11, R15
MOV.W R15, 0xc(R6)
// 136
// 137 /* Now the co-routine has been initialised it can be added to the ready
// 138 list at the correct priority. */
// 139 prvAddCoRoutineToReadyQueue( pxCoRoutine );
CMP.W 0x16(R6), &uxTopCoRoutineReadyPriority
JC ??xCoRoutineCreate_3
MOV.W 0x16(R6), &uxTopCoRoutineReadyPriority
??xCoRoutineCreate_3:
MOV.W R6, R14
ADD.W #0x2, R14
MOV.W #pxReadyCoRoutineLists, R12
MOV.W 0x16(R6), R15
RLA.W R15
MOV.W R15, R13
RLA.W R15
RLA.W R15
ADD.W R13, R15
ADD.W R15, R12
CALL #vListInsertEnd
// 140
// 141 xReturn = pdPASS;
MOV.W #0x1, R9
JMP ??xCoRoutineCreate_4
// 142 }
// 143 else
// 144 {
// 145 xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
??xCoRoutineCreate_0:
MOV.W #0xffff, R9
// 146 }
// 147
// 148 return xReturn;
??xCoRoutineCreate_4:
MOV.W R9, R12
BR #?Epilogue5
CFI EndBlock cfiBlock0
// 149 }
// 150 /*-----------------------------------------------------------*/
// 151
RSEG CODE:CODE:REORDER:NOROOT(1)
// 152 void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList )
vCoRoutineAddToDelayedList:
CFI Block cfiBlock1 Using cfiCommon0
CFI Function vCoRoutineAddToDelayedList
// 153 {
FUNCALL vCoRoutineAddToDelayedList, vListRemove
LOCFRAME CSTACK, 8, STACK
FUNCALL vCoRoutineAddToDelayedList, vListInsert
LOCFRAME CSTACK, 8, STACK
FUNCALL vCoRoutineAddToDelayedList, vListInsert
LOCFRAME CSTACK, 8, STACK
FUNCALL vCoRoutineAddToDelayedList, vListInsert
LOCFRAME CSTACK, 8, STACK
PUSH.W R10
CFI R10 Frame(CFA, -4)
CFI CFA SP+4
PUSH.W R11
CFI R11 Frame(CFA, -6)
CFI CFA SP+6
PUSH.W R8
CFI R8 Frame(CFA, -8)
CFI CFA SP+8
MOV.W R12, R10
MOV.W R14, R11
// 154 portTickType xTimeToWake;
// 155
// 156 /* Calculate the time to wake - this may overflow but this is
// 157 not a problem. */
// 158 xTimeToWake = xCoRoutineTickCount + xTicksToDelay;
MOV.W R10, R15
ADD.W &xCoRoutineTickCount, R15
MOV.W R15, R8
// 159
// 160 /* We must remove ourselves from the ready list before adding
// 161 ourselves to the blocked list as the same list item is used for
// 162 both lists. */
// 163 vListRemove( ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
MOV.W &pxCurrentCoRoutine, R12
ADD.W #0x2, R12
CALL #vListRemove
// 164
// 165 /* The list item will be inserted in wake time order. */
// 166 listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
MOV.W &pxCurrentCoRoutine, R15
MOV.W R8, 0x2(R15)
// 167
// 168 if( xTimeToWake < xCoRoutineTickCount )
CMP.W &xCoRoutineTickCount, R8
JC ??vCoRoutineAddToDelayedList_0
// 169 {
// 170 /* Wake time has overflowed. Place this item in the
// 171 overflow list. */
// 172 vListInsert( ( xList * ) pxOverflowDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
MOV.W &pxCurrentCoRoutine, R14
ADD.W #0x2, R14
MOV.W &pxOverflowDelayedCoRoutineList, R12
CALL #vListInsert
JMP ??vCoRoutineAddToDelayedList_1
// 173 }
// 174 else
// 175 {
// 176 /* The wake time has not overflowed, so we can use the
// 177 current block list. */
// 178 vListInsert( ( xList * ) pxDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
??vCoRoutineAddToDelayedList_0:
MOV.W &pxCurrentCoRoutine, R14
ADD.W #0x2, R14
MOV.W &pxDelayedCoRoutineList, R12
CALL #vListInsert
// 179 }
// 180
// 181 if( pxEventList )
??vCoRoutineAddToDelayedList_1:
CMP.W #0x0, R11
JEQ ??vCoRoutineAddToDelayedList_2
// 182 {
// 183 /* Also add the co-routine to an event list. If this is done then the
// 184 function must be called with interrupts disabled. */
// 185 vListInsert( pxEventList, &( pxCurrentCoRoutine->xEventListItem ) );
MOV.W &pxCurrentCoRoutine, R14
ADD.W #0xc, R14
MOV.W R11, R12
CALL #vListInsert
// 186 }
// 187 }
??vCoRoutineAddToDelayedList_2:
BR #?Epilogue3
CFI EndBlock cfiBlock1
// 188 /*-----------------------------------------------------------*/
// 189
RSEG CODE:CODE:REORDER:NOROOT(1)
// 190 static inline void prvCheckPendingReadyList( void )
prvCheckPendingReadyList:
CFI Block cfiBlock2 Using cfiCommon0
CFI Function prvCheckPendingReadyList
// 191 {
FUNCALL prvCheckPendingReadyList, vListRemove
LOCFRAME CSTACK, 4, STACK
FUNCALL prvCheckPendingReadyList, vListRemove
LOCFRAME CSTACK, 4, STACK
FUNCALL prvCheckPendingReadyList, vListInsertEnd
LOCFRAME CSTACK, 4, STACK
PUSH.W R10
CFI R10 Frame(CFA, -4)
CFI CFA SP+4
// 192 /* Are there any co-routines waiting to get moved to the ready list? These
// 193 are co-routines that have been readied by an ISR. The ISR cannot access
// 194 the ready lists itself. */
// 195 while( !listLIST_IS_EMPTY( &xPendingReadyList ) )
??prvCheckPendingReadyList_0:
CMP.W #0x0, &xPendingReadyList
JEQ ??prvCheckPendingReadyList_1
// 196 {
// 197 corCRCB *pxUnblockedCRCB;
// 198
// 199 /* The pending ready list can be accessed by an ISR. */
// 200 portDISABLE_INTERRUPTS();
DINT
NOP
// 201 {
// 202 pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyList) );
CMP.W #0x0, &xPendingReadyList
JEQ ??prvCheckPendingReadyList_2
MOV.W &xPendingReadyList + 6, R15
MOV.W 0x6(R15), R10
JMP ??prvCheckPendingReadyList_3
??prvCheckPendingReadyList_2:
MOV.W #0x0, R10
// 203 vListRemove( &( pxUnblockedCRCB->xEventListItem ) );
??prvCheckPendingReadyList_3:
MOV.W R10, R12
ADD.W #0xc, R12
CALL #vListRemove
// 204 }
// 205 portENABLE_INTERRUPTS();
EINT
// 206
// 207 vListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
MOV.W R10, R12
ADD.W #0x2, R12
CALL #vListRemove
// 208 prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
CMP.W 0x16(R10), &uxTopCoRoutineReadyPriority
JC ??prvCheckPendingReadyList_4
MOV.W 0x16(R10), &uxTopCoRoutineReadyPriority
??prvCheckPendingReadyList_4:
MOV.W R10, R14
ADD.W #0x2, R14
MOV.W #pxReadyCoRoutineLists, R12
MOV.W 0x16(R10), R15
RLA.W R15
MOV.W R15, R13
RLA.W R15
RLA.W R15
ADD.W R13, R15
ADD.W R15, R12
CALL #vListInsertEnd
JMP ??prvCheckPendingReadyList_0
// 209 }
// 210 }
??prvCheckPendingReadyList_1:
POP.W R10
CFI R10 SameValue
CFI CFA SP+2
RET
CFI EndBlock cfiBlock2
// 211 /*-----------------------------------------------------------*/
// 212
RSEG CODE:CODE:REORDER:NOROOT(1)
// 213 static inline void prvCheckDelayedList( void )
prvCheckDelayedList:
CFI Block cfiBlock3 Using cfiCommon0
CFI Function prvCheckDelayedList
// 214 {
FUNCALL prvCheckDelayedList, xTaskGetTickCount
LOCFRAME CSTACK, 4, STACK
FUNCALL prvCheckDelayedList, vListRemove
LOCFRAME CSTACK, 4, STACK
FUNCALL prvCheckDelayedList, vListRemove
LOCFRAME CSTACK, 4, STACK
FUNCALL prvCheckDelayedList, vListInsertEnd
LOCFRAME CSTACK, 4, STACK
PUSH.W R10
CFI R10 Frame(CFA, -4)
CFI CFA SP+4
// 215 static portTickType xLastTickCount, xPassedTicks;
// 216 corCRCB *pxCRCB;
// 217
// 218 xPassedTicks = xTaskGetTickCount() - xLastTickCount;
CALL #xTaskGetTickCount
SUB.W &??xLastTickCount, R12
MOV.W R12, &??xPassedTicks
// 219 while( xPassedTicks )
??prvCheckDelayedList_0:
CMP.W #0x0, &??xPassedTicks
JEQ ??prvCheckDelayedList_2
// 220 {
// 221 xCoRoutineTickCount++;
ADD.W #0x1, &xCoRoutineTickCount
// 222 xPassedTicks--;
ADD.W #0xffff, &??xPassedTicks
// 223
// 224 /* If the tick count has overflowed we need to swap the ready lists. */
// 225 if( xCoRoutineTickCount == 0 )
CMP.W #0x0, &xCoRoutineTickCount
JNE ??prvCheckDelayedList_1
// 226 {
// 227 xList * pxTemp;
// 228
// 229 /* Tick count has overflowed so we need to swap the delay lists. If there are
// 230 any items in pxDelayedCoRoutineList here then there is an error! */
// 231 pxTemp = pxDelayedCoRoutineList;
MOV.W &pxDelayedCoRoutineList, R15
// 232 pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
MOV.W &pxOverflowDelayedCoRoutineList, &pxDelayedCoRoutineList
// 233 pxOverflowDelayedCoRoutineList = pxTemp;
MOV.W R15, &pxOverflowDelayedCoRoutineList
// 234 }
// 235
// 236 /* See if this tick has made a timeout expire. */
// 237 while( ( pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList ) ) != NULL )
??prvCheckDelayedList_1:
MOV.W &pxDelayedCoRoutineList, R15
CMP.W #0x0, 0(R15)
JEQ ??prvCheckDelayedList_3
MOV.W &pxDelayedCoRoutineList, R15
MOV.W 0x6(R15), R15
MOV.W 0x6(R15), R10
JMP ??prvCheckDelayedList_4
??prvCheckDelayedList_3:
MOV.W #0x0, R10
??prvCheckDelayedList_4:
CMP.W #0x0, R10
JEQ ??prvCheckDelayedList_0
// 238 {
// 239 if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
CMP.W 0x2(R10), &xCoRoutineTickCount
JNC ??prvCheckDelayedList_0
// 240 {
// 241 /* Timeout not yet expired. */
// 242 break;
// 243 }
// 244
// 245 portDISABLE_INTERRUPTS();
DINT
NOP
// 246 {
// 247 /* The event could have occurred just before this critical
// 248 section. If this is the case then the generic list item will
// 249 have been moved to the pending ready list and the following
// 250 line is still valid. Also the pvContainer parameter will have
// 251 been set to NULL so the following lines are also valid. */
// 252 vListRemove( &( pxCRCB->xGenericListItem ) );
MOV.W R10, R12
ADD.W #0x2, R12
CALL #vListRemove
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -