usbh_ctrl.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*!
  2. \file usbh_ctrl.h
  3. \brief header file for usbh_ctrl.c
  4. */
  5. /*
  6. Copyright (C) 2017 GigaDevice
  7. 2017-02-10, V1.0.0, firmware for GD32F30x
  8. */
  9. #ifndef USBH_CTRL_H
  10. #define USBH_CTRL_H
  11. #include "usbh_core.h"
  12. #include "usbh_usr.h"
  13. #define CTRL_HANDLE_TABLE_SIZE 13U /*!< the ctrl handle table size define */
  14. extern state_table_struct ctrl_handle_table[CTRL_HANDLE_TABLE_SIZE];
  15. extern uint8_t ctrl_polling_handle_flag;
  16. /* the enum of CTRL event */
  17. typedef enum
  18. {
  19. CTRL_EVENT_IDLE = 0, /* the ctrl idle event */
  20. CTRL_EVENT_SETUP, /* the ctrl setup event */
  21. CTRL_EVENT_DATA, /* the ctrl data event */
  22. CTRL_EVENT_STATUS, /* the ctrl status event */
  23. CTRL_EVENT_COMPLETE, /* the ctrl complete event */
  24. CTRL_EVENT_ERROR, /* the ctrl error event */
  25. CTRL_EVENT_STALLED, /* the ctrl stalled event */
  26. }ctrl_event_enum;
  27. /* function declarations */
  28. /* the polling function of control transfer state handle */
  29. usbh_status_enum ctrl_state_polling_fun (usb_core_handle_struct *pudev, usbh_host_struct *puhost, void *pustate);
  30. /* send datas from the host channel */
  31. usbh_status_enum usbh_xfer (usb_core_handle_struct *pudev, uint8_t *buf, uint8_t hc_num, uint16_t len);
  32. /* send the setup packet to the device */
  33. usbh_status_enum usbh_ctltx_setup (usb_core_handle_struct *pudev, uint8_t *buf, uint8_t hc_num);
  34. /* this function prepare a hc and start a transfer */
  35. uint32_t hcd_submit_request (usb_core_handle_struct *pudev, uint8_t channel_num);
  36. #endif /* USBH_CTRL_H */