update version to v2.0.4

This commit is contained in:
Artery-MCU
2022-04-11 19:32:28 +08:00
parent 07d7347ba4
commit ccd0f1e108
1470 changed files with 213761 additions and 13939 deletions

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usb_core.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb core header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -31,12 +31,12 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "usb_std.h"
#include "usb_conf.h"
#ifdef USE_OTG_DEVICE_MODE
#ifdef USE_OTG_DEVICE_MODE
#include "usbd_core.h"
#endif
#ifdef USE_OTG_HOST_MODE
@@ -46,7 +46,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usb_drivers
* @{
*/
/** @addtogroup USB_drivers_core
* @{
*/
@@ -74,7 +74,7 @@ typedef struct
uint8_t dma_en; /*!< dma enable state, not use*/
uint8_t hc_num; /*!< the otg host support number of channel */
uint8_t ept_num; /*!< the otg device support number of endpoint */
uint16_t max_size; /*!< support max packet size */
uint16_t fifo_size; /*!< the usb otg total file size */
uint8_t phy_itface; /*!< usb phy select */
@@ -82,7 +82,7 @@ typedef struct
uint8_t low_power; /*!< the usb otg low power option */
uint8_t sof_out; /*!< the sof signal output */
uint8_t usb_id; /*!< select otgfs1 or otgfs2 */
uint8_t vbusig; /*!< ignore vbus detection, only available in at32f415xx revision C.
at32f415xx revision B: (not support)
the vbus detection pin (pa9) can not be used for other functionality.
@@ -91,7 +91,7 @@ typedef struct
at32f415xx revision C: (support)
ignore vbus detection, the internal vbus is always valid.
the vbus pin (pa9) can be used for other functionality.
*/
*/
} usb_core_cfg;
/**
@@ -100,43 +100,43 @@ typedef struct
typedef struct
{
usb_reg_type *usb_reg; /*!< the usb otg register type */
#ifdef USE_OTG_DEVICE_MODE
#ifdef USE_OTG_DEVICE_MODE
usbd_core_type dev; /*!< the usb device core type */
#endif
#ifdef USE_OTG_HOST_MODE
#ifdef USE_OTG_HOST_MODE
usbh_core_type host; /*!< the usb host core type */
#endif
usb_core_cfg cfg; /*!< the usb otg core config type */
} otg_core_type;
usb_sts_type usb_core_config(otg_core_type *otgdev, uint8_t core_id);
#ifdef USE_OTG_DEVICE_MODE
usb_sts_type usbd_init(otg_core_type *udev,
uint8_t core_id, uint8_t usb_id,
#ifdef USE_OTG_DEVICE_MODE
usb_sts_type usbd_init(otg_core_type *udev,
uint8_t core_id, uint8_t usb_id,
usbd_class_handler *class_handler,
usbd_desc_handler *desc_handler);
#endif
#ifdef USE_OTG_HOST_MODE
usb_sts_type usbh_init(otg_core_type *hdev,
uint8_t core_id, uint8_t usb_id,
#ifdef USE_OTG_HOST_MODE
usb_sts_type usbh_init(otg_core_type *hdev,
uint8_t core_id, uint8_t usb_id,
usbh_class_handler_type *class_handler,
usbh_user_handler_type *user_handler);
#endif
/**
* @}
*/
*/
/**
* @}
*/
/**
* @}
*/
*/
#ifdef __cplusplus
}
#endif

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usb_std.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb standard header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -39,7 +39,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usb_drivers
* @{
*/
/** @addtogroup USB_standard
* @{
*/
@@ -130,7 +130,7 @@ typedef enum
USB_CONN_STATE_ADDRESSED, /*!< usb device connect state address */
USB_CONN_STATE_CONFIGURED, /*!< usb device connect state configured */
USB_CONN_STATE_SUSPENDED /*!< usb device connect state suspend */
}usbd_conn_state;
}usbd_conn_state;
/**
* @brief endpoint 0 state
@@ -141,7 +141,7 @@ typedef enum
#define USB_EPT0_DATA_OUT 3 /*!< usb endpoint state data out */
#define USB_EPT0_STATUS_IN 4 /*!< usb endpoint state status in */
#define USB_EPT0_STATUS_OUT 5 /*!< usb endpoint state status out */
#define USB_EPT0_STALL 6 /*!< usb endpoint state stall */
#define USB_EPT0_STALL 6 /*!< usb endpoint state stall */
/**
* @brief usb descriptor length
@@ -209,7 +209,7 @@ typedef enum
/**
* @brief usb cdc class set line coding struct
*/
typedef struct
typedef struct
{
uint32_t bitrate; /* line coding baud rate */
uint8_t format; /* line coding foramt */
@@ -272,7 +272,7 @@ typedef enum
}usb_sts_type;
/**
/**
* @brief format of usb setup data
*/
typedef struct
@@ -280,12 +280,12 @@ typedef struct
uint8_t bmRequestType; /*!< characteristics of request */
uint8_t bRequest; /*!< specific request */
uint16_t wValue; /*!< word-sized field that varies according to request */
uint16_t wIndex; /*!< word-sized field that varies according to request
uint16_t wIndex; /*!< word-sized field that varies according to request
typically used to pass an index or offset */
uint16_t wLength; /*!< number of bytes to transfer if there is a data stage */
} usb_setup_type;
/**
/**
* @brief format of standard device descriptor
*/
typedef struct
@@ -306,28 +306,28 @@ typedef struct
uint8_t bNumConfigurations; /*!< number of possible configurations */
} usb_device_desc_type;
/**
/**
* @brief format of standard configuration descriptor
*/
typedef struct
{
uint8_t bLength; /*!< size of this descriptor in bytes */
uint8_t bDescriptorType; /*!< configuration descriptor type */
uint8_t bDescriptorType; /*!< configuration descriptor type */
uint16_t wTotalLength; /*!< total length of data returned for this configuration */
uint8_t bNumInterfaces; /*!< number of interfaces supported by this configuration */
uint8_t bConfigurationValue; /*!< value to use as an argument to the SetConfiguration() request */
uint8_t iConfiguration; /*!< index of string descriptor describing this configuration */
uint8_t bmAttributes; /*!< configuration characteristics
uint8_t bmAttributes; /*!< configuration characteristics
D7 reserved
D6 self-powered
D5 remote wakeup
D4~D0 reserved */
D4~D0 reserved */
uint8_t bMaxPower; /*!< maximum power consumption of the usb device from the bus */
}usb_configuration_desc_type;
/**
/**
* @brief format of standard interface descriptor
*/
typedef struct
@@ -336,14 +336,14 @@ typedef struct
uint8_t bDescriptorType; /*!< interface descriptor type */
uint8_t bInterfaceNumber; /*!< number of this interface */
uint8_t bAlternateSetting; /*!< value used to select this alternate setting for the interface */
uint8_t bNumEndpoints; /*!< number of endpoints used by this interface */
uint8_t bNumEndpoints; /*!< number of endpoints used by this interface */
uint8_t bInterfaceClass; /*!< class code (assigned by the usb-if) */
uint8_t bInterfaceSubClass; /*!< subclass code (assigned by the usb-if) */
uint8_t bInterfaceProtocol; /*!< protocol code (assigned by the usb-if) */
uint8_t iInterface; /*!< index of string descriptor describing this interface */
} usb_interface_desc_type;
/**
/**
* @brief format of standard endpoint descriptor
*/
typedef struct
@@ -353,10 +353,10 @@ typedef struct
uint8_t bEndpointAddress; /*!< the address of the endpoint on the usb device described by this descriptor */
uint8_t bmAttributes; /*!< describes the endpoints attributes when it is configured using bConfiguration value */
uint16_t wMaxPacketSize; /*!< maximum packet size this endpoint */
uint8_t bInterval; /*!< interval for polling endpoint for data transfers */
uint8_t bInterval; /*!< interval for polling endpoint for data transfers */
} usb_endpoint_desc_type;
/**
/**
* @brief format of header
*/
typedef struct
@@ -373,7 +373,7 @@ typedef struct
/**
* @}
*/
/**
* @}
*/

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usbd_core.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb device core header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -39,7 +39,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usbd_drivers
* @{
*/
/** @addtogroup USBD_drivers_core
* @{
*/
@@ -66,7 +66,7 @@ typedef enum
}usbd_event_type;
/**
* @brief usb device descriptor struct
* @brief usb device descriptor struct
*/
typedef struct
{
@@ -75,7 +75,7 @@ typedef struct
}usbd_desc_t;
/**
* @brief usb device descriptor handler
* @brief usb device descriptor handler
*/
typedef struct
{
@@ -114,23 +114,23 @@ typedef struct
typedef struct
{
usb_reg_type *usb_reg; /*!< usb register pointer */
usbd_class_handler *class_handler; /*!< usb device class handler pointer */
usbd_desc_handler *desc_handler; /*!< usb device descriptor handler pointer */
usb_ept_info ept_in[USB_EPT_MAX_NUM]; /*!< usb in endpoint infomation struct */
usb_ept_info ept_out[USB_EPT_MAX_NUM]; /*!< usb out endpoint infomation struct */
usb_setup_type setup; /*!< usb setup type struct */
uint8_t setup_buffer[12]; /*!< usb setup request buffer */
uint8_t ept0_sts; /*!< usb control endpoint 0 state */
uint8_t speed; /*!< usb speed */
uint16_t ept0_wlength; /*!< usb endpoint 0 transfer length */
usbd_conn_state conn_state; /*!< usb current connect state */
usbd_conn_state old_conn_state; /*!< usb save the previous connect state */
uint8_t device_addr; /*!< device address */
uint8_t remote_wakup; /*!< remote wakeup state */
uint8_t default_config; /*!< usb default config state */
@@ -162,20 +162,20 @@ void usbd_remote_wakeup(usbd_core_type *udev);
void usbd_enter_suspend(usbd_core_type *udev);
void usbd_flush_tx_fifo(usbd_core_type *udev, uint8_t ept_num);
void usbd_fifo_alloc(usbd_core_type *udev);
usb_sts_type usbd_core_init(usbd_core_type *udev,
usb_sts_type usbd_core_init(usbd_core_type *udev,
usb_reg_type *usb_reg,
usbd_class_handler *class_handler,
usbd_desc_handler *desc_handler,
usbd_desc_handler *desc_handler,
uint8_t core_id);
#endif
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usbd_int.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb interrupt header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -35,7 +35,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usbd_drivers
* @{
*/
/** @addtogroup USBD_drivers_int
* @{
*/
@@ -64,11 +64,11 @@ void usb_write_empty_txfifo(usbd_core_type *udev, uint32_t ept_num);
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usb_sdr.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -39,7 +39,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usbd_drivers
* @{
*/
/** @addtogroup USBD_drivers_standard_request
* @{
*/
@@ -57,11 +57,11 @@ usb_sts_type usbd_endpoint_request(usbd_core_type *udev);
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usbh_core.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb host core header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -38,7 +38,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usbh_drivers
* @{
*/
/** @addtogroup USBH_drivers_core
* @{
*/
@@ -234,7 +234,7 @@ typedef struct
/**
* @brief usb host control struct type
*/
typedef struct
typedef struct
{
uint8_t hch_in; /*!< in channel number */
uint8_t hch_out; /*!< out channel number */
@@ -285,24 +285,24 @@ typedef struct
typedef struct
{
usb_reg_type *usb_reg; /*!< usb register pointer */
uint8_t global_state; /*!< usb host global state machine */
uint8_t enum_state; /*!< usb host enumeration state machine */
uint8_t req_state; /*!< usb host request state machine */
usbh_dev_desc_type dev; /*!< usb device descriptor */
usbh_ctrl_type ctrl; /*!< usb host control transfer struct */
usbh_class_handler_type *class_handler; /*!< usb host class handler pointer */
usbh_user_handler_type *user_handler; /*!< usb host user handler pointer */
usb_hch_type hch[USB_HOST_CHANNEL_NUM]; /*!< usb host channel array */
uint8_t rx_buffer[USB_MAX_DATA_LENGTH]; /*!< usb host rx buffer */
uint32_t conn_sts; /*!< connect status */
uint32_t conn_sts; /*!< connect status */
uint32_t port_enable; /*!< port enable status */
uint32_t timer; /*!< sof timer */
uint32_t err_cnt[USB_HOST_CHANNEL_NUM]; /*!< error counter */
uint32_t xfer_cnt[USB_HOST_CHANNEL_NUM]; /*!< xfer counter */
hch_sts_type hch_state[USB_HOST_CHANNEL_NUM];/*!< channel state */
@@ -333,8 +333,8 @@ void usbh_resume(usbh_core_type *uhost);
uint16_t usbh_alloc_channel(usbh_core_type *uhost, uint8_t ept_addr);
urb_sts_type usbh_get_urb_status(usbh_core_type *uhost, uint8_t ch_num);
usb_sts_type usbh_ctrl_result_check(usbh_core_type *uhost,
ctrl_ept0_sts_type next_ctrl_state,
usb_sts_type usbh_ctrl_result_check(usbh_core_type *uhost,
ctrl_ept0_sts_type next_ctrl_state,
uint8_t next_enum_state);
uint8_t usbh_alloc_address(void);
void usbh_reset_port(usbh_core_type *uhost);
@@ -342,10 +342,10 @@ usb_sts_type usbh_loop_handler(usbh_core_type *uhost);
void usbh_ch_disable(usbh_core_type *uhost, uint8_t chn);
void usbh_hc_open(usbh_core_type *uhost,
uint8_t chn,
uint8_t ept_num,
uint8_t ept_num,
uint8_t dev_address,
uint8_t type,
uint16_t maxpacket,
uint8_t type,
uint16_t maxpacket,
uint8_t speed);
void usbh_active_vbus(usbh_core_type *uhost, confirm_state state);
@@ -359,11 +359,11 @@ usb_sts_type usbh_core_init(usbh_core_type *uhost,
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usbh_ctrl.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -40,7 +40,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usbh_drivers
* @{
*/
/** @addtogroup USBH_drivers_control
* @{
*/
@@ -93,11 +93,11 @@ usb_sts_type usbh_clear_ept_feature(usbh_core_type *uhost, uint8_t ept_num, uint
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}

View File

@@ -1,17 +1,17 @@
/**
**************************************************************************
* @file usbh_int.h
* @version v2.0.3
* @date 2022-02-11
* @version v2.0.4
* @date 2022-04-02
* @brief usb header file
**************************************************************************
* Copyright notice & Disclaimer
*
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* The software Board Support Package (BSP) that is made available to
* download from Artery official website is the copyrighted work of Artery.
* Artery authorizes customers to use, copy, and distribute the BSP
* software and its related documentation for the purpose of design and
* development in conjunction with Artery microcontrollers. Use of the
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
@@ -35,7 +35,7 @@ extern "C" {
/** @addtogroup AT32F415_middlewares_usbh_drivers
* @{
*/
/** @addtogroup USBH_drivers_int
* @{
*/
@@ -59,11 +59,11 @@ void usbh_sof_handler(usbh_core_type *uhost);
/**
* @}
*/
*/
/**
* @}
*/
*/
/**
* @}