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