dcd/musb: fix unaligned cast

Signed-off-by: HiFiPhile <admin@hifiphile.com>
This commit is contained in:
HiFiPhile
2026-01-15 19:13:02 +01:00
parent 71ed9d1498
commit b03a87731c

View File

@ -32,12 +32,6 @@
#define MUSB_DEBUG 2
#define MUSB_REGS(rhport) ((musb_regs_t*) MUSB_BASES[rhport])
#if __GNUC__ > 8 && defined(__ARM_FEATURE_UNALIGNED)
/* GCC warns that an address may be unaligned, even though
* the target CPU has the capability for unaligned memory access. */
_Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"");
#endif
#include "musb_type.h"
#include "device/dcd.h"
@ -73,7 +67,10 @@ typedef struct TU_ATTR_PACKED
typedef struct
{
tusb_control_request_t setup_packet;
union {
tusb_control_request_t setup_packet;
uint32_t setup_buffer[2];
};
uint16_t remaining_ctrl; /* The number of bytes remaining in data stage of control transfer. */
int8_t status_out;
pipe_state_t pipe0;
@ -174,9 +171,8 @@ static void process_setup_packet(uint8_t rhport) {
musb_regs_t* musb_regs = MUSB_REGS(rhport);
// Read setup packet
uint32_t *p = (void*)&_dcd.setup_packet;
p[0] = musb_regs->fifo[0];
p[1] = musb_regs->fifo[0];
_dcd.setup_buffer[0] = musb_regs->fifo[0];
_dcd.setup_buffer[1] = musb_regs->fifo[0];
_dcd.pipe0.buf = NULL;
_dcd.pipe0.length = 0;