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

📄 semtest.lst

📁 本代码已经经过修改
💻 LST
📖 第 1 页 / 共 3 页
字号:
   \   0000003E   01B4               PUSH        {R0}
   \   00000040   331C               MOV         R3,R6
   \   00000042   6422               MOV         R2,#+0x64
   \   00000044   2049               LDR         R1,??vStartSemaphoreTasks_0+0x4  ;; `?<Constant "PolSEM1">`
   \   00000046   281C               MOV         R0,R5
   \   00000048   ........           _BLF        xTaskCreate,xTaskCreate??rT
    120          			xTaskCreate( prvSemaphoreTest, "PolSEM2", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
   \   0000004C   0020               MOV         R0,#+0
   \   0000004E   01B4               PUSH        {R0}
   \   00000050   01B4               PUSH        {R0}
   \   00000052   331C               MOV         R3,R6
   \   00000054   6422               MOV         R2,#+0x64
   \   00000056   1D49               LDR         R1,??vStartSemaphoreTasks_0+0x8  ;; `?<Constant "PolSEM2">`
   \   00000058   281C               MOV         R0,R5
   \   0000005A   ........           _BLF        xTaskCreate,xTaskCreate??rT
   \   0000005E   04B0               ADD         SP,#+0x10
    121          		}
    122          	}
    123          
    124          	/* Do exactly the same to create the second set of tasks, only this time 
    125          	provide a block time for the semaphore calls. */
    126          	pxSecondSemaphoreParameters = ( xSemaphoreParameters * ) pvPortMalloc( sizeof( xSemaphoreParameters ) );
   \                     ??vStartSemaphoreTasks_1:
   \   00000060   0C20               MOV         R0,#+0xC
   \   00000062   ........           _BLF        pvPortMalloc,pvPortMalloc??rT
   \   00000066   061C               MOV         R6,R0
    127          	if( pxSecondSemaphoreParameters != NULL )
   \   00000068   28D0               BEQ         ??vStartSemaphoreTasks_3
    128          	{
    129          		vSemaphoreCreateBinary( pxSecondSemaphoreParameters->xSemaphore );
   \   0000006A   0021               MOV         R1,#+0
   \   0000006C   0120               MOV         R0,#+0x1
   \   0000006E   ........           _BLF        xQueueCreate,xQueueCreate??rT
   \   00000072   3060               STR         R0,[R6, #+0]
   \   00000074   0028               CMP         R0,#+0
   \   00000076   03D0               BEQ         ??vStartSemaphoreTasks_4
   \   00000078   0022               MOV         R2,#+0
   \   0000007A   0021               MOV         R1,#+0
   \   0000007C   ........           _BLF        xQueueSend,xQueueSend??rT
    130          
    131          		if( pxSecondSemaphoreParameters->xSemaphore != NULL )
   \                     ??vStartSemaphoreTasks_4:
   \   00000080   3068               LDR         R0,[R6, #+0]
   \   00000082   0028               CMP         R0,#+0
   \   00000084   1AD0               BEQ         ??vStartSemaphoreTasks_3
    132          		{
    133          			pxSecondSemaphoreParameters->pulSharedVariable = ( unsigned portLONG * ) pvPortMalloc( sizeof( unsigned portLONG ) );
   \   00000086   0420               MOV         R0,#+0x4
   \   00000088   ........           _BLF        pvPortMalloc,pvPortMalloc??rT
   \   0000008C   7060               STR         R0,[R6, #+0x4]
    134          			*( pxSecondSemaphoreParameters->pulSharedVariable ) = semtstBLOCKING_EXPECTED_VALUE;
   \   0000008E   ....               LDR         R1,??DataTable1    ;; 0xfff
   \   00000090   0160               STR         R1,[R0, #+0]
    135          			pxSecondSemaphoreParameters->xBlockTime = xBlockTime / portTICK_RATE_MS;
   \   00000092   6420               MOV         R0,#+0x64
   \   00000094   B060               STR         R0,[R6, #+0x8]
    136          
    137          			xTaskCreate( prvSemaphoreTest, "BlkSEM1", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
   \   00000096   0021               MOV         R1,#+0
   \   00000098   201C               MOV         R0,R4
   \   0000009A   03B4               PUSH        {R0,R1}
   \   0000009C   331C               MOV         R3,R6
   \   0000009E   6422               MOV         R2,#+0x64
   \   000000A0   0B49               LDR         R1,??vStartSemaphoreTasks_0+0xC  ;; `?<Constant "BlkSEM1">`
   \   000000A2   281C               MOV         R0,R5
   \   000000A4   ........           _BLF        xTaskCreate,xTaskCreate??rT
    138          			xTaskCreate( prvSemaphoreTest, "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
   \   000000A8   0020               MOV         R0,#+0
   \   000000AA   01B4               PUSH        {R0}
   \   000000AC   10B4               PUSH        {R4}
   \   000000AE   331C               MOV         R3,R6
   \   000000B0   6422               MOV         R2,#+0x64
   \   000000B2   0849               LDR         R1,??vStartSemaphoreTasks_0+0x10  ;; `?<Constant "BlkSEM2">`
   \   000000B4   281C               MOV         R0,R5
   \   000000B6   ........           _BLF        xTaskCreate,xTaskCreate??rT
   \   000000BA   04B0               ADD         SP,#+0x10
    139          		}
    140          	}
    141          }
   \                     ??vStartSemaphoreTasks_3:
   \   000000BC   70BC               POP         {R4-R6}
   \   000000BE   01BC               POP         {R0}
   \   000000C0   0047               BX          R0                 ;; return
   \   000000C2   C046               NOP         
   \                     ??vStartSemaphoreTasks_0:
   \   000000C4   ........           DC32        ??prvSemaphoreTest
   \   000000C8   ........           DC32        `?<Constant "PolSEM1">`
   \   000000CC   ........           DC32        `?<Constant "PolSEM2">`
   \   000000D0   ........           DC32        `?<Constant "BlkSEM1">`
   \   000000D4   ........           DC32        `?<Constant "BlkSEM2">`
    142          /*-----------------------------------------------------------*/
    143          

   \                                 In segment CODE, align 4, keep-with-next
    144          static portTASK_FUNCTION( prvSemaphoreTest, pvParameters )
    145          {
   \                     ??prvSemaphoreTest:
   \   00000000   F0B5               PUSH        {R4-R7,LR}
   \   00000002   81B0               SUB         SP,#+0x4
   \   00000004   041C               MOV         R4,R0
    146          xSemaphoreParameters *pxParameters;
    147          volatile unsigned portLONG *pulSharedVariable, ulExpectedValue;
    148          unsigned portLONG ulCounter;
    149          portSHORT sError = pdFALSE, sCheckVariableToUse;
   \   00000006   0025               MOV         R5,#+0
    150          
    151          	/* See which check variable to use.  sNextCheckVariable is not semaphore 
    152          	protected! */
    153          	portENTER_CRITICAL();
   \   00000008   ........           _BLF        vPortEnterCritical,vPortEnterCritical??rT
    154          		sCheckVariableToUse = sNextCheckVariable;
   \   0000000C   2248               LDR         R0,??prvSemaphoreTest_1  ;; ??sNextCheckVariable
   \   0000000E   0021               MOV         R1,#+0
   \   00000010   465E               LDRSH       R6,[R0, R1]
    155          		sNextCheckVariable++;
   \   00000012   415E               LDRSH       R1,[R0, R1]
   \   00000014   491C               ADD         R1,R1,#+0x1
   \   00000016   0180               STRH        R1,[R0, #+0]
    156          	portEXIT_CRITICAL();
   \   00000018   ........           _BLF        vPortExitCritical,vPortExitCritical??rT
    157          
    158          	/* A structure is passed in as the parameter.  This contains the shared 
    159          	variable being guarded. */
    160          	pxParameters = ( xSemaphoreParameters * ) pvParameters;
    161          	pulSharedVariable = pxParameters->pulSharedVariable;
   \   0000001C   6768               LDR         R7,[R4, #+0x4]
    162          
    163          	/* If we are blocking we use a much higher count to ensure loads of context
    164          	switches occur during the count. */
    165          	if( pxParameters->xBlockTime > ( portTickType ) 0 )
   \   0000001E   A068               LDR         R0,[R4, #+0x8]
   \   00000020   0028               CMP         R0,#+0
   \   00000022   02D0               BEQ         ??prvSemaphoreTest_2
    166          	{
    167          		ulExpectedValue = semtstBLOCKING_EXPECTED_VALUE;
   \   00000024   ....               LDR         R0,??DataTable1    ;; 0xfff
   \                     ??prvSemaphoreTest_3:
   \   00000026   0090               STR         R0,[SP, #+0]
   \   00000028   11E0               B           ??prvSemaphoreTest_4
    168          	}
    169          	else
    170          	{
    171          		ulExpectedValue = semtstNON_BLOCKING_EXPECTED_VALUE;
   \                     ??prvSemaphoreTest_2:
   \   0000002A   FF20               MOV         R0,#+0xFF
   \   0000002C   FBE7               B           ??prvSemaphoreTest_3
    172          	}
    173          
    174          	for( ;; )
    175          	{
    176          		/* Try to obtain the semaphore. */
    177          		if( xSemaphoreTake( pxParameters->xSemaphore, pxParameters->xBlockTime ) == pdPASS )
    178          		{
    179          			/* We have the semaphore and so expect any other tasks using the
    180          			shared variable to have left it in the state we expect to find
    181          			it. */
    182          			if( *pulSharedVariable != ulExpectedValue )
    183          			{
    184          				sError = pdTRUE;
    185          			}
    186          			
    187          			/* Clear the variable, then count it back up to the expected value
    188          			before releasing the semaphore.  Would expect a context switch or
    189          			two during this time. */
    190          			for( ulCounter = ( unsigned portLONG ) 0; ulCounter <= ulExpectedValue; ulCounter++ )
    191          			{
    192          				*pulSharedVariable = ulCounter;
    193          				if( *pulSharedVariable != ulCounter )
    194          				{
    195          					sError = pdTRUE;
    196          				}
    197          			}
    198          
    199          			/* Release the semaphore, and if no errors have occurred increment the check
    200          			variable. */
    201          			if(	xSemaphoreGive( pxParameters->xSemaphore ) == pdFALSE )
    202          			{
    203          				sError = pdTRUE;
    204          			}
    205          
    206          			if( sError == pdFALSE )
   \                     ??prvSemaphoreTest_5:
   \   0000002E   002D               CMP         R5,#+0
   \   00000030   08D1               BNE         ??prvSemaphoreTest_6
    207          			{
    208          				if( sCheckVariableToUse < semtstNUM_TASKS )
   \   00000032   042E               CMP         R6,#+0x4
   \   00000034   06DA               BGE         ??prvSemaphoreTest_6
    209          				{
    210          					( sCheckVariables[ sCheckVariableToUse ] )++;
   \   00000036   7000               LSL         R0,R6,#+0x1
   \   00000038   ....               LDR         R1,??DataTable3    ;; ??sCheckVariables
   \   0000003A   0818               ADD         R0,R1,R0
   \   0000003C   0021               MOV         R1,#+0
   \   0000003E   415E               LDRSH       R1,[R0, R1]
   \   00000040   491C               ADD         R1,R1,#+0x1

⌨️ 快捷键说明

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