aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/platforms/STM32/GPIOv2/pal_lld.c79
-rw-r--r--os/kernel/include/chdebug.h8
-rw-r--r--readme.txt20
3 files changed, 65 insertions, 42 deletions
diff --git a/os/hal/platforms/STM32/GPIOv2/pal_lld.c b/os/hal/platforms/STM32/GPIOv2/pal_lld.c
index 5d33adafc..c84df64f6 100644
--- a/os/hal/platforms/STM32/GPIOv2/pal_lld.c
+++ b/os/hal/platforms/STM32/GPIOv2/pal_lld.c
@@ -143,49 +143,50 @@ void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
iomode_t mode) {
- uint32_t modemask = ((mode & PAL_STM32_MODE_MASK) >> 0) & 3;
- uint32_t otypemask = ((mode & PAL_STM32_OTYPE_MASK) >> 2) & 1;
- uint32_t ospeedmask = ((mode & PAL_STM32_OSPEED_MASK) >> 3) & 3;
- uint32_t pupdrmask = ((mode & PAL_STM32_PUDR_MASK) >> 5) & 15;
- uint32_t bit = 0;
- while (mask) {
+ uint32_t moder = (mode & PAL_STM32_MODE_MASK) >> 0;
+ uint32_t otyper = (mode & PAL_STM32_OTYPE_MASK) >> 2;
+ uint32_t ospeedr = (mode & PAL_STM32_OSPEED_MASK) >> 3;
+ uint32_t pupdr = (mode & PAL_STM32_PUDR_MASK) >> 5;
+ uint32_t altr = (mode & PAL_STM32_ALTERNATE_MASK) >> 7;
+ uint32_t bit = 0;
+ while (TRUE) {
if ((mask & 1) != 0) {
- uint32_t m4 = 15 < ((bit & 7) * 4);
- uint32_t altmask = ((mode & PAL_STM32_ALTERNATE_MASK) >> 7) <<
- ((bit & 7) * 4);
+ uint32_t altrmask, m1, m2, m4;
+
+ altrmask = altr << ((bit & 7) * 4);
+ m4 = 15 << ((bit & 7) * 4);
if (bit < 8)
- port->AFRL = (port->AFRL & ~m4) | altmask;
+ port->AFRL = (port->AFRL & ~m4) | altrmask;
else
- port->AFRH = (port->AFRH & ~m4) | altmask;
- port->OTYPER = (port->OTYPER & ~(1 << bit)) | otypemask;
- port->OSPEEDR = (port->OSPEEDR & ~(3 << (bit * 2))) | ospeedmask;
- port->PUPDR = (port->PUPDR & ~(3 << (bit * 2))) | pupdrmask;
- port->MODER = (port->MODER & ~(3 << (bit * 2))) | modemask;
+ port->AFRH = (port->AFRH & ~m4) | altrmask;
+ m1 = 1 << bit;
+ port->OTYPER = (port->OTYPER & ~m1) | otyper;
+ m2 = 3 << (bit * 2);
+ port->OSPEEDR = (port->OSPEEDR & ~m2) | ospeedr;
+ port->PUPDR = (port->PUPDR & ~m2) | pupdr;
+ port->MODER = (port->MODER & ~m2) | moder;
}
- modemask <<= 2;
- otypemask <<= 1;
- ospeedmask <<= 2;
- pupdrmask <<= 2;
- bit++;
mask >>= 1;
+ if (!mask)
+ return;
+ otyper <<= 1;
+ ospeedr <<= 2;
+ pupdr <<= 2;
+ moder <<= 2;
+ bit++;
}
}
#else
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
iomode_t mode) {
-
+ uint32_t afrm, moderm, pupdrm, otyperm, ospeedrm;
uint32_t m1 = (uint32_t)mask;
uint32_t m2 = 0;
uint32_t m4l = 0;
uint32_t m4h = 0;
- uint32_t moder = (((mode & PAL_STM32_MODE_MASK) >> 0) & 3) * 0x5555;
- uint32_t otyper = (((mode & PAL_STM32_OTYPE_MASK) >> 2) & 1) * 0xffff;
- uint32_t ospeedr = (((mode & PAL_STM32_OSPEED_MASK) >> 3) & 3) * 0x5555;
- uint32_t pupdr = (((mode & PAL_STM32_PUDR_MASK) >> 5) & 3) * 0x5555;
- uint32_t afr = (((mode & PAL_STM32_ALTERNATE_MASK) >> 7) & 15) * 0x1111;
uint32_t bit = 0;
- while (mask) {
+ do {
if ((mask & 1) != 0) {
m2 |= 3 << bit;
if (bit < 16)
@@ -195,13 +196,23 @@ void _pal_lld_setgroupmode(ioportid_t port,
}
bit += 2;
mask >>= 1;
- }
- port->AFRL = (port->AFRL & ~m4l) | (afr & m4l);
- port->AFRH = (port->AFRH & ~m4h) | (afr & m4h);
- port->OSPEEDR = (port->OSPEEDR & ~m2) | (ospeedr & m2);
- port->OTYPER = (port->OTYPER & ~m1) | (otyper & m1);
- port->PUPDR = (port->PUPDR & ~m2) | (pupdr & m2);
- port->MODER = (port->MODER & ~m2) | (moder & m2);
+ } while (mask);
+
+ afrm = ((mode & PAL_STM32_ALTERNATE_MASK) >> 7) * 0x1111;
+ port->AFRL = (port->AFRL & ~m4l) | (afrm & m4l);
+ port->AFRH = (port->AFRH & ~m4h) | (afrm & m4h);
+
+ ospeedrm = ((mode & PAL_STM32_OSPEED_MASK) >> 3) * 0x5555;
+ port->OSPEEDR = (port->OSPEEDR & ~m2) | (ospeedrm & m2);
+
+ otyperm = ((mode & PAL_STM32_OTYPE_MASK) >> 2) * 0xffff;
+ port->OTYPER = (port->OTYPER & ~m1) | (otyperm & m1);
+
+ pupdrm = ((mode & PAL_STM32_PUDR_MASK) >> 5) * 0x5555;
+ port->PUPDR = (port->PUPDR & ~m2) | (pupdrm & m2);
+
+ moderm = ((mode & PAL_STM32_MODE_MASK) >> 0) * 0x5555;
+ port->MODER = (port->MODER & ~m2) | (moderm & m2);
}
#endif
diff --git a/os/kernel/include/chdebug.h b/os/kernel/include/chdebug.h
index 2fb3b2385..b2edf176e 100644
--- a/os/kernel/include/chdebug.h
+++ b/os/kernel/include/chdebug.h
@@ -90,13 +90,15 @@ typedef struct {
*
* @api
*/
+#if !defined(chDbgCheck)
#define chDbgCheck(c, func) { \
if (!(c)) \
- chDbgPanic(__QUOTE_THIS(func)"(), line "__QUOTE_THIS(__LINE__)); \
+ chDbgPanic(__QUOTE_THIS(func)"()"); \
}
+#endif /* !defined(chDbgCheck) */
#else /* !CH_DBG_ENABLE_CHECKS */
#define chDbgCheck(c, func) { \
- (void)(c), (void)__QUOTE_THIS(func)"(), line "__QUOTE_THIS(__LINE__); \
+ (void)(c), (void)__QUOTE_THIS(func)"()"; \
}
#endif /* !CH_DBG_ENABLE_CHECKS */
@@ -118,10 +120,12 @@ typedef struct {
*
* @api
*/
+#if !defined(chDbgAssert)
#define chDbgAssert(c, m, r) { \
if (!(c)) \
chDbgPanic(m); \
}
+#endif /* !defined(chDbgAssert) */
#else /* !CH_DBG_ENABLE_ASSERTS */
#define chDbgAssert(c, m, r) {(void)(c);}
#endif /* !CH_DBG_ENABLE_ASSERTS */
diff --git a/readme.txt b/readme.txt
index 4ae396ee8..3578a38aa 100644
--- a/readme.txt
+++ b/readme.txt
@@ -61,10 +61,12 @@
+--test/ - Kernel test suite source code.
| +--coverage/ - Code coverage project.
+--testhal/ - HAL integration test demos.
- +--LPC11xx/ - LPC11xx HAL test demos.
- +--LPC13xx/ - LPC13xx HAL test demos.
- +--STM32/ - STM32 HAL test demos.
- +--STM8S/ - STM8S HAL test demos.
+ | +--LPC11xx/ - LPC11xx HAL test demos.
+ | +--LPC13xx/ - LPC13xx HAL test demos.
+ | +--STM32/ - STM32 HAL test demos.
+ | +--STM8S/ - STM8S HAL test demos.
+ +--tools - Various tools.
+ +--eclipse - Eclipse enhancements.
*****************************************************************************
*** Releases ***
@@ -85,6 +87,12 @@
(backported to 2.2.4).
- FIX: Fixed timeout problem in the lwIP interface layer (bug 3302420)
(backported to 2.2.4).
+- NEW: Added debug plugin for Eclipse under ./tools/eclipse (backported to
+ 2.2.7).
+- NEW: The debug macros chDbgCheck() and chDbgAssert() now can be externally
+ redefined. The macro chDbgCheck() no more includes the line number in the
+ description because incompatibility with the Cosmic compiler (backported to
+ 2.2.7).
- NEW: Added provisional support for STM32L1xx and STM32F2xx. Because of this
some directories related to the STM32 have been renamed, your makefiles may
require adjustments.
@@ -92,10 +100,10 @@
to add an user rule into the Makefiles.
- NEW: Improvements to the trace buffer, now it stores a full thread pointer
and event time, changed names to debug variables by adding the "dbg_"
- prefix.
+ prefix (backported to 2.2.7).
- NEW: Added a new functionality to the registry subsystem, now it is possible
to associate a name to the threads using chRegSetThreadName. The main and
- idle threads have their name assigned by default.
+ idle threads have their name assigned by default (backported to 2.2.7).
- NEW: Added TIM8 support to the STM32 GPT, ICU and PWM drivers.
- NEW: Updated the STM32 header file to the latest version 3.5.0 and fixed
it in order to correct several bugs related to the XL family.