|
39 | 39 | .extern pxCurrentTCB
|
40 | 40 | .extern vTaskSwitchContext
|
41 | 41 | .extern vApplicationIRQHandler
|
| 42 | + .extern vApplicationFPUSafeIRQHandler |
42 | 43 | .extern ulPortInterruptNesting
|
43 | 44 | .extern ulPortTaskHasFPUContext
|
44 | 45 | .extern ulICCEOIR
|
@@ -237,6 +238,50 @@ vApplicationSVCHandler:
|
237 | 238 |
|
238 | 239 | /*-----------------------------------------------------------*/
|
239 | 240 |
|
| 241 | +/* If the application provides an implementation of vApplicationIRQHandler(), |
| 242 | + * then it will get called directly without saving the FPU registers on |
| 243 | + * interrupt entry, and this weak implementation of vApplicationIRQHandler() |
| 244 | + * will not get called. |
| 245 | + * |
| 246 | + * If the application provides its own implementation of |
| 247 | + * vApplicationFPUSafeIRQHandler() then this implementation of |
| 248 | + * vApplicationIRQHandler() will be called, save the FPU registers, and then |
| 249 | + * call vApplicationFPUSafeIRQHandler(). |
| 250 | + * |
| 251 | + * Therefore, if the application writer wants FPU registers to be saved on |
| 252 | + * interrupt entry, their IRQ handler must be called |
| 253 | + * vApplicationFPUSafeIRQHandler(), and if the application writer does not want |
| 254 | + * FPU registers to be saved on interrupt entry their IRQ handler must be |
| 255 | + * called vApplicationIRQHandler(). |
| 256 | + */ |
| 257 | +.align 4 |
| 258 | +.weak vApplicationIRQHandler |
| 259 | +.type vApplicationIRQHandler, %function |
| 260 | +vApplicationIRQHandler: |
| 261 | + PUSH {LR} |
| 262 | + |
| 263 | + VMRS R1, FPSCR |
| 264 | + VPUSH {D0-D7} |
| 265 | + PUSH {R1} |
| 266 | + |
| 267 | + BLX vApplicationFPUSafeIRQHandler |
| 268 | + |
| 269 | + POP {R0} |
| 270 | + VPOP {D0-D7} |
| 271 | + VMSR FPSCR, R0 |
| 272 | + |
| 273 | + POP {PC} |
| 274 | + |
| 275 | +/*-----------------------------------------------------------*/ |
| 276 | + |
| 277 | +.align 4 |
| 278 | +.weak vApplicationFPUSafeIRQHandler |
| 279 | +.type vApplicationFPUSafeIRQHandler, %function |
| 280 | +vApplicationFPUSafeIRQHandler: |
| 281 | + B vApplicationFPUSafeIRQHandler |
| 282 | + |
| 283 | +/*-----------------------------------------------------------*/ |
| 284 | + |
240 | 285 | /*
|
241 | 286 | * UBaseType_t ulPortCountLeadingZeros( UBaseType_t ulBitmap );
|
242 | 287 | *
|
|
0 commit comments