Space optimization for Cortex-M3 port.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@844 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2009-03-13 20:53:08 +00:00
parent b4357c2bf7
commit 196ea50917
3 changed files with 31 additions and 1 deletions

View File

@ -42,6 +42,18 @@ void port_halt(void) {
}
}
#if !CH_OPTIMIZE_SPEED
void _port_lock(void) {
register uint32_t tmp asm ("r3") = BASEPRI_KERNEL;
asm volatile ("msr BASEPRI, %0" : : "r" (tmp));
}
void _port_unlock(void) {
register uint32_t tmp asm ("r3") = BASEPRI_USER;
asm volatile ("msr BASEPRI, %0" : : "r" (tmp));
}
#endif
/**
* System Timer vector.
* This interrupt is used as system tick.

View File

@ -221,18 +221,30 @@ struct context {
/**
* Raises the base priority to kernel level.
*/
#if CH_OPTIMIZE_SPEED
#define port_lock() { \
register uint32_t tmp asm ("r3") = BASEPRI_KERNEL; \
asm volatile ("msr BASEPRI, %0" : : "r" (tmp)); \
}
#else
#define port_lock() { \
asm volatile ("bl _port_lock" : : : "r3", "lr"); \
}
#endif
/**
* Lowers the base priority to user level.
*/
#if CH_OPTIMIZE_SPEED
#define port_unlock() { \
register uint32_t tmp asm ("r3") = BASEPRI_USER; \
asm volatile ("msr BASEPRI, %0" : : "r" (tmp)); \
}
#else
#define port_unlock() { \
asm volatile ("bl _port_unlock" : : : "r3", "lr"); \
}
#endif
/**
* Same as @p port_lock() in this port.
@ -303,6 +315,10 @@ struct context {
extern "C" {
#endif
void port_halt(void);
#if !CH_OPTIMIZE_SPEED
void _port_lock(void);
void _port_unlock(void);
#endif
#ifdef __cplusplus
}
#endif

View File

@ -87,8 +87,10 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
the macro chSysGetTime() in chTimeNow(), the old names are still recognized
but marked as deprecated (fixes the bug 2678953 but goes a bit further by
introducing a new API category "Time").
- OPT: Small optimization to the Cortex-M3 port code, improved thread
- OPT: Small optimization to the Cortex-M3 thread startup code, improved thread
related performance scores and smaller code.
- OPT: Alternative implementations for port_lock() and port_unlock() when
CH_OPTIMIZE_SPEED is FALSE, huge space savings.
- OPT: Improved ready list and priority ordered lists code, saved some tens
of bytes here and there in the kernel.
- Modified the test thread function to return the global test result flag.