mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
Cleanup of USB drivers for AT32F4 (#12441)
* Cleanup of USB drivers for AT32F4 * F4 has different directories
This commit is contained in:
parent
deeebb4c1c
commit
c224c075f8
31 changed files with 53 additions and 7458 deletions
|
@ -138,6 +138,7 @@ void usbd_core_out_handler(usbd_core_type *udev, uint8_t ept_addr)
|
|||
*/
|
||||
void usbd_core_setup_handler(usbd_core_type *udev, uint8_t ept_num)
|
||||
{
|
||||
UNUSED(ept_num);
|
||||
/* setup parse */
|
||||
usbd_setup_request_parse(&udev->setup, udev->setup_buffer);
|
||||
|
||||
|
@ -745,6 +746,7 @@ usb_sts_type usbd_core_init(usbd_core_type *udev,
|
|||
usbd_desc_handler *desc_handler,
|
||||
uint8_t core_id)
|
||||
{
|
||||
UNUSED(core_id);
|
||||
usb_reg_type *usbx;
|
||||
otg_device_type *dev;
|
||||
otg_eptin_type *ept_in;
|
||||
|
|
|
@ -502,6 +502,7 @@ usb_sts_type usbh_core_init(usbh_core_type *uhost,
|
|||
usbh_user_handler_type *user_handler,
|
||||
uint8_t core_id)
|
||||
{
|
||||
UNUSED(core_id);
|
||||
usb_sts_type status = USB_OK;
|
||||
uint32_t i_index;
|
||||
otg_global_type *usbx = usb_reg;
|
||||
|
@ -552,8 +553,8 @@ usb_sts_type usbh_core_init(usbh_core_type *uhost,
|
|||
|
||||
if(usbx == OTG1_GLOBAL)
|
||||
{
|
||||
/* set receive fifo size */
|
||||
usbx->grxfsiz = USBH_RX_FIFO_SIZE;
|
||||
/* set receive fifo size */
|
||||
usbx->grxfsiz = USBH_RX_FIFO_SIZE;
|
||||
|
||||
/* set non-periodic transmit fifo start address and depth */
|
||||
usbx->gnptxfsiz_ept0tx_bit.nptxfstaddr = USBH_RX_FIFO_SIZE;
|
||||
|
@ -566,8 +567,8 @@ usb_sts_type usbh_core_init(usbh_core_type *uhost,
|
|||
#ifdef OTG2_GLOBAL
|
||||
if(usbx == OTG2_GLOBAL)
|
||||
{
|
||||
/* set receive fifo size */
|
||||
usbx->grxfsiz = USBH2_RX_FIFO_SIZE;
|
||||
/* set receive fifo size */
|
||||
usbx->grxfsiz = USBH2_RX_FIFO_SIZE;
|
||||
|
||||
/* set non-periodic transmit fifo start address and depth */
|
||||
usbx->gnptxfsiz_ept0tx_bit.nptxfstaddr = USBH2_RX_FIFO_SIZE;
|
||||
|
@ -808,8 +809,6 @@ usb_sts_type usbh_enum_handler(usbh_core_type *uhost)
|
|||
if(usbh_ctrl_result_check(uhost, CONTROL_IDLE, ENUM_SET_ADDR) == USB_OK)
|
||||
{
|
||||
usbh_parse_dev_desc(uhost, uhost->rx_buffer, 18);
|
||||
USBH_DEBUG("VID: %xh", uhost->dev.dev_desc.idVendor);
|
||||
USBH_DEBUG("PID: %xh", uhost->dev.dev_desc.idProduct);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -818,7 +817,6 @@ usb_sts_type usbh_enum_handler(usbh_core_type *uhost)
|
|||
if(uhost->ctrl.state == CONTROL_IDLE)
|
||||
{
|
||||
uhost->dev.address = usbh_alloc_address();
|
||||
USBH_DEBUG("Set Address: %d", uhost->dev.address);
|
||||
usbh_set_address(uhost, uhost->dev.address);
|
||||
}
|
||||
if (usbh_ctrl_result_check(uhost, CONTROL_IDLE, ENUM_GET_CFG) == USB_OK)
|
||||
|
@ -1096,7 +1094,6 @@ static void usbh_wakeup(usbh_core_type *uhost)
|
|||
if(usbh_ctrl_result_check(uhost, CONTROL_IDLE, ENUM_IDLE) == USB_OK)
|
||||
{
|
||||
uhost->global_state = USBH_CLASS_REQUEST;
|
||||
USBH_DEBUG("Remote Wakeup");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ usb_sts_type usbh_ctrl_data_in_handler(usbh_core_type *uhost)
|
|||
*/
|
||||
usb_sts_type usbh_ctrl_data_in_wait_handler(usbh_core_type *uhost, uint32_t timeout)
|
||||
{
|
||||
UNUSED(timeout);
|
||||
usb_sts_type status = USB_OK;
|
||||
urb_sts_type urb_state;
|
||||
urb_state = uhost->urb_state[uhost->ctrl.hch_in];
|
||||
|
@ -260,6 +261,7 @@ usb_sts_type usbh_ctrl_data_out_handler(usbh_core_type *uhost)
|
|||
*/
|
||||
usb_sts_type usbh_ctrl_data_out_wait_handler(usbh_core_type *uhost, uint32_t timeout)
|
||||
{
|
||||
UNUSED(timeout);
|
||||
usb_sts_type status = USB_OK;
|
||||
urb_sts_type urb_state;
|
||||
urb_state = uhost->urb_state[uhost->ctrl.hch_out];
|
||||
|
@ -316,6 +318,7 @@ usb_sts_type usbh_ctrl_status_in_handler(usbh_core_type *uhost)
|
|||
*/
|
||||
usb_sts_type usbh_ctrl_status_in_wait_handler(usbh_core_type *uhost, uint32_t timeout)
|
||||
{
|
||||
UNUSED(timeout);
|
||||
usb_sts_type status = USB_OK;
|
||||
urb_sts_type urb_state;
|
||||
urb_state = uhost->urb_state[uhost->ctrl.hch_in];
|
||||
|
@ -369,6 +372,7 @@ usb_sts_type usbh_ctrl_status_out_handler(usbh_core_type *uhost)
|
|||
*/
|
||||
usb_sts_type usbh_ctrl_status_out_wait_handler(usbh_core_type *uhost, uint32_t timeout)
|
||||
{
|
||||
UNUSED(timeout);
|
||||
usb_sts_type status = USB_OK;
|
||||
urb_sts_type urb_state;
|
||||
urb_state = uhost->urb_state[uhost->ctrl.hch_out];
|
||||
|
@ -418,7 +422,6 @@ usb_sts_type usbh_ctrl_error_handler(usbh_core_type *uhost)
|
|||
uhost->ctrl.sts = CTRL_FAIL;
|
||||
uhost->global_state = USBH_ERROR_STATE;
|
||||
uhost->ctrl.err_cnt = 0;
|
||||
USBH_DEBUG("control error: **** Device No Response ****");
|
||||
status = USB_ERROR;
|
||||
}
|
||||
return status;
|
||||
|
@ -431,6 +434,7 @@ usb_sts_type usbh_ctrl_error_handler(usbh_core_type *uhost)
|
|||
*/
|
||||
usb_sts_type usbh_ctrl_stall_handler(usbh_core_type *uhost)
|
||||
{
|
||||
UNUSED(uhost);
|
||||
return USB_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
|
@ -441,6 +445,7 @@ usb_sts_type usbh_ctrl_stall_handler(usbh_core_type *uhost)
|
|||
*/
|
||||
usb_sts_type usbh_ctrl_complete_handler(usbh_core_type *uhost)
|
||||
{
|
||||
UNUSED(uhost);
|
||||
return USB_OK;
|
||||
}
|
||||
|
||||
|
@ -810,6 +815,8 @@ usb_sts_type usbh_get_configure_descriptor(usbh_core_type *uhost, uint16_t lengt
|
|||
usb_sts_type usbh_get_sting_descriptor(usbh_core_type *uhost, uint8_t string_id,
|
||||
uint8_t *buffer, uint16_t length)
|
||||
{
|
||||
UNUSED(buffer);
|
||||
|
||||
usb_sts_type status = USB_WAIT;
|
||||
uint8_t bm_req;
|
||||
uint16_t wvalue;
|
||||
|
@ -941,6 +948,7 @@ usb_sts_type usbh_clear_dev_feature(usbh_core_type *uhost, uint8_t feature, uint
|
|||
*/
|
||||
usb_sts_type usbh_clear_ept_feature(usbh_core_type *uhost, uint8_t ept_num, uint8_t hc_num)
|
||||
{
|
||||
UNUSED(hc_num);
|
||||
usb_sts_type status = USB_WAIT;
|
||||
uint8_t bm_req;
|
||||
if(uhost->ctrl.state == CONTROL_IDLE )
|
||||
|
|
|
@ -191,6 +191,7 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
|
|||
*/
|
||||
static usb_sts_type class_ept0_tx_handler(void *udev)
|
||||
{
|
||||
UNUSED(udev);
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
/* ...user code... */
|
||||
|
@ -268,6 +269,7 @@ static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
|
|||
*/
|
||||
static usb_sts_type class_sof_handler(void *udev)
|
||||
{
|
||||
UNUSED(udev);
|
||||
usb_sts_type status = USB_OK;
|
||||
|
||||
/* ...user code... */
|
||||
|
@ -283,6 +285,7 @@ static usb_sts_type class_sof_handler(void *udev)
|
|||
*/
|
||||
static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
|
||||
{
|
||||
UNUSED(udev);
|
||||
usb_sts_type status = USB_OK;
|
||||
switch(event)
|
||||
{
|
||||
|
@ -391,6 +394,7 @@ error_status usb_vcp_send_data(void *udev, uint8_t *send_data, uint16_t len)
|
|||
*/
|
||||
static void usb_vcp_cmd_process(void *udev, uint8_t cmd, uint8_t *buff, uint16_t len)
|
||||
{
|
||||
UNUSED(len);
|
||||
usbd_core_type *pudev = (usbd_core_type *)udev;
|
||||
cdc_struct_type *pcdc = (cdc_struct_type *)pudev->class_handler->pdata;
|
||||
switch(cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue