src/arch/cores/armv7-m/C/m4-fpu.c
void fpu_enable(void)
{
#if CONFIG_FPU_ENABLE
    uint32_t r_cpacr = CPACR_BASE;
    uint32_t value = read_reg_value(&r_cpacr);

#if CONFIG_FPU_LAZY
    struct FPU *fpuregs = FPU_SYSREG_BASE;

    /* activate LSPEN for Lazy auto saving */
    fpuregs->FPCCR |= FPU_FPCCR_LSPEN_Msk;
#endif
    /* register FPU IRQ handler */
    irq_handler_set(FPU_IRQ, fpu_handler, 0, ID_DEV_UNUSED);
    /* Enable CP10 & CP 11 */
    value |= (FPU_ACCESS_MODE << 20);

    write_reg_value(&r_cpacr, value);
    full_memory_barrier();
#endif
}
/*
  Case of full FPU context saving:

  TODO: for scheduling time: the scheduler must check if the FPSCR flags is set. If yes,
  the FPU context (reg S0-S32 + SCR or S16-S32 + SCR in case of lazy) must be pushed in
  the caller stack. Before scheduling the next task, the scheduler must check if there is
  an FPU context in the stack. If yes, this context must be restored.
*/
Case of full FPU context saving:
TODO: for scheduling time: the scheduler must check if the FPSCR flags is set. If yes,
the FPU context (reg S0-S32 + SCR or S16-S32 + SCR in case of lazy) must be pushed in
the caller stack. Before scheduling the next task, the scheduler must check if there is
an FPU context in the stack. If yes, this context must be restored.
Case of full FPU context saving : TODO : for scheduling time : the scheduler must check if the FPSCR flags is set . If yes the FPU context ( reg S0 - S32 + SCR or S16 - S32 + SCR in case of lazy ) must be pushed in the caller stack . Before scheduling the next task the scheduler must check if there is an FPU context in the stack . If yes this context must be restored .
void fpu_enable(void)
{
#if CONFIG_FPU_ENABLE
    uint32_t r_cpacr = CPACR_BASE;
    uint32_t value = read_reg_value(&r_cpacr);
#if CONFIG_FPU_LAZY
    struct FPU *fpuregs = FPU_SYSREG_BASE;
    fpuregs->FPCCR |= FPU_FPCCR_LSPEN_Msk;
#endif
    irq_handler_set(FPU_IRQ, fpu_handler, 0, ID_DEV_UNUSED);
    value |= (FPU_ACCESS_MODE << 20);
    write_reg_value(&r_cpacr, value);
    full_memory_barrier();
#endif
}
void fpu_enable ( void ) { #if CONFIG_FPU_ENABLE uint32_t r_cpacr = CPACR_BASE ; uint32_t value = read_reg_value ( & r_cpacr ) ; #if CONFIG_FPU_LAZY struct FPU * fpuregs = FPU_SYSREG_BASE ; fpuregs -> FPCCR |= FPU_FPCCR_LSPEN_Msk ; #endif irq_handler_set ( FPU_IRQ , fpu_handler , 0 , ID_DEV_UNUSED ) ; value |= ( FPU_ACCESS_MODE << 20 ) ; write_reg_value ( & r_cpacr , value ) ; full_memory_barrier ( ) ; #endif }
Case of full FPU context saving:
TODO: for scheduling time: the scheduler must check if the FPSCR flags is set.
Case of full FPU context saving : TODO : for scheduling time : the scheduler must check if the FPSCR flags is set .
/* activate LSPEN for Lazy auto saving */ /* register FPU IRQ handler */ /* Enable CP10 & CP 11 */