Some improvements.
This commit is contained in:
parent
25d71d9982
commit
568ed8d0ee
|
@ -223,9 +223,6 @@
|
||||||
GPION_AHB_BIT | GPIOP_AHB_BIT | GPIOQ_AHB_BIT | \
|
GPION_AHB_BIT | GPIOP_AHB_BIT | GPIOQ_AHB_BIT | \
|
||||||
GPIOR_AHB_BIT | GPIOS_AHB_BIT | GPIOT_AHB_BIT)
|
GPIOR_AHB_BIT | GPIOS_AHB_BIT | GPIOT_AHB_BIT)
|
||||||
|
|
||||||
/* GPIO lock password.*/
|
|
||||||
#define TIVA_GPIO_LOCK_PWD 0x4C4F434B
|
|
||||||
|
|
||||||
#define GPIOC_JTAG_MASK (0x0F)
|
#define GPIOC_JTAG_MASK (0x0F)
|
||||||
#define GPIOD_NMI_MASK (0x80)
|
#define GPIOD_NMI_MASK (0x80)
|
||||||
#define GPIOF_NMI_MASK (0x01)
|
#define GPIOF_NMI_MASK (0x01)
|
||||||
|
@ -275,7 +272,7 @@ static void gpio_init(ioportid_t port, const tiva_gpio_setup_t *config)
|
||||||
static void gpio_unlock(ioportid_t port, ioportmask_t mask)
|
static void gpio_unlock(ioportid_t port, ioportmask_t mask)
|
||||||
{
|
{
|
||||||
|
|
||||||
HWREG(port + GPIO_O_LOCK) = TIVA_GPIO_LOCK_PWD;
|
HWREG(port + GPIO_O_LOCK) = GPIO_LOCK_KEY;
|
||||||
HWREG(port + GPIO_O_CR) = mask;
|
HWREG(port + GPIO_O_CR) = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,18 +400,18 @@ void _pal_lld_setgroupmode(ioportid_t port, ioportmask_t mask, iomode_t mode)
|
||||||
uint32_t bit_mask = (1 << bit);
|
uint32_t bit_mask = (1 << bit);
|
||||||
|
|
||||||
if ((mask & 1) != 0) {
|
if ((mask & 1) != 0) {
|
||||||
HWREG((port) + GPIO_O_DIR) = (HWREG((port) + GPIO_O_DIR) & ~bit_mask) | dir;
|
HWREG(port + GPIO_O_DIR) = (HWREG(port + GPIO_O_DIR) & ~bit_mask) | dir;
|
||||||
HWREG((port) + GPIO_O_AFSEL) = (HWREG((port) + GPIO_O_AFSEL) & ~bit_mask) | afsel;
|
HWREG(port + GPIO_O_AFSEL) = (HWREG(port + GPIO_O_AFSEL) & ~bit_mask) | afsel;
|
||||||
HWREG((port) + GPIO_O_DR2R) = (HWREG((port) + GPIO_O_DR2R) & ~bit_mask) | dr2r;
|
HWREG(port + GPIO_O_DR2R) = (HWREG(port + GPIO_O_DR2R) & ~bit_mask) | dr2r;
|
||||||
HWREG((port) + GPIO_O_DR4R) = (HWREG((port) + GPIO_O_DR4R) & ~bit_mask) | dr4r;
|
HWREG(port + GPIO_O_DR4R) = (HWREG(port + GPIO_O_DR4R) & ~bit_mask) | dr4r;
|
||||||
HWREG((port) + GPIO_O_DR8R) = (HWREG((port) + GPIO_O_DR8R) & ~bit_mask) | dr8r;
|
HWREG(port + GPIO_O_DR8R) = (HWREG(port + GPIO_O_DR8R) & ~bit_mask) | dr8r;
|
||||||
HWREG((port) + GPIO_O_ODR) = (HWREG((port) + GPIO_O_ODR) & ~bit_mask) | odr;
|
HWREG(port + GPIO_O_ODR) = (HWREG(port + GPIO_O_ODR) & ~bit_mask) | odr;
|
||||||
HWREG((port) + GPIO_O_PUR) = (HWREG((port) + GPIO_O_PUR) & ~bit_mask) | pur;
|
HWREG(port + GPIO_O_PUR) = (HWREG(port + GPIO_O_PUR) & ~bit_mask) | pur;
|
||||||
HWREG((port) + GPIO_O_PDR) = (HWREG((port) + GPIO_O_PDR) & ~bit_mask) | pdr;
|
HWREG(port + GPIO_O_PDR) = (HWREG(port + GPIO_O_PDR) & ~bit_mask) | pdr;
|
||||||
HWREG((port) + GPIO_O_SLR) = (HWREG((port) + GPIO_O_SLR) & ~bit_mask) | slr;
|
HWREG(port + GPIO_O_SLR) = (HWREG(port + GPIO_O_SLR) & ~bit_mask) | slr;
|
||||||
HWREG((port) + GPIO_O_DEN) = (HWREG((port) + GPIO_O_DEN) & ~bit_mask) | den;
|
HWREG(port + GPIO_O_DEN) = (HWREG(port + GPIO_O_DEN) & ~bit_mask) | den;
|
||||||
HWREG((port) + GPIO_O_AMSEL) = (HWREG((port) + GPIO_O_AMSEL) & ~bit_mask) | amsel;
|
HWREG(port + GPIO_O_AMSEL) = (HWREG(port + GPIO_O_AMSEL) & ~bit_mask) | amsel;
|
||||||
HWREG((port) + GPIO_O_PCTL) = (HWREG((port) + GPIO_O_PCTL) & ~pctl_mask) | pctl;
|
HWREG(port + GPIO_O_PCTL) = (HWREG(port + GPIO_O_PCTL) & ~pctl_mask) | pctl;
|
||||||
}
|
}
|
||||||
|
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
|
|
|
@ -421,55 +421,55 @@ typedef uint32_t ioportid_t;
|
||||||
/* Derived constants and error checks. */
|
/* Derived constants and error checks. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOA_USE_AHB
|
#if TIVA_GPIO_GPIOA_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOA GPIO_PORTA_AHB_BASE
|
#define GPIOA GPIO_PORTA_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOA GPIO_PORTA_BASE
|
#define GPIOA GPIO_PORTA_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOB_USE_AHB
|
#if TIVA_GPIO_GPIOB_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOB GPIO_PORTB_AHB_BASE
|
#define GPIOB GPIO_PORTB_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOB GPIO_PORTB_BASE
|
#define GPIOB GPIO_PORTB_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOC_USE_AHB
|
#if TIVA_GPIO_GPIOC_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOC GPIO_PORTC_AHB_BASE
|
#define GPIOC GPIO_PORTC_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOC GPIO_PORTC_BASE
|
#define GPIOC GPIO_PORTC_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOD_USE_AHB
|
#if TIVA_GPIO_GPIOD_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOD GPIO_PORTD_AHB_BASE
|
#define GPIOD GPIO_PORTD_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOD GPIO_PORTD_BASE
|
#define GPIOD GPIO_PORTD_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOE_USE_AHB
|
#if TIVA_GPIO_GPIOE_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOE GPIO_PORTE_AHB_BASE
|
#define GPIOE GPIO_PORTE_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOE GPIO_PORTE_BASE
|
#define GPIOE GPIO_PORTE_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOF_USE_AHB
|
#if TIVA_GPIO_GPIOF_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOF GPIO_PORTF_AHB_BASE
|
#define GPIOF GPIO_PORTF_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOF GPIO_PORTF_BASE
|
#define GPIOF GPIO_PORTF_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOG_USE_AHB
|
#if TIVA_GPIO_GPIOG_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOG GPIO_PORTG_AHB_BASE
|
#define GPIOG GPIO_PORTG_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOG GPIO_PORTG_BASE
|
#define GPIOG GPIO_PORTG_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOH_USE_AHB
|
#if TIVA_GPIO_GPIOH_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOH GPIO_PORTH_AHB_BASE
|
#define GPIOH GPIO_PORTH_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOH GPIO_PORTH_BASE
|
#define GPIOH GPIO_PORTH_BASE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TIVA_GPIO_GPIOJ_USE_AHB
|
#if TIVA_GPIO_GPIOJ_USE_AHB && defined(TM4C123x)
|
||||||
#define GPIOJ GPIO_PORTJ_AHB_BASE
|
#define GPIOJ GPIO_PORTJ_AHB_BASE
|
||||||
#else
|
#else
|
||||||
#define GPIOJ GPIO_PORTJ_BASE
|
#define GPIOJ GPIO_PORTJ_BASE
|
||||||
|
|
Loading…
Reference in New Issue