📄 tasks.lst
字号:
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
211 static xList pxReadyTasksLists[ configMAX_PRIORITIES ]; /*< Prioritised ready tasks. */
\ pxReadyTasksLists:
\ 000000 DS8 40
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
212 static xList xDelayedTaskList1; /*< Delayed tasks. */
\ xDelayedTaskList1:
\ 000000 DS8 10
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
213 static xList xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */
\ xDelayedTaskList2:
\ 000000 DS8 10
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
214 static xList * volatile pxDelayedTaskList; /*< Points to the delayed task list currently being used. */
\ pxDelayedTaskList:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
215 static xList * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */
\ pxOverflowDelayedTaskList:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
216 static xList xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready queue when the scheduler is resumed. */
\ xPendingReadyList:
\ 000000 DS8 10
217
218 #if ( INCLUDE_vTaskDelete == 1 )
219
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
220 static volatile xList xTasksWaitingTermination; /*< Tasks that have been deleted - but the their memory not yet freed. */
\ xTasksWaitingTermination:
\ 000000 DS8 10
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
221 static volatile unsigned portBASE_TYPE uxTasksDeleted = ( unsigned portBASE_TYPE ) 0;
\ uxTasksDeleted:
\ 000000 DS8 2
222
223 #endif
224
225 #if ( INCLUDE_vTaskSuspend == 1 )
226
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
227 static xList xSuspendedTaskList; /*< Tasks that are currently suspended. */
\ xSuspendedTaskList:
\ 000000 DS8 10
228
229 #endif
230
231 /* File private variables. --------------------------------*/
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
232 static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0;
\ uxCurrentNumberOfTasks:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
233 static volatile portTickType xTickCount = ( portTickType ) 0;
\ xTickCount:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
234 static unsigned portBASE_TYPE uxTopUsedPriority = tskIDLE_PRIORITY;
\ uxTopUsedPriority:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
235 static volatile unsigned portBASE_TYPE uxTopReadyPriority = tskIDLE_PRIORITY;
\ uxTopReadyPriority:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
236 static volatile signed portBASE_TYPE xSchedulerRunning = pdFALSE;
\ xSchedulerRunning:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
237 static volatile unsigned portBASE_TYPE uxSchedulerSuspended = ( unsigned portBASE_TYPE ) pdFALSE;
\ uxSchedulerSuspended:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
238 static volatile unsigned portBASE_TYPE uxMissedTicks = ( unsigned portBASE_TYPE ) 0;
\ uxMissedTicks:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
239 static volatile portBASE_TYPE xMissedYield = ( portBASE_TYPE ) pdFALSE;
\ xMissedYield:
\ 000000 DS8 2
240
241 /* Debugging and trace facilities private variables and macros. ------------*/
242
243 /*
244 * The value used to fill the stack of a task when the task is created. This
245 * is used purely for checking the high water mark for tasks.
246 */
247 #define tskSTACK_FILL_BYTE ( 0xa5 )
248
249 /*
250 * Macros used by vListTask to indicate which state a task is in.
251 */
252 #define tskBLOCKED_CHAR ( ( signed portCHAR ) 'B' )
253 #define tskREADY_CHAR ( ( signed portCHAR ) 'R' )
254 #define tskDELETED_CHAR ( ( signed portCHAR ) 'D' )
255 #define tskSUSPENDED_CHAR ( ( signed portCHAR ) 'S' )
256
257 /*
258 * Macros and private variables used by the trace facility.
259 */
260 #if ( configUSE_TRACE_FACILITY == 1 )
261
262 #define tskSIZE_OF_EACH_TRACE_LINE ( ( unsigned portLONG ) ( sizeof( unsigned portLONG ) + sizeof( unsigned portLONG ) ) )
263 static volatile signed portCHAR * volatile pcTraceBuffer;
264 static signed portCHAR *pcTraceBufferStart;
265 static signed portCHAR *pcTraceBufferEnd;
266 static signed portBASE_TYPE xTracing = pdFALSE;
267
268 #endif
269
270 /*
271 * Macro that writes a trace of scheduler activity to a buffer. This trace
272 * shows which task is running when and is very useful as a debugging tool.
273 * As this macro is called each context switch it is a good idea to undefine
274 * it if not using the facility.
275 */
276 #if ( configUSE_TRACE_FACILITY == 1 )
277
278 #define vWriteTraceToBuffer() \
279 { \
280 if( xTracing ) \
281 { \
282 static unsigned portBASE_TYPE uxPreviousTask = 255; \
283 \
284 if( uxPreviousTask != pxCurrentTCB->uxTCBNumber ) \
285 { \
286 if( ( pcTraceBuffer + tskSIZE_OF_EACH_TRACE_LINE ) < pcTraceBufferEnd ) \
287 { \
288 uxPreviousTask = pxCurrentTCB->uxTCBNumber; \
289 *( unsigned portLONG * ) pcTraceBuffer = ( unsigned portLONG ) xTickCount; \
290 pcTraceBuffer += sizeof( unsigned portLONG ); \
291 *( unsigned portLONG * ) pcTraceBuffer = ( unsigned portLONG ) uxPreviousTask; \
292 pcTraceBuffer += sizeof( unsigned portLONG ); \
293 } \
294 else \
295 { \
296 xTracing = pdFALSE; \
297 } \
298 } \
299 } \
300 }
301
302 #else
303
304 #define vWriteTraceToBuffer()
305
306 #endif
307
308
309 /*
310 * Place the task represented by pxTCB into the appropriate ready queue for
311 * the task. It is inserted at the end of the list. One quirk of this is
312 * that if the task being inserted is at the same priority as the currently
313 * executing task, then it will only be rescheduled after the currently
314 * executing task has been rescheduled.
315 */
316 #define prvAddTaskToReadyQueue( pxTCB ) \
317 { \
318 if( pxTCB->uxPriority > uxTopReadyPriority ) \
319 { \
320 uxTopReadyPriority = pxTCB->uxPriority; \
321 } \
322 vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ); \
323 }
324
325
326 /*
327 * Macro that looks at the list of tasks that are currently delayed to see if
328 * any require waking.
329 *
330 * Tasks are stored in the queue in the order of their wake time - meaning
331 * once one tasks has been found whose timer has not expired we need not look
332 * any further down the list.
333 */
334 #define prvCheckDelayedTasks() \
335 { \
336 register tskTCB *pxTCB; \
337 \
338 while( ( pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ) ) != NULL ) \
339 { \
340 if( xTickCount < listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) ) ) \
341 { \
342 break; \
343 } \
344 vListRemove( &( pxTCB->xGenericListItem ) ); \
345 /* Is the task waiting on an event also? */ \
346 if( pxTCB->xEventListItem.pvContainer ) \
347 { \
348 vListRemove( &( pxTCB->xEventListItem ) ); \
349 } \
350 prvAddTaskToReadyQueue( pxTCB ); \
351 } \
352 }
353
354 /*
355 * Several functions take an xTaskHandle parameter that can optionally be NULL,
356 * where NULL is used to indicate that the handle of the currently executing
357 * task should be used in place of the parameter. This macro simply checks to
358 * see if the parameter is NULL and returns a pointer to the appropriate TCB.
359 */
360 #define prvGetTCBFromHandle( pxHandle ) ( ( pxHandle == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) pxHandle )
361
362
363 /* File private functions. --------------------------------*/
364
365 /*
366 * Utility to ready a TCB for a given task. Mainly just copies the parameters
367 * into the TCB structure.
368 */
369 static void prvInitialiseTCBVariables( tskTCB *pxTCB, unsigned portSHORT usStackDepth, const signed portCHAR * const pcName, unsigned portBASE_TYPE uxPriority );
370
371 /*
372 * Utility to ready all the lists used by the scheduler. This is called
373 * automatically upon the creation of the first task.
374 */
375 static void prvInitialiseTaskLists( void );
376
377 /*
378 * The idle task, which as all tasks is implemented as a never ending loop.
379 * The idle task is automatically created and added to the ready lists upon
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -