📄 croutine.lst
字号:
\ 000094 3943 MOV.W #0xffff, R9
146 }
147
148 return xReturn;
\ ??xCoRoutineCreate_4:
\ 000096 0C49 MOV.W R9, R12
\ 000098 3040.... BR #?Epilogue5
149 }
150 /*-----------------------------------------------------------*/
151
\ In segment CODE, align 2
152 void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList )
\ vCoRoutineAddToDelayedList:
153 {
\ 000000 0A12 PUSH.W R10
\ 000002 0B12 PUSH.W R11
\ 000004 0812 PUSH.W R8
\ 000006 0A4C MOV.W R12, R10
\ 000008 0B4E 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;
\ 00000A 0F4A MOV.W R10, R15
\ 00000C 1F52.... ADD.W &xCoRoutineTickCount, R15
\ 000010 084F 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 ) );
\ 000012 1C42.... MOV.W &pxCurrentCoRoutine, R12
\ 000016 2C53 ADD.W #0x2, R12
\ 000018 B012.... CALL #vListRemove
164
165 /* The list item will be inserted in wake time order. */
166 listSET_LIST_ITEM_VALUE( &( pxCurrentCoRoutine->xGenericListItem ), xTimeToWake );
\ 00001C 1F42.... MOV.W &pxCurrentCoRoutine, R15
\ 000020 8F480200 MOV.W R8, 0x2(R15)
167
168 if( xTimeToWake < xCoRoutineTickCount )
\ 000024 1892.... CMP.W &xCoRoutineTickCount, R8
\ 000028 082C JC ??vCoRoutineAddToDelayedList_0
169 {
170 /* Wake time has overflowed. Place this item in the
171 overflow list. */
172 vListInsert( ( xList * ) pxOverflowDelayedCoRoutineList, ( xListItem * ) &( pxCurrentCoRoutine->xGenericListItem ) );
\ 00002A 1E42.... MOV.W &pxCurrentCoRoutine, R14
\ 00002E 2E53 ADD.W #0x2, R14
\ 000030 1C42.... MOV.W &pxOverflowDelayedCoRoutineList, R12
\ 000034 B012.... CALL #vListInsert
\ 000038 073C 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:
\ 00003A 1E42.... MOV.W &pxCurrentCoRoutine, R14
\ 00003E 2E53 ADD.W #0x2, R14
\ 000040 1C42.... MOV.W &pxDelayedCoRoutineList, R12
\ 000044 B012.... CALL #vListInsert
179 }
180
181 if( pxEventList )
\ ??vCoRoutineAddToDelayedList_1:
\ 000048 0B93 CMP.W #0x0, R11
\ 00004A 0724 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 ) );
\ 00004C 1E42.... MOV.W &pxCurrentCoRoutine, R14
\ 000050 3E500C00 ADD.W #0xc, R14
\ 000054 0C4B MOV.W R11, R12
\ 000056 B012.... CALL #vListInsert
186 }
187 }
\ ??vCoRoutineAddToDelayedList_2:
\ 00005A 3040.... BR #?Epilogue3
188 /*-----------------------------------------------------------*/
189
\ In segment CODE, align 2
190 static inline void prvCheckPendingReadyList( void )
\ prvCheckPendingReadyList:
191 {
\ 000000 0A12 PUSH.W R10
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:
\ 000002 8293.... CMP.W #0x0, &xPendingReadyList
\ 000006 2B24 JEQ ??prvCheckPendingReadyList_1
196 {
197 corCRCB *pxUnblockedCRCB;
198
199 /* The pending ready list can be accessed by an ISR. */
200 portDISABLE_INTERRUPTS();
\ 000008 32C2 DINT
\ 00000A 0343 NOP
201 {
202 pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyList) );
\ 00000C 8293.... CMP.W #0x0, &xPendingReadyList
\ 000010 0524 JEQ ??prvCheckPendingReadyList_2
\ 000012 1F42.... MOV.W &xPendingReadyList + 6, R15
\ 000016 1A4F0600 MOV.W 0x6(R15), R10
\ 00001A 013C JMP ??prvCheckPendingReadyList_3
\ ??prvCheckPendingReadyList_2:
\ 00001C 0A43 MOV.W #0x0, R10
203 vListRemove( &( pxUnblockedCRCB->xEventListItem ) );
\ ??prvCheckPendingReadyList_3:
\ 00001E 0C4A MOV.W R10, R12
\ 000020 3C500C00 ADD.W #0xc, R12
\ 000024 B012.... CALL #vListRemove
204 }
205 portENABLE_INTERRUPTS();
\ 000028 32D2 EINT
206
207 vListRemove( &( pxUnblockedCRCB->xGenericListItem ) );
\ 00002A 0C4A MOV.W R10, R12
\ 00002C 2C53 ADD.W #0x2, R12
\ 00002E B012.... CALL #vListRemove
208 prvAddCoRoutineToReadyQueue( pxUnblockedCRCB );
\ 000032 929A1600.... CMP.W 0x16(R10), &uxTopCoRoutineReadyPriority
\ 000038 032C JC ??prvCheckPendingReadyList_4
\ 00003A 924A1600.... MOV.W 0x16(R10), &uxTopCoRoutineReadyPriority
\ ??prvCheckPendingReadyList_4:
\ 000040 0E4A MOV.W R10, R14
\ 000042 2E53 ADD.W #0x2, R14
\ 000044 3C40.... MOV.W #pxReadyCoRoutineLists, R12
\ 000048 1F4A1600 MOV.W 0x16(R10), R15
\ 00004C 0F5F RLA.W R15
\ 00004E 0D4F MOV.W R15, R13
\ 000050 0F5F RLA.W R15
\ 000052 0F5F RLA.W R15
\ 000054 0F5D ADD.W R13, R15
\ 000056 0C5F ADD.W R15, R12
\ 000058 B012.... CALL #vListInsertEnd
\ 00005C D23F JMP ??prvCheckPendingReadyList_0
209 }
210 }
\ ??prvCheckPendingReadyList_1:
\ 00005E 3A41 POP.W R10
\ 000060 3041 RET
211 /*-----------------------------------------------------------*/
212
\ In segment CODE, align 2
213 static inline void prvCheckDelayedList( void )
\ prvCheckDelayedList:
214 {
\ 000000 0A12 PUSH.W R10
215 static portTickType xLastTickCount, xPassedTicks;
216 corCRCB *pxCRCB;
217
218 xPassedTicks = xTaskGetTickCount() - xLastTickCount;
\ 000002 B012.... CALL #xTaskGetTickCount
\ 000006 1C82.... SUB.W &??xLastTickCount, R12
\ 00000A 824C.... MOV.W R12, &??xPassedTicks
219 while( xPassedTicks )
\ ??prvCheckDelayedList_0:
\ 00000E 8293.... CMP.W #0x0, &??xPassedTicks
\ 000012 4624 JEQ ??prvCheckDelayedList_2
220 {
221 xCoRoutineTickCount++;
\ 000014 9253.... ADD.W #0x1, &xCoRoutineTickCount
222 xPassedTicks--;
\ 000018 B253.... ADD.W #0xffff, &??xPassedTicks
223
224 /* If the tick count has overflowed we need to swap the ready lists. */
225 if( xCoRoutineTickCount == 0 )
\ 00001C 8293.... CMP.W #0x0, &xCoRoutineTickCount
\ 000020 0720 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;
\ 000022 1F42.... MOV.W &pxDelayedCoRoutineList, R15
232 pxDelayedCoRoutineList = pxOverflowDelayedCoRoutineList;
\ 000026 9242........ MOV.W &pxOverflowDelayedCoRoutineList, &pxDelayedCoRoutineList
233 pxOverflowDelayedCoRoutineList = pxTemp;
\ 00002C 824F.... 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:
\ 000030 1F42.... MOV.W &pxDelayedCoRoutineList, R15
\ 000034 8F930000 CMP.W #0x0, 0(R15)
\ 000038 0724 JEQ ??prvCheckDelayedList_3
\ 00003A 1F42.... MOV.W &pxDelayedCoRoutineList, R15
\ 00003E 1F4F0600 MOV.W 0x6(R15), R15
\ 000042 1A4F0600 MOV.W 0x6(R15), R10
\ 000046 013C JMP ??prvCheckDelayedList_4
\ ??prvCheckDelayedList_3:
\ 000048 0A43 MOV.W #0x0, R10
\ ??prvCheckDelayedList_4:
\ 00004A 0A93 CMP.W #0x0, R10
\ 00004C E027 JEQ ??prvCheckDelayedList_0
238 {
239 if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
\ 00004E 929A0200.... CMP.W 0x2(R10), &xCoRoutineTickCount
\ 000054 DC2B JNC ??prvCheckDelayedList_0
240 {
241 /* Timeout not yet expired. */
242 break;
243 }
244
245 portDISABLE_INTERRUPTS();
\ 000056 32C2 DINT
\ 000058 0343 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 ) );
\ 00005A 0C4A MOV.W R10, R12
\ 00005C 2C53 ADD.W #0x2, R12
\ 00005E B012.... CALL #vListRemove
253
254 /* Is the co-routine waiting on an event also? */
255 if( pxCRCB->xEventListItem.pvContainer )
\ 000062 8A931400 CMP.W #0x0, 0x14(R10)
\ 000066 0524 JEQ ??prvCheckDelayedList_5
256 {
257 vListRemove( &( pxCRCB->xEventListItem ) );
\ 000068 0C4A MOV.W R10, R12
\ 00006A 3C500C00 ADD.W #0xc, R12
\ 00006E B012.... CALL #vListRemove
258 }
259 }
260 portENABLE_INTERRUPTS();
\ ??prvCheckDelayedList_5:
\ 000072 32D2 EINT
261
262 prvAddCoRoutineToReadyQueue( pxCRCB );
\ 000074 929A1600.... CMP.W 0x16(R10), &uxTopCoRoutineReadyPriority
\ 00007A 032C JC ??prvCheckDelayedList_6
\ 00007C 924A1600.... MOV.W 0x16(R10), &uxTopCoRoutineReadyPriority
\ ??prvCheckDelayedList_6:
\ 000082 0E4A MOV.W R10, R14
\ 000084 2E53 ADD.W #0x2, R14
\ 000086 3C40.... MOV.W #pxReadyCoRoutineLists, R12
\ 00008A 1F4A1600 MOV.W 0x16(R10), R15
\ 00008E 0F5F RLA.W R15
\ 000090 0D4F MOV.W R15, R13
\ 000092 0F5F RLA.W R15
\ 000094 0F5F RLA.W R15
\ 000096 0F5D ADD.W R13, R15
\ 000098 0C5F ADD.W R15, R12
\ 00009A B012.... CALL #vListInsertEnd
\ 00009E C83F JMP ??prvCheckDelayedList_1
263 }
264 }
265
266 xLastTickCount = xCoRoutineTickCount;
\ ??prvCheckDelayedList_2:
\ 0000A0 9242........ MOV.W &xCoRoutineTickCount, &??xLastTickCount
267 }
\ 0000A6 3A41 POP.W R10
\ 0000A8 3041 RET
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
\ ??xLastTickCount:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
\ ??xPassedTicks:
\ 000000 DS8 2
268 /*-----------------------------------------------------------*/
269
\ In segment CODE, align 2
270 void vCoRoutineSchedule( void )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -