STM32 initialization cleanup.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1015 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
8020fc3d67
commit
1aa2773ad0
|
@ -59,24 +59,23 @@ void hwinit0(void) {
|
|||
;
|
||||
|
||||
/*
|
||||
* I/O ports initialization as specified in board.h.
|
||||
* I/O ports initialization as specified in board.h. Note that being this
|
||||
* a low level initialization routine it is OK to invoke directly the
|
||||
* low level port functions.
|
||||
*/
|
||||
ioport_init();
|
||||
GPIOA->CRL = VAL_GPIOACRL;
|
||||
GPIOA->CRH = VAL_GPIOACRH;
|
||||
GPIOA->ODR = VAL_GPIOAODR;
|
||||
ioport_init_lld();
|
||||
|
||||
GPIOB->CRL = VAL_GPIOBCRL;
|
||||
GPIOB->CRH = VAL_GPIOBCRH;
|
||||
GPIOB->ODR = VAL_GPIOBODR;
|
||||
ioport_stm32_setup_lld(IOPORT_A, VAL_GPIOACRH, VAL_GPIOACRL);
|
||||
ioport_write_lld(IOPORT_A, VAL_GPIOAODR);
|
||||
|
||||
GPIOC->CRL = VAL_GPIOCCRL;
|
||||
GPIOC->CRH = VAL_GPIOCCRH;
|
||||
GPIOC->ODR = VAL_GPIOCODR;
|
||||
ioport_stm32_setup_lld(IOPORT_B, VAL_GPIOBCRH, VAL_GPIOBCRL);
|
||||
ioport_write_lld(IOPORT_B, VAL_GPIOBODR);
|
||||
|
||||
GPIOD->CRL = VAL_GPIODCRL;
|
||||
GPIOD->CRH = VAL_GPIODCRH;
|
||||
GPIOD->ODR = VAL_GPIODODR;
|
||||
ioport_stm32_setup_lld(IOPORT_C, VAL_GPIOCCRH, VAL_GPIOCCRL);
|
||||
ioport_write_lld(IOPORT_C, VAL_GPIOCODR);
|
||||
|
||||
ioport_stm32_setup_lld(IOPORT_D, VAL_GPIODCRH, VAL_GPIODCRL);
|
||||
ioport_write_lld(IOPORT_D, VAL_GPIODODR);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -111,7 +111,7 @@ typedef GPIO_TypeDef * ioportid_t;
|
|||
* @brief GPIO ports subsystem initialization.
|
||||
* @details Ports A-D enabled, AFIO enabled.
|
||||
*/
|
||||
#define ioport_init() { \
|
||||
#define ioport_init_lld() { \
|
||||
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN | RCC_APB2ENR_IOPAEN | \
|
||||
RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPCEN | \
|
||||
RCC_APB2ENR_IOPDEN; \
|
||||
|
@ -201,6 +201,16 @@ typedef GPIO_TypeDef * ioportid_t;
|
|||
#define ioport_readbus_lld(bus) \
|
||||
(((bus)->bus_portid->IDR & (bus)->bus_mask) >> (bus)->bus_offset)
|
||||
|
||||
/**
|
||||
* @brief GPIO port setup.
|
||||
* @details This function initializes a GPIO port, note that this functionality
|
||||
* is STM32 specific and non portable.
|
||||
*/
|
||||
#define ioport_stm32_setup_lld(port, crh, crl) { \
|
||||
(port)->CRH = (crh); \
|
||||
(port)->CRL = (crl); \
|
||||
}
|
||||
|
||||
#endif /* _IOPORTS_LLD_H_ */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -70,7 +70,8 @@ GNU-Linux-GCC - ChibiOS/RT simulator for x86 Linux systems, it is
|
|||
interface for digital I/O operations, this should help to create more
|
||||
portable applications and, in general, make easier to work with ChibiOS/RT
|
||||
on multiple architectures.
|
||||
- NEW: Port driver for STM32.
|
||||
- NEW: Port driver for STM32, cleaned up the initialization code in board.c to
|
||||
use the port driver macros.
|
||||
- Documentation section reorganization and fixes.
|
||||
- Changed the STM32 demo stack sizes, it was incorrectly adjusted in version
|
||||
1.3.0 but it did not create problems (not a bug).
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef uint32_t ioportid_t;
|
|||
* @note This function is not invoked by a system API, it should be invoked
|
||||
* from the system initialization code.
|
||||
*/
|
||||
#define ioport_init()
|
||||
#define ioport_init_lld()
|
||||
|
||||
/**
|
||||
* @brief Writes a bits mask on a I/O port.
|
||||
|
|
Loading…
Reference in New Issue