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

📄 semtest.lst

📁 MSP430 IAR project with FreeRTOS port.
💻 LST
📖 第 1 页 / 共 3 页
字号:
   \   00005E   0312         PUSH.W  #0x0
   \   000060   0B12         PUSH.W  R11
   \   000062   30124000     PUSH.W  #0x40
   \   000066   3E40....     MOV.W   #`?<Constant "PolSEM1">`, R14
   \   00006A   3C40....     MOV.W   #prvSemaphoreTest, R12
   \   00006E   B012....     CALL    #xTaskCreate
    120          			xTaskCreate( prvSemaphoreTest, ( signed portCHAR * ) "PolSEM2", semtstSTACK_SIZE, ( void * ) pxFirstSemaphoreParameters, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
   \   000072   0312         PUSH.W  #0x0
   \   000074   0312         PUSH.W  #0x0
   \   000076   0B12         PUSH.W  R11
   \   000078   30124000     PUSH.W  #0x40
   \   00007C   3E40....     MOV.W   #`?<Constant "PolSEM2">`, R14
   \   000080   3C40....     MOV.W   #prvSemaphoreTest, R12
   \   000084   B012....     CALL    #xTaskCreate
   \   000088   31501000     ADD.W   #0x10, SP
    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_0:
   \   00008C   3C400600     MOV.W   #0x6, R12
   \   000090   B012....     CALL    #pvPortMalloc
   \   000094   084C         MOV.W   R12, R8
    127          	if( pxSecondSemaphoreParameters != NULL )
   \   000096   0893         CMP.W   #0x0, R8
   \   000098   3C24         JEQ     ??vStartSemaphoreTasks_2
    128          	{
    129          		vSemaphoreCreateBinary( pxSecondSemaphoreParameters->xSemaphore );
   \   00009A   0E43         MOV.W   #0x0, R14
   \   00009C   1C43         MOV.W   #0x1, R12
   \   00009E   B012....     CALL    #xQueueCreate
   \   0000A2   884C0000     MOV.W   R12, 0(R8)
   \   0000A6   88930000     CMP.W   #0x0, 0(R8)
   \   0000AA   0624         JEQ     ??vStartSemaphoreTasks_3
   \   0000AC   0312         PUSH.W  #0x0
   \   0000AE   0E43         MOV.W   #0x0, R14
   \   0000B0   2C48         MOV.W   @R8, R12
   \   0000B2   B012....     CALL    #xQueueSend
   \   0000B6   2153         ADD.W   #0x2, SP
    130          
    131          		if( pxSecondSemaphoreParameters->xSemaphore != NULL )
   \                     ??vStartSemaphoreTasks_3:
   \   0000B8   88930000     CMP.W   #0x0, 0(R8)
   \   0000BC   2A24         JEQ     ??vStartSemaphoreTasks_2
    132          		{
    133          			pxSecondSemaphoreParameters->pulSharedVariable = ( unsigned portLONG * ) pvPortMalloc( sizeof( unsigned portLONG ) );
   \   0000BE   2C42         MOV.W   #0x4, R12
   \   0000C0   B012....     CALL    #pvPortMalloc
   \   0000C4   884C0200     MOV.W   R12, 0x2(R8)
    134          			*( pxSecondSemaphoreParameters->pulSharedVariable ) = semtstBLOCKING_EXPECTED_VALUE;
   \   0000C8   1F480200     MOV.W   0x2(R8), R15
   \   0000CC   BF40FF0F0000 MOV.W   #0xfff, 0(R15)
   \   0000D2   8F430200     MOV.W   #0x0, 0x2(R15)
    135          			pxSecondSemaphoreParameters->xBlockTime = xBlockTime / portTICK_RATE_MS;
   \   0000D6   0C49         MOV.W   R9, R12
   \   0000D8   1E43         MOV.W   #0x1, R14
   \   0000DA   B012....     CALL    #?DivMod16u
   \   0000DE   884C0400     MOV.W   R12, 0x4(R8)
    136          
    137          			xTaskCreate( prvSemaphoreTest, ( signed portCHAR * ) "BlkSEM1", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
   \   0000E2   0312         PUSH.W  #0x0
   \   0000E4   0A12         PUSH.W  R10
   \   0000E6   0812         PUSH.W  R8
   \   0000E8   30124000     PUSH.W  #0x40
   \   0000EC   3E40....     MOV.W   #`?<Constant "BlkSEM1">`, R14
   \   0000F0   3C40....     MOV.W   #prvSemaphoreTest, R12
   \   0000F4   B012....     CALL    #xTaskCreate
    138          			xTaskCreate( prvSemaphoreTest, ( signed portCHAR * ) "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
   \   0000F8   0312         PUSH.W  #0x0
   \   0000FA   0A12         PUSH.W  R10
   \   0000FC   0812         PUSH.W  R8
   \   0000FE   30124000     PUSH.W  #0x40
   \   000102   3E40....     MOV.W   #`?<Constant "BlkSEM2">`, R14
   \   000106   3C40....     MOV.W   #prvSemaphoreTest, R12
   \   00010A   B012....     CALL    #xTaskCreate
   \   00010E   31501000     ADD.W   #0x10, SP
    139          		}
    140          	}
    141          }
   \                     ??vStartSemaphoreTasks_2:
   \   000112   3040....     BR      #?Epilogue4
    142          /*-----------------------------------------------------------*/
    143          

   \                                 In segment CODE, align 2
    144          static portTASK_FUNCTION( prvSemaphoreTest, pvParameters )
   \                     prvSemaphoreTest:
    145          {
   \   000000   0A12         PUSH.W  R10
   \   000002   0B12         PUSH.W  R11
   \   000004   0812         PUSH.W  R8
   \   000006   0912         PUSH.W  R9
   \   000008   0612         PUSH.W  R6
   \   00000A   0712         PUSH.W  R7
   \   00000C   0412         PUSH.W  R4
   \   00000E   2182         SUB.W   #0x4, SP
   \   000010   084C         MOV.W   R12, R8
    146          xSemaphoreParameters *pxParameters;
    147          volatile unsigned portLONG *pulSharedVariable, ulExpectedValue;
    148          unsigned portLONG ulCounter;
    149          portSHORT sError = pdFALSE, sCheckVariableToUse;
   \   000012   0743         MOV.W   #0x0, R7
    150          
    151          	/* See which check variable to use.  sNextCheckVariable is not semaphore 
    152          	protected! */
    153          	portENTER_CRITICAL();
   \   000014   32C2         DINT
   \   000016   0343         NOP
   \   000018   9253....     ADD.W   #0x1, &usCriticalNesting
    154          		sCheckVariableToUse = sNextCheckVariable;
   \   00001C   1442....     MOV.W   &sNextCheckVariable, R4
    155          		sNextCheckVariable++;
   \   000020   9253....     ADD.W   #0x1, &sNextCheckVariable
    156          	portEXIT_CRITICAL();
   \   000024   8293....     CMP.W   #0x0, &usCriticalNesting
   \   000028   0624         JEQ     ??prvSemaphoreTest_2
   \   00002A   B253....     ADD.W   #0xffff, &usCriticalNesting
   \   00002E   8293....     CMP.W   #0x0, &usCriticalNesting
   \   000032   0120         JNE     ??prvSemaphoreTest_2
   \   000034   32D2         EINT
    157          
    158          	/* A structure is passed in as the parameter.  This contains the shared 
    159          	variable being guarded. */
    160          	pxParameters = ( xSemaphoreParameters * ) pvParameters;
   \                     ??prvSemaphoreTest_2:
   \   000036   0948         MOV.W   R8, R9
    161          	pulSharedVariable = pxParameters->pulSharedVariable;
   \   000038   16490200     MOV.W   0x2(R9), R6
    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 )
   \   00003C   89930400     CMP.W   #0x0, 0x4(R9)
   \   000040   0624         JEQ     ??prvSemaphoreTest_3
    166          	{
    167          		ulExpectedValue = semtstBLOCKING_EXPECTED_VALUE;
   \   000042   B140FF0F0000 MOV.W   #0xfff, 0x0(SP)
   \   000048   81430200     MOV.W   #0x0, 0x2(SP)
   \   00004C   053C         JMP     ??prvSemaphoreTest_1
    168          	}
    169          	else
    170          	{
    171          		ulExpectedValue = semtstNON_BLOCKING_EXPECTED_VALUE;
   \                     ??prvSemaphoreTest_3:
   \   00004E   B140FF000000 MOV.W   #0xff, 0x0(SP)
   \   000054   81430200     MOV.W   #0x0, 0x2(SP)
    172          	}
    173          
    174          	for( ;; )
    175          	{
    176          		/* Try to obtain the semaphore. */
    177          		if( xSemaphoreTake( pxParameters->xSemaphore, pxParameters->xBlockTime ) == pdPASS )
   \                     ??prvSemaphoreTest_1:
   \   000058   19120400     PUSH.W  0x4(R9)
   \   00005C   0E43         MOV.W   #0x0, R14
   \   00005E   2C49         MOV.W   @R9, R12
   \   000060   B012....     CALL    #xQueueReceive
   \   000064   2153         ADD.W   #0x2, SP
   \   000066   1C93         CMP.W   #0x1, R12
   \   000068   3A20         JNE     ??prvSemaphoreTest_4
    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 )
                 			                                          ^
Warning[Pa082]: undefined behavior: the order of volatile accesses is
          undefined in this statement
   \   00006A   A6910000     CMP.W   0x0(SP), 0x0(R6)
   \   00006E   0420         JNE     ??prvSemaphoreTest_5
   \   000070   969102000200 CMP.W   0x2(SP), 0x2(R6)
   \   000076   0124         JEQ     ??prvSemaphoreTest_6
    183          			{
    184          				sError = pdTRUE;
   \                     ??prvSemaphoreTest_5:
   \   000078   1743         MOV.W   #0x1, R7
    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++ )
   \                     ??prvSemaphoreTest_6:
   \   00007A   0A43         MOV.W   #0x0, R10
   \   00007C   0B43         MOV.W   #0x0, R11
   \                     ??prvSemaphoreTest_0:
   \   00007E   819B0200     CMP.W   R11, 0x2(SP)
   \   000082   1228         JNC     ??prvSemaphoreTest_7
   \   000084   0320         JNE     ??prvSemaphoreTest_8
   \   000086   819A0000     CMP.W   R10, 0x0(SP)
   \   00008A   0E28         JNC     ??prvSemaphoreTest_7
    191          			{
    192          				*pulSharedVariable = ulCounter;
   \                     ??prvSemaphoreTest_8:
   \   00008C   864A0000     MOV.W   R10, 0(R6)
   \   000090   864B0200     MOV.W   R11, 0x2(R6)
    193          				if( *pulSharedVariable != ulCounter )
   \   000094   869A0000     CMP.W   R10, 0x0(R6)
   \   000098   0320         JNE     ??prvSemaphoreTest_9
   \   00009A   869B0200     CMP.W   R11, 0x2(R6)
   \   00009E   0124         JEQ     ??prvSemaphoreTest_10

⌨️ 快捷键说明

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