Ethernetwebsoc
Dependencies: C12832_lcd LM75B WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip
mbed-rtos/rtx/LPC11U24/uARM/HAL_CM0.c@0:0ed2a7c7190c, 2013-05-31 (annotated)
- Committer:
- GordonSin
- Date:
- Fri May 31 04:09:54 2013 +0000
- Revision:
- 0:0ed2a7c7190c
31/5/2013;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GordonSin | 0:0ed2a7c7190c | 1 | /*---------------------------------------------------------------------------- |
GordonSin | 0:0ed2a7c7190c | 2 | * RL-ARM - RTX |
GordonSin | 0:0ed2a7c7190c | 3 | *---------------------------------------------------------------------------- |
GordonSin | 0:0ed2a7c7190c | 4 | * Name: HAL_CM0.C |
GordonSin | 0:0ed2a7c7190c | 5 | * Purpose: Hardware Abstraction Layer for Cortex-M0 |
GordonSin | 0:0ed2a7c7190c | 6 | * Rev.: V4.50 |
GordonSin | 0:0ed2a7c7190c | 7 | *---------------------------------------------------------------------------- |
GordonSin | 0:0ed2a7c7190c | 8 | * |
GordonSin | 0:0ed2a7c7190c | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH |
GordonSin | 0:0ed2a7c7190c | 10 | * All rights reserved. |
GordonSin | 0:0ed2a7c7190c | 11 | * Redistribution and use in source and binary forms, with or without |
GordonSin | 0:0ed2a7c7190c | 12 | * modification, are permitted provided that the following conditions are met: |
GordonSin | 0:0ed2a7c7190c | 13 | * - Redistributions of source code must retain the above copyright |
GordonSin | 0:0ed2a7c7190c | 14 | * notice, this list of conditions and the following disclaimer. |
GordonSin | 0:0ed2a7c7190c | 15 | * - Redistributions in binary form must reproduce the above copyright |
GordonSin | 0:0ed2a7c7190c | 16 | * notice, this list of conditions and the following disclaimer in the |
GordonSin | 0:0ed2a7c7190c | 17 | * documentation and/or other materials provided with the distribution. |
GordonSin | 0:0ed2a7c7190c | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
GordonSin | 0:0ed2a7c7190c | 19 | * to endorse or promote products derived from this software without |
GordonSin | 0:0ed2a7c7190c | 20 | * specific prior written permission. |
GordonSin | 0:0ed2a7c7190c | 21 | * |
GordonSin | 0:0ed2a7c7190c | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
GordonSin | 0:0ed2a7c7190c | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
GordonSin | 0:0ed2a7c7190c | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
GordonSin | 0:0ed2a7c7190c | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
GordonSin | 0:0ed2a7c7190c | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
GordonSin | 0:0ed2a7c7190c | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
GordonSin | 0:0ed2a7c7190c | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
GordonSin | 0:0ed2a7c7190c | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
GordonSin | 0:0ed2a7c7190c | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
GordonSin | 0:0ed2a7c7190c | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
GordonSin | 0:0ed2a7c7190c | 32 | * POSSIBILITY OF SUCH DAMAGE. |
GordonSin | 0:0ed2a7c7190c | 33 | *---------------------------------------------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 34 | |
GordonSin | 0:0ed2a7c7190c | 35 | #include "rt_TypeDef.h" |
GordonSin | 0:0ed2a7c7190c | 36 | #include "RTX_Config.h" |
GordonSin | 0:0ed2a7c7190c | 37 | #include "rt_System.h" |
GordonSin | 0:0ed2a7c7190c | 38 | #include "rt_HAL_CM.h" |
GordonSin | 0:0ed2a7c7190c | 39 | #include "rt_Task.h" |
GordonSin | 0:0ed2a7c7190c | 40 | #include "rt_MemBox.h" |
GordonSin | 0:0ed2a7c7190c | 41 | |
GordonSin | 0:0ed2a7c7190c | 42 | |
GordonSin | 0:0ed2a7c7190c | 43 | /*---------------------------------------------------------------------------- |
GordonSin | 0:0ed2a7c7190c | 44 | * Functions |
GordonSin | 0:0ed2a7c7190c | 45 | *---------------------------------------------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 46 | |
GordonSin | 0:0ed2a7c7190c | 47 | |
GordonSin | 0:0ed2a7c7190c | 48 | /*--------------------------- rt_set_PSP ------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 49 | |
GordonSin | 0:0ed2a7c7190c | 50 | __asm void rt_set_PSP (U32 stack) { |
GordonSin | 0:0ed2a7c7190c | 51 | MSR PSP,R0 |
GordonSin | 0:0ed2a7c7190c | 52 | BX LR |
GordonSin | 0:0ed2a7c7190c | 53 | } |
GordonSin | 0:0ed2a7c7190c | 54 | |
GordonSin | 0:0ed2a7c7190c | 55 | |
GordonSin | 0:0ed2a7c7190c | 56 | /*--------------------------- rt_get_PSP ------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 57 | |
GordonSin | 0:0ed2a7c7190c | 58 | __asm U32 rt_get_PSP (void) { |
GordonSin | 0:0ed2a7c7190c | 59 | MRS R0,PSP |
GordonSin | 0:0ed2a7c7190c | 60 | BX LR |
GordonSin | 0:0ed2a7c7190c | 61 | } |
GordonSin | 0:0ed2a7c7190c | 62 | |
GordonSin | 0:0ed2a7c7190c | 63 | |
GordonSin | 0:0ed2a7c7190c | 64 | /*--------------------------- os_set_env ------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 65 | |
GordonSin | 0:0ed2a7c7190c | 66 | __asm void os_set_env (void) { |
GordonSin | 0:0ed2a7c7190c | 67 | /* Switch to Unprivileged/Privileged Thread mode, use PSP. */ |
GordonSin | 0:0ed2a7c7190c | 68 | MOV R0,SP ; PSP = MSP |
GordonSin | 0:0ed2a7c7190c | 69 | MSR PSP,R0 |
GordonSin | 0:0ed2a7c7190c | 70 | LDR R0,=__cpp(&os_flags) |
GordonSin | 0:0ed2a7c7190c | 71 | LDRB R0,[R0] |
GordonSin | 0:0ed2a7c7190c | 72 | LSLS R0,#31 |
GordonSin | 0:0ed2a7c7190c | 73 | BNE PrivilegedE |
GordonSin | 0:0ed2a7c7190c | 74 | MOVS R0,#0x03 ; Unprivileged Thread mode, use PSP |
GordonSin | 0:0ed2a7c7190c | 75 | MSR CONTROL,R0 |
GordonSin | 0:0ed2a7c7190c | 76 | BX LR |
GordonSin | 0:0ed2a7c7190c | 77 | PrivilegedE |
GordonSin | 0:0ed2a7c7190c | 78 | MOVS R0,#0x02 ; Privileged Thread mode, use PSP |
GordonSin | 0:0ed2a7c7190c | 79 | MSR CONTROL,R0 |
GordonSin | 0:0ed2a7c7190c | 80 | BX LR |
GordonSin | 0:0ed2a7c7190c | 81 | |
GordonSin | 0:0ed2a7c7190c | 82 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 83 | } |
GordonSin | 0:0ed2a7c7190c | 84 | |
GordonSin | 0:0ed2a7c7190c | 85 | |
GordonSin | 0:0ed2a7c7190c | 86 | /*--------------------------- _alloc_box ------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 87 | |
GordonSin | 0:0ed2a7c7190c | 88 | __asm void *_alloc_box (void *box_mem) { |
GordonSin | 0:0ed2a7c7190c | 89 | /* Function wrapper for Unprivileged/Privileged mode. */ |
GordonSin | 0:0ed2a7c7190c | 90 | LDR R3,=__cpp(rt_alloc_box) |
GordonSin | 0:0ed2a7c7190c | 91 | MOV R12,R3 |
GordonSin | 0:0ed2a7c7190c | 92 | MRS R3,IPSR |
GordonSin | 0:0ed2a7c7190c | 93 | LSLS R3,#24 |
GordonSin | 0:0ed2a7c7190c | 94 | BNE PrivilegedA |
GordonSin | 0:0ed2a7c7190c | 95 | MRS R3,CONTROL |
GordonSin | 0:0ed2a7c7190c | 96 | LSLS R3,#31 |
GordonSin | 0:0ed2a7c7190c | 97 | BEQ PrivilegedA |
GordonSin | 0:0ed2a7c7190c | 98 | SVC 0 |
GordonSin | 0:0ed2a7c7190c | 99 | BX LR |
GordonSin | 0:0ed2a7c7190c | 100 | PrivilegedA |
GordonSin | 0:0ed2a7c7190c | 101 | BX R12 |
GordonSin | 0:0ed2a7c7190c | 102 | |
GordonSin | 0:0ed2a7c7190c | 103 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 104 | } |
GordonSin | 0:0ed2a7c7190c | 105 | |
GordonSin | 0:0ed2a7c7190c | 106 | |
GordonSin | 0:0ed2a7c7190c | 107 | /*--------------------------- _free_box -------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 108 | |
GordonSin | 0:0ed2a7c7190c | 109 | __asm int _free_box (void *box_mem, void *box) { |
GordonSin | 0:0ed2a7c7190c | 110 | /* Function wrapper for Unprivileged/Privileged mode. */ |
GordonSin | 0:0ed2a7c7190c | 111 | LDR R3,=__cpp(rt_free_box) |
GordonSin | 0:0ed2a7c7190c | 112 | MOV R12,R3 |
GordonSin | 0:0ed2a7c7190c | 113 | MRS R3,IPSR |
GordonSin | 0:0ed2a7c7190c | 114 | LSLS R3,#24 |
GordonSin | 0:0ed2a7c7190c | 115 | BNE PrivilegedF |
GordonSin | 0:0ed2a7c7190c | 116 | MRS R3,CONTROL |
GordonSin | 0:0ed2a7c7190c | 117 | LSLS R3,#31 |
GordonSin | 0:0ed2a7c7190c | 118 | BEQ PrivilegedF |
GordonSin | 0:0ed2a7c7190c | 119 | SVC 0 |
GordonSin | 0:0ed2a7c7190c | 120 | BX LR |
GordonSin | 0:0ed2a7c7190c | 121 | PrivilegedF |
GordonSin | 0:0ed2a7c7190c | 122 | BX R12 |
GordonSin | 0:0ed2a7c7190c | 123 | |
GordonSin | 0:0ed2a7c7190c | 124 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 125 | } |
GordonSin | 0:0ed2a7c7190c | 126 | |
GordonSin | 0:0ed2a7c7190c | 127 | |
GordonSin | 0:0ed2a7c7190c | 128 | /*-------------------------- SVC_Handler ------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 129 | |
GordonSin | 0:0ed2a7c7190c | 130 | __asm void SVC_Handler (void) { |
GordonSin | 0:0ed2a7c7190c | 131 | PRESERVE8 |
GordonSin | 0:0ed2a7c7190c | 132 | |
GordonSin | 0:0ed2a7c7190c | 133 | IMPORT SVC_Count |
GordonSin | 0:0ed2a7c7190c | 134 | IMPORT SVC_Table |
GordonSin | 0:0ed2a7c7190c | 135 | IMPORT rt_stk_check |
GordonSin | 0:0ed2a7c7190c | 136 | |
GordonSin | 0:0ed2a7c7190c | 137 | MRS R0,PSP ; Read PSP |
GordonSin | 0:0ed2a7c7190c | 138 | LDR R1,[R0,#24] ; Read Saved PC from Stack |
GordonSin | 0:0ed2a7c7190c | 139 | SUBS R1,R1,#2 ; Point to SVC Instruction |
GordonSin | 0:0ed2a7c7190c | 140 | LDRB R1,[R1] ; Load SVC Number |
GordonSin | 0:0ed2a7c7190c | 141 | CMP R1,#0 |
GordonSin | 0:0ed2a7c7190c | 142 | BNE SVC_User ; User SVC Number > 0 |
GordonSin | 0:0ed2a7c7190c | 143 | |
GordonSin | 0:0ed2a7c7190c | 144 | MOV LR,R4 |
GordonSin | 0:0ed2a7c7190c | 145 | LDMIA R0,{R0-R3,R4} ; Read R0-R3,R12 from stack |
GordonSin | 0:0ed2a7c7190c | 146 | MOV R12,R4 |
GordonSin | 0:0ed2a7c7190c | 147 | MOV R4,LR |
GordonSin | 0:0ed2a7c7190c | 148 | BLX R12 ; Call SVC Function |
GordonSin | 0:0ed2a7c7190c | 149 | |
GordonSin | 0:0ed2a7c7190c | 150 | MRS R3,PSP ; Read PSP |
GordonSin | 0:0ed2a7c7190c | 151 | STMIA R3!,{R0-R2} ; Store return values |
GordonSin | 0:0ed2a7c7190c | 152 | |
GordonSin | 0:0ed2a7c7190c | 153 | LDR R3,=__cpp(&os_tsk) |
GordonSin | 0:0ed2a7c7190c | 154 | LDMIA R3!,{R1,R2} ; os_tsk.run, os_tsk.new |
GordonSin | 0:0ed2a7c7190c | 155 | CMP R1,R2 |
GordonSin | 0:0ed2a7c7190c | 156 | BEQ SVC_Exit ; no task switch |
GordonSin | 0:0ed2a7c7190c | 157 | |
GordonSin | 0:0ed2a7c7190c | 158 | SUBS R3,#8 |
GordonSin | 0:0ed2a7c7190c | 159 | CMP R1,#0 ; Runtask deleted? |
GordonSin | 0:0ed2a7c7190c | 160 | BEQ SVC_Next |
GordonSin | 0:0ed2a7c7190c | 161 | |
GordonSin | 0:0ed2a7c7190c | 162 | MRS R0,PSP ; Read PSP |
GordonSin | 0:0ed2a7c7190c | 163 | SUBS R0,R0,#32 ; Adjust Start Address |
GordonSin | 0:0ed2a7c7190c | 164 | STR R0,[R1,#TCB_TSTACK] ; Update os_tsk.run->tsk_stack |
GordonSin | 0:0ed2a7c7190c | 165 | STMIA R0!,{R4-R7} ; Save old context (R4-R7) |
GordonSin | 0:0ed2a7c7190c | 166 | MOV R4,R8 |
GordonSin | 0:0ed2a7c7190c | 167 | MOV R5,R9 |
GordonSin | 0:0ed2a7c7190c | 168 | MOV R6,R10 |
GordonSin | 0:0ed2a7c7190c | 169 | MOV R7,R11 |
GordonSin | 0:0ed2a7c7190c | 170 | STMIA R0!,{R4-R7} ; Save old context (R8-R11) |
GordonSin | 0:0ed2a7c7190c | 171 | |
GordonSin | 0:0ed2a7c7190c | 172 | PUSH {R2,R3} |
GordonSin | 0:0ed2a7c7190c | 173 | BL rt_stk_check ; Check for Stack overflow |
GordonSin | 0:0ed2a7c7190c | 174 | POP {R2,R3} |
GordonSin | 0:0ed2a7c7190c | 175 | |
GordonSin | 0:0ed2a7c7190c | 176 | SVC_Next |
GordonSin | 0:0ed2a7c7190c | 177 | STR R2,[R3] ; os_tsk.run = os_tsk.new |
GordonSin | 0:0ed2a7c7190c | 178 | |
GordonSin | 0:0ed2a7c7190c | 179 | LDR R0,[R2,#TCB_TSTACK] ; os_tsk.new->tsk_stack |
GordonSin | 0:0ed2a7c7190c | 180 | ADDS R0,R0,#16 ; Adjust Start Address |
GordonSin | 0:0ed2a7c7190c | 181 | LDMIA R0!,{R4-R7} ; Restore new Context (R8-R11) |
GordonSin | 0:0ed2a7c7190c | 182 | MOV R8,R4 |
GordonSin | 0:0ed2a7c7190c | 183 | MOV R9,R5 |
GordonSin | 0:0ed2a7c7190c | 184 | MOV R10,R6 |
GordonSin | 0:0ed2a7c7190c | 185 | MOV R11,R7 |
GordonSin | 0:0ed2a7c7190c | 186 | MSR PSP,R0 ; Write PSP |
GordonSin | 0:0ed2a7c7190c | 187 | SUBS R0,R0,#32 ; Adjust Start Address |
GordonSin | 0:0ed2a7c7190c | 188 | LDMIA R0!,{R4-R7} ; Restore new Context (R4-R7) |
GordonSin | 0:0ed2a7c7190c | 189 | |
GordonSin | 0:0ed2a7c7190c | 190 | SVC_Exit |
GordonSin | 0:0ed2a7c7190c | 191 | MOVS R0,#:NOT:0xFFFFFFFD ; Set EXC_RETURN value |
GordonSin | 0:0ed2a7c7190c | 192 | MVNS R0,R0 |
GordonSin | 0:0ed2a7c7190c | 193 | BX R0 ; RETI to Thread Mode, use PSP |
GordonSin | 0:0ed2a7c7190c | 194 | |
GordonSin | 0:0ed2a7c7190c | 195 | /*------------------- User SVC ------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 196 | |
GordonSin | 0:0ed2a7c7190c | 197 | SVC_User |
GordonSin | 0:0ed2a7c7190c | 198 | PUSH {R4,LR} ; Save Registers |
GordonSin | 0:0ed2a7c7190c | 199 | LDR R2,=SVC_Count |
GordonSin | 0:0ed2a7c7190c | 200 | LDR R2,[R2] |
GordonSin | 0:0ed2a7c7190c | 201 | CMP R1,R2 |
GordonSin | 0:0ed2a7c7190c | 202 | BHI SVC_Done ; Overflow |
GordonSin | 0:0ed2a7c7190c | 203 | |
GordonSin | 0:0ed2a7c7190c | 204 | LDR R4,=SVC_Table-4 |
GordonSin | 0:0ed2a7c7190c | 205 | LSLS R1,R1,#2 |
GordonSin | 0:0ed2a7c7190c | 206 | LDR R4,[R4,R1] ; Load SVC Function Address |
GordonSin | 0:0ed2a7c7190c | 207 | MOV LR,R4 |
GordonSin | 0:0ed2a7c7190c | 208 | |
GordonSin | 0:0ed2a7c7190c | 209 | LDMIA R0,{R0-R3,R4} ; Read R0-R3,R12 from stack |
GordonSin | 0:0ed2a7c7190c | 210 | MOV R12,R4 |
GordonSin | 0:0ed2a7c7190c | 211 | BLX LR ; Call SVC Function |
GordonSin | 0:0ed2a7c7190c | 212 | |
GordonSin | 0:0ed2a7c7190c | 213 | MRS R4,PSP ; Read PSP |
GordonSin | 0:0ed2a7c7190c | 214 | STMIA R4!,{R0-R3} ; Function return values |
GordonSin | 0:0ed2a7c7190c | 215 | SVC_Done |
GordonSin | 0:0ed2a7c7190c | 216 | POP {R4,PC} ; RETI |
GordonSin | 0:0ed2a7c7190c | 217 | |
GordonSin | 0:0ed2a7c7190c | 218 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 219 | } |
GordonSin | 0:0ed2a7c7190c | 220 | |
GordonSin | 0:0ed2a7c7190c | 221 | |
GordonSin | 0:0ed2a7c7190c | 222 | /*-------------------------- PendSV_Handler ---------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 223 | |
GordonSin | 0:0ed2a7c7190c | 224 | __asm void PendSV_Handler (void) { |
GordonSin | 0:0ed2a7c7190c | 225 | PRESERVE8 |
GordonSin | 0:0ed2a7c7190c | 226 | |
GordonSin | 0:0ed2a7c7190c | 227 | BL __cpp(rt_pop_req) |
GordonSin | 0:0ed2a7c7190c | 228 | |
GordonSin | 0:0ed2a7c7190c | 229 | Sys_Switch |
GordonSin | 0:0ed2a7c7190c | 230 | LDR R3,=__cpp(&os_tsk) |
GordonSin | 0:0ed2a7c7190c | 231 | LDMIA R3!,{R1,R2} ; os_tsk.run, os_tsk.new |
GordonSin | 0:0ed2a7c7190c | 232 | CMP R1,R2 |
GordonSin | 0:0ed2a7c7190c | 233 | BEQ Sys_Exit ; no task switch |
GordonSin | 0:0ed2a7c7190c | 234 | |
GordonSin | 0:0ed2a7c7190c | 235 | SUBS R3,#8 |
GordonSin | 0:0ed2a7c7190c | 236 | |
GordonSin | 0:0ed2a7c7190c | 237 | MRS R0,PSP ; Read PSP |
GordonSin | 0:0ed2a7c7190c | 238 | SUBS R0,R0,#32 ; Adjust Start Address |
GordonSin | 0:0ed2a7c7190c | 239 | STR R0,[R1,#TCB_TSTACK] ; Update os_tsk.run->tsk_stack |
GordonSin | 0:0ed2a7c7190c | 240 | STMIA R0!,{R4-R7} ; Save old context (R4-R7) |
GordonSin | 0:0ed2a7c7190c | 241 | MOV R4,R8 |
GordonSin | 0:0ed2a7c7190c | 242 | MOV R5,R9 |
GordonSin | 0:0ed2a7c7190c | 243 | MOV R6,R10 |
GordonSin | 0:0ed2a7c7190c | 244 | MOV R7,R11 |
GordonSin | 0:0ed2a7c7190c | 245 | STMIA R0!,{R4-R7} ; Save old context (R8-R11) |
GordonSin | 0:0ed2a7c7190c | 246 | |
GordonSin | 0:0ed2a7c7190c | 247 | PUSH {R2,R3} |
GordonSin | 0:0ed2a7c7190c | 248 | BL rt_stk_check ; Check for Stack overflow |
GordonSin | 0:0ed2a7c7190c | 249 | POP {R2,R3} |
GordonSin | 0:0ed2a7c7190c | 250 | |
GordonSin | 0:0ed2a7c7190c | 251 | STR R2,[R3] ; os_tsk.run = os_tsk.new |
GordonSin | 0:0ed2a7c7190c | 252 | |
GordonSin | 0:0ed2a7c7190c | 253 | LDR R0,[R2,#TCB_TSTACK] ; os_tsk.new->tsk_stack |
GordonSin | 0:0ed2a7c7190c | 254 | ADDS R0,R0,#16 ; Adjust Start Address |
GordonSin | 0:0ed2a7c7190c | 255 | LDMIA R0!,{R4-R7} ; Restore new Context (R8-R11) |
GordonSin | 0:0ed2a7c7190c | 256 | MOV R8,R4 |
GordonSin | 0:0ed2a7c7190c | 257 | MOV R9,R5 |
GordonSin | 0:0ed2a7c7190c | 258 | MOV R10,R6 |
GordonSin | 0:0ed2a7c7190c | 259 | MOV R11,R7 |
GordonSin | 0:0ed2a7c7190c | 260 | MSR PSP,R0 ; Write PSP |
GordonSin | 0:0ed2a7c7190c | 261 | SUBS R0,R0,#32 ; Adjust Start Address |
GordonSin | 0:0ed2a7c7190c | 262 | LDMIA R0!,{R4-R7} ; Restore new Context (R4-R7) |
GordonSin | 0:0ed2a7c7190c | 263 | |
GordonSin | 0:0ed2a7c7190c | 264 | Sys_Exit |
GordonSin | 0:0ed2a7c7190c | 265 | MOVS R0,#:NOT:0xFFFFFFFD ; Set EXC_RETURN value |
GordonSin | 0:0ed2a7c7190c | 266 | MVNS R0,R0 |
GordonSin | 0:0ed2a7c7190c | 267 | BX R0 ; RETI to Thread Mode, use PSP |
GordonSin | 0:0ed2a7c7190c | 268 | |
GordonSin | 0:0ed2a7c7190c | 269 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 270 | } |
GordonSin | 0:0ed2a7c7190c | 271 | |
GordonSin | 0:0ed2a7c7190c | 272 | |
GordonSin | 0:0ed2a7c7190c | 273 | /*-------------------------- SysTick_Handler --------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 274 | |
GordonSin | 0:0ed2a7c7190c | 275 | __asm void SysTick_Handler (void) { |
GordonSin | 0:0ed2a7c7190c | 276 | PRESERVE8 |
GordonSin | 0:0ed2a7c7190c | 277 | |
GordonSin | 0:0ed2a7c7190c | 278 | BL __cpp(rt_systick) |
GordonSin | 0:0ed2a7c7190c | 279 | B Sys_Switch |
GordonSin | 0:0ed2a7c7190c | 280 | |
GordonSin | 0:0ed2a7c7190c | 281 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 282 | } |
GordonSin | 0:0ed2a7c7190c | 283 | |
GordonSin | 0:0ed2a7c7190c | 284 | |
GordonSin | 0:0ed2a7c7190c | 285 | /*-------------------------- OS_Tick_Handler --------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 286 | |
GordonSin | 0:0ed2a7c7190c | 287 | __asm void OS_Tick_Handler (void) { |
GordonSin | 0:0ed2a7c7190c | 288 | PRESERVE8 |
GordonSin | 0:0ed2a7c7190c | 289 | |
GordonSin | 0:0ed2a7c7190c | 290 | BL __cpp(os_tick_irqack) |
GordonSin | 0:0ed2a7c7190c | 291 | BL __cpp(rt_systick) |
GordonSin | 0:0ed2a7c7190c | 292 | B Sys_Switch |
GordonSin | 0:0ed2a7c7190c | 293 | |
GordonSin | 0:0ed2a7c7190c | 294 | ALIGN |
GordonSin | 0:0ed2a7c7190c | 295 | } |
GordonSin | 0:0ed2a7c7190c | 296 | |
GordonSin | 0:0ed2a7c7190c | 297 | |
GordonSin | 0:0ed2a7c7190c | 298 | /*---------------------------------------------------------------------------- |
GordonSin | 0:0ed2a7c7190c | 299 | * end of file |
GordonSin | 0:0ed2a7c7190c | 300 | *---------------------------------------------------------------------------*/ |
GordonSin | 0:0ed2a7c7190c | 301 |