1
0

usbh_hcs.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*!
  2. \file usbh_hcs.h
  3. \brief header file for usbh_hcs.c
  4. \version 2014-12-26, V1.0.0, firmware for GD32F10x
  5. \version 2017-06-20, V2.0.0, firmware for GD32F10x
  6. \version 2018-07-31, V2.1.0, firmware for GD32F10x
  7. */
  8. /*
  9. Copyright (c) 2018, GigaDevice Semiconductor Inc.
  10. All rights reserved.
  11. Redistribution and use in source and binary forms, with or without modification,
  12. are permitted provided that the following conditions are met:
  13. 1. Redistributions of source code must retain the above copyright notice, this
  14. list of conditions and the following disclaimer.
  15. 2. Redistributions in binary form must reproduce the above copyright notice,
  16. this list of conditions and the following disclaimer in the documentation
  17. and/or other materials provided with the distribution.
  18. 3. Neither the name of the copyright holder nor the names of its contributors
  19. may be used to endorse or promote products derived from this software without
  20. specific prior written permission.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  22. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  23. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  25. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  27. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  30. OF SUCH DAMAGE.
  31. */
  32. #ifndef USBH_HCS_H
  33. #define USBH_HCS_H
  34. #include "usbh_core.h"
  35. /* constants definitions */
  36. #define HC_MAX 8U
  37. #define HC_OK 0x0000U
  38. #define HC_USED 0x8000U
  39. #define HC_ERROR 0xFFFFU
  40. #define HC_USED_MASK 0x7FFFU
  41. /* function declarations */
  42. /* allocate a new channel for the pipe */
  43. uint8_t usbh_channel_alloc (usb_core_handle_struct *pudev, uint8_t ep_addr);
  44. /* free all usb host channel */
  45. uint8_t usbh_allchannel_dealloc (usb_core_handle_struct *pudev);
  46. /* free the usb host channel */
  47. uint8_t usbh_channel_free (usb_core_handle_struct *pudev, uint8_t index);
  48. /* open a channel */
  49. uint8_t usbh_channel_open (usb_core_handle_struct *pudev,
  50. uint8_t channel_num,
  51. uint8_t dev_addr,
  52. uint8_t dev_speed,
  53. uint8_t ep_type,
  54. uint16_t ep_mps);
  55. /* modify a channel */
  56. uint8_t usbh_channel_modify (usb_core_handle_struct *pudev,
  57. uint8_t channel_num,
  58. uint8_t dev_addr,
  59. uint8_t dev_speed,
  60. uint8_t ep_type,
  61. uint16_t ep_mps);
  62. #endif /* USBH_HCS_H */