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

📄 integer.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 2 页
字号:
        PUSH.W  R10
        CFI CFA SP+10
        MOV.W   #xTaskCheck, R14
        MOV.W   R11, R15
        RLA.W   R15
        ADD.W   R15, R14
        PUSH.W  R14
        CFI CFA SP+12
        PUSH.W  #0x40
        CFI CFA SP+14
        MOV.W   #`?<Constant "IntMath">`, R14
        MOV.W   #vCompeteingIntMathTask, R12
        CALL    #xTaskCreate
//  104 	}
        ADD.W   #0x1, R11
        ADD.W   #0x8, SP
        CFI CFA SP+6
        JMP     ??vStartIntegerMathTasks_0
//  105 }
??vStartIntegerMathTasks_1:
        POP.W   R11
        CFI R11 SameValue
        CFI CFA SP+4
        POP.W   R10
        CFI R10 SameValue
        CFI CFA SP+2
        RET
        CFI EndBlock cfiBlock0
//  106 /*-----------------------------------------------------------*/
//  107 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  108 static portTASK_FUNCTION( vCompeteingIntMathTask, pvParameters )
vCompeteingIntMathTask:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function vCompeteingIntMathTask
//  109 {
        PUSH.W  R10
        CFI R10 Frame(CFA, -4)
        CFI CFA SP+4
        PUSH.W  R11
        CFI R11 Frame(CFA, -6)
        CFI CFA SP+6
        PUSH.W  R8
        CFI R8 Frame(CFA, -8)
        CFI CFA SP+8
        SUB.W   #0x4, SP
        CFI CFA SP+12
        MOV.W   R12, R10
//  110 /* These variables are all effectively set to constants so they are volatile to
//  111 ensure the compiler does not just get rid of them. */
//  112 volatile portLONG lValue;
//  113 portSHORT sError = pdFALSE;
        MOV.W   #0x0, R11
//  114 volatile signed portBASE_TYPE *pxTaskHasExecuted;
//  115 
//  116 	/* Set a pointer to the variable we are going to set to true each
//  117 	iteration.  This is also a good test of the parameter passing mechanism
//  118 	within each port. */
//  119 	pxTaskHasExecuted = ( volatile signed portBASE_TYPE * ) pvParameters;
        MOV.W   R10, R8
//  120 
//  121 	/* Keep performing a calculation and checking the result against a constant. */
//  122 	for( ;; )
//  123 	{
//  124 		/* Perform the calculation.  This will store partial value in
//  125 		registers, resulting in a good test of the context switch mechanism. */
//  126 		lValue = intgCONST1;
??vCompeteingIntMathTask_0:
        MOV.W   #0x7b, 0x0(SP)
        MOV.W   #0x0, 0x2(SP)
//  127 		lValue += intgCONST2;
        ADD.W   #0x9447, 0x0(SP)
        ADDC.W  #0x3, 0x2(SP)
//  128 
//  129 		/* Yield in case cooperative scheduling is being used. */
//  130 		#if configUSE_PREEMPTION == 0
//  131 		{
//  132 			taskYIELD();
//  133 		}
//  134 		#endif
//  135 
//  136 		/* Finish off the calculation. */
//  137 		lValue *= intgCONST3;
        MOV.W   0x0(SP), R12
        MOV.W   0x2(SP), R13
        MOV.W   #0xfffd, R14
        MOV.W   #0xffff, R15
        CALL    #?Mul32
        MOV.W   R12, 0x0(SP)
        MOV.W   R13, 0x2(SP)
//  138 		lValue /= intgCONST4;
        MOV.W   0x0(SP), R12
        MOV.W   0x2(SP), R13
        MOV.W   #0x7, R14
        MOV.W   #0x0, R15
        CALL    #?DivMod32s
        MOV.W   R12, 0x0(SP)
        MOV.W   R13, 0x2(SP)
//  139 
//  140 		/* If the calculation is found to be incorrect we stop setting the 
//  141 		TaskHasExecuted variable so the check task can see an error has 
//  142 		occurred. */
//  143 		if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */
        CMP.W   #0x771b, 0x0(SP)
        JNE     ??vCompeteingIntMathTask_1
        CMP.W   #0xfffe, 0x2(SP)
        JEQ     ??vCompeteingIntMathTask_2
//  144 		{
//  145 			sError = pdTRUE;
??vCompeteingIntMathTask_1:
        MOV.W   #0x1, R11
//  146 		}
//  147 
//  148 		if( sError == pdFALSE )
??vCompeteingIntMathTask_2:
        CMP.W   #0x0, R11
        JNE     ??vCompeteingIntMathTask_0
//  149 		{
//  150 			/* We have not encountered any errors, so set the flag that show
//  151 			we are still executing.  This will be periodically cleared by
//  152 			the check task. */
//  153 			portENTER_CRITICAL();
        DINT
        NOP
        ADD.W   #0x1, &usCriticalNesting
//  154 				*pxTaskHasExecuted = pdTRUE;
        MOV.W   #0x1, 0(R8)
//  155 			portEXIT_CRITICAL();
        CMP.W   #0x0, &usCriticalNesting
        JEQ     ??vCompeteingIntMathTask_0
        ADD.W   #0xffff, &usCriticalNesting
        CMP.W   #0x0, &usCriticalNesting
        JNE     ??vCompeteingIntMathTask_0
        EINT
        JMP     ??vCompeteingIntMathTask_0
        CFI EndBlock cfiBlock1
//  156 		}
//  157 
//  158 		/* Yield in case cooperative scheduling is being used. */
//  159 		#if configUSE_PREEMPTION == 0
//  160 		{
//  161 			taskYIELD();
//  162 		}
//  163 		#endif
//  164 	}
//  165 }
//  166 /*-----------------------------------------------------------*/
//  167 
//  168 /* This is called to check that all the created tasks are still running. */

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  169 portBASE_TYPE xAreIntegerMathsTaskStillRunning( void )
xAreIntegerMathsTaskStillRunning:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function xAreIntegerMathsTaskStillRunning
//  170 {
//  171 portBASE_TYPE xReturn = pdTRUE;
        MOV.W   #0x1, R12
//  172 portSHORT sTask;
//  173 
//  174 	/* Check the maths tasks are still running by ensuring their check variables 
//  175 	are still being set to true. */
//  176 	for( sTask = 0; sTask < intgNUMBER_OF_TASKS; sTask++ )
        MOV.W   #0x0, R14
??xAreIntegerMathsTaskStillRunning_0:
        CMP.W   #0x1, R14
        JGE     ??xAreIntegerMathsTaskStillRunning_1
//  177 	{
//  178 		if( xTaskCheck[ sTask ] == pdFALSE )
        MOV.W   R14, R15
        RLA.W   R15
        CMP.W   #0x0, xTaskCheck(R15)
        JNE     ??xAreIntegerMathsTaskStillRunning_2
//  179 		{
//  180 			/* The check has not incremented so an error exists. */
//  181 			xReturn = pdFALSE;
        MOV.W   #0x0, R12
//  182 		}
//  183 
//  184 		/* Reset the check variable so we can tell if it has been set by
//  185 		the next time around. */
//  186 		xTaskCheck[ sTask ] = pdFALSE;
??xAreIntegerMathsTaskStillRunning_2:
        MOV.W   R14, R15
        RLA.W   R15
        MOV.W   #0x0, xTaskCheck(R15)
//  187 	}
        ADD.W   #0x1, R14
        JMP     ??xAreIntegerMathsTaskStillRunning_0
//  188 
//  189 	return xReturn;
??xAreIntegerMathsTaskStillRunning_1:
        RET
        CFI EndBlock cfiBlock2
//  190 }

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r4:
        REQUIRE ?setjmp_r4
        REQUIRE ?longjmp_r4

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r5:
        REQUIRE ?setjmp_r5
        REQUIRE ?longjmp_r5

        RSEG DATA16_C:CONST:SORT:NOROOT(0)
`?<Constant "IntMath">`:
        DC8 "IntMath"

        END
//  191 
// 
// 228 bytes in segment CODE
//   8 bytes in segment DATA16_C
//   2 bytes in segment DATA16_Z
// 
// 228 bytes of CODE  memory
//   8 bytes of CONST memory
//   2 bytes of DATA  memory
//
//Errors: none
//Warnings: 1

⌨️ 快捷键说明

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