summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2020-05-18 13:21:37 +0700
committerGitHub <[email protected]>2020-05-18 13:21:37 +0700
commit76bf96bcb0c12ba241ee4ecc175afb257e550d19 (patch)
tree6be8654ae1d2fd78e257783b2535455df2597d9c /src/portable
parent17869f0999d275ec6a8830c95999998f0f84fd03 (diff)
parent550746097b81c07cdc2459371c809a3678fe1ff4 (diff)
Merge pull request #411 from hathach/fix-cast-align-warning
enable -Wcast-align
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/nuvoton/nuc505/dcd_nuc505.c5
-rw-r--r--src/portable/nxp/transdimension/dcd_transdimension.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/src/portable/nuvoton/nuc505/dcd_nuc505.c b/src/portable/nuvoton/nuc505/dcd_nuc505.c
index 02f0b35a6..e67b69ab2 100644
--- a/src/portable/nuvoton/nuc505/dcd_nuc505.c
+++ b/src/portable/nuvoton/nuc505/dcd_nuc505.c
@@ -182,7 +182,10 @@ static void dcd_userEP_in_xfer(struct xfer_ctl_t *xfer, USBD_EP_T *ep)
/* provided buffers are thankfully 32-bit aligned, allowing most data to be transfered as 32-bit */
while (countdown > 3)
{
- ep->EPDAT = *(uint32_t *)xfer->data_ptr;
+ uint32_t u32;
+ memcpy(&u32, xfer->data_ptr, 4);
+
+ ep->EPDAT = u32;
xfer->data_ptr += 4; countdown -= 4;
}
while (countdown--)
diff --git a/src/portable/nxp/transdimension/dcd_transdimension.c b/src/portable/nxp/transdimension/dcd_transdimension.c
index fcedc1c0c..7baf43e23 100644
--- a/src/portable/nxp/transdimension/dcd_transdimension.c
+++ b/src/portable/nxp/transdimension/dcd_transdimension.c
@@ -273,7 +273,8 @@ typedef struct {
dcd_qtd_t qtd[QHD_MAX] TU_ATTR_ALIGNED(32); // for portability, TinyUSB only queue 1 TD for each Qhd
}dcd_data_t;
-static dcd_data_t _dcd_data CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(2048);
+CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(2048)
+static dcd_data_t _dcd_data;
//--------------------------------------------------------------------+
// CONTROLLER API
@@ -478,7 +479,8 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t t
// Force the CPU to flush the buffer. We increase the size by 32 because the call aligns the
// address to 32-byte boundaries.
- CleanInvalidateDCache_by_Addr((uint32_t*) buffer, total_bytes + 31);
+ // void* cast to suppress cast-align warning, buffer must be
+ CleanInvalidateDCache_by_Addr((uint32_t*) tu_align((uint32_t) buffer, 4), total_bytes + 31);
//------------- Prepare qtd -------------//
qtd_init(p_qtd, buffer, total_bytes);