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

📄 port.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 2 页
字号:
        CFI Function pxPortInitialiseStack
//   80 {
        MOV.W   0x2(SP), R15
//   81 	/* 
//   82 		Place a few bytes of known values on the bottom of the stack. 
//   83 		This is just useful for debugging and can be included if required.
//   84 
//   85 		*pxTopOfStack = ( portSTACK_TYPE ) 0x1111;
//   86 		pxTopOfStack--;
//   87 		*pxTopOfStack = ( portSTACK_TYPE ) 0x2222;
//   88 		pxTopOfStack--;
//   89 		*pxTopOfStack = ( portSTACK_TYPE ) 0x3333;
//   90 		pxTopOfStack--; 
//   91 	*/
//   92 
//   93 	/* The msp430 automatically pushes the PC then SR onto the stack before 
//   94 	executing an ISR.  We want the stack to look just as if this has happened
//   95 	so place a pointer to the start of the task on the stack first - followed
//   96 	by the flags we want the task to use when it starts up. */
//   97 	*pxTopOfStack = ( portSTACK_TYPE ) pxCode;
        MOV.W   R14, 0(R12)
//   98 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//   99 	*pxTopOfStack = portFLAGS_INT_ENABLED;
        MOV.W   #0x8, 0(R12)
//  100 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  101 
//  102 	/* Next the general purpose registers. */
//  103 	*pxTopOfStack = ( portSTACK_TYPE ) 0x4444;
        MOV.W   #0x4444, 0(R12)
//  104 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  105 	*pxTopOfStack = ( portSTACK_TYPE ) 0x5555;
        MOV.W   #0x5555, 0(R12)
//  106 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  107 	*pxTopOfStack = ( portSTACK_TYPE ) 0x6666;
        MOV.W   #0x6666, 0(R12)
//  108 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  109 	*pxTopOfStack = ( portSTACK_TYPE ) 0x7777;
        MOV.W   #0x7777, 0(R12)
//  110 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  111 	*pxTopOfStack = ( portSTACK_TYPE ) 0x8888;
        MOV.W   #0x8888, 0(R12)
//  112 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  113 	*pxTopOfStack = ( portSTACK_TYPE ) 0x9999;
        MOV.W   #0x9999, 0(R12)
//  114 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  115 	*pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa;
        MOV.W   #0xaaaa, 0(R12)
//  116 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  117 //	*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
//  118 //	pxTopOfStack--;
//  119 	*pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb;
        MOV.W   #0xbbbb, 0(R12)
//  120 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  121 // XXX - ok - something strange going on here...
//  122 	
//  123 //	*pxTopOfStack = ( portSTACK_TYPE ) 0xcccc;
//  124 //	pxTopOfStack--;
//  125 
//  126 // pvParameters has been moved from R15 to R12.  The IAR compiler will
//  127 // move R12 into R10 upon task (function) entry.  Note this may not
//  128 // work on all data types...Data types may need to be known apriori
//  129 // to make this work in all cases.	
//  130 	
//  131 // Pass in R12...
//  132 	*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
        MOV.W   R15, 0(R12)
//  133 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  134 	*pxTopOfStack = ( portSTACK_TYPE ) 0xdddd;
        MOV.W   #0xdddd, 0(R12)
//  135 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  136 	*pxTopOfStack = ( portSTACK_TYPE ) 0xeeee;
        MOV.W   #0xeeee, 0(R12)
//  137 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  138 
//  139 	/* When the task starts is will expect to find the function parameter in
//  140 	R15. */
//  141 	*pxTopOfStack = ( portSTACK_TYPE ) 0xffff;
        MOV.W   #0xffff, 0(R12)
//  142 	pxTopOfStack--;
        ADD.W   #0xfffe, R12
//  143 //	*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
//  144 //	pxTopOfStack--;
//  145 
//  146 	/* A variable is used to keep track of the critical section nesting.  
//  147 	This variable has to be stored as part of the task context and is 
//  148 	initially set to zero. */
//  149 	*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;	
        MOV.W   #0x0, 0(R12)
//  150 
//  151 	/* Return a pointer to the top of the stack we have generated so this can
//  152 	be stored in the task control block for the task. */
//  153 	return pxTopOfStack;
        RET
        CFI EndBlock cfiBlock0
//  154 }
//  155 /*-----------------------------------------------------------*/
//  156 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  157 void vPortEndScheduler( void )
vPortEndScheduler:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function vPortEndScheduler
//  158 {
//  159 	/* It is unlikely that the MSP430 port will get stopped.  If required simply
//  160 	disable the tick interrupt here. */
//  161 }
        RET
        CFI EndBlock cfiBlock1
//  162 /*-----------------------------------------------------------*/
//  163 
//  164 /*
//  165  * Hardware initialisation to generate the RTOS tick.  This uses timer 0
//  166  * but could alternatively use the watchdog timer or timer 1. 
//  167  */
//  168 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  169 void prvSetupTimerInterrupt( void )
prvSetupTimerInterrupt:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function prvSetupTimerInterrupt
//  170 {
//  171 	/* Ensure the timer is stopped. */
//  172 	TACTL = 0;
        MOV.W   #0x0, &0x160
//  173 
//  174 	/* Run the timer of the ACLK. */
//  175 	TACTL = TASSEL_1|CNTL_0|ID_0;		// use ACLK as 32768;
        MOV.W   #0x100, &0x160
//  176 
//  177 	/* Clear everything to start with. */
//  178 	TACTL |= TACLR;
        BIS.W   #0x4, &0x160
//  179 
//  180 	/* Set the compare match value according to the tick rate we want. */
//  181 	TACCR0 = ( portACLK_FREQUENCY_HZ / configTICK_RATE_HZ ) - 1;
        MOV.W   #0x1f, &0x172
//  182 
//  183 	/* Enable the interrupts. */
//  184 	TACCTL0 = CCIE;
        MOV.W   #0x10, &0x162
//  185 
//  186 	/* Start up clean. */
//  187 	TACTL |= TACLR;
        BIS.W   #0x4, &0x160
//  188 
//  189 	/* Up mode. */
//  190 	TACTL |= TASSEL_1 | MC_1 | CNTL_0 | ID_0;
        BIS.W   #0x110, &0x160
//  191 }
        RET
        CFI EndBlock cfiBlock2

        RSEG DATA16_ID:CONST:SORT:NOROOT(1)
`?<Initializer for usCriticalNesting>`:
        DC16 10

        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

        END
//  192 /*-----------------------------------------------------------*/
//  193 
//  194 
//  195 	
// 
// 182 bytes in segment CODE
//   6 bytes in segment DATA16_AN
//   2 bytes in segment DATA16_I
//   2 bytes in segment DATA16_ID
// 
// 182 bytes of CODE  memory
//   2 bytes of CONST memory
//   2 bytes of DATA  memory (+ 6 bytes shared)
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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