diff options
| author | hathach <[email protected]> | 2021-10-17 16:26:27 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-10-17 16:36:53 +0700 |
| commit | a5f516893bbd539f11fb8d1cbb5b6db5a50fc632 (patch) | |
| tree | 1d9f344ae3b7ed1a56b27bcbb11c4ff9d1ae07de /src | |
| parent | 0b249618b0469529da748e3e5478751cd56acd31 (diff) | |
more with -Wcast-qual
Diffstat (limited to 'src')
| -rw-r--r-- | src/class/cdc/cdc_host.c | 2 | ||||
| -rw-r--r-- | src/class/msc/msc_host.c | 2 | ||||
| -rw-r--r-- | src/device/usbd.c | 2 | ||||
| -rw-r--r-- | src/host/usbh.c | 5 | ||||
| -rw-r--r-- | src/portable/ehci/ehci.c | 6 | ||||
| -rw-r--r-- | src/portable/nxp/transdimension/dcd_transdimension.c | 2 | ||||
| -rw-r--r-- | src/portable/renesas/usba/dcd_usba.c | 4 | ||||
| -rw-r--r-- | src/portable/st/synopsys/dcd_synopsys.c | 4 | ||||
| -rw-r--r-- | src/portable/valentyusb/eptri/dcd_eptri.c | 12 |
9 files changed, 19 insertions, 20 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index e7eaf4d05..f4fb6c1d6 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -105,7 +105,7 @@ bool tuh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool i uint8_t const ep_out = cdch_data[dev_addr-1].ep_out; if ( usbh_edpt_busy(dev_addr, ep_out) ) return false; - return usbh_edpt_xfer(dev_addr, ep_out, (void *) p_data, length); + return usbh_edpt_xfer(dev_addr, ep_out, (void*)(uintptr_t) p_data, length); } bool tuh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify) diff --git a/src/class/msc/msc_host.c b/src/class/msc/msc_host.c index 8069353cd..fa6519956 100644 --- a/src/class/msc/msc_host.c +++ b/src/class/msc/msc_host.c @@ -263,7 +263,7 @@ bool tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * buffer, uint32_ memcpy(cbw.command, &cmd_write10, cbw.cmd_len); - return tuh_msc_scsi_command(dev_addr, &cbw, (void*) buffer, complete_cb); + return tuh_msc_scsi_command(dev_addr, &cbw, (void*)(uintptr_t) buffer, complete_cb); } #if 0 diff --git a/src/device/usbd.c b/src/device/usbd.c index b4680283f..6a5210b34 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -1002,7 +1002,7 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const tusb_control_request_t mod_request = *p_request; mod_request.wLength = CFG_TUD_ENDPOINT0_SIZE; - tud_control_xfer(rhport, &mod_request, desc_device, CFG_TUD_ENDPOINT0_SIZE); + return tud_control_xfer(rhport, &mod_request, desc_device, CFG_TUD_ENDPOINT0_SIZE); }else { return tud_control_xfer(rhport, p_request, desc_device, sizeof(tusb_desc_device_t)); diff --git a/src/host/usbh.c b/src/host/usbh.c index 2ef936ad0..53e8b9715 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -894,11 +894,10 @@ static bool enum_get_9byte_config_desc_complete(uint8_t dev_addr, tusb_control_r TU_ASSERT(XFER_RESULT_SUCCESS == result); // TODO not enough buffer to hold configuration descriptor - tusb_desc_configuration_t const * desc_config = (tusb_desc_configuration_t const*) _usbh_ctrl_buf; - uint16_t total_len; + uint8_t const * desc_config = _usbh_ctrl_buf; // Use offsetof to avoid pointer to the odd/misaligned address - memcpy(&total_len, (uint8_t*) desc_config + offsetof(tusb_desc_configuration_t, wTotalLength), 2); + uint16_t const total_len = tu_le16toh( tu_unaligned_read16(desc_config + offsetof(tusb_desc_configuration_t, wTotalLength)) ); TU_ASSERT(total_len <= CFG_TUH_ENUMERATION_BUFSIZE); diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c index e3b7499cc..18ddaf31a 100644 --- a/src/portable/ehci/ehci.c +++ b/src/portable/ehci/ehci.c @@ -128,7 +128,7 @@ static inline ehci_qtd_t* qtd_find_free (void); static inline ehci_qtd_t* qtd_next (ehci_qtd_t const * p_qtd); static inline void qtd_insert_to_qhd (ehci_qhd_t *p_qhd, ehci_qtd_t *p_qtd_new); static inline void qtd_remove_1st_from_qhd (ehci_qhd_t *p_qhd); -static void qtd_init (ehci_qtd_t* p_qtd, void* buffer, uint16_t total_bytes); +static void qtd_init (ehci_qtd_t* p_qtd, void const* buffer, uint16_t total_bytes); static inline void list_insert (ehci_link_t *current, ehci_link_t *new, uint8_t new_type); static inline ehci_link_t* list_next (ehci_link_t *p_link_pointer); @@ -392,7 +392,7 @@ bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setup_packet ehci_qhd_t* qhd = &ehci_data.control[dev_addr].qhd; ehci_qtd_t* td = &ehci_data.control[dev_addr].qtd; - qtd_init(td, (void*) setup_packet, 8); + qtd_init(td, setup_packet, 8); td->pid = EHCI_PID_SETUP; td->int_on_complete = 1; td->next.terminate = 1; @@ -857,7 +857,7 @@ static void qhd_init(ehci_qhd_t *p_qhd, uint8_t dev_addr, tusb_desc_endpoint_t c } } -static void qtd_init(ehci_qtd_t* p_qtd, void* buffer, uint16_t total_bytes) +static void qtd_init(ehci_qtd_t* p_qtd, void const* buffer, uint16_t total_bytes) { tu_memclr(p_qtd, sizeof(ehci_qtd_t)); diff --git a/src/portable/nxp/transdimension/dcd_transdimension.c b/src/portable/nxp/transdimension/dcd_transdimension.c index a7c4545c2..0f58cceb9 100644 --- a/src/portable/nxp/transdimension/dcd_transdimension.c +++ b/src/portable/nxp/transdimension/dcd_transdimension.c @@ -636,7 +636,7 @@ void dcd_int_handler(uint8_t rhport) // 23.10.10.2 Operational model for setup transfers dcd_reg->ENDPTSETUPSTAT = dcd_reg->ENDPTSETUPSTAT; - dcd_event_setup_received(rhport, (uint8_t*) &_dcd_data.qhd[0][0].setup_request, true); + dcd_event_setup_received(rhport, (uint8_t*)(uintptr_t) &_dcd_data.qhd[0][0].setup_request, true); } // 23.10.12.3 Failed QTD also get ENDPTCOMPLETE set diff --git a/src/portable/renesas/usba/dcd_usba.c b/src/portable/renesas/usba/dcd_usba.c index 92e29f9bf..07d3ba898 100644 --- a/src/portable/renesas/usba/dcd_usba.c +++ b/src/portable/renesas/usba/dcd_usba.c @@ -259,7 +259,7 @@ static inline void pipe_wait_for_ready(unsigned num) static void pipe_write_packet(void *buf, volatile void *fifo, unsigned len) { - hw_fifo_t *reg = (hw_fifo_t*)fifo; + volatile hw_fifo_t *reg = (volatile hw_fifo_t*) fifo; uintptr_t addr = (uintptr_t)buf; while (len >= 2) { reg->u16 = *(const uint16_t *)addr; @@ -275,7 +275,7 @@ static void pipe_write_packet(void *buf, volatile void *fifo, unsigned len) static void pipe_read_packet(void *buf, volatile void *fifo, unsigned len) { uint8_t *p = (uint8_t*)buf; - uint8_t *reg = (uint8_t*)fifo; /* byte access is always at base register address */ + volatile uint8_t *reg = (volatile uint8_t*)fifo; /* byte access is always at base register address */ while (len--) *p++ = *reg; } diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c index 85abf940e..29030784b 100644 --- a/src/portable/st/synopsys/dcd_synopsys.c +++ b/src/portable/st/synopsys/dcd_synopsys.c @@ -976,7 +976,7 @@ static void handle_rxflvl_ints(uint8_t rhport, USB_OTG_OUTEndpointTypeDef * out_ if (xfer->ff) { // Ring buffer - tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *) rx_fifo, bcnt); + tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *)(uintptr_t) rx_fifo, bcnt); } else { @@ -1096,7 +1096,7 @@ static void handle_epin_ints(uint8_t rhport, USB_OTG_DeviceTypeDef * dev, USB_OT if (xfer->ff) { usb_fifo_t tx_fifo = FIFO_BASE(rhport, n); - tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *) tx_fifo, packet_size); + tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *)(uintptr_t) tx_fifo, packet_size); } else { diff --git a/src/portable/valentyusb/eptri/dcd_eptri.c b/src/portable/valentyusb/eptri/dcd_eptri.c index 89bc7a1ab..837d0c0ce 100644 --- a/src/portable/valentyusb/eptri/dcd_eptri.c +++ b/src/portable/valentyusb/eptri/dcd_eptri.c @@ -314,13 +314,13 @@ static void dcd_reset(void) usb_in_ctrl_write(1 << CSR_USB_IN_CTRL_RESET_OFFSET); usb_out_ctrl_write(1 << CSR_USB_OUT_CTRL_RESET_OFFSET); - memset((void *)rx_buffer, 0, sizeof(rx_buffer)); - memset((void *)rx_buffer_max, 0, sizeof(rx_buffer_max)); - memset((void *)rx_buffer_offset, 0, sizeof(rx_buffer_offset)); + memset((void *)(uintptr_t) rx_buffer, 0, sizeof(rx_buffer)); + memset((void *)(uintptr_t) rx_buffer_max, 0, sizeof(rx_buffer_max)); + memset((void *)(uintptr_t) rx_buffer_offset, 0, sizeof(rx_buffer_offset)); - memset((void *)tx_buffer, 0, sizeof(tx_buffer)); - memset((void *)tx_buffer_max, 0, sizeof(tx_buffer_max)); - memset((void *)tx_buffer_offset, 0, sizeof(tx_buffer_offset)); + memset((void *)(uintptr_t) tx_buffer, 0, sizeof(tx_buffer)); + memset((void *)(uintptr_t) tx_buffer_max, 0, sizeof(tx_buffer_max)); + memset((void *)(uintptr_t) tx_buffer_offset, 0, sizeof(tx_buffer_offset)); tx_ep = 0; tx_active = false; |
