1 /** 2 ************************************************************************** 3 * @file usb_core.h 4 * @brief usb core header file 5 ************************************************************************** 6 * Copyright notice & Disclaimer 7 * 8 * The software Board Support Package (BSP) that is made available to 9 * download from Artery official website is the copyrighted work of Artery. 10 * Artery authorizes customers to use, copy, and distribute the BSP 11 * software and its related documentation for the purpose of design and 12 * development in conjunction with Artery microcontrollers. Use of the 13 * software is governed by this copyright notice and the following disclaimer. 14 * 15 * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES, 16 * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS, 17 * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR 18 * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS, 19 * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. 21 * 22 ************************************************************************** 23 */ 24 25 /* define to prevent recursive inclusion -------------------------------------*/ 26 #ifndef __USB_CORE_H 27 #define __USB_CORE_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #include "usb_std.h" 34 35 #ifdef USE_OTG_DEVICE_MODE 36 #include "usbd_core.h" 37 #endif 38 #ifdef USE_OTG_HOST_MODE 39 #include "usbh_core.h" 40 #endif 41 42 /** @addtogroup USB_drivers_core 43 * @{ 44 */ 45 46 /** @defgroup USB_core_exported_types 47 * @{ 48 */ 49 50 /** 51 * @brief usb core speed select 52 */ 53 typedef enum 54 { 55 USB_HIGH_SPEED_CORE_ID, /*!< usb low speed core id */ 56 USB_FULL_SPEED_CORE_ID, /*!< usb full speed core id */ 57 USB_LOW_SPEED_CORE_ID /*!< usb high speed core id */ 58 } usb_speed_type; 59 60 /** 61 * @brief usb core cofig struct 62 */ 63 typedef struct 64 { 65 uint8_t speed; /*!< otg speed */ 66 uint8_t dma_en; /*!< dma enable state, not use*/ 67 uint8_t hc_num; /*!< the otg host support number of channel */ 68 uint8_t ept_num; /*!< the otg device support number of endpoint */ 69 70 uint16_t max_size; /*!< support max packet size */ 71 uint16_t fifo_size; /*!< the usb otg total file size */ 72 uint8_t phy_itface; /*!< usb phy select */ 73 uint8_t core_id; /*!< the usb otg core id */ 74 uint8_t low_power; /*!< the usb otg low power option */ 75 uint8_t sof_out; /*!< the sof signal output */ 76 uint8_t usb_id; /*!< select otgfs1 or otgfs2 */ 77 uint8_t vbusig; /*!< vbus ignore */ 78 } usb_core_cfg; 79 80 /** 81 * @brief usb otg core struct type 82 */ 83 typedef struct 84 { 85 usb_reg_type *usb_reg; /*!< the usb otg register type */ 86 #ifdef USE_OTG_DEVICE_MODE 87 usbd_core_type dev; /*!< the usb device core type */ 88 #endif 89 90 #ifdef USE_OTG_HOST_MODE 91 usbh_core_type host; /*!< the usb host core type */ 92 #endif 93 94 usb_core_cfg cfg; /*!< the usb otg core config type */ 95 96 } otg_core_type; 97 98 usb_sts_type usb_core_config(otg_core_type *otgdev, uint8_t core_id); 99 #ifdef USE_OTG_DEVICE_MODE 100 usb_sts_type usbd_init(otg_core_type *udev, 101 uint8_t core_id, uint8_t usb_id); 102 #endif 103 104 #ifdef USE_OTG_HOST_MODE 105 usb_sts_type usbh_init(otg_core_type *hdev, 106 uint8_t core_id, uint8_t usb_id); 107 #endif 108 109 /** 110 * @} 111 */ 112 113 /** 114 * @} 115 */ 116 117 #ifdef __cplusplus 118 } 119 #endif 120 121 #endif 122 123