Surround all macro parameters with ()
All the macro arguments that are user supplied, or potentially, wrap properly in () as good practice. Probably missed one or two, and a lot of them are possibly unnecessary, but it's straightforward to just do it always. Fixes github issue #321
This commit is contained in:
@@ -90,92 +90,92 @@
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
/* GPIO Data */
|
||||
#define GPIO_DATA(port) (&MMIO32(port + 0x000))
|
||||
#define GPIO_DATA(port) (&MMIO32((port) + 0x000))
|
||||
|
||||
/* GPIO Direction */
|
||||
#define GPIO_DIR(port) MMIO32(port + 0x400)
|
||||
#define GPIO_DIR(port) MMIO32((port) + 0x400)
|
||||
|
||||
/* GPIO Interrupt Sense */
|
||||
#define GPIO_IS(port) MMIO32(port + 0x404)
|
||||
#define GPIO_IS(port) MMIO32((port) + 0x404)
|
||||
|
||||
/* GPIO Interrupt Both Edges */
|
||||
#define GPIO_IBE(port) MMIO32(port + 0x408)
|
||||
#define GPIO_IBE(port) MMIO32((port) + 0x408)
|
||||
|
||||
/* GPIO Interrupt Event */
|
||||
#define GPIO_IEV(port) MMIO32(port + 0x40c)
|
||||
#define GPIO_IEV(port) MMIO32((port) + 0x40c)
|
||||
|
||||
/* GPIO Interrupt Mask */
|
||||
#define GPIO_IM(port) MMIO32(port + 0x410)
|
||||
#define GPIO_IM(port) MMIO32((port) + 0x410)
|
||||
|
||||
/* GPIO Raw Interrupt Status */
|
||||
#define GPIO_RIS(port) MMIO32(port + 0x414)
|
||||
#define GPIO_RIS(port) MMIO32((port) + 0x414)
|
||||
|
||||
/* GPIO Masked Interrupt Status */
|
||||
#define GPIO_MIS(port) MMIO32(port + 0x418)
|
||||
#define GPIO_MIS(port) MMIO32((port) + 0x418)
|
||||
|
||||
/* GPIO Interrupt Clear */
|
||||
#define GPIO_ICR(port) MMIO32(port + 0x41c)
|
||||
#define GPIO_ICR(port) MMIO32((port) + 0x41c)
|
||||
|
||||
/* GPIO Alternate Function Select */
|
||||
#define GPIO_AFSEL(port) MMIO32(port + 0x420)
|
||||
#define GPIO_AFSEL(port) MMIO32((port) + 0x420)
|
||||
|
||||
/* GPIO 2-mA Drive Select */
|
||||
#define GPIO_DR2R(port) MMIO32(port + 0x500)
|
||||
#define GPIO_DR2R(port) MMIO32((port) + 0x500)
|
||||
|
||||
/* GPIO 4-mA Drive Select */
|
||||
#define GPIO_DR4R(port) MMIO32(port + 0x504)
|
||||
#define GPIO_DR4R(port) MMIO32((port) + 0x504)
|
||||
|
||||
/* GPIO 8-mA Drive Select */
|
||||
#define GPIO_DR8R(port) MMIO32(port + 0x508)
|
||||
#define GPIO_DR8R(port) MMIO32((port) + 0x508)
|
||||
|
||||
/* GPIO Open Drain Select */
|
||||
#define GPIO_ODR(port) MMIO32(port + 0x50c)
|
||||
#define GPIO_ODR(port) MMIO32((port) + 0x50c)
|
||||
|
||||
/* GPIO Pull-Up Select */
|
||||
#define GPIO_PUR(port) MMIO32(port + 0x510)
|
||||
#define GPIO_PUR(port) MMIO32((port) + 0x510)
|
||||
|
||||
/* GPIO Pull-Down Select */
|
||||
#define GPIO_PDR(port) MMIO32(port + 0x514)
|
||||
#define GPIO_PDR(port) MMIO32((port) + 0x514)
|
||||
|
||||
/* GPIO Slew Rate Control Select */
|
||||
#define GPIO_SLR(port) MMIO32(port + 0x518)
|
||||
#define GPIO_SLR(port) MMIO32((port) + 0x518)
|
||||
|
||||
/* GPIO Digital Enable */
|
||||
#define GPIO_DEN(port) MMIO32(port + 0x51c)
|
||||
#define GPIO_DEN(port) MMIO32((port) + 0x51c)
|
||||
|
||||
/* GPIO Lock */
|
||||
#define GPIO_LOCK(port) MMIO32(port + 0x520)
|
||||
#define GPIO_LOCK(port) MMIO32((port) + 0x520)
|
||||
|
||||
/* GPIO Commit */
|
||||
#define GPIO_CR(port) MMIO32(port + 0x524)
|
||||
#define GPIO_CR(port) MMIO32((port) + 0x524)
|
||||
|
||||
/* GPIO Analog Mode Select */
|
||||
#define GPIO_AMSEL(port) MMIO32(port + 0x528)
|
||||
#define GPIO_AMSEL(port) MMIO32((port) + 0x528)
|
||||
|
||||
/* GPIO Port Control */
|
||||
#define GPIO_PCTL(port) MMIO32(port + 0x52C)
|
||||
#define GPIO_PCTL(port) MMIO32((port) + 0x52C)
|
||||
|
||||
/* GPIO ADC Control */
|
||||
#define GPIO_ADCCTL(port) MMIO32(port + 0x530)
|
||||
#define GPIO_ADCCTL(port) MMIO32((port) + 0x530)
|
||||
|
||||
/* GPIO DMA Control */
|
||||
#define GPIO_DMACTL(port) MMIO32(port + 0x534)
|
||||
#define GPIO_DMACTL(port) MMIO32((port) + 0x534)
|
||||
|
||||
/* GPIO Peripheral Identification */
|
||||
#define GPIO_PERIPH_ID4(port) MMIO32(port + 0xFD0)
|
||||
#define GPIO_PERIPH_ID5(port) MMIO32(port + 0xFD4)
|
||||
#define GPIO_PERIPH_ID6(port) MMIO32(port + 0xFD8)
|
||||
#define GPIO_PERIPH_ID7(port) MMIO32(port + 0xFDC)
|
||||
#define GPIO_PERIPH_ID0(port) MMIO32(port + 0xFE0)
|
||||
#define GPIO_PERIPH_ID1(port) MMIO32(port + 0xFE4)
|
||||
#define GPIO_PERIPH_ID2(port) MMIO32(port + 0xFE8)
|
||||
#define GPIO_PERIPH_ID3(port) MMIO32(port + 0xFEC)
|
||||
#define GPIO_PERIPH_ID4(port) MMIO32((port) + 0xFD0)
|
||||
#define GPIO_PERIPH_ID5(port) MMIO32((port) + 0xFD4)
|
||||
#define GPIO_PERIPH_ID6(port) MMIO32((port) + 0xFD8)
|
||||
#define GPIO_PERIPH_ID7(port) MMIO32((port) + 0xFDC)
|
||||
#define GPIO_PERIPH_ID0(port) MMIO32((port) + 0xFE0)
|
||||
#define GPIO_PERIPH_ID1(port) MMIO32((port) + 0xFE4)
|
||||
#define GPIO_PERIPH_ID2(port) MMIO32((port) + 0xFE8)
|
||||
#define GPIO_PERIPH_ID3(port) MMIO32((port) + 0xFEC)
|
||||
|
||||
/* GPIO PrimeCell Identification */
|
||||
#define GPIO_PCELL_ID0(port) MMIO32(port + 0xFF0)
|
||||
#define GPIO_PCELL_ID1(port) MMIO32(port + 0xFF4)
|
||||
#define GPIO_PCELL_ID2(port) MMIO32(port + 0xFF8)
|
||||
#define GPIO_PCELL_ID3(port) MMIO32(port + 0xFFC)
|
||||
#define GPIO_PCELL_ID0(port) MMIO32((port) + 0xFF0)
|
||||
#define GPIO_PCELL_ID1(port) MMIO32((port) + 0xFF4)
|
||||
#define GPIO_PCELL_ID2(port) MMIO32((port) + 0xFF8)
|
||||
#define GPIO_PCELL_ID3(port) MMIO32((port) + 0xFFC)
|
||||
|
||||
/* =============================================================================
|
||||
* Convenience enums
|
||||
|
||||
@@ -57,53 +57,53 @@
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
/* SSI Control 0 */
|
||||
#define SSI_CR0(port) MMIO32(port + 0x000)
|
||||
#define SSI_CR0(port) MMIO32((port) + 0x000)
|
||||
|
||||
/* SSI Control 1 */
|
||||
#define SSI_CR1(port) MMIO32(port + 0x004)
|
||||
#define SSI_CR1(port) MMIO32((port) + 0x004)
|
||||
|
||||
/* SSI Data */
|
||||
#define SSI_DR(port) MMIO32(port + 0x008)
|
||||
#define SSI_DR(port) MMIO32((port) + 0x008)
|
||||
|
||||
/* SSI Satus */
|
||||
#define SSI_SR(port) MMIO32(port + 0x00C)
|
||||
#define SSI_SR(port) MMIO32((port) + 0x00C)
|
||||
|
||||
/* SSI Clock Prescale */
|
||||
#define SSI_CPSR(port) MMIO32(port + 0x010)
|
||||
#define SSI_CPSR(port) MMIO32((port) + 0x010)
|
||||
|
||||
/* SSI Interrupt Mask */
|
||||
#define SSI_IM(port) MMIO32(port + 0x014)
|
||||
#define SSI_IM(port) MMIO32((port) + 0x014)
|
||||
|
||||
/* SSI Raw Interrupt Status */
|
||||
#define SSI_RIS(port) MMIO32(port + 0x018)
|
||||
#define SSI_RIS(port) MMIO32((port) + 0x018)
|
||||
|
||||
/* SSI Masked Interrupt Status */
|
||||
#define SSI_MIS(port) MMIO32(port + 0x01C)
|
||||
#define SSI_MIS(port) MMIO32((port) + 0x01C)
|
||||
|
||||
/* SSI Interrupt Clear */
|
||||
#define SSI_ICR(port) MMIO32(port + 0x020)
|
||||
#define SSI_ICR(port) MMIO32((port) + 0x020)
|
||||
|
||||
/* SSI DMA Control */
|
||||
#define SSI_DMACTL(port) MMIO32(port + 0x024)
|
||||
#define SSI_DMACTL(port) MMIO32((port) + 0x024)
|
||||
|
||||
/* SSI Clock Configuration */
|
||||
#define SSI_CC(port) MMIO32(port + 0xFC8)
|
||||
#define SSI_CC(port) MMIO32((port) + 0xFC8)
|
||||
|
||||
/* SSI Peripheral Identification */
|
||||
#define SSI_PERIPH_ID4(port) MMIO32(port + 0xFD0)
|
||||
#define SSI_PERIPH_ID5(port) MMIO32(port + 0xFD4)
|
||||
#define SSI_PERIPH_ID6(port) MMIO32(port + 0xFD8)
|
||||
#define SSI_PERIPH_ID7(port) MMIO32(port + 0xFDC)
|
||||
#define SSI_PERIPH_ID0(port) MMIO32(port + 0xFE0)
|
||||
#define SSI_PERIPH_ID1(port) MMIO32(port + 0xFE4)
|
||||
#define SSI_PERIPH_ID2(port) MMIO32(port + 0xFE8)
|
||||
#define SSI_PERIPH_ID3(port) MMIO32(port + 0xFEC)
|
||||
#define SSI_PERIPH_ID4(port) MMIO32((port) + 0xFD0)
|
||||
#define SSI_PERIPH_ID5(port) MMIO32((port) + 0xFD4)
|
||||
#define SSI_PERIPH_ID6(port) MMIO32((port) + 0xFD8)
|
||||
#define SSI_PERIPH_ID7(port) MMIO32((port) + 0xFDC)
|
||||
#define SSI_PERIPH_ID0(port) MMIO32((port) + 0xFE0)
|
||||
#define SSI_PERIPH_ID1(port) MMIO32((port) + 0xFE4)
|
||||
#define SSI_PERIPH_ID2(port) MMIO32((port) + 0xFE8)
|
||||
#define SSI_PERIPH_ID3(port) MMIO32((port) + 0xFEC)
|
||||
|
||||
/* SSI PrimeCell Identification */
|
||||
#define SSI_PCELL_ID0(port) MMIO32(port + 0xFF0)
|
||||
#define SSI_PCELL_ID1(port) MMIO32(port + 0xFF4)
|
||||
#define SSI_PCELL_ID2(port) MMIO32(port + 0xFF8)
|
||||
#define SSI_PCELL_ID3(port) MMIO32(port + 0xFFC)
|
||||
#define SSI_PCELL_ID0(port) MMIO32((port) + 0xFF0)
|
||||
#define SSI_PCELL_ID1(port) MMIO32((port) + 0xFF4)
|
||||
#define SSI_PCELL_ID2(port) MMIO32((port) + 0xFF8)
|
||||
#define SSI_PCELL_ID3(port) MMIO32((port) + 0xFFC)
|
||||
|
||||
/* =============================================================================
|
||||
* Function prototypes
|
||||
@@ -115,4 +115,4 @@ END_DECLS
|
||||
/**@}*/
|
||||
|
||||
#endif /* LM4F_SSI_H */
|
||||
|
||||
|
||||
|
||||
@@ -61,104 +61,104 @@
|
||||
* ---------------------------------------------------------------------------*/
|
||||
|
||||
/* UART data register */
|
||||
#define UART_DR(uart_base) MMIO32(uart_base + 0x00)
|
||||
#define UART_DR(uart_base) MMIO32((uart_base) + 0x00)
|
||||
|
||||
/* UART Receive Status/Error Clear register */
|
||||
#define UART_RSR(uart_base) MMIO32(uart_base + 0x04)
|
||||
#define UART_ECR(uart_base) MMIO32(uart_base + 0x04)
|
||||
#define UART_RSR(uart_base) MMIO32((uart_base) + 0x04)
|
||||
#define UART_ECR(uart_base) MMIO32((uart_base) + 0x04)
|
||||
|
||||
/* UART Flag register */
|
||||
#define UART_FR(uart_base) MMIO32(uart_base + 0x18)
|
||||
#define UART_FR(uart_base) MMIO32((uart_base) + 0x18)
|
||||
|
||||
/* UART IrDA Low-Power register */
|
||||
#define UART_ILPR(uart_base) MMIO32(uart_base + 0x20)
|
||||
#define UART_ILPR(uart_base) MMIO32((uart_base) + 0x20)
|
||||
|
||||
/* UART Integer baudrate divisor */
|
||||
#define UART_IBRD(uart_base) MMIO32(uart_base + 0x24)
|
||||
#define UART_IBRD(uart_base) MMIO32((uart_base) + 0x24)
|
||||
|
||||
/* UART Fractional baudrate divisor */
|
||||
#define UART_FBRD(uart_base) MMIO32(uart_base + 0x28)
|
||||
#define UART_FBRD(uart_base) MMIO32((uart_base) + 0x28)
|
||||
|
||||
/* UART Line control */
|
||||
#define UART_LCRH(uart_base) MMIO32(uart_base + 0x2C)
|
||||
#define UART_LCRH(uart_base) MMIO32((uart_base) + 0x2C)
|
||||
|
||||
/* UART Control */
|
||||
#define UART_CTL(uart_base) MMIO32(uart_base + 0x30)
|
||||
#define UART_CTL(uart_base) MMIO32((uart_base) + 0x30)
|
||||
|
||||
/* UART Interrupt FIFO level select */
|
||||
#define UART_IFLS(uart_base) MMIO32(uart_base + 0x34)
|
||||
#define UART_IFLS(uart_base) MMIO32((uart_base) + 0x34)
|
||||
|
||||
/* UART Interrupt mask */
|
||||
#define UART_IM(uart_base) MMIO32(uart_base + 0x38)
|
||||
#define UART_IM(uart_base) MMIO32((uart_base) + 0x38)
|
||||
|
||||
/* UART Raw interrupt status */
|
||||
#define UART_RIS(uart_base) MMIO32(uart_base + 0x3C)
|
||||
#define UART_RIS(uart_base) MMIO32((uart_base) + 0x3C)
|
||||
|
||||
/* UART Masked Interrupt status */
|
||||
#define UART_MIS(uart_base) MMIO32(uart_base + 0x40)
|
||||
#define UART_MIS(uart_base) MMIO32((uart_base) + 0x40)
|
||||
|
||||
/* UART Interrupt Clear */
|
||||
#define UART_ICR(uart_base) MMIO32(uart_base + 0x44)
|
||||
#define UART_ICR(uart_base) MMIO32((uart_base) + 0x44)
|
||||
|
||||
/* UART DMA control */
|
||||
#define UART_DMACTL(uart_base) MMIO32(uart_base + 0x48)
|
||||
#define UART_DMACTL(uart_base) MMIO32((uart_base) + 0x48)
|
||||
|
||||
/* UART LIN control */
|
||||
#define UART_LCTL(uart_base) MMIO32(uart_base + 0x90)
|
||||
#define UART_LCTL(uart_base) MMIO32((uart_base) + 0x90)
|
||||
|
||||
/* UART LIN snap shot */
|
||||
#define UART_LSS(uart_base) MMIO32(uart_base + 0x94)
|
||||
#define UART_LSS(uart_base) MMIO32((uart_base) + 0x94)
|
||||
|
||||
/* UART LIN timer */
|
||||
#define UART_LTIM(uart_base) MMIO32(uart_base + 0x98)
|
||||
#define UART_LTIM(uart_base) MMIO32((uart_base) + 0x98)
|
||||
|
||||
/* UART 9-Bit self address */
|
||||
#define UART_9BITADDR(uart_base) MMIO32(uart_base + 0xA4)
|
||||
#define UART_9BITADDR(uart_base) MMIO32((uart_base) + 0xA4)
|
||||
|
||||
/* UART 9-Bit self address mask */
|
||||
#define UART_9BITAMASK(uart_base) MMIO32(uart_base + 0xA8)
|
||||
#define UART_9BITAMASK(uart_base) MMIO32((uart_base) + 0xA8)
|
||||
|
||||
/* UART Peripheral properties */
|
||||
#define UART_PP(uart_base) MMIO32(uart_base + 0xFC0)
|
||||
#define UART_PP(uart_base) MMIO32((uart_base) + 0xFC0)
|
||||
|
||||
/* UART Clock configuration */
|
||||
#define UART_CC(uart_base) MMIO32(uart_base + 0xFC8)
|
||||
#define UART_CC(uart_base) MMIO32((uart_base) + 0xFC8)
|
||||
|
||||
/* UART Peripheral Identification 4 */
|
||||
#define UART_PERIPH_ID4(uart_base) MMIO32(uart_base + 0xFD0)
|
||||
#define UART_PERIPH_ID4(uart_base) MMIO32((uart_base) + 0xFD0)
|
||||
|
||||
/* UART Peripheral Identification 5 */
|
||||
#define UART_PERIPH_ID5(uart_base) MMIO32(uart_base + 0xFD4)
|
||||
#define UART_PERIPH_ID5(uart_base) MMIO32((uart_base) + 0xFD4)
|
||||
|
||||
/* UART Peripheral Identification 6 */
|
||||
#define UART_PERIPH_ID6(uart_base) MMIO32(uart_base + 0xFD8)
|
||||
#define UART_PERIPH_ID6(uart_base) MMIO32((uart_base) + 0xFD8)
|
||||
|
||||
/* UART Peripheral Identification 7 */
|
||||
#define UART_PERIPH_ID7(uart_base) MMIO32(uart_base + 0xFDC)
|
||||
#define UART_PERIPH_ID7(uart_base) MMIO32((uart_base) + 0xFDC)
|
||||
|
||||
/* UART Peripheral Identification 0 */
|
||||
#define UART_PERIPH_ID0(uart_base) MMIO32(uart_base + 0xFE0)
|
||||
#define UART_PERIPH_ID0(uart_base) MMIO32((uart_base) + 0xFE0)
|
||||
|
||||
/* UART Peripheral Identification 1 */
|
||||
#define UART_PERIPH_ID1(uart_base) MMIO32(uart_base + 0xFE4)
|
||||
#define UART_PERIPH_ID1(uart_base) MMIO32((uart_base) + 0xFE4)
|
||||
|
||||
/* UART Peripheral Identification 2 */
|
||||
#define UART_PERIPH_ID2(uart_base) MMIO32(uart_base + 0xFE8)
|
||||
#define UART_PERIPH_ID2(uart_base) MMIO32((uart_base) + 0xFE8)
|
||||
|
||||
/* UART Peripheral Identification 3 */
|
||||
#define UART_PERIPH_ID3(uart_base) MMIO32(uart_base + 0xFEC)
|
||||
#define UART_PERIPH_ID3(uart_base) MMIO32((uart_base) + 0xFEC)
|
||||
|
||||
/* UART PrimeCell Identification 0 */
|
||||
#define UART_PCELL_ID0(uart_base) MMIO32(uart_base + 0xFF0)
|
||||
#define UART_PCELL_ID0(uart_base) MMIO32((uart_base) + 0xFF0)
|
||||
|
||||
/* UART PrimeCell Identification 1 */
|
||||
#define UART_PCELL_ID1(uart_base) MMIO32(uart_base + 0xFF4)
|
||||
#define UART_PCELL_ID1(uart_base) MMIO32((uart_base) + 0xFF4)
|
||||
|
||||
/* UART PrimeCell Identification 2 */
|
||||
#define UART_PCELL_ID2(uart_base) MMIO32(uart_base + 0xFF8)
|
||||
#define UART_PCELL_ID2(uart_base) MMIO32((uart_base) + 0xFF8)
|
||||
|
||||
/* UART PrimeCell Identification 3 */
|
||||
#define UART_PCELL_ID3(uart_base) MMIO32(uart_base + 0xFFC)
|
||||
#define UART_PCELL_ID3(uart_base) MMIO32((uart_base) + 0xFFC)
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
|
||||
@@ -114,25 +114,25 @@
|
||||
#define USB_COUNT0 MMIO8(USB_BASE + 0x108)
|
||||
|
||||
/* USB Maximum Transmit Data Endpoint [1-7] */
|
||||
#define USB_TXMAXP(n) MMIO16(USB_BASE + 0x100 + n*0x10)
|
||||
#define USB_TXMAXP(n) MMIO16(USB_BASE + 0x100 + (n)*0x10)
|
||||
|
||||
/* USB Transmit Control and Status Endpoint [1-7] Low */
|
||||
#define USB_TXCSRL(n) MMIO8(USB_BASE + 0x102 + n*0x10)
|
||||
#define USB_TXCSRL(n) MMIO8(USB_BASE + 0x102 + (n)*0x10)
|
||||
|
||||
/* USB Transmit Control and Status Endpoint [1-7] High */
|
||||
#define USB_TXCSRH(n) MMIO8(USB_BASE + 0x103 + n*0x10)
|
||||
#define USB_TXCSRH(n) MMIO8(USB_BASE + 0x103 + (n)*0x10)
|
||||
|
||||
/* USB Maximum Receive Data Endpoint [1-7] */
|
||||
#define USB_RXMAXP(n) MMIO16(USB_BASE + 0x104 + n*0x10)
|
||||
#define USB_RXMAXP(n) MMIO16(USB_BASE + 0x104 + (n)*0x10)
|
||||
|
||||
/* USB Receive Control and Status Endpoint [1-7] Low */
|
||||
#define USB_RXCSRL(n) MMIO8(USB_BASE + 0x106 + n*0x10)
|
||||
#define USB_RXCSRL(n) MMIO8(USB_BASE + 0x106 + (n)*0x10)
|
||||
|
||||
/* USB Receive Control and Status Endpoint [1-7] High */
|
||||
#define USB_RXCSRH(n) MMIO8(USB_BASE + 0x107 + n*0x10)
|
||||
#define USB_RXCSRH(n) MMIO8(USB_BASE + 0x107 + (n)*0x10)
|
||||
|
||||
/* USB Receive Byte Count Endpoint [1-7] */
|
||||
#define USB_RXCOUNT(n) MMIO16(USB_BASE + 0x108 + n*0x10)
|
||||
#define USB_RXCOUNT(n) MMIO16(USB_BASE + 0x108 + (n)*0x10)
|
||||
|
||||
/* USB Receive Double Packet Buffer Disable */
|
||||
#define USB_RXDPKTBUFDIS MMIO16(USB_BASE + 0x340)
|
||||
|
||||
Reference in New Issue
Block a user