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.
30 * Implementation of functions defined in portable.h for the RX100 port.
52 /* The peripheral clock is divided by this value before being supplying the
55 /* If tickless idle is not used then the divisor can be fixed. */
75 /* The following lines are to ensure vSoftwareInterruptEntry can be referenced,
76 and therefore installed in the vector table, when the FreeRTOS code is built
84 * Function to start the first task executing - written in asm code as direct
90 * Software interrupt handler. Performs the actual context switch (saving and
97 * The entry point for the software interrupt handler. This is the function
98 * that calls the inline asm function prvYieldHandler(). It is installed in
99 * the vector table, but the code that installs it is in prvYieldHandler rather
105 * Sets up the periodic ISR used for the RTOS tick using the CMT.
106 * The application writer can define configSETUP_TICK_INTERRUPT() (in
112 /* The user has not provided their own tick interrupt configuration so use
113 the definition in this file (which uses the interval timer). */
118 * Called after the sleep mode registers have been configured, prvSleep()
119 * executes the pre and post sleep macros, and actually calls the wait
128 /* These is accessed by the inline assembler functions. */
139 /* Holds the maximum number of ticks that can be suppressed - which is
140 basically how far into the future an interrupt can be generated. Set
141 during initialisation. This is the maximum possible value that the
145 /* Flag set from the tick interrupt to allow the sleep processing to know if
150 /* The CMT counter is stopped temporarily each time it is re-programmed.
151 The following constant offsets the CMT counter match value by the number of
152 CMT counts that would typically be missed while the counter was stopped to
153 compensate for the lost time. The large difference between the divided CMT
154 clock and the CPU clock means it is likely ulStoppedTimerCompensation will
170 /* R0 is not included as it is the stack pointer. */ in pxPortInitialiseStack()
180 value. Otherwise code space can be saved by just setting the registers in pxPortInitialiseStack()
216 /* Leave space for the registers that will get popped from the stack in pxPortInitialiseStack()
217 when the task first starts executing. */ in pxPortInitialiseStack()
237 /* Call an application function to set up the timer that will generate in xPortStartScheduler()
238 the tick interrupt. This way the application can decide which in xPortStartScheduler()
239 peripheral to use. If tickless mode is used then the default in xPortStartScheduler()
244 /* Enable the software interrupt. */ in xPortStartScheduler()
247 /* Ensure the software interrupt is clear. */ in xPortStartScheduler()
250 /* Ensure the software interrupt is set to the kernel priority. */ in xPortStartScheduler()
253 /* Start the first task. */ in xPortStartScheduler()
257 /* Execution should not reach here as the tasks are now running! in xPortStartScheduler()
258 prvSetupTimerInterrupt() is called here to prevent the compiler outputting in xPortStartScheduler()
259 a warning about a statically declared function not being referenced in the in xPortStartScheduler()
260 case that the application writer has provided their own tick interrupt in xPortStartScheduler()
265 /* Just to make sure the function is not optimised away. */ in xPortStartScheduler()
276 /* When starting the scheduler there is nothing that needs moving to the in prvStartFirstTask()
277 interrupt stack because the function is not called from an interrupt. in prvStartFirstTask()
278 Just ensure the current stack is the user stack. */ in prvStartFirstTask()
281 /* Obtain the location of the stack associated with which ever task in prvStartFirstTask()
287 /* Restore the registers from the stack of the task pointed to by in prvStartFirstTask()
293 POPM R1-R15 /* R1 to R15 - R0 is not included as it is the SP. */ in prvStartFirstTask()
294 RTE /* This pops the remaining registers. */ in prvStartFirstTask()
303 /* Increment the tick, and perform any processing the new tick value in prvTickISR()
316 /* The CPU woke because of a tick. */ in prvTickISR()
319 /* If this is the first tick since exiting tickless mode then the CMT in prvTickISR()
339 /* Move the data that was automatically pushed onto the interrupt stack in prvYieldHandler()
340 when the interrupt occurred from the interrupt stack to the user stack. in prvYieldHandler()
345 /* Read the user stack pointer. */ in prvYieldHandler()
348 /* Move the address down to the data being moved. */ in prvYieldHandler()
352 /* Copy the data across. */ in prvYieldHandler()
357 /* Move the interrupt stack pointer to its new correct position. */ in prvYieldHandler()
360 /* All the rest of the registers are saved directly to the user stack. */ in prvYieldHandler()
363 /* Save the rest of the general registers (R15 has been saved already). */ in prvYieldHandler()
366 /* Save the accumulator. */ in prvYieldHandler()
370 SHLL #16, R15 ; Shifted left as it is restored to the low order word. in prvYieldHandler()
373 /* Save the stack pointer to the TCB. */ in prvYieldHandler()
378 /* Ensure the interrupt mask is set to the syscall priority while the in prvYieldHandler()
382 /* Select the next task to run. */ in prvYieldHandler()
385 /* Reset the interrupt mask as no more data structure access is in prvYieldHandler()
389 /* Load the stack pointer of the task that is now selected as the Running in prvYieldHandler()
395 /* Restore the context of the new task. The PSW (Program Status Word) and in prvYieldHandler()
396 PC will be popped by the RTE instruction. */ in prvYieldHandler()
414 /* The following line is just to prevent the symbol getting optimised away. */ in vPortEndScheduler()
433 /* Set the compare match value. */ in prvSetupTimerInterrupt()
436 /* Divide the PCLK. */ in prvSetupTimerInterrupt()
460 /* Enable the interrupt... */ in prvSetupTimerInterrupt()
463 /* ...and set its priority to the application defined kernel priority. */ in prvSetupTimerInterrupt()
466 /* Start the timer. */ in prvSetupTimerInterrupt()
475 /* Allow the application to define some pre-sleep processing. */ in prvSleep()
479 means the application defined code has already executed the WAIT in prvSleep()
486 /* Allow the application to define some post sleep processing. */ in prvSleep()
500 /* THIS FUNCTION IS CALLED WITH THE SCHEDULER SUSPENDED. */ in vPortSuppressTicksAndSleep()
502 /* Make sure the CMT reload value does not overflow the counter. */ in vPortSuppressTicksAndSleep()
508 /* Calculate the reload value required to wait xExpectedIdleTime tick in vPortSuppressTicksAndSleep()
513 /* Compensate for the fact that the CMT is going to be stopped in vPortSuppressTicksAndSleep()
518 /* Stop the CMT momentarily. The time the CMT is stopped for is in vPortSuppressTicksAndSleep()
519 accounted for as best it can be, but using the tickless mode will in vPortSuppressTicksAndSleep()
520 inevitably result in some tiny drift of the time maintained by the in vPortSuppressTicksAndSleep()
528 /* Critical section using the global interrupt bit as the i bit is in vPortSuppressTicksAndSleep()
529 automatically reset by the WAIT instruction. */ in vPortSuppressTicksAndSleep()
532 /* The tick flag is set to false before sleeping. If it is true when in vPortSuppressTicksAndSleep()
533 sleep mode is exited then sleep mode was probably exited because the in vPortSuppressTicksAndSleep()
534 tick was suppressed for the entire xExpectedIdleTime period. */ in vPortSuppressTicksAndSleep()
537 /* If a context switch is pending then abandon the low power entry as in vPortSuppressTicksAndSleep()
538 the context switch might have been pended by an external interrupt that in vPortSuppressTicksAndSleep()
559 automatically reset the i bit in the PSW. */ in vPortSuppressTicksAndSleep()
562 /* Restart the CMT. */ in vPortSuppressTicksAndSleep()
578 /* Adjust the match value to take into account that the current in vPortSuppressTicksAndSleep()
583 /* Restart the CMT to count up to the new match value. */ in vPortSuppressTicksAndSleep()
588 automatically reset the i bit in the PSW. */ in vPortSuppressTicksAndSleep()
591 /* Stop CMT. Again, the time the SysTick is stopped for is in vPortSuppressTicksAndSleep()
592 accounted for as best it can be, but using the tickless mode will in vPortSuppressTicksAndSleep()
593 inevitably result in some tiny drift of the time maintained by the in vPortSuppressTicksAndSleep()
605 /* The tick interrupt has already executed, although because in vPortSuppressTicksAndSleep()
606 this function is called with the scheduler suspended the actual in vPortSuppressTicksAndSleep()
608 exited. Reset the match value with whatever remains of this in vPortSuppressTicksAndSleep()
613 /* The tick interrupt handler will already have pended the tick in vPortSuppressTicksAndSleep()
614 processing in the kernel. As the pending tick will be in vPortSuppressTicksAndSleep()
615 processed as soon as this function exits, the tick value in vPortSuppressTicksAndSleep()
616 maintained by the tick is stepped forward by one less than the in vPortSuppressTicksAndSleep()
617 time spent sleeping. The actual stepping of the tick appears in vPortSuppressTicksAndSleep()
623 /* Something other than the tick interrupt ended the sleep. in vPortSuppressTicksAndSleep()
624 How many complete tick periods passed while the processor was in vPortSuppressTicksAndSleep()
628 /* The match value is set to whatever fraction of a single tick in vPortSuppressTicksAndSleep()
634 /* Restart the CMT so it runs up to the match value. The match value in vPortSuppressTicksAndSleep()
635 will get set to the value required to generate exactly one tick period in vPortSuppressTicksAndSleep()
636 the next time the CMT interrupt executes. */ in vPortSuppressTicksAndSleep()
640 /* Wind the tick forward by the number of tick periods that the CPU in vPortSuppressTicksAndSleep()