diff --git a/Code/Appli/OsGenCfg.h b/Code/Appli/OsGenCfg.h index 5f9c6b9..b0b6ff9 100644 --- a/Code/Appli/OsGenCfg.h +++ b/Code/Appli/OsGenCfg.h @@ -64,8 +64,8 @@ OS_CONFIG_BEGIN OS_INTERRUPT_CAT2_DEF(Undefined, 0, NOT_NESTED) /* SVCall */ OS_INTERRUPT_CAT2_DEF(Undefined, 0, NOT_NESTED) /* Reserved */ OS_INTERRUPT_CAT2_DEF(Undefined, 0, NOT_NESTED) /* Reserved */ - OS_INTERRUPT_CAT1_DEF(OsDispatchHandler, 4, NESTED) /* OsDispatchHandler */ - OS_INTERRUPT_CAT2_DEF(SysTickTimer, 4, NOT_NESTED) /* OsCat2IsrWrapper */ + OS_INTERRUPT_CAT1_DEF(osDispatchHandler, 4, NESTED) /* osDispatchHandler */ + OS_INTERRUPT_CAT2_DEF(SysTickTimer, 4, NOT_NESTED) /* osCat2IsrWrapper */ #endif OS_INTERRUPT_CAT2_DEF(Undefined, 0, NOT_NESTED) /* TIMER0_IRQ_0_IRQn */ OS_INTERRUPT_CAT2_DEF(Undefined, 0, NOT_NESTED) /* TIMER0_IRQ_1_IRQn */ diff --git a/Code/OSEK/HwPlatform/ARM/OsAsm.h b/Code/OSEK/HwPlatform/ARM/OsAsm.h index f64ee51..9020fe0 100644 --- a/Code/OSEK/HwPlatform/ARM/OsAsm.h +++ b/Code/OSEK/HwPlatform/ARM/OsAsm.h @@ -14,16 +14,20 @@ #ifndef __OS_ASM_H__ #define __OS_ASM_H__ -void OsDispatch(void); -void OsCat2IsrIrqWrapper(void); -void OsStartNewTask(uint32 StackFramePtr, pFunc TaskFuncPtr); -void OsGetCurrentSP(uint32* CurrentSpPtr); -void OsGetPSR(uint32* CurrentPsr); -void OsSetSysCtrlReg(uint32 CtrlRegValue); -void OsGetSysCtrlReg(uint32* CtrlRegValue); -void OsSetSysBasepriReg(uint32 BasepriRegValue); -void OsGetSysBasepriReg(uint32* BasepriRegValue); -uint32 OsHwGetInterruptPrioBits(void); -uint32 OsGetSysPrimaskReg(void); -uint32 OsHwSearchForHighPrio(void); +#include + +void osDispatchHandler(void); +void osCat2IsrWrapper(void); +void osStartNewTask(uint32_t StackFramePtr, pFunc TaskFuncPtr); +void osGetCurrentSP(uint32_t* CurrentSpPtr); +void OsGetPSR(uint32_t* CurrentPsr); +void OsSetSysCtrlReg(uint32_t CtrlRegValue); +void OsGetSysCtrlReg(uint32_t* CtrlRegValue); +void OsSetSysBasepriReg(uint32_t BasepriRegValue); +void OsGetSysBasepriReg(uint32_t* BasepriRegValue); + +uint32_t OsGetSysPrimaskReg(void); +uint32_t OsHwGetInterruptPrioBits(void); +uint32_t osHwSearchForHighPrio(void); + #endif diff --git a/Code/OSEK/HwPlatform/ARM/OsAsm.s b/Code/OSEK/HwPlatform/ARM/OsAsm.s index 2e4edd9..d76d615 100644 --- a/Code/OSEK/HwPlatform/ARM/OsAsm.s +++ b/Code/OSEK/HwPlatform/ARM/OsAsm.s @@ -17,7 +17,7 @@ .syntax unified //----------------------------------------------------------------------------------------------------------------- -// \brief OsDispatchHandler +// \brief void osDispatchHandler(void) // // \descr Context switcher // @@ -28,11 +28,11 @@ .thumb_func .section ".text" .align 4 -.globl OsDispatchHandler -.type OsDispatchHandler, % function +.globl osDispatchHandler +.type osDispatchHandler, % function .extern osDispatcher -OsDispatchHandler: +osDispatchHandler: cpsid i push {r4 - r11, lr} @@ -51,7 +51,7 @@ OsDispatchHandler: bx lr // ---------------------------------------------------------------------------------------------------------------- -// \brief OsCat2IsrWrapper +// \brief void osCat2IsrWrapper(void) // // \descr Wrapper for all category 2 interrupts // @@ -62,8 +62,8 @@ OsDispatchHandler: .thumb_func .section ".text" .align 4 -.globl OsCat2IsrWrapper -.type OsCat2IsrWrapper, % function +.globl osCat2IsrWrapper +.type osCat2IsrWrapper, % function .extern osStoreStackPointer .extern osRunCat2Isr .extern osGetSavedStackPointer @@ -71,7 +71,7 @@ OsDispatchHandler: .extern osIncNestingDepthLevel .extern osDecNestingDepthLevel -OsCat2IsrWrapper: +osCat2IsrWrapper: cpsid i push {r4 - r11, lr} @@ -95,7 +95,7 @@ OsCat2IsrWrapper: bx lr //------------------------------------------------------------------------------------------------------------------ -/// \brief OsStartNewTask (OsStartNewTask(uint32 StackFramePtr, pFunc TaskFuncPtr)) +/// \brief void osStartNewTask(uint32 StackFramePtr, pFunc TaskFuncPtr) /// /// \descr This function start an OSEK Task for the 1st execution /// @@ -106,11 +106,11 @@ OsCat2IsrWrapper: .thumb_func .section ".text" .align 4 -.globl OsStartNewTask -.type OsStartNewTask, % function +.globl osStartNewTask +.type osStartNewTask, % function .extern osErrTaskExitWithoutTerminate -OsStartNewTask: +osStartNewTask: mov sp,r0 movw r0, #0 movt r0, #0x0100 @@ -131,7 +131,7 @@ OsStartNewTask: bx r0 //----------------------------------------------------------------------------------------------------------------- -// \brief OsGetCurrentSP : void OsGetCurrentSP(unsigned int* CurrentSpPtr) +// \brief osGetCurrentSP : void osGetCurrentSP(unsigned int* CurrentSpPtr) // // \descr Get the current stack pointer register value // @@ -142,10 +142,10 @@ OsStartNewTask: .thumb_func .section ".text" .align 4 -.globl OsGetCurrentSP -.type OsGetCurrentSP, % function +.globl osGetCurrentSP +.type osGetCurrentSP, % function -OsGetCurrentSP: +osGetCurrentSP: str r13,[r0] dsb @@ -175,7 +175,7 @@ OsGetPSR: bx lr //----------------------------------------------------------------------------------------------------------------- -// \brief OsSetSysCtrlReg : void OsSetSysCtrlReg(unsigned int CtrlRegValue) +// \brief OsSetSysCtrlReg : void OsSetSysCtrlReg(uint32 CtrlRegValue) // // \descr set the system CONTROL register // diff --git a/Code/OSEK/HwPlatform/ARM/OsHwSchedPrio.s b/Code/OSEK/HwPlatform/ARM/OsHwSchedPrio.s index dfd7014..65c65e7 100644 --- a/Code/OSEK/HwPlatform/ARM/OsHwSchedPrio.s +++ b/Code/OSEK/HwPlatform/ARM/OsHwSchedPrio.s @@ -19,14 +19,14 @@ .thumb_func .section ".text" .align 4 -.globl OsHwSearchForHighPrio -.type OsHwSearchForHighPrio, %function +.globl osHwSearchForHighPrio +.type osHwSearchForHighPrio, %function .extern OsSchedPrioTypeSize .extern OsHwSchedPrioReg .equ osNoReadyTaskWasFound, 0xA0A0F5F5UL -OsHwSearchForHighPrio: +osHwSearchForHighPrio: push {r4-r7,lr} ldr r0,=OsSchedPrioTypeSize ldr r7, [r0] diff --git a/Code/OSEK/HwPlatform/RISC-V/OsAsm.h b/Code/OSEK/HwPlatform/RISC-V/OsAsm.h index 9043389..913f4d8 100644 --- a/Code/OSEK/HwPlatform/RISC-V/OsAsm.h +++ b/Code/OSEK/HwPlatform/RISC-V/OsAsm.h @@ -14,15 +14,19 @@ #ifndef __OS_ASM_H__ #define __OS_ASM_H__ +#include + #ifndef PFUNC_TYPEDEF #define PFUNC_TYPEDEF typedef void (*pFunc)(void); #endif -void OsDispatchHandler(void); -void OsCat2IsrIrqWrapper(void); -void OsStartNewTask(uint32 StackFramePtr, pFunc TaskFuncPtr); -void OsGetCurrentSP(uint32* CurrentSpPtr); -uint32 OsHwSearchForHighPrio(void); +void osDispatchHandler(void); +void osCat2IsrWrapper(void); +void osStartNewTask(uint32_t StackFramePtr, pFunc TaskFuncPtr); +void osSetIntVectTableAddress(uint32_t address); + +uint32_t osGetCurrentSP(void); +uint32_t osHwSearchForHighPrio(void); #endif diff --git a/Code/OSEK/HwPlatform/RISC-V/OsAsm.s b/Code/OSEK/HwPlatform/RISC-V/OsAsm.s index 88b5085..8644d6f 100644 --- a/Code/OSEK/HwPlatform/RISC-V/OsAsm.s +++ b/Code/OSEK/HwPlatform/RISC-V/OsAsm.s @@ -114,7 +114,7 @@ .endm /*-----------------------------------------------------------------------------------------------------------------*/ -/* \brief OsDispatchHandler */ +/* \brief void osDispatchHandler(void) */ /* */ /* \descr Context switcher */ /* */ @@ -124,14 +124,14 @@ /*-----------------------------------------------------------------------------------------------------------------*/ .section ".text" .align 4 -.globl OsDispatchHandler -.type OsDispatchHandler, % function +.globl osDispatchHandler +.type osDispatchHandler, % function .extern osDispatcher .equ SIO_CPUID, 0xd0000000 .equ SIO_RISCV_SOFTIRQ, 0xd00001a0 -OsDispatchHandler: +osDispatchHandler: OsSaveCpuContext mv a0, sp la a1, SIO_RISCV_SOFTIRQ @@ -147,10 +147,10 @@ OsDispatchHandler: csrw mcause, zero mret -.size OsDispatchHandler, .-OsDispatchHandler +.size osDispatchHandler, .-osDispatchHandler /* ---------------------------------------------------------------------------------------------------------------- */ -/* \brief OsCat2IsrWrapper */ +/* \brief void osCat2IsrWrapper(void) */ /* */ /* \descr Wrapper for all category 2 interrupts */ /* */ @@ -160,8 +160,8 @@ OsDispatchHandler: /* ---------------------------------------------------------------------------------------------------------------- */ .section ".text" .align 4 -.globl OsCat2IsrWrapper -.type OsCat2IsrWrapper, % function +.globl osCat2IsrWrapper +.type osCat2IsrWrapper, % function .extern osStoreStackPointer .extern osRunCat2Isr .extern osGetSavedStackPointer @@ -169,7 +169,7 @@ OsDispatchHandler: .extern osIncNestingDepthLevel .extern osDecNestingDepthLevel -OsCat2IsrWrapper: +osCat2IsrWrapper: OsSaveCpuContext jal osIncNestingDepthLevel mv a0, sp @@ -183,10 +183,10 @@ OsCat2IsrWrapper: csrw mcause, zero mret -.size OsCat2IsrWrapper, .-OsCat2IsrWrapper +.size osCat2IsrWrapper, .-osCat2IsrWrapper /* ------------------------------------------------------------------------------------------------------------------ */ -/* / \brief OsStartNewTask (OsStartNewTask(uint32 StackFramePtr, pFunc TaskFuncPtr)) */ +/* / \brief void osStartNewTask(uint32 StackFramePtr, pFunc TaskFuncPtr) */ /* / */ /* / \descr This function start an OSEK Task for the 1st execution */ /* / */ @@ -196,11 +196,11 @@ OsCat2IsrWrapper: /* ------------------------------------------------------------------------------------------------------------------ */ .section ".text" .align 4 -.globl OsStartNewTask -.type OsStartNewTask, % function +.globl osStartNewTask +.type osStartNewTask, % function .extern osErrTaskExitWithoutTerminate -OsStartNewTask: +osStartNewTask: mv sp,a0 csrrw zero, mepc, a1 lw x1, osErrTaskExitWithoutTerminate @@ -236,10 +236,10 @@ OsStartNewTask: csrw mcause, zero mret -.size OsStartNewTask, .-OsStartNewTask +.size osStartNewTask, .-osStartNewTask /* ----------------------------------------------------------------------------------------------------------------- */ -/* \brief OsGetCurrentSP : void OsGetCurrentSP(unsigned int* CurrentSpPtr) */ +/* \brief osGetCurrentSP : uint32 osGetCurrentSP(void) */ /* */ /* \descr Get the current stack pointer register value */ /* */ @@ -249,18 +249,18 @@ OsStartNewTask: /* ----------------------------------------------------------------------------------------------------------------- */ .section ".text" .align 4 -.globl OsGetCurrentSP -.type OsGetCurrentSP, % function +.globl osGetCurrentSP +.type osGetCurrentSP, % function -OsGetCurrentSP: +osGetCurrentSP: mv a0, sp ret -.size OsGetCurrentSP, .-OsGetCurrentSP +.size osGetCurrentSP, .-osGetCurrentSP /* ----------------------------------------------------------------------------------------------------------------- */ -/* \brief OsSetIntVectTableAddress : void OsSetIntVectTableAddress(unsigned int* address) */ +/* \brief osSetIntVectTableAddress : void osSetIntVectTableAddress(uint32 address) */ /* */ /* \descr */ /* */ @@ -270,16 +270,16 @@ OsGetCurrentSP: /* ----------------------------------------------------------------------------------------------------------------- */ .section ".text" .align 4 -.globl OsSetIntVectTableAddress -.type OsSetIntVectTableAddress, % function +.globl osSetIntVectTableAddress +.type osSetIntVectTableAddress, % function -OsSetIntVectTableAddress: +osSetIntVectTableAddress: /* setup the interrupt vector table */ ori a0, a0, 3 csrw mtvec, a0 ret -.size OsSetIntVectTableAddress, .-OsSetIntVectTableAddress +.size osSetIntVectTableAddress, .-osSetIntVectTableAddress /* diff --git a/Code/OSEK/HwPlatform/RISC-V/OsHwSchedPrio.s b/Code/OSEK/HwPlatform/RISC-V/OsHwSchedPrio.s index d304512..e422b36 100644 --- a/Code/OSEK/HwPlatform/RISC-V/OsHwSchedPrio.s +++ b/Code/OSEK/HwPlatform/RISC-V/OsHwSchedPrio.s @@ -25,15 +25,15 @@ .section ".text", "ax" .align 4 -.globl OsHwSearchForHighPrio -.type OsHwSearchForHighPrio, %function +.globl osHwSearchForHighPrio +.type osHwSearchForHighPrio, %function .extern OsSchedPrioTypeSize .extern OsHwSchedPrioReg .extern __os_sw_clz .equ osNoReadyTaskWasFound, 0xA0A0F5F5UL -OsHwSearchForHighPrio: +osHwSearchForHighPrio: addi sp, sp, -4 sw ra, 0(sp) la a0, OsSchedPrioTypeSize @@ -80,7 +80,7 @@ OsHwSearchForHighPrio: addi sp, sp, 4 ret -.size OsHwSearchForHighPrio, .-OsHwSearchForHighPrio +.size osHwSearchForHighPrio, .-osHwSearchForHighPrio /******************************************************************************************* \brief diff --git a/Code/OSEK/OsCore.c b/Code/OSEK/OsCore.c index a2f0273..be83f3b 100644 --- a/Code/OSEK/OsCore.c +++ b/Code/OSEK/OsCore.c @@ -228,7 +228,7 @@ uint32 osDispatcher(uint32 StackPtr) OCB_Cfg.pTcb[OCB_Cfg.CurrentTaskIdx]->pCurrentStackPointer = NewStackFramePtr; /* Start the new task */ - OsStartNewTask(NewStackFramePtr, NewTaskPtr); + osStartNewTask(NewStackFramePtr, NewTaskPtr); } else if(OCB_Cfg.pTcb[OCB_Cfg.CurrentTaskIdx]->TaskStatus == READY) diff --git a/Code/OSEK/OsGenMac.h b/Code/OSEK/OsGenMac.h index 7c314a9..13175f0 100644 --- a/Code/OSEK/OsGenMac.h +++ b/Code/OSEK/OsGenMac.h @@ -386,7 +386,7 @@ #define OS_INTERRUPT_BEGIN osVectoredIVT: #define OS_INTERRUPT_CAT1_DEF(IsrFunc,Prio,Type) j IsrFunc -#define OS_INTERRUPT_CAT2_DEF(IsrFunc,Prio,Type) j OsCat2IsrWrapper +#define OS_INTERRUPT_CAT2_DEF(IsrFunc,Prio,Type) j osCat2IsrWrapper #define OS_INTERRUPT_CATx_DEF(IsrFunc,Prio,Type) j IsrFunc #define OS_INTERRUPT_END .size osVectoredIVT, .-osVectoredIVT @@ -421,7 +421,7 @@ #define OS_INTERRUPT_BEGIN osLookupIVT: #define OS_INTERRUPT_CAT1_DEF(IsrFunc,Prio,Type) .word IsrFunc -#define OS_INTERRUPT_CAT2_DEF(IsrFunc,Prio,Type) .word OsCat2IsrWrapper +#define OS_INTERRUPT_CAT2_DEF(IsrFunc,Prio,Type) .word osCat2IsrWrapper #define OS_INTERRUPT_CATx_DEF(IsrFunc,Prio,Type) .word IsrFunc #define OS_INTERRUPT_END .size osLookupIVT, .-osLookupIVT diff --git a/Code/OSEK/OsSched.c b/Code/OSEK/OsSched.c index 0667e83..681bffb 100644 --- a/Code/OSEK/OsSched.c +++ b/Code/OSEK/OsSched.c @@ -113,7 +113,7 @@ OsStatusType OS_Schedule(void) OS_SuspendAllInterrupts(); /* Get the high prio task id */ - OCB_Cfg.HighPrioReadyTaskIdx = osGetHighPrioReadyTaskIdx((uint32)OsHwSearchForHighPrio()); + OCB_Cfg.HighPrioReadyTaskIdx = osGetHighPrioReadyTaskIdx((uint32)osHwSearchForHighPrio()); /* Exit the critical section */ OS_ResumeAllInterrupts(); @@ -181,7 +181,7 @@ OsStatusType osSchedule(void) OS_SuspendAllInterrupts(); /* Get the high prio task id */ - OCB_Cfg.HighPrioReadyTaskIdx = osGetHighPrioReadyTaskIdx((uint32)OsHwSearchForHighPrio()); + OCB_Cfg.HighPrioReadyTaskIdx = osGetHighPrioReadyTaskIdx((uint32)osHwSearchForHighPrio()); /* Exit the critical section */ OS_ResumeAllInterrupts(); diff --git a/Code/Startup/Core/ARM/IntVect.c b/Code/Startup/Core/ARM/IntVect.c index 54febc0..619e0f2 100644 --- a/Code/Startup/Core/ARM/IntVect.c +++ b/Code/Startup/Core/ARM/IntVect.c @@ -29,8 +29,8 @@ void UndefinedHandler(void) { for(;;); } void Startup_Init(void); void main_Core1 (void) __attribute__((weak, alias("UndefinedHandler"))); -void OsCat2IsrWrapper(void) __attribute__((weak, alias("UndefinedHandler"))); -void OsDispatchHandler(void) __attribute__((weak, alias("UndefinedHandler"))); +void osCat2IsrWrapper(void) __attribute__((weak, alias("UndefinedHandler"))); +void osDispatchHandler(void) __attribute__((weak, alias("UndefinedHandler"))); void __CORE0_STACK_TOP(void); void __CORE1_STACK_TOP(void); @@ -105,8 +105,8 @@ const InterruptHandler __attribute__((section(".intvect_c0"), aligned(128))) __I (InterruptHandler)&SVCall, (InterruptHandler)0, (InterruptHandler)0, - (InterruptHandler)&OsDispatchHandler, - (InterruptHandler)&OsCat2IsrWrapper, + (InterruptHandler)&osDispatchHandler, + (InterruptHandler)&osCat2IsrWrapper, (InterruptHandler)&TIMER0_IRQ_0_IRQn, (InterruptHandler)&TIMER0_IRQ_1_IRQn, (InterruptHandler)&TIMER0_IRQ_2_IRQn, @@ -178,8 +178,8 @@ const InterruptHandler __attribute__((section(".intvect_c1"), aligned(128))) __I (InterruptHandler)&SVCall, (InterruptHandler)0, (InterruptHandler)0, - (InterruptHandler)&OsDispatchHandler, - (InterruptHandler)&OsCat2IsrWrapper, + (InterruptHandler)&osDispatchHandler, + (InterruptHandler)&osCat2IsrWrapper, (InterruptHandler)&TIMER0_IRQ_0_IRQn, (InterruptHandler)&TIMER0_IRQ_1_IRQn, (InterruptHandler)&TIMER0_IRQ_2_IRQn, diff --git a/Code/Startup/Core/RISC-V/boot.s b/Code/Startup/Core/RISC-V/boot.s index 1aca14b..3521977 100644 --- a/Code/Startup/Core/RISC-V/boot.s +++ b/Code/Startup/Core/RISC-V/boot.s @@ -83,8 +83,8 @@ _start_c1: .section .riscv_intvect .align 4 .type _VectoredInterruptVectorTable, @function -.globl OsDispatchHandler -.globl OsCat2IsrWrapper +.globl osDispatchHandler +.globl osCat2IsrWrapper .globl osCatchAllCpuExceptions .globl _VectoredInterruptVectorTable @@ -92,15 +92,15 @@ _VectoredInterruptVectorTable: j osCatchAllCpuExceptions /* Exceptions */ j Isr_UndefinedHandler j Isr_UndefinedHandler - j OsDispatchHandler /* MachineSoftwareInterrupt (MSI) */ + j osDispatchHandler /* MachineSoftwareInterrupt (MSI) */ j Isr_UndefinedHandler j Isr_UndefinedHandler j Isr_UndefinedHandler - j OsCat2IsrWrapper /* MachineTimerInterrupt (MTI) --> The lowest priority interrupt level */ + j osCat2IsrWrapper /* MachineTimerInterrupt (MTI) --> The lowest priority interrupt level */ j Isr_UndefinedHandler j Isr_UndefinedHandler j Isr_UndefinedHandler - j OsCat2IsrWrapper /* MachineExternalInterrupt (MEI) --> The highest priority interrupt level */ + j osCat2IsrWrapper /* MachineExternalInterrupt (MEI) --> The highest priority interrupt level */ .size _VectoredInterruptVectorTable, .-_VectoredInterruptVectorTable