From f6ff614e9b23f889b29ac17c7ebfcc96ca3606b6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Jan 2009 18:16:26 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@624 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chsys.c | 8 ++++---- src/include/sys.h | 30 +++++++++++++++--------------- src/templates/chcore.c | 26 +++++++++++++------------- src/templates/chcore.h | 30 +++++++++++++++--------------- 4 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/chsys.c b/src/chsys.c index 2f4c796a8..71eb59d98 100644 --- a/src/chsys.c +++ b/src/chsys.c @@ -38,7 +38,7 @@ static WORKING_AREA(idle_thread_wa, IDLE_THREAD_STACK_SIZE); static void idle_thread(void *p) { while (TRUE) { - sys_wait_for_interrupt(); + port_wait_for_interrupt(); } } @@ -52,7 +52,7 @@ static void idle_thread(void *p) { void chSysInit(void) { static Thread mainthread; - sys_init(); + port_init(); chSchInit(); chDbgInit(); chVTInit(); @@ -100,14 +100,14 @@ void chSysLock(void) { chDbgAssert(currp->p_locks >= 0, "chinit.c, chSysLock()"); if (currp->p_locks++ == 0) - sys_lock(); + port_lock(); } void chSysUnlock(void) { chDbgAssert(currp->p_locks > 0, "chinit.c, chSysUnlock()"); if (--currp->p_locks == 0) - sys_unlock(); + port_unlock(); } #endif /* defined(CH_USE_NESTED_LOCKS) && !defined(CH_OPTIMIZE_SPEED) */ diff --git a/src/include/sys.h b/src/include/sys.h index 0c58a9c8e..29f049f47 100644 --- a/src/include/sys.h +++ b/src/include/sys.h @@ -29,14 +29,14 @@ * Prints a message on the system console (if any). * @param msg the message to be printed on the system console */ -#define chSysPuts(msg) sys_puts(msg) +#define chSysPuts(msg) port_puts(msg) /** * Halts the system. This function is invoked by the operating system when an * unrecoverable error is detected (as example because a programming error in * the application code that triggers an assertion while in debug mode). */ -#define chSysHalt() sys_halt() +#define chSysHalt() port_halt() /** * Performs a context switch. @@ -47,7 +47,7 @@ * @note The implementation of this code affects directly the context * switch performance so optimize here as much as you can. */ -#define chSysSwitchI(otp, ntp) sys_switch(otp, ntp) +#define chSysSwitchI(otp, ntp) port_switch(otp, ntp) /** * Raises the system interrupt priority mask to the maximum level. @@ -57,7 +57,7 @@ * interrupts or be exactly equivalent to @p chSysDisable(). * @note Do not invoke this API from within a kernel lock. */ -#define chSysDisable() sys_disable() +#define chSysDisable() port_disable() /** * Raises the system interrupt priority mask to system level. @@ -69,7 +69,7 @@ * @note This API is no replacement for @p chSysLock(), the @p chSysLock() * could do more than just disable the interrupts. */ -#define chSysSuspend() sys_suspend() +#define chSysSuspend() port_suspend() /** * Lowers the system interrupt priority mask to user level. @@ -80,7 +80,7 @@ * @note This API is no replacement for @p chSysUnlock(), the @p chSysUnlock() * could do more than just enable the interrupts. */ -#define chSysEnable() sys_enable() +#define chSysEnable() port_enable() /** * Enters the kernel lock mode. @@ -92,11 +92,11 @@ #if defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__) #define chSysLock() { \ if (currp->p_locks++ == 0) \ - sys_lock(); \ + port_lock(); \ } #endif /* defined(CH_OPTIMIZE_SPEED) */ #else /* !defined(CH_USE_NESTED_LOCKS) */ -#define chSysLock() sys_lock() +#define chSysLock() port_lock() #endif /* !defined(CH_USE_NESTED_LOCKS) */ /** @@ -109,11 +109,11 @@ #if defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__) #define chSysUnlock() { \ if (--currp->p_locks == 0) \ - sys_unlock(); \ + port_unlock(); \ } #endif /* defined(CH_OPTIMIZE_SPEED) */ #else /* !defined(CH_USE_NESTED_LOCKS) */ -#define chSysUnlock() sys_unlock() +#define chSysUnlock() port_unlock() #endif /* !defined(CH_USE_NESTED_LOCKS) */ /** @@ -126,7 +126,7 @@ * syscall from an interrupt handler. * @note This API must be invoked exclusively from interrupt handlers. */ -#define chSysLockI() sys_lock_from_isr() +#define chSysLockI() port_lock_from_isr() /** * Leaves the kernel lock mode from within an interrupt handler. @@ -138,14 +138,14 @@ * syscall from an interrupt handler. * @note This API must be invoked exclusively from interrupt handlers. */ -#define chSysUnlockI() sys_unlock_from_isr() +#define chSysUnlockI() port_unlock_from_isr() /** * IRQ handler enter code. * @note Usually IRQ handlers functions are also declared naked. * @note On some architectures this macro can be empty. */ -#define CH_IRQ_PROLOGUE() SYS_IRQ_PROLOGUE() +#define CH_IRQ_PROLOGUE() PORT_IRQ_PROLOGUE() /** * IRQ handler exit code. @@ -153,12 +153,12 @@ * @note This macro usually performs the final reschedulation by using * @p chSchRescRequiredI() and @p chSchDoRescheduleI(). */ -#define CH_IRQ_EPILOGUE() SYS_IRQ_EPILOGUE() +#define CH_IRQ_EPILOGUE() PORT_IRQ_EPILOGUE() /** * Standard modifier for IRQ handler functions. */ -#define CH_IRQ_HANDLER SYS_IRQ_HANDLER +#define CH_IRQ_HANDLER PORT_IRQ_HANDLER #ifdef __cplusplus extern "C" { diff --git a/src/templates/chcore.c b/src/templates/chcore.c index 677c4ea2f..e9f1868af 100644 --- a/src/templates/chcore.c +++ b/src/templates/chcore.c @@ -35,21 +35,21 @@ * Port-related initialization code. * @note This function is usually empty. */ -void sys_init(void){ +void port_init(void){ } /** * Kernel-unlock action. Usually this function just disables interrupts but * may perform more actions. */ -void sys_lock(void) { +void port_lock(void) { } /** * Kernel-unlock action. Usually this function just disables interrupts but * may perform more actions. */ -void sys_unlock(void) { +void port_unlock(void) { } /** @@ -57,7 +57,7 @@ void sys_unlock(void) { * before invoking I-class APIs from interrupt handlers. The implementation * is architecture dependent, in its simplest form it is void. */ -void sys_lock_from_isr(void) { +void port_lock_from_isr(void) { } /** @@ -65,26 +65,26 @@ void sys_lock_from_isr(void) { * after invoking I-class APIs from interrupt handlers. The implementation * is architecture dependent, in its simplest form it is void. */ -void sys_unlock_from_isr(void) { +void port_unlock_from_isr(void) { } /** * Disables all the interrupt sources. * @note Of course non maskable interrupt sources are not included. */ -void sys_disable() { +void port_disable() { } /** * Disables the interrupt sources that are not supposed to preempt the kernel. */ -void sys_suspend(void) { +void port_suspend(void) { } /** * Enables all the interrupt sources. */ -void sys_enable(void) { +void port_enable(void) { } /** @@ -93,7 +93,7 @@ void sys_enable(void) { * function but this will not take advantage of architecture-specific power * saving modes. */ -void sys_wait_for_interrupt(void) { +void port_wait_for_interrupt(void) { } /** @@ -101,9 +101,9 @@ void sys_wait_for_interrupt(void) { * unrecoverable error is detected (as example because a programming error in * the application code that triggers an assertion while in debug mode). */ -void sys_halt(void) { +void port_halt(void) { - sys_disable_all(); + port_disable_all(); while (TRUE) { } } @@ -113,14 +113,14 @@ void sys_halt(void) { * @param otp the thread to be switched out * @param ntp the thread to be switched in */ -void sys_switch(Thread *otp, Thread *ntp) { +void port_switch(Thread *otp, Thread *ntp) { } /** * Prints a message on the system console. * @param msg pointer to the message */ -void sys_puts(char *msg) { +void port_puts(char *msg) { } /** @} */ diff --git a/src/templates/chcore.h b/src/templates/chcore.h index 92852fead..e4cf7d89e 100644 --- a/src/templates/chcore.h +++ b/src/templates/chcore.h @@ -113,34 +113,34 @@ typedef struct { * IRQ prologue code, inserted at the start of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_PROLOGUE() +#define PORT_IRQ_PROLOGUE() /** * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_EPILOGUE() +#define PORT_IRQ_EPILOGUE() /** * IRQ handler function modifier. */ -#define SYS_IRQ_HANDLER +#define PORT_IRQ_HANDLER #ifdef __cplusplus extern "C" { #endif - void sys_init(void); - void sys_disable(void); - void sys_suspend(void); - void sys_enable(void); - void sys_lock(void); - void sys_unlock(void); - void sys_disable_from_isr(void); - void sys_enable_from_isr(void); - void sys_wait_for_interrupt(void); - void sys_halt(void); - void sys_switch(Thread *otp, Thread *ntp); - void sys_puts(char *msg); + void port_init(void); + void port_lock(void); + void port_unlock(void); + void port_lock_from_isr(void); + void port_unlock_from_isr(void); + void port_disable(void); + void port_suspend(void); + void port_enable(void); + void port_wait_for_interrupt(void); + void port_halt(void); + void port_switch(Thread *otp, Thread *ntp); + void port_puts(char *msg); #ifdef __cplusplus } #endif -- cgit v1.2.3