diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index a8cc7ac81..bd8fe92d3 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -62,6 +62,10 @@ #define CH_KERNEL_PATCH 0 /** @} */ +/* Required forward declaration, knowledge of this type is required by all + modules.*/ +typedef struct thread thread_t; + /* Core headers.*/ #include "chtypes.h" #include "chconf.h" diff --git a/os/rt/ports/ARMCMx/chcore_v6m.h b/os/rt/ports/ARMCMx/chcore_v6m.h index fa6476084..ed05fe6b7 100644 --- a/os/rt/ports/ARMCMx/chcore_v6m.h +++ b/os/rt/ports/ARMCMx/chcore_v6m.h @@ -254,7 +254,7 @@ struct port_intctx { struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \ if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \ chSysHalt("stack overflow"); \ - _port_switch((void *)ntp, (void *)otp); \ + _port_switch(ntp, otp); \ } #endif @@ -266,7 +266,7 @@ struct port_intctx { extern "C" { #endif void _port_irq_epilogue(regarm_t lr); - void _port_switch(void *ntp, void *otp); + void _port_switch(thread_t *ntp, thread_t *otp); void _port_thread_start(void); void _port_switch_from_isr(void); void _port_exit_from_isr(void); diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h index 9e0b1e9cd..404e87411 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.h +++ b/os/rt/ports/ARMCMx/chcore_v7m.h @@ -344,7 +344,7 @@ struct port_intctx { struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \ if ((stkalign_t *)(r13 - 1) < (otp)->p_stklimit) \ chSysHalt("stack overflow"); \ - _port_switch((void *)ntp, (void *)otp); \ + _port_switch(ntp, otp); \ } #endif @@ -356,7 +356,7 @@ struct port_intctx { extern "C" { #endif void _port_irq_epilogue(void); - void _port_switch(void *ntp, void *otp); + void _port_switch(thread_t *ntp, thread_t *otp); void _port_thread_start(void); void _port_switch_from_isr(void); void _port_exit_from_isr(void); diff --git a/os/rt/ports/e200/chcore.h b/os/rt/ports/e200/chcore.h index a043bb0b0..0255a0f1d 100644 --- a/os/rt/ports/e200/chcore.h +++ b/os/rt/ports/e200/chcore.h @@ -340,7 +340,7 @@ struct context { register struct port_intctx *sp asm ("%r1"); \ if ((stkalign_t *)(sp - 1) < otp->p_stklimit) \ chDbgPanic("stack overflow"); \ - _port_switch((void *)ntp, (void *)otp); \ + _port_switch(ntp, otp); \ } #endif @@ -373,7 +373,7 @@ struct context { #ifdef __cplusplus extern "C" { #endif - void _port_switch(void *ntp, void *otp); + void _port_switch(thread_t *ntp, thread_t *otp); void _port_thread_start(void); #ifdef __cplusplus }