summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-06-25 22:46:47 +0800
committersakumisu <[email protected]>2022-06-25 22:46:57 +0800
commitb47fe8d958bc5bb8432cb9c0aaca0f7962d02a64 (patch)
treef35f413c05a6933ded7ec7cfc0ced8315182f966
parent2bb5d6c13768933b4cdeaf9d43862806f6b993a3 (diff)
fix warning in 64bit cpu
-rw-r--r--common/usb_mem.h14
-rw-r--r--core/usbd_core.c8
2 files changed, 11 insertions, 11 deletions
diff --git a/common/usb_mem.h b/common/usb_mem.h
index 3806696c..6f8b2422 100644
--- a/common/usb_mem.h
+++ b/common/usb_mem.h
@@ -36,7 +36,7 @@
#endif
#define usb_malloc(size) malloc(size)
-#define usb_free(ptr) free(ptr)
+#define usb_free(ptr) free(ptr)
#ifdef CONFIG_USB_DCACHE_ENABLE
static inline void *usb_iomalloc(size_t size)
@@ -60,14 +60,14 @@ static inline void *usb_iomalloc(size_t size)
ptr = usb_malloc(align_size);
if (ptr != NULL) {
/* the allocated memory block is aligned */
- if (((uint32_t)ptr & (align - 1)) == 0) {
- align_ptr = (void *)((uint32_t)ptr + align);
+ if (((unsigned long)ptr & (align - 1)) == 0) {
+ align_ptr = (void *)((unsigned long)ptr + align);
} else {
- align_ptr = (void *)(((uint32_t)ptr + (align - 1)) & ~(align - 1));
+ align_ptr = (void *)(((unsigned long)ptr + (align - 1)) & ~(align - 1));
}
/* set the pointer before alignment pointer to the real pointer */
- *((uint32_t *)((uint32_t)align_ptr - sizeof(void *))) = (uint32_t)ptr;
+ *((unsigned long *)((unsigned long)align_ptr - sizeof(void *))) = (unsigned long)ptr;
ptr = align_ptr;
}
@@ -79,12 +79,12 @@ static inline void usb_iofree(void *ptr)
{
void *real_ptr;
- real_ptr = (void *)*(uint32_t *)((uint32_t)ptr - sizeof(void *));
+ real_ptr = (void *)*(unsigned long *)((unsigned long)ptr - sizeof(void *));
usb_free(real_ptr);
}
#else
#define usb_iomalloc(size) usb_malloc(size)
-#define usb_iofree(ptr) usb_free(ptr)
+#define usb_iofree(ptr) usb_free(ptr)
#endif
#endif
diff --git a/core/usbd_core.c b/core/usbd_core.c
index c80df15c..cfc7aaa5 100644
--- a/core/usbd_core.c
+++ b/core/usbd_core.c
@@ -311,7 +311,7 @@ static bool usbd_get_descriptor(uint16_t type_index, uint8_t **data, uint32_t *l
*data = p;
/* get length from structure */
- if ((type == USB_DESCRIPTOR_TYPE_CONFIGURATION)||((type == USB_DESCRIPTOR_TYPE_OTHER_SPEED))){
+ if ((type == USB_DESCRIPTOR_TYPE_CONFIGURATION) || ((type == USB_DESCRIPTOR_TYPE_OTHER_SPEED))) {
/* configuration descriptor is an
* exception, length is at offset
* 2 and 3
@@ -1056,7 +1056,7 @@ static void usbd_ep0_setup_handler(void)
setup->wLength);
#ifdef CONFIG_USB_DCACHE_ENABLE
/* check if the data buf addr uses usbd_core_cfg.req_data */
- if (((uint32_t)usbd_core_cfg.ep0_data_buf) != ((uint32_t)usbd_core_cfg.req_data)) {
+ if (((unsigned long)usbd_core_cfg.ep0_data_buf) != ((unsigned long)usbd_core_cfg.req_data)) {
/*copy data buf from misalign32 addr to align32 addr*/
memcpy(usbd_core_cfg.req_data, usbd_core_cfg.ep0_data_buf, usbd_core_cfg.ep0_data_buf_residue);
usbd_core_cfg.ep0_data_buf = usbd_core_cfg.req_data;
@@ -1251,11 +1251,11 @@ void usbd_event_notify_handler(uint8_t event, void *arg)
break;
case USBD_EVENT_EP_IN_NOTIFY:
- usbd_ep_in_handler((uint8_t)arg);
+ usbd_ep_in_handler((uint8_t)(unsigned long)arg);
break;
case USBD_EVENT_EP_OUT_NOTIFY:
- usbd_ep_out_handler((uint8_t)arg);
+ usbd_ep_out_handler((uint8_t)(unsigned long)arg);
break;
default: