Lines Matching full:the

8  * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 * Implementation of functions defined in portable.h for the MSP430 port.
47 /* Constants required for hardware setup. The tick ISR runs off the ACLK,
48 * not the MCLK. */
53 /* We require the address of the pxCurrentTCB variable, but don't want to know
58 /* Most ports implement critical sections by placing the interrupt flags on
59 * the stack before disabling interrupts. Exiting the critical section is then
60 * simply a case of popping the flags from the stack. As mspgcc does not use
61 * a frame pointer this cannot be done as modifying the stack will clobber all
62 * the stack variables. Instead each task maintains a count of the critical
63 * section nesting depth. Each time a critical section is entered the count is
64 * incremented. Each time a critical section is left the count is decremented -
65 * with interrupts only being re-enabled if the count is zero.
67 * usCriticalNesting will get set to zero when the scheduler starts, but must
68 * not be initialised to zero as this will cause problems during the startup
74 * Macro to save a task context to the task stack. This simply pushes all the
75 * general purpose msp430 registers onto the stack, followed by the
76 * usCriticalNesting value used by the task. Finally the resultant stack
77 * pointer value is saved into the task control block so it can be retrieved
78 * the next time the task executes.
100 * Macro to restore a task context from the task stack. This is effectively
101 * the reverse of portSAVE_CONTEXT(). First the stack pointer value is
102 * loaded from the task control block. Next the value for usCriticalNesting
103 * used by the task is retrieved from the stack - followed by the value of all
104 * the general purpose msp430 registers.
106 * The bic instruction ensures there are no low power bits set in the status
107 * register that is about to be popped from the stack.
132 * Sets up the periodic ISR used for the RTOS tick. This uses timer 0, but
133 * could have alternatively used the watchdog timer or timer 1.
139 * Initialise the stack of a task to look exactly as if a call to
142 * See the header file portable.h.
149 * Place a few bytes of known values on the bottom of the stack. in pxPortInitialiseStack()
160 /* The msp430 automatically pushes the PC then SR onto the stack before in pxPortInitialiseStack()
161 * executing an ISR. We want the stack to look just as if this has happened in pxPortInitialiseStack()
162 * so place a pointer to the start of the task on the stack first - followed in pxPortInitialiseStack()
163 * by the flags we want the task to use when it starts up. */ in pxPortInitialiseStack()
169 /* Next the general purpose registers. */ in pxPortInitialiseStack()
193 /* When the task starts is will expect to find the function parameter in in pxPortInitialiseStack()
198 /* The code generated by the mspgcc compiler does not maintain separate in pxPortInitialiseStack()
199 * stack and frame pointers. The portENTER_CRITICAL macro cannot therefore in pxPortInitialiseStack()
200 * use the stack as per other ports. Instead a variable is used to keep in pxPortInitialiseStack()
201 * track of the critical section nesting. This variable has to be stored in pxPortInitialiseStack()
202 * as part of the task context and is initially set to zero. */ in pxPortInitialiseStack()
205 /* Return a pointer to the top of the stack we have generated so this can in pxPortInitialiseStack()
206 * be stored in the task control block for the task. */ in pxPortInitialiseStack()
213 /* Setup the hardware to generate the tick. Interrupts are disabled when in xPortStartScheduler()
217 /* Restore the context of the first task that is going to run. */ in xPortStartScheduler()
220 /* Should not get here as the tasks are now running! */ in xPortStartScheduler()
227 /* It is unlikely that the MSP430 port will get stopped. If required simply in vPortEndScheduler()
228 * disable the tick interrupt here. */ in vPortEndScheduler()
235 * The first thing we do is save the registers so we can use a naked attribute.
240 /* We want the stack of the task being saved to look exactly as if the task in vPortYield()
241 * was saved during a pre-emptive RTOS tick ISR. Before calling an ISR the in vPortYield()
242 * msp430 places the status register onto the stack. As this is a function in vPortYield()
247 /* Save the context of the current task. */ in vPortYield()
250 /* Switch to the highest priority task that is ready to run. */ in vPortYield()
253 /* Restore the context of the new task. */ in vPortYield()
259 * Hardware initialisation to generate the RTOS tick. This uses timer 0
260 * but could alternatively use the watchdog timer or timer 1.
264 /* Ensure the timer is stopped. */ in prvSetupTimerInterrupt()
267 /* Run the timer of the ACLK. */ in prvSetupTimerInterrupt()
273 /* Set the compare match value according to the tick rate we want. */ in prvSetupTimerInterrupt()
276 /* Enable the interrupts. */ in prvSetupTimerInterrupt()
288 * The interrupt service routine used depends on whether the pre-emptive
296 * the context is saved at the start of vPortYieldFromTick(). The tick
297 * count is incremented after the context is saved.
302 /* Save the context of the interrupted task. */ in prvTickISR()
305 /* Increment the tick count then switch to the highest priority task in prvTickISR()
312 /* Restore the context of the new task. */ in prvTickISR()
319 * Tick ISR for the cooperative scheduler. All this does is increment the