diff --git a/bsp/at32/libraries/rt_drivers/drv_usbd.c b/bsp/at32/libraries/rt_drivers/drv_usbd.c index ef9cb8ddd8..96e1fecfce 100644 --- a/bsp/at32/libraries/rt_drivers/drv_usbd.c +++ b/bsp/at32/libraries/rt_drivers/drv_usbd.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2023-02-28 leo first version + * 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t */ #include @@ -152,20 +153,20 @@ static rt_err_t _ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; RT_ASSERT(buffer != RT_NULL); return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { usbd_ept_recv(p_usbd_instance->p_usbd_core, address, buffer, size); return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { usbd_ept_send(p_usbd_instance->p_usbd_core, address, buffer, size); return size; diff --git a/bsp/at32/libraries/rt_drivers/drv_usbfsd.c b/bsp/at32/libraries/rt_drivers/drv_usbfsd.c index 00764e44d3..8c2db41ed7 100644 --- a/bsp/at32/libraries/rt_drivers/drv_usbfsd.c +++ b/bsp/at32/libraries/rt_drivers/drv_usbfsd.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2023, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2023-02-28 leo first version + * 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t */ #include @@ -175,20 +176,20 @@ static rt_err_t _ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; RT_ASSERT(buffer != RT_NULL); return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { usbd_ept_recv(&p_usbfs_instance->p_otg_core->dev, address, buffer, size); return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { usbd_ept_send(&p_usbfs_instance->p_otg_core->dev, address, buffer, size); return size; diff --git a/bsp/imx/imx6ull-smart/drivers/drv_usbd.c b/bsp/imx/imx6ull-smart/drivers/drv_usbd.c index 9e7c8ad108..acf13fbbbd 100644 --- a/bsp/imx/imx6ull-smart/drivers/drv_usbd.c +++ b/bsp/imx/imx6ull-smart/drivers/drv_usbd.c @@ -6,6 +6,7 @@ * Change Logs: * Date Author Notes * 2017-12-04 ZYH first implementation + * 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t */ #include #include @@ -161,7 +162,7 @@ static rt_err_t _ehci0_ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ehci0_ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ehci0_ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; @@ -170,13 +171,13 @@ static rt_size_t _ehci0_ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ehci0_ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ehci0_ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { USB_DeviceRecvRequest(ehci0_handle, address, buffer, size); return size; } -static rt_size_t _ehci0_ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ehci0_ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { USB_DeviceSendRequest(ehci0_handle, address, buffer, size); return size; diff --git a/bsp/nuvoton/libraries/m031/rtt_port/drv_usbd.c b/bsp/nuvoton/libraries/m031/rtt_port/drv_usbd.c index fdac21ff1e..83159506db 100644 --- a/bsp/nuvoton/libraries/m031/rtt_port/drv_usbd.c +++ b/bsp/nuvoton/libraries/m031/rtt_port/drv_usbd.c @@ -7,6 +7,7 @@ * Change Logs: * Date Author Notes * 2021-02-24 klcheng First version +* 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t * ******************************************************************************/ @@ -192,7 +193,7 @@ static rt_err_t _ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; rt_uint8_t *buf; @@ -208,7 +209,7 @@ static rt_size_t _ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT(!(address & USB_DIR_IN)); @@ -217,7 +218,7 @@ static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t si return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT((address & USB_DIR_IN)); diff --git a/bsp/nuvoton/libraries/m2354/rtt_port/drv_usbd.c b/bsp/nuvoton/libraries/m2354/rtt_port/drv_usbd.c index ce601c4253..246a8ac8c0 100644 --- a/bsp/nuvoton/libraries/m2354/rtt_port/drv_usbd.c +++ b/bsp/nuvoton/libraries/m2354/rtt_port/drv_usbd.c @@ -7,6 +7,7 @@ * Change Logs: * Date Author Notes * 2020-09-17 CHChen First version +* 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t * ******************************************************************************/ @@ -229,7 +230,7 @@ static rt_err_t _ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; rt_uint8_t *buf; @@ -245,7 +246,7 @@ static rt_size_t _ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT(!(address & USB_DIR_IN)); @@ -254,7 +255,7 @@ static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t si return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT((address & USB_DIR_IN)); diff --git a/bsp/nuvoton/libraries/m460/rtt_port/drv_usbd.c b/bsp/nuvoton/libraries/m460/rtt_port/drv_usbd.c index 0011cacb22..e9bcfabcb0 100644 --- a/bsp/nuvoton/libraries/m460/rtt_port/drv_usbd.c +++ b/bsp/nuvoton/libraries/m460/rtt_port/drv_usbd.c @@ -7,6 +7,7 @@ * Change Logs: * Date Author Notes * 2022-3-15 Wayne First version +* 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t * ******************************************************************************/ @@ -276,7 +277,7 @@ static rt_err_t _ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; rt_uint8_t *buf; @@ -292,7 +293,7 @@ static rt_size_t _ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT(!(address & USB_DIR_IN)); @@ -301,7 +302,7 @@ static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t si return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT((address & USB_DIR_IN)); diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_usbd.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_usbd.c index 2df21ac8d4..f4daa4b79d 100644 --- a/bsp/nuvoton/libraries/m480/rtt_port/drv_usbd.c +++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_usbd.c @@ -7,6 +7,7 @@ * Change Logs: * Date Author Notes * 2020-3-25 Egbert First version +* 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t * ******************************************************************************/ @@ -210,7 +211,7 @@ static rt_err_t _ep_disable(uep_t ep) return RT_EOK; } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; rt_uint8_t *buf; @@ -226,7 +227,7 @@ static rt_size_t _ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT(!(address & USB_DIR_IN)); @@ -235,7 +236,7 @@ static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t si return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT((address & USB_DIR_IN)); diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_usbd.c b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_usbd.c index 876c6d96c2..5bc43309dd 100644 --- a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_usbd.c +++ b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_usbd.c @@ -7,6 +7,7 @@ * Change Logs: * Date Author Notes * 2021-03-16 Wayne First version +* 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t * ******************************************************************************/ @@ -436,7 +437,7 @@ __STATIC_INLINE void nu_buffer_cpy(rt_uint8_t address, void *buffer, rt_size_t s } } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; @@ -464,7 +465,7 @@ static rt_size_t _ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT(!(address & USB_DIR_IN)); @@ -496,7 +497,7 @@ static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t si return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT((address & USB_DIR_IN)); diff --git a/bsp/nuvoton/libraries/nuc980/rtt_port/drv_usbd.c b/bsp/nuvoton/libraries/nuc980/rtt_port/drv_usbd.c index ae563d1a1e..3b1efdad2e 100644 --- a/bsp/nuvoton/libraries/nuc980/rtt_port/drv_usbd.c +++ b/bsp/nuvoton/libraries/nuc980/rtt_port/drv_usbd.c @@ -7,6 +7,7 @@ * Change Logs: * Date Author Notes * 2020-12-25 Wayne First version +* 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t * ******************************************************************************/ @@ -437,7 +438,7 @@ __STATIC_INLINE void nu_buffer_cpy(rt_uint8_t address, void *buffer, rt_size_t s } } -static rt_size_t _ep_read(rt_uint8_t address, void *buffer) +static rt_ssize_t _ep_read(rt_uint8_t address, void *buffer) { rt_size_t size = 0; @@ -465,7 +466,7 @@ static rt_size_t _ep_read(rt_uint8_t address, void *buffer) return size; } -static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT(!(address & USB_DIR_IN)); @@ -497,7 +498,7 @@ static rt_size_t _ep_read_prepare(rt_uint8_t address, void *buffer, rt_size_t si return size; } -static rt_size_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) +static rt_ssize_t _ep_write(rt_uint8_t address, void *buffer, rt_size_t size) { RT_ASSERT((address & USB_DIR_IN)); diff --git a/components/drivers/include/drivers/usb_device.h b/components/drivers/include/drivers/usb_device.h index 42636a939f..db737afaf7 100644 --- a/components/drivers/include/drivers/usb_device.h +++ b/components/drivers/include/drivers/usb_device.h @@ -9,6 +9,7 @@ * 2012-12-12 heyuanjie87 change endpoint and function handler * 2013-04-26 aozima add DEVICEQUALIFIER support. * 2017-11-15 ZYH fix ep0 transform error + * 2023-10-11 ChuShicheng change rt_size_t to rt_ssize_t */ #ifndef __USB_DEVICE_H__ @@ -86,9 +87,9 @@ struct udcd_ops rt_err_t (*ep_clear_stall)(rt_uint8_t address); rt_err_t (*ep_enable)(struct uendpoint* ep); rt_err_t (*ep_disable)(struct uendpoint* ep); - rt_size_t (*ep_read_prepare)(rt_uint8_t address, void *buffer, rt_size_t size); - rt_size_t (*ep_read)(rt_uint8_t address, void *buffer); - rt_size_t (*ep_write)(rt_uint8_t address, void *buffer, rt_size_t size); + rt_ssize_t (*ep_read_prepare)(rt_uint8_t address, void *buffer, rt_size_t size); + rt_ssize_t (*ep_read)(rt_uint8_t address, void *buffer); + rt_ssize_t (*ep_write)(rt_uint8_t address, void *buffer, rt_size_t size); rt_err_t (*ep0_send_status)(void); rt_err_t (*suspend)(void); rt_err_t (*wakeup)(void);