]> git.sur5r.net Git - freertos/blob - Source/portable/Rowley/MSP430F449/portext.asm
First version under SVN is V4.0.1
[freertos] / Source / portable / Rowley / MSP430F449 / portext.asm
1 #include "FreeRTOSConfig.h"\r
2 \r
3 portSAVE_CONTEXT macro\r
4                 push    r4\r
5                 push    r5\r
6                 push    r6\r
7                 push    r7\r
8                 push    r8\r
9                 push    r9\r
10                 push    r10\r
11                 push    r11\r
12                 push    r12\r
13                 push    r13\r
14                 push    r14\r
15                 push    r15\r
16                 mov.w   &_usCriticalNesting, r14\r
17                 push    r14\r
18                 mov.w   &_pxCurrentTCB, r12\r
19                 mov.w   r1, @r12\r
20                 endm\r
21 /*-----------------------------------------------------------*/\r
22                 \r
23 portRESTORE_CONTEXT macro\r
24                 mov.w   &_pxCurrentTCB, r12\r
25                 mov.w   @r12, r1\r
26                 pop             r15\r
27                 mov.w   r15, &_usCriticalNesting\r
28                 pop             r15\r
29                 pop             r14\r
30                 pop             r13\r
31                 pop             r12\r
32                 pop             r11\r
33                 pop             r10\r
34                 pop             r9\r
35                 pop             r8\r
36                 pop             r7\r
37                 pop             r6\r
38                 pop             r5\r
39                 pop             r4\r
40                 reti\r
41                 endm\r
42 /*-----------------------------------------------------------*/\r
43 \r
44 \r
45 .CODE\r
46 \r
47 /*\r
48  * The RTOS tick ISR.\r
49  *\r
50  * If the cooperative scheduler is in use this simply increments the tick \r
51  * count.\r
52  *\r
53  * If the preemptive scheduler is in use a context switch can also occur.\r
54  */\r
55 _vTickISR:\r
56                 portSAVE_CONTEXT\r
57                                 \r
58                 call    #_vTaskIncrementTick\r
59 \r
60                 #if configUSE_PREEMPTION == 1\r
61                         call    #_vTaskSwitchContext\r
62                 #endif\r
63                 \r
64                 portRESTORE_CONTEXT\r
65 /*-----------------------------------------------------------*/\r
66 \r
67 \r
68 /*\r
69  * Manual context switch called by the portYIELD() macro.\r
70  */                \r
71 _vPortYield::\r
72 \r
73                 /* Mimic an interrupt by pushing the SR. */\r
74                 push    SR                      \r
75 \r
76                 /* Now the SR is stacked we can disable interrupts. */\r
77                 dint                    \r
78                                 \r
79                 /* Save the context of the current task. */\r
80         portSAVE_CONTEXT                        \r
81 \r
82         /* Switch to the highest priority task that is ready to run. */\r
83         call    #_vTaskSwitchContext            \r
84 \r
85         /* Restore the context of the new task. */\r
86         portRESTORE_CONTEXT\r
87 /*-----------------------------------------------------------*/\r
88 \r
89 \r
90 /*\r
91  * Start off the scheduler by initialising the RTOS tick timer, then restoring\r
92  * the context of the first task.\r
93  */\r
94 _xPortStartScheduler::\r
95 \r
96                 /* Setup the hardware to generate the tick.  Interrupts are disabled \r
97                 when this function is called. */\r
98                 call    #_prvSetupTimerInterrupt\r
99 \r
100                 /* Restore the context of the first task that is going to run. */\r
101                 portRESTORE_CONTEXT\r
102 /*-----------------------------------------------------------*/          \r
103                 \r
104 \r
105                 /* Place the tick ISR in the correct vector. */\r
106                 .VECTORS\r
107                 \r
108                 .KEEP\r
109                 \r
110                 ORG             TIMERA0_VECTOR\r
111                 DW              _vTickISR\r
112                 \r
113 \r
114 \r
115                 END\r
116                 \r