Skip to content

Commit

Permalink
Replace all __attribute__((aligned(x)) with aligned_data(x)
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 authored and gustavonihei committed Jul 30, 2021
1 parent 9c3799f commit b3f9ffb
Show file tree
Hide file tree
Showing 71 changed files with 188 additions and 192 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/armv6-m/arm_ramvec_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
*/

up_vector_t g_ram_vectors[ARMV6M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"), aligned (RAMVEC_ALIGN)));
__attribute__ ((section (".ram_vectors"))) aligned_data(RAMVEC_ALIGN);

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv6-m/ram_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
*/

extern up_vector_t g_ram_vectors[ARMV6M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"), aligned (128)));
__attribute__ ((section (".ram_vectors"))) aligned_data(128);

/****************************************************************************
* Public Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/arm_ramvec_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
*/

up_vector_t g_ram_vectors[ARMV7M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"), aligned (RAMVEC_ALIGN)));
__attribute__ ((section (".ram_vectors"))) aligned_data(RAMVEC_ALIGN);

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-m/ram_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
*/

extern up_vector_t g_ram_vectors[ARMV7M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"), aligned (128)));
__attribute__ ((section (".ram_vectors"))) aligned_data(128);

/****************************************************************************
* Public Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/arm_ramvec_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
*/

up_vector_t g_ram_vectors[ARMV8M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"), aligned (RAMVEC_ALIGN)));
__attribute__ ((section (".ram_vectors"))) aligned_data(RAMVEC_ALIGN);

/****************************************************************************
* Public Functions
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/ram_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
*/

extern up_vector_t g_ram_vectors[ARMV8M_VECTAB_SIZE]
__attribute__ ((section (".ram_vectors"), aligned (128)));
__attribute__ ((section (".ram_vectors"))) aligned_data(128);

/****************************************************************************
* Public Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/cxd56xx/cxd56_udmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static struct dma_channel_s g_dmach[CXD56_DMA_NCHANNELS];
#endif

static struct dma_descriptor_s g_descriptors[CXD56_DMA_NCHANNELS]
__attribute__((aligned(DESC_TABLE_ALIGN)));
aligned_data(DESC_TABLE_ALIGN);

/****************************************************************************
* Public Data
Expand Down
10 changes: 3 additions & 7 deletions arch/arm/src/cxd56xx/cxd56_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@
(PHY_STAGSELECT | PHY_HSFALLCNTRL | PHY_IHSTX(0xc) | PHY_INHSRFRED | \
PHY_INHSIPLUS | PHY_INHSDRVSLEW| PHY_INLFSFBCAP)

#ifndef __aligned
# define __aligned(x) __attribute__((aligned(x)))
#endif

/* Debug ********************************************************************/

/* Trace error codes */
Expand Down Expand Up @@ -556,9 +552,9 @@ static struct cxd56_usbdev_s g_usbdev;

/* DMA Descriptors for each endpoints */

static struct cxd56_setup_desc_s __aligned(4) g_ep0setup;
static struct cxd56_data_desc_s __aligned(4) g_ep0in;
static struct cxd56_data_desc_s __aligned(4) g_ep0out;
static struct cxd56_setup_desc_s aligned_data(4) g_ep0setup;
static struct cxd56_data_desc_s aligned_data(4) g_ep0in;
static struct cxd56_data_desc_s aligned_data(4) g_ep0out;

/* Summarizes information about all CXD56 endpoints */

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/efm32/efm32_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ static struct dma_channel_s g_dmach[EFM32_DMA_NCHANNELS];
#ifdef CONFIG_EFM32_DMA_ALTDSEC
static struct dma_descriptor_s
g_descriptors[DESC_TABLE_SIZE + EFM32_DMA_NCHANNELS]
__attribute__((aligned(DESC_TABLE_ALIGN)));
aligned_data(DESC_TABLE_ALIGN);
#else
static struct dma_descriptor_s g_descriptors[EFM32_DMA_NCHANNELS]
__attribute__((aligned(DESC_TABLE_ALIGN)));
aligned_data(DESC_TABLE_ALIGN);
#endif

/****************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/imx6/imx_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ static struct imx_driver_s g_enet[CONFIG_IMX_ENET_NETHIFS];
*/

static uint8_t g_desc_pool[NENET_NBUFFERS * sizeof(struct enet_desc_s)]
__attribute__((aligned(ENET_ALIGN)));
aligned_data(ENET_ALIGN);

/* The DMA buffers. Again, A unaligned uint8_t is used to allocate the
* memory; 16 is added to assure that we can meet the descriptor alignment
* requirements.
*/

static uint8_t g_buffer_pool[NENET_NBUFFERS * IMX_BUF_SIZE]
__attribute__((aligned(ENET_ALIGN)));
aligned_data(ENET_ALIGN);

/****************************************************************************
* Private Function Prototypes
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/imxrt/imxrt_edma.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static sq_queue_t g_tcd_free;
/* This is a pool of pre-allocated TCDs */

static struct imxrt_edmatcd_s g_tcd_pool[CONFIG_IMXRT_EDMA_NTCD]
__attribute__((aligned(EDMA_ALIGN)));
aligned_data(EDMA_ALIGN);
#endif

/****************************************************************************
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/src/imxrt/imxrt_ehci.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,17 @@ static const uint8_t g_ehci_speed[4] =

/* The head of the asynchronous queue */

static struct imxrt_qh_s g_asynchead __attribute__ ((aligned(32)));
static struct imxrt_qh_s g_asynchead aligned_data(32);

#ifndef CONFIG_USBHOST_INT_DISABLE
/* The head of the periodic queue */

static struct imxrt_qh_s g_intrhead __attribute__ ((aligned(32)));
static struct imxrt_qh_s g_intrhead aligned_data(32);

/* The frame list */

#ifdef CONFIG_IMXRT_EHCI_PREALLOCATE
static uint32_t g_framelist[FRAME_LIST_SIZE] __attribute__ ((aligned(4096)));
static uint32_t g_framelist[FRAME_LIST_SIZE] aligned_data(4096);
#else
static uint32_t *g_framelist;
#endif
Expand All @@ -606,12 +606,12 @@ static uint32_t *g_framelist;
/* Queue Head (QH) pool */

static struct imxrt_qh_s g_qhpool[CONFIG_IMXRT_EHCI_NQHS]
__attribute__ ((aligned(32)));
aligned_data(32);

/* Queue Element Transfer Descriptor (qTD) pool */

static struct imxrt_qtd_s g_qtdpool[CONFIG_IMXRT_EHCI_NQTDS]
__attribute__ ((aligned(32)));
aligned_data(32);

#else
/* Pools of dynamically data structures. These will all be linked into the
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/imxrt/imxrt_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ static struct imxrt_driver_s g_enet[CONFIG_IMXRT_ENET_NETHIFS];
*/

static uint8_t g_desc_pool[NENET_NBUFFERS * sizeof(struct enet_desc_s)]
__attribute__((aligned(ENET_ALIGN)));
aligned_data(ENET_ALIGN);

/* The DMA buffers. Again, A unaligned uint8_t is used to allocate the
* memory; 16 is added to assure that we can meet the descriptor alignment
* requirements.
*/

static uint8_t g_buffer_pool[NENET_NBUFFERS * IMXRT_BUF_SIZE]
__attribute__((aligned(ENET_ALIGN)));
aligned_data(ENET_ALIGN);

/****************************************************************************
* Private Function Prototypes
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/imxrt/imxrt_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ static int imxrt_pullup(struct usbdev_s *dev, bool enable);
static struct imxrt_usbdev_s g_usbdev;

static struct imxrt_dqh_s g_qh[IMXRT_NPHYSENDPOINTS]
__attribute__((aligned(2048)));
aligned_data(2048);

static struct imxrt_dtd_s g_td[IMXRT_NPHYSENDPOINTS]
__attribute__((aligned(32)));
aligned_data(32);

static const struct usbdev_epops_s g_epops =
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/kinetis/kinetis_edma.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static sq_queue_t g_tcd_free;
/* This is a pool of pre-allocated TCDs */

static struct kinetis_edmatcd_s g_tcd_pool[CONFIG_KINETIS_EDMA_NTCD]
__attribute__((aligned(EDMA_ALIGN)));
aligned_data(EDMA_ALIGN);
#endif

/****************************************************************************
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/src/kinetis/kinetis_lpserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,39 +379,39 @@ static char g_lpuart0rxbuffer[CONFIG_LPUART0_RXBUFSIZE];
static char g_lpuart0txbuffer[CONFIG_LPUART0_TXBUFSIZE];
# ifdef CONFIG_KINETIS_LPUART0_RXDMA
static char g_lpuart0rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif
#ifdef CONFIG_KINETIS_LPUART1
static char g_lpuart1rxbuffer[CONFIG_LPUART1_RXBUFSIZE];
static char g_lpuart1txbuffer[CONFIG_LPUART1_TXBUFSIZE];
# ifdef CONFIG_KINETIS_LPUART1_RXDMA
static char g_lpuart1rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif
#ifdef CONFIG_KINETIS_LPUART2
static char g_lpuart2rxbuffer[CONFIG_LPUART2_RXBUFSIZE];
static char g_lpuart2txbuffer[CONFIG_LPUART2_TXBUFSIZE];
# ifdef CONFIG_KINETIS_LPUART2_RXDMA
static char g_lpuart2rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif
#ifdef CONFIG_KINETIS_LPUART3
static char g_lpuart3rxbuffer[CONFIG_LPUART3_RXBUFSIZE];
static char g_lpuart3txbuffer[CONFIG_LPUART3_TXBUFSIZE];
# ifdef CONFIG_KINETIS_LPUART3_RXDMA
static char g_lpuart3rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif
#ifdef CONFIG_KINETIS_LPUART4
static char g_lpuart4rxbuffer[CONFIG_LPUART4_RXBUFSIZE];
static char g_lpuart4txbuffer[CONFIG_LPUART4_TXBUFSIZE];
# ifdef CONFIG_KINETIS_LPUART4_RXDMA
static char g_lpuart4rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand Down
12 changes: 6 additions & 6 deletions arch/arm/src/kinetis/kinetis_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE];
static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE];
# ifdef CONFIG_KINETIS_UART0_RXDMA
static char g_uart0rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand All @@ -418,7 +418,7 @@ static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE];
static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE];
# ifdef CONFIG_KINETIS_UART1_RXDMA
static char g_uart1rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand All @@ -427,7 +427,7 @@ static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE];
static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE];
# ifdef CONFIG_KINETIS_UART2_RXDMA
static char g_uart2rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand All @@ -436,7 +436,7 @@ static char g_uart3rxbuffer[CONFIG_UART3_RXBUFSIZE];
static char g_uart3txbuffer[CONFIG_UART3_TXBUFSIZE];
# ifdef CONFIG_KINETIS_UART3_RXDMA
static char g_uart3rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand All @@ -445,7 +445,7 @@ static char g_uart4rxbuffer[CONFIG_UART4_RXBUFSIZE];
static char g_uart4txbuffer[CONFIG_UART4_TXBUFSIZE];
# ifdef CONFIG_KINETIS_UART4_RXDMA
static char g_uart4rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand All @@ -454,7 +454,7 @@ static char g_uart5rxbuffer[CONFIG_UART5_RXBUFSIZE];
static char g_uart5txbuffer[CONFIG_UART5_TXBUFSIZE];
# ifdef CONFIG_KINETIS_UART5_RXDMA
static char g_uart5rxfifo[RXDMA_BUFFER_SIZE]
__attribute__((aligned(ARMV7M_DCACHE_LINESIZE)));
aligned_data(ARMV7M_DCACHE_LINESIZE);
# endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/kinetis/kinetis_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
int ret;
size_t adjust;
ssize_t nbytes;
static uint8_t rxdummy[4] __attribute__((aligned(4)));
static uint8_t rxdummy[4] aligned_data(4);
static const uint16_t txdummy = 0xffff;
FAR struct kinetis_spidev_s *priv = (FAR struct kinetis_spidev_s *)dev;

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/kinetis/kinetis_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static const struct usbdev_ops_s g_devops =
*/

static volatile struct usbotg_bdtentry_s g_bdt[4*KHCI_NENDPOINTS]
__attribute__ ((aligned(512)));
aligned_data(512);

/****************************************************************************
* Private Private Functions
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/src/kinetis/kinetis_usbhshost.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,17 +609,17 @@ static const uint8_t g_ehci_speed[4] =

/* The head of the asynchronous queue */

static struct kinetis_qh_s g_asynchead __attribute__ ((aligned(32)));
static struct kinetis_qh_s g_asynchead aligned_data(32);

#ifndef CONFIG_USBHOST_INT_DISABLE
/* The head of the periodic queue */

static struct kinetis_qh_s g_intrhead __attribute__ ((aligned(32)));
static struct kinetis_qh_s g_intrhead aligned_data(32);

/* The frame list */

#ifdef CONFIG_KINETIS_EHCI_PREALLOCATE
static uint32_t g_framelist[FRAME_LIST_SIZE] __attribute__ ((aligned(4096)));
static uint32_t g_framelist[FRAME_LIST_SIZE] aligned_data(4096);
#else
static uint32_t *g_framelist;
#endif
Expand All @@ -633,12 +633,12 @@ static uint32_t *g_framelist;
/* Queue Head (QH) pool */

static struct kinetis_qh_s g_qhpool[CONFIG_KINETIS_EHCI_NQHS]
__attribute__ ((aligned(32)));
aligned_data(32);

/* Queue Element Transfer Descriptor (qTD) pool */

static struct kinetis_qtd_s g_qtdpool[CONFIG_KINETIS_EHCI_NQTDS]
__attribute__ ((aligned(32)));
aligned_data(32);

#else
/* Pools of dynamically data structures. These will all be linked into the
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/lpc17xx_40xx/lpc17_40_usbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ static const struct usbdev_ops_s g_devops =

#ifdef CONFIG_LPC17_40_USBDEV_DMA
static uint32_t
g_udca[LPC17_40_NPHYSENDPOINTS] __attribute__ ((aligned (128)));
g_udca[LPC17_40_NPHYSENDPOINTS] aligned_data(128);
static struct
lpc17_40_dmadesc_s g_usbddesc[CONFIG_LPC17_40_USBDEV_NDMADESCRIPTORS];
#endif
Expand Down
Loading

0 comments on commit b3f9ffb

Please sign in to comment.