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

📄 tasks.lst

📁 本代码已经经过修改
💻 LST
📖 第 1 页 / 共 5 页
字号:
    376           *
    377           * This does not free memory allocated by the task itself (i.e. memory
    378           * allocated by calls to pvPortMalloc from within the tasks application code).
    379           */
    380          #if ( ( INCLUDE_vTaskDelete == 1 ) || ( INCLUDE_vTaskCleanUpResources == 1 ) )
    381          	static void prvDeleteTCB( tskTCB *pxTCB );
    382          #endif
    383          
    384          /*
    385           * Used only by the idle task.  This checks to see if anything has been placed
    386           * in the list of tasks waiting to be deleted.  If so the task is cleaned up
    387           * and its TCB deleted.
    388           */
    389          static void prvCheckTasksWaitingTermination( void );
    390          
    391          /*
    392           * Allocates memory from the heap for a TCB and associated stack.  Checks the
    393           * allocation was successful.
    394           */
    395          static tskTCB *prvAllocateTCBAndStack( unsigned portSHORT usStackDepth );
    396          
    397          /*
    398           * Called from vTaskList.  vListTasks details all the tasks currently under
    399           * control of the scheduler.  The tasks may be in one of a number of lists.
    400           * prvListTaskWithinSingleList accepts a list and details the tasks from
    401           * within just that list.
    402           *
    403           * THIS FUNCTION IS INTENDED FOR DEBUGGING ONLY, AND SHOULD NOT BE CALLED FROM
    404           * NORMAL APPLICATION CODE.
    405           */
    406          #if ( configUSE_TRACE_FACILITY == 1 )
    407          
    408          	static void prvListTaskWithinSingleList( signed portCHAR *pcWriteBuffer, xList *pxList, signed portCHAR cStatus );
    409          
    410          #endif
    411          
    412          /*
    413           * When a task is created, the stack of the task is filled with a known value.
    414           * This function determines the 'high water mark' of the task stack by
    415           * determining how much of the stack remains at the original preset value.
    416           */
    417          #if ( configUSE_TRACE_FACILITY == 1 )
    418          
    419          	unsigned portSHORT usTaskCheckFreeStackSpace( const unsigned portCHAR *pucStackByte );
    420          
    421          #endif
    422          
    423          /*lint +e956 */
    424          
    425          
    426          
    427          
    428          
    429          /*-----------------------------------------------------------
    430           * TASK CREATION API documented in task.h
    431           *----------------------------------------------------------*/
    432          

   \                                 In segment CODE, align 4, keep-with-next
    433          signed portBASE_TYPE xTaskCreate( pdTASK_CODE pvTaskCode, const signed portCHAR * const pcName, unsigned portSHORT usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask )
    434          {
   \                     xTaskCreate:
   \   00000000   FBB5               PUSH        {R0,R1,R3-R7,LR}
   \   00000002   161C               MOV         R6,R2
   \   00000004   099C               LDR         R4,[SP, #+0x24]
    435          signed portBASE_TYPE xReturn;
    436          tskTCB * pxNewTCB;
    437          static unsigned portBASE_TYPE uxTaskNumber = 0; /*lint !e956 Static is deliberate - this is guarded before use. */
    438          
    439          	/* Allocate the memory required by the TCB and stack for the new task.
    440          	checking that the allocation was successful. */
    441          	pxNewTCB = prvAllocateTCBAndStack( usStackDepth );
   \   00000006   4C20               MOV         R0,#+0x4C
   \   00000008   ........           _BLF        pvPortMalloc,pvPortMalloc??rT
   \   0000000C   051C               MOV         R5,R0
   \   0000000E   08D0               BEQ         ??xTaskCreate_0
   \   00000010   B000               LSL         R0,R6,#+0x2
   \   00000012   ........           _BLF        pvPortMalloc,pvPortMalloc??rT
   \   00000016   6860               STR         R0,[R5, #+0x4]
   \   00000018   0028               CMP         R0,#+0
   \   0000001A   05D1               BNE         ??xTaskCreate_1
   \   0000001C   281C               MOV         R0,R5
   \   0000001E   ........           _BLF        vPortFree,vPortFree??rT
    442          
    443          	if( pxNewTCB != NULL )
    444          	{		
    445          		portSTACK_TYPE *pxTopOfStack;
    446          
    447          		/* Setup the newly allocated TCB with the initial state of the task. */
    448          		prvInitialiseTCBVariables( pxNewTCB, usStackDepth, pcName, uxPriority );
    449          
    450          		/* Calculate the top of stack address.  This depends on whether the
    451          		stack grows from high memory to low (as per the 80x86) or visa versa.
    452          		portSTACK_GROWTH is used to make the result positive or negative as
    453          		required by the port. */
    454          		#if portSTACK_GROWTH < 0
    455          		{
    456          			pxTopOfStack = pxNewTCB->pxStack + ( pxNewTCB->usStackDepth - 1 );
    457          		}
    458          		#else
    459          		{
    460          			pxTopOfStack = pxNewTCB->pxStack;	
    461          		}
    462          		#endif
    463          
    464          		/* Initialise the TCB stack to look as if the task was already running,
    465          		but had been interrupted by the scheduler.  The return address is set
    466          		to the start of the task function. Once the stack has been initialised
    467          		the	top of stack variable is updated. */
    468          		pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pvTaskCode, pvParameters );
    469          
    470          		/* We are going to manipulate the task queues to add this task to a
    471          		ready list, so must make sure no interrupts occur. */
    472          		portENTER_CRITICAL();
    473          		{
    474          			uxCurrentNumberOfTasks++;
    475          			if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 )
    476          			{
    477          				/* As this is the first task it must also be the current task. */
    478          				pxCurrentTCB = ( volatile tskTCB * volatile ) pxNewTCB;
    479          
    480          				/* This is the first task to be created so do the preliminary
    481          				initialisation required.  We will not recover if this call
    482          				fails, but we will report the failure. */
    483          				prvInitialiseTaskLists();
    484          			}
    485          			else
    486          			{	
    487          				/* If the scheduler is not already running, make this task the
    488          				current task if it is the highest priority task to be created
    489          				so far. */
    490          				if( xSchedulerRunning == pdFALSE )
    491          				{
    492          					if( pxCurrentTCB->uxPriority <= uxPriority )
    493          					{
    494          						pxCurrentTCB = ( volatile tskTCB * volatile ) pxNewTCB;	
    495          					}
    496          				}
    497          			}				
    498          
    499          			/* Remember the top priority to make context switching faster.  Use
    500          			the priority in pxNewTCB as this has been capped to a valid value. */
    501          			if( pxNewTCB->uxPriority > uxTopUsedPriority )
    502          			{
    503          				uxTopUsedPriority = pxNewTCB->uxPriority;
    504          			}
    505          
    506          			/* Add a counter into the TCB for tracing only. */
    507          			pxNewTCB->uxTCBNumber = uxTaskNumber;
    508          			uxTaskNumber++;
    509          
    510          			prvAddTaskToReadyQueue( pxNewTCB );
    511          
    512          			xReturn = pdPASS;
    513          		}
    514          		portEXIT_CRITICAL();
    515          	}
    516          	else
    517          	{
    518          		xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
   \                     ??xTaskCreate_0:
   \   00000022   0027               MOV         R7,#+0
   \   00000024   FF43               MVN         R7,R7              ;; #-1
   \   00000026   94E0               B           ??xTaskCreate_2
    519          	}
   \                     ??xTaskCreate_1:
   \   00000028   B000               LSL         R0,R6,#+0x2
   \   0000002A   A521               MOV         R1,#+0xA5
   \   0000002C   6A68               LDR         R2,[R5, #+0x4]
   \   0000002E   0028               CMP         R0,#+0
   \   00000030   02D0               BEQ         ??xTaskCreate_3
   \                     ??xTaskCreate_4:
   \   00000032   401E               SUB         R0,R0,#+0x1
   \   00000034   1154               STRB        R1,[R2, R0]
   \   00000036   FCD1               BNE         ??xTaskCreate_4
   \                     ??xTaskCreate_3:
   \   00000038   089F               LDR         R7,[SP, #+0x20]
   \   0000003A   4820               MOV         R0,#+0x48
   \   0000003C   2E52               STRH        R6,[R5, R0]
   \   0000003E   1022               MOV         R2,#+0x10
   \   00000040   0199               LDR         R1,[SP, #+0x4]
   \   00000042   281C               MOV         R0,R5
   \   00000044   3830               ADD         R0,#+0x38
   \   00000046   ........           _BLF        strncpy,strncpy??rT
   \   0000004A   4720               MOV         R0,#+0x47
   \   0000004C   0021               MOV         R1,#+0
   \   0000004E   2954               STRB        R1,[R5, R0]
   \   00000050   052F               CMP         R7,#+0x5
   \   00000052   00D3               BCC         ??xTaskCreate_5
   \   00000054   0427               MOV         R7,#+0x4
   \                     ??xTaskCreate_5:
   \   00000056   EF60               STR         R7,[R5, #+0xC]
   \   00000058   281C               MOV         R0,R5
   \   0000005A   1030               ADD         R0,#+0x10
   \   0000005C   ........           _BLF        vListInitialiseItem,vListInitialiseItem??rT
   \   00000060   281C               MOV         R0,R5
   \   00000062   2430               ADD         R0,#+0x24
   \   00000064   ........           _BLF        vListInitialiseItem,vListInitialiseItem??rT
   \   00000068   ED61               STR         R5,[R5, #+0x1C]
   \   0000006A   0520               MOV         R0,#+0x5
   \   0000006C   C01B               SUB         R0,R0,R7
   \   0000006E   6862               STR         R0,[R5, #+0x24]
   \   00000070   2D63               STR         R5,[R5, #+0x30]
   \   00000072   029A               LDR         R2,[SP, #+0x8]
   \   00000074   0099               LDR         R1,[SP, #+0]
   \   00000076   4820               MOV         R0,#+0x48
   \   00000078   285A               LDRH        R0,[R5, R0]
   \   0000007A   8000               LSL         R0,R0,#+0x2
   \   0000007C   6B68               LDR         R3,[R5, #+0x4]
   \   0000007E   1818               ADD         R0,R3,R0
   \   00000080   001F               SUB         R0,R0,#+0x4
   \   00000082   ........           _BLF        pxPortInitialiseStack,pxPortInitialiseStack??rT
   \   00000086   2860               STR         R0,[R5, #+0]
   \   00000088   ........           _BLF        vPortEnterCritical,vPortEnterCritical??rT
   \   0000008C   ....               LDR         R0,??DataTable0    ;; ??uxCurrentNumberOfTasks
   \   0000008E   0168               LDR         R1,[R0, #+0]
   \   00000090   491C               ADD         R1,R1,#+0x1
   \   00000092   0160               STR         R1,[R0, #+0]
   \   00000094   ....               LDR         R7,??DataTable20   ;; ??pxReadyTasksLists
   \   00000096   ....               LDR         R6,??DataTable24   ;; pxCurrentTCB
   \   00000098   0129               CMP         R1,#+0x1
   \   0000009A   26D1               BNE         ??xTaskCreate_6
   \   0000009C   3560               STR         R5,[R6, #+0]
   \   0000009E   381C               MOV         R0,R7
   \   000000A0   ........           _BLF        vListInitialise,vListInitialise??rT
   \   000000A4   381C               MOV         R0,R7
   \   000000A6   2030               ADD         R0,#+0x20
   \   000000A8   ........           _BLF        vListInitialise,vListInitialise??rT
   \   000000AC   381C               MOV         R0,R7
   \   000000AE   4030               ADD         R0,#+0x40
   \   000000B0   ........           _BLF        vListInitialise,vListInitialise??rT
   \   000000B4   381C               MOV         R0,R7
   \   000000B6   6030               ADD         R0,#+0x60
   \   000000B8   ........           _BLF        vListInitialise,vListInitialise??rT
   \   000000BC   381C               MOV         R0,R7
   \   000000BE   8030               ADD         R0,#+0x80

⌨️ 快捷键说明

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