1 #include <msp430x14x.h>
\r
7 /**********************************************************
\r
8 All Interrupts should follow the naming convention : ISR"name" and declared
\r
9 as a normal function in C.
\r
11 One must not forget to allocate interrupts below (see the line "MSPINT OsTick"
\r
12 below for an example).
\r
14 By default the ISR will not cause the context switch, but if called in
\r
15 conjunction with portENTER_SWITCHING_ISR/portEXIT_SWITCHING_ISR(wakeup), where
\r
16 wakeup = TRUE upon exit the ISR will force the context switch via the
\r
17 ucReschedule global variable.
\r
18 **********************************************************/
\r
21 call #_portSAVE_CONTEXT
\r
23 br #_portSWITCH_EXIT
\r
27 /**********************************************************
\r
29 **********************************************************/
\r
33 /* Mimic an INT call by pushing SR. */
\r
37 /* Save the context of the current task. */
\r
38 call #_portSAVE_CONTEXT
\r
39 /* Switch to the highest priority task that is ready to run. */
\r
40 call #_vTaskSwitchContext
\r
41 /* Restore the context of the new task. */
\r
42 br #_portSWITCH_EXIT
\r
44 _xPortStartScheduler::
\r
45 /* Setup the hardware to generate the tick. Interrupts are disabled when
\r
46 this function is called. */
\r
47 call #_prvSetupTimerInterrupt
\r
49 /* Restore the context of the first task that is going to run. */
\r
50 jmp _portRESTORE_CONTEXT
\r
53 /* Function to save the context. When this function is called the
\r
54 return address will appear on the stack. This does not need to be
\r
55 saved so is overwritten by R4 - hence R4 is not saved initially.
\r
57 Save the general purpose registers. */
\r
70 /* Now R10 has been saved we can use it to hold the return address,
\r
71 which is about to be overwritten. */
\r
74 /* Store R4 where the return address was on the stack. */
\r
77 /* Save the critical nesting depth. */
\r
78 mov.w &_usCriticalNesting, R14
\r
81 /* Finally save the new top of stack. */
\r
82 mov.w &_pxCurrentTCB, R12
\r
85 /* No rescheduling by default. */
\r
86 mov.b #0,&_ucReschedule
\r
88 /* Return using the saved return address. */
\r
93 /* Check ucReschedule to see if a context switch is required. */
\r
94 tst.b &_ucReschedule
\r
95 jz _portRESTORE_CONTEXT
\r
96 call #_vTaskSwitchContext
\r
97 _portRESTORE_CONTEXT::
\r
98 /* Restore the context in the opposite order to the save. */
\r
99 mov.w &_pxCurrentTCB, R12
\r
102 mov.w R15, &_usCriticalNesting
\r
118 /**********************************************************
\r
119 Allocate Interrupts using the MSPINT macro (defined at the top of this file.
\r
121 **********************************************************/
\r
128 /*********************************************************
\r
131 ex: PORT1 would look like:
\r
134 **********************************************************/
\r