Cleanup and refactoring of the STM32w port

This is a general cleanup of things like code style issues and code structure of the STM32w port to make it more like the rest of Contiki is structured.
This commit is contained in:
Adam Dunkels 2013-03-15 16:14:09 +01:00
parent 12b3d02ba1
commit a5046e83c7
118 changed files with 4470 additions and 4281 deletions

View file

@ -28,7 +28,7 @@ void halInternalResetWatchDog(void)
WDOG_RESET = 1;
}
void halInternalDisableWatchDog(int8u magicKey)
void halInternalDisableWatchDog(uint8_t magicKey)
{
if (magicKey == MICRO_DISABLE_WATCH_DOG_KEY) {
WDOG_KEY = 0xDEAD;
@ -45,33 +45,33 @@ boolean halInternalWatchDogEnabled(void)
}
}
void halGpioConfig(int32u io, int32u config)
void halGpioConfig(uint32_t io, uint32_t config)
{
static volatile int32u *const configRegs[] =
{ (volatile int32u *)GPIO_PACFGL_ADDR,
(volatile int32u *)GPIO_PACFGH_ADDR,
(volatile int32u *)GPIO_PBCFGL_ADDR,
(volatile int32u *)GPIO_PBCFGH_ADDR,
(volatile int32u *)GPIO_PCCFGL_ADDR,
(volatile int32u *)GPIO_PCCFGH_ADDR };
int32u portcfg;
static volatile uint32_t *const configRegs[] =
{ (volatile uint32_t *)GPIO_PACFGL_ADDR,
(volatile uint32_t *)GPIO_PACFGH_ADDR,
(volatile uint32_t *)GPIO_PBCFGL_ADDR,
(volatile uint32_t *)GPIO_PBCFGH_ADDR,
(volatile uint32_t *)GPIO_PCCFGL_ADDR,
(volatile uint32_t *)GPIO_PCCFGH_ADDR };
uint32_t portcfg;
portcfg = *configRegs[io/4]; // get current config
portcfg = portcfg & ~((0xF)<<((io&3)*4)); // mask out config of this pin
*configRegs[io/4] = portcfg | (config <<((io&3)*4));
}
void halGpioSet(int32u gpio, boolean value)
void halGpioSet(uint32_t gpio, boolean value)
{
if(gpio/8 < 3) {
if (value) {
*((volatile int32u *)(GPIO_PxSET_BASE+(GPIO_Px_OFFSET*(gpio/8)))) = BIT(gpio&7);
*((volatile uint32_t *)(GPIO_PxSET_BASE+(GPIO_Px_OFFSET*(gpio/8)))) = BIT(gpio&7);
} else {
*((volatile int32u *)(GPIO_PxCLR_BASE+(GPIO_Px_OFFSET*(gpio/8)))) = BIT(gpio&7);
*((volatile uint32_t *)(GPIO_PxCLR_BASE+(GPIO_Px_OFFSET*(gpio/8)))) = BIT(gpio&7);
}
}
}
int16u halInternalStartSystemTimer(void)
uint16_t halInternalStartSystemTimer(void)
{
//Since the SleepTMR is the only timer maintained during deep sleep, it is
//used as the System Timer (RTC). We maintain a 32 bit hardware timer