Skip to content

Commit 6dfc857

Browse files
author
Ben Avison
committed
[rp2040] Explicit cast value of hw_set_alias
Some compilers don't support the GNU extension `typeof` so their definitions of `hw_set_alias` can't inherit their type from their argument, and the best we can do is have `hw_set_alias` act the same as `hw_set_alias_untyped`. This requires an explicit cast when the macro is used instead, otherwise IAR generates error Pe132 'expression must have pointer-to-struct-or-union type but it has type "void *"'. The same goes for `hw_clear_alias`.
1 parent e5355d0 commit 6dfc857

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/portable/raspberrypi/rp2040/dcd_rp2040.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
/* Low level controller
4747
*------------------------------------------------------------------*/
4848

49-
#define usb_hw_set hw_set_alias(usb_hw)
50-
#define usb_hw_clear hw_clear_alias(usb_hw)
49+
#define usb_hw_set ((usb_hw_t *)hw_set_alias(usb_hw))
50+
#define usb_hw_clear ((usb_hw_t *)hw_clear_alias(usb_hw))
5151

5252
// Init these in dcd_init
5353
static uint8_t *next_buffer_ptr;

src/portable/raspberrypi/rp2040/hcd_rp2040.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static_assert(PICO_USB_HOST_INTERRUPT_ENDPOINTS <= USB_MAX_ENDPOINTS, "");
5656
static struct hw_endpoint ep_pool[1 + PICO_USB_HOST_INTERRUPT_ENDPOINTS];
5757
#define epx (ep_pool[0])
5858

59-
#define usb_hw_set hw_set_alias(usb_hw)
60-
#define usb_hw_clear hw_clear_alias(usb_hw)
59+
#define usb_hw_set ((usb_hw_t *)hw_set_alias(usb_hw))
60+
#define usb_hw_clear ((usb_hw_t *)hw_clear_alias(usb_hw))
6161

6262
// Flags we set by default in sie_ctrl (we add other bits on top)
6363
enum {

0 commit comments

Comments
 (0)