| 1 |
572 |
jeremybenn |
;/*
|
| 2 |
|
|
; FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
| 3 |
|
|
;
|
| 4 |
|
|
; ***************************************************************************
|
| 5 |
|
|
; * *
|
| 6 |
|
|
; * If you are: *
|
| 7 |
|
|
; * *
|
| 8 |
|
|
; * + New to FreeRTOS, *
|
| 9 |
|
|
; * + Wanting to learn FreeRTOS or multitasking in general quickly *
|
| 10 |
|
|
; * + Looking for basic training, *
|
| 11 |
|
|
; * + Wanting to improve your FreeRTOS skills and productivity *
|
| 12 |
|
|
; * *
|
| 13 |
|
|
; * then take a look at the FreeRTOS books - available as PDF or paperback *
|
| 14 |
|
|
; * *
|
| 15 |
|
|
; * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
|
| 16 |
|
|
; * http://www.FreeRTOS.org/Documentation *
|
| 17 |
|
|
; * *
|
| 18 |
|
|
; * A pdf reference manual is also available. Both are usually delivered *
|
| 19 |
|
|
; * to your inbox within 20 minutes to two hours when purchased between 8am *
|
| 20 |
|
|
; * and 8pm GMT (although please allow up to 24 hours in case of *
|
| 21 |
|
|
; * exceptional circumstances). Thank you for your support! *
|
| 22 |
|
|
; * *
|
| 23 |
|
|
; ***************************************************************************
|
| 24 |
|
|
;
|
| 25 |
|
|
; This file is part of the FreeRTOS distribution.
|
| 26 |
|
|
;
|
| 27 |
|
|
; FreeRTOS is free software; you can redistribute it and/or modify it under
|
| 28 |
|
|
; the terms of the GNU General Public License (version 2) as published by the
|
| 29 |
|
|
; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
| 30 |
|
|
; ***NOTE*** The exception to the GPL is included to allow you to distribute
|
| 31 |
|
|
; a combined work that includes FreeRTOS without being obliged to provide the
|
| 32 |
|
|
; source code for proprietary components outside of the FreeRTOS kernel.
|
| 33 |
|
|
; FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
|
| 34 |
|
|
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 35 |
|
|
; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
| 36 |
|
|
; more details. You should have received a copy of the GNU General Public
|
| 37 |
|
|
; License and the FreeRTOS license exception along with FreeRTOS; if not it
|
| 38 |
|
|
; can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
| 39 |
|
|
; by writing to Richard Barry, contact details for whom are available on the
|
| 40 |
|
|
; FreeRTOS WEB site.
|
| 41 |
|
|
;
|
| 42 |
|
|
; 1 tab == 4 spaces!
|
| 43 |
|
|
;
|
| 44 |
|
|
; http://www.FreeRTOS.org - Documentation, latest information, license and
|
| 45 |
|
|
; contact details.
|
| 46 |
|
|
;
|
| 47 |
|
|
; http://www.SafeRTOS.com - A version that is certified for use in safety
|
| 48 |
|
|
; critical systems.
|
| 49 |
|
|
;
|
| 50 |
|
|
; http://www.OpenRTOS.com - Commercial support, development, porting,
|
| 51 |
|
|
; licensing and training services.
|
| 52 |
|
|
;*/
|
| 53 |
|
|
#include "ISR_Support.h"
|
| 54 |
|
|
;------------------------------------------------------------------------------
|
| 55 |
|
|
|
| 56 |
|
|
#if __CORE__ != __78K0R__
|
| 57 |
|
|
#error "This file is only for 78K0R Devices"
|
| 58 |
|
|
#endif
|
| 59 |
|
|
|
| 60 |
|
|
#define CS 0xFFFFC
|
| 61 |
|
|
#define ES 0xFFFFD
|
| 62 |
|
|
|
| 63 |
|
|
; Functions implemented in this file
|
| 64 |
|
|
;------------------------------------------------------------------------------
|
| 65 |
|
|
PUBLIC vPortYield
|
| 66 |
|
|
PUBLIC vPortStart
|
| 67 |
|
|
|
| 68 |
|
|
; Functions used by scheduler
|
| 69 |
|
|
;------------------------------------------------------------------------------
|
| 70 |
|
|
EXTERN vTaskSwitchContext
|
| 71 |
|
|
EXTERN vTaskIncrementTick
|
| 72 |
|
|
|
| 73 |
|
|
; Tick ISR Prototype
|
| 74 |
|
|
;------------------------------------------------------------------------------
|
| 75 |
|
|
; EXTERN ?CL78K0R_V2_L00
|
| 76 |
|
|
|
| 77 |
|
|
PUBWEAK `??MD_INTTM05??INTVEC 68`
|
| 78 |
|
|
PUBLIC MD_INTTM05
|
| 79 |
|
|
|
| 80 |
|
|
MD_INTTM05 SYMBOL "MD_INTTM05"
|
| 81 |
|
|
`??MD_INTTM05??INTVEC 68` SYMBOL "??INTVEC 68", MD_INTTM05
|
| 82 |
|
|
|
| 83 |
|
|
|
| 84 |
|
|
|
| 85 |
|
|
;------------------------------------------------------------------------------
|
| 86 |
|
|
; Yield to another task. Implemented as a software interrupt. The return
|
| 87 |
|
|
; address and PSW will have been saved to the stack automatically before
|
| 88 |
|
|
; this code runs.
|
| 89 |
|
|
;
|
| 90 |
|
|
; Input: NONE
|
| 91 |
|
|
;
|
| 92 |
|
|
; Call: CALL vPortYield
|
| 93 |
|
|
;
|
| 94 |
|
|
; Output: NONE
|
| 95 |
|
|
;
|
| 96 |
|
|
;------------------------------------------------------------------------------
|
| 97 |
|
|
RSEG CODE:CODE
|
| 98 |
|
|
vPortYield:
|
| 99 |
|
|
portSAVE_CONTEXT ; Save the context of the current task.
|
| 100 |
|
|
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
| 101 |
|
|
portRESTORE_CONTEXT ; Restore the context of the next task to run.
|
| 102 |
|
|
retb
|
| 103 |
|
|
|
| 104 |
|
|
|
| 105 |
|
|
;------------------------------------------------------------------------------
|
| 106 |
|
|
; Restore the context of the first task that is going to run.
|
| 107 |
|
|
;
|
| 108 |
|
|
; Input: NONE
|
| 109 |
|
|
;
|
| 110 |
|
|
; Call: CALL vPortStart
|
| 111 |
|
|
;
|
| 112 |
|
|
; Output: NONE
|
| 113 |
|
|
;
|
| 114 |
|
|
;------------------------------------------------------------------------------
|
| 115 |
|
|
RSEG CODE:CODE
|
| 116 |
|
|
vPortStart:
|
| 117 |
|
|
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
| 118 |
|
|
reti ; An interrupt stack frame is used so the task
|
| 119 |
|
|
; is started using a RETI instruction.
|
| 120 |
|
|
|
| 121 |
|
|
;------------------------------------------------------------------------------
|
| 122 |
|
|
; Perform the necessary steps of the Tick Count Increment and Task Switch
|
| 123 |
|
|
; depending on the chosen kernel configuration
|
| 124 |
|
|
;
|
| 125 |
|
|
; Input: NONE
|
| 126 |
|
|
;
|
| 127 |
|
|
; Call: ISR
|
| 128 |
|
|
;
|
| 129 |
|
|
; Output: NONE
|
| 130 |
|
|
;
|
| 131 |
|
|
;------------------------------------------------------------------------------
|
| 132 |
|
|
|
| 133 |
|
|
MD_INTTM05:
|
| 134 |
|
|
|
| 135 |
|
|
portSAVE_CONTEXT ; Save the context of the current task.
|
| 136 |
|
|
call vTaskIncrementTick ; Call the timer tick function.
|
| 137 |
|
|
#if configUSE_PREEMPTION == 1
|
| 138 |
|
|
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
| 139 |
|
|
#endif
|
| 140 |
|
|
portRESTORE_CONTEXT ; Restore the context of the next task to run.
|
| 141 |
|
|
reti
|
| 142 |
|
|
|
| 143 |
|
|
|
| 144 |
|
|
|
| 145 |
|
|
; REQUIRE ?CL78K0R_V2_L00
|
| 146 |
|
|
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
|
| 147 |
|
|
ORG 68
|
| 148 |
|
|
`??MD_INTTM05??INTVEC 68`:
|
| 149 |
|
|
DW MD_INTTM05
|
| 150 |
|
|
|
| 151 |
|
|
COMMON INTVEC:CODE:ROOT(1) ; Set ISR location to the Interrupt vector table.
|
| 152 |
|
|
ORG 126
|
| 153 |
|
|
`??vPortYield??INTVEC 126`:
|
| 154 |
|
|
DW vPortYield
|
| 155 |
|
|
|
| 156 |
|
|
; Set value for the usCriticalNesting.
|
| 157 |
|
|
RSEG NEAR_ID:CONST:SORT:NOROOT(1)
|
| 158 |
|
|
`?`:
|
| 159 |
|
|
DW 10
|
| 160 |
|
|
|
| 161 |
|
|
;#endif
|
| 162 |
|
|
|
| 163 |
|
|
END
|