mirror of
https://github.com/ArteryTek/AT32F413_Firmware_Library.git
synced 2026-05-21 09:22:02 +00:00
update version to v2.0.4
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_codec.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief audio codec 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,20 +31,20 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413.h"
|
||||
|
||||
/** @defgroup USB_device_audio_codec_reg_definition
|
||||
/** @defgroup USB_device_audio_codec_reg_definition
|
||||
* @{
|
||||
*/
|
||||
#define WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
|
||||
@@ -97,7 +97,7 @@ extern "C" {
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_device_audio_codec_pin_definition
|
||||
/** @defgroup USB_device_audio_codec_pin_definition
|
||||
* @{
|
||||
*/
|
||||
#define I2S1_WS_PIN GPIO_PINS_4
|
||||
@@ -143,7 +143,7 @@ typedef struct
|
||||
uint16_t spk_threshold;
|
||||
uint16_t spk_calc;
|
||||
uint8_t spk_stage;
|
||||
|
||||
|
||||
//mic part
|
||||
uint16_t mic_buffer[MIC_BUFFER_SIZE];
|
||||
uint16_t *mic_roff;
|
||||
@@ -156,19 +156,19 @@ typedef struct
|
||||
uint16_t mic_adj_count;
|
||||
uint8_t mic_adj_stage;
|
||||
uint8_t mic_stage;
|
||||
|
||||
|
||||
uint8_t mic_mute;
|
||||
uint8_t spk_mute;
|
||||
|
||||
|
||||
uint16_t mic_volume;
|
||||
uint16_t spk_volume;
|
||||
|
||||
|
||||
uint32_t spk_tx_size;
|
||||
uint32_t mic_rx_size;
|
||||
|
||||
|
||||
uint32_t spk_enable;
|
||||
uint32_t mic_enable;
|
||||
|
||||
|
||||
}audio_codec_type;
|
||||
|
||||
error_status audio_codec_init(void);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,11 +102,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_codec.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief audio codec function
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -33,25 +33,25 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#define I2C_TIMEOUT 0xFFFFFFFF
|
||||
|
||||
|
||||
#define I2Cx_SPEED 100000
|
||||
#define I2Cx_ADDRESS 0x00
|
||||
|
||||
#define I2Cx_PORT I2C1
|
||||
#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
|
||||
|
||||
#define I2Cx_SCL_PIN GPIO_PINS_8
|
||||
#define I2Cx_SCL_GPIO_PORT GPIOB
|
||||
#define I2Cx_SCL_PIN GPIO_PINS_8
|
||||
#define I2Cx_SCL_GPIO_PORT GPIOB
|
||||
#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
|
||||
|
||||
#define I2Cx_SDA_PIN GPIO_PINS_9
|
||||
#define I2Cx_SDA_GPIO_PORT GPIOB
|
||||
#define I2Cx_SDA_PIN GPIO_PINS_9
|
||||
#define I2Cx_SDA_GPIO_PORT GPIOB
|
||||
#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ uint16_t reg_addr_data[] =
|
||||
(WM8988_R0_LEFT_INPUT_VOLUME << 9) | 0x012F, /*Left Input Channel Volume*/
|
||||
(WM8988_R1_RIGHT_INPUT_VOLUME << 9) | 0x012F, /*Right Input Channel Volume*/
|
||||
(WM8988_R2_LOUT1_VOLUME << 9) | 0x0179, /*Left Output Channel Volume*/
|
||||
(WM8988_R3_ROUT1_VOLUME << 9) | 0x0179, /*Right Output Channel Volume*/
|
||||
(WM8988_R3_ROUT1_VOLUME << 9) | 0x0179, /*Right Output Channel Volume*/
|
||||
(WM8988_R5_ADC_DAC_CONTROL << 9) | 0x0006, /*De-emphasis Control and Digital soft mute*/
|
||||
(WM8988_REG_BITW16),
|
||||
(WM8988_REG_FREQ16K),
|
||||
@@ -83,12 +83,12 @@ uint16_t reg_addr_data[] =
|
||||
(WM8988_R13_TREBLE_CONTROL << 9) | 0x000F, /*Treble Control*/
|
||||
(WM8988_R16_3D_CONTROL << 9) | 0x0000, /*3D stereo Enhancment*/
|
||||
(WM8988_R21_LEFT_ADC_VOLUME << 9) | 0x01C3, /*Left ADC Digital Volume*/
|
||||
(WM8988_R22_RIGHT_ADC_VOLUME << 9) | 0x01C3, /*Right ADC Digital Volume*/
|
||||
(WM8988_R22_RIGHT_ADC_VOLUME << 9) | 0x01C3, /*Right ADC Digital Volume*/
|
||||
(WM8988_R23_ADDITIONAL_1_CONTROL << 9) | 0x00C2, /*Additional Control 1*/
|
||||
(WM8988_R24_ADDITIONAL_2_CONTROL << 9) | 0x0000, /*Additional Control 2*/
|
||||
(WM8988_R27_ADDITIONAL_3_CONTROL << 9) | 0x0000, /*Additional Control 3*/
|
||||
(WM8988_R31_ADC_INPUT_MODE << 9) | 0x0000, /*ADC input mode*/
|
||||
(WM8988_R32_ADC_L_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control left*/
|
||||
(WM8988_R32_ADC_L_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control left*/
|
||||
(WM8988_R33_ADC_R_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control right*/
|
||||
(WM8988_R34_LEFT_OUT_MIX_1 << 9) | 0x0152, /*Left DAC mixer Control*/
|
||||
(WM8988_R35_LEFT_OUT_MIX_2 << 9) | 0x0050, /*Left DAC mixer Control*/
|
||||
@@ -98,7 +98,7 @@ uint16_t reg_addr_data[] =
|
||||
(WM8988_R41_ROUT2_VOLUME << 9) | 0x01FF, /*Output left channel volume*/
|
||||
(WM8988_R43_LOW_POWER_PALYBACK << 9) | 0x0008, /*Output left channel volume*/
|
||||
(WM8988_R25_PWR_1_MGMT << 9) | 0x017C, /*Power Management1*/
|
||||
(WM8988_R26_PWR_2_MGMT << 9) | 0x01F8, /*Power Management2*/
|
||||
(WM8988_R26_PWR_2_MGMT << 9) | 0x01F8, /*Power Management2*/
|
||||
};
|
||||
|
||||
i2c_handle_type hi2cx;
|
||||
@@ -245,7 +245,7 @@ void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
|
||||
{
|
||||
uint16_t ulen = len / 2, i;
|
||||
uint16_t *u16data = (uint16_t *)data;
|
||||
|
||||
|
||||
switch(audio_codec.spk_stage)
|
||||
{
|
||||
case 0:
|
||||
@@ -289,7 +289,7 @@ uint32_t audio_codec_mic_get_data(uint8_t *buffer)
|
||||
{
|
||||
case 0:
|
||||
audio_codec.mic_stage = 1;
|
||||
memset( buffer, 0, len );
|
||||
memset( buffer, 0, len );
|
||||
return len;
|
||||
case 1:
|
||||
if( audio_codec.mic_wtotal - audio_codec.mic_rtotal >= MIC_BUFFER_SIZE/2 )
|
||||
@@ -315,7 +315,7 @@ uint32_t audio_codec_mic_get_data(uint8_t *buffer)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for( i = 0; i < len/2; ++i )
|
||||
{
|
||||
*u16buf++ = *audio_codec.mic_roff++;
|
||||
@@ -399,32 +399,32 @@ void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len)
|
||||
void i2c_lowlevel_init(i2c_handle_type* hi2c)
|
||||
{
|
||||
gpio_init_type gpio_initstructure;
|
||||
|
||||
|
||||
if(hi2c->i2cx == I2Cx_PORT)
|
||||
{
|
||||
{
|
||||
/* i2c periph clock enable */
|
||||
crm_periph_clock_enable(I2Cx_CLK, TRUE);
|
||||
crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
|
||||
gpio_pin_remap_config(I2C1_MUX, TRUE);
|
||||
crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
|
||||
crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
|
||||
|
||||
/* gpio configuration */
|
||||
gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
|
||||
gpio_initstructure.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
|
||||
|
||||
/* gpio configuration */
|
||||
gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
|
||||
gpio_initstructure.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
||||
|
||||
/* configure i2c pins: scl */
|
||||
|
||||
/* configure i2c pins: scl */
|
||||
gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
|
||||
gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
|
||||
|
||||
/* configure i2c pins: sda */
|
||||
/* configure i2c pins: sda */
|
||||
gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
|
||||
gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
|
||||
|
||||
|
||||
i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
|
||||
|
||||
|
||||
i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
|
||||
}
|
||||
}
|
||||
@@ -439,22 +439,22 @@ void mclk_tmr1_init(void)
|
||||
gpio_init_type gpio_init_struct;
|
||||
tmr_output_config_type tmr_oc_init_structure;
|
||||
uint16_t prescaler_value = (uint16_t)(system_core_clock / 24000000) - 1;
|
||||
|
||||
|
||||
crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_8;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
|
||||
tmr_base_init(TMR1, 1, prescaler_value);
|
||||
tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
|
||||
tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
|
||||
|
||||
|
||||
tmr_output_default_para_init(&tmr_oc_init_structure);
|
||||
tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
|
||||
tmr_oc_init_structure.oc_idle_state = FALSE;
|
||||
@@ -468,11 +468,11 @@ void mclk_tmr1_init(void)
|
||||
tmr_counter_enable(TMR1, TRUE);
|
||||
tmr_output_enable(TMR1, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief audio codec i2s reset
|
||||
* @param none
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void codec_i2s_reset(void)
|
||||
@@ -495,24 +495,24 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
dma_init_type dma_init_struct;
|
||||
i2s_init_type i2s_init_struct;
|
||||
i2s_data_channel_format_type format = I2S_DATA_16BIT_CHANNEL_16BIT;
|
||||
|
||||
|
||||
crm_periph_clock_enable(I2S1_GPIO_CRM_CLK, TRUE);
|
||||
crm_periph_clock_enable(I2S2_GPIO_CRM_CLK, TRUE);
|
||||
crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
param->spk_freq = param->audio_freq;
|
||||
|
||||
|
||||
param->spk_tx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_SPK_CHANEL_NUM / 2;
|
||||
param->mic_rx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_MIC_CHANEL_NUM / 2;
|
||||
|
||||
|
||||
memset(param->spk_buffer, 0, SPK_BUFFER_SIZE*sizeof(uint16_t));
|
||||
memset(param->mic_buffer, 0, MIC_BUFFER_SIZE*sizeof(uint16_t));
|
||||
|
||||
|
||||
param->mic_wend = param->mic_woff = param->mic_roff = param->mic_buffer;
|
||||
param->spk_rend = param->spk_woff = param->spk_roff = param->spk_buffer;
|
||||
|
||||
|
||||
while(param->mic_wend < param->mic_buffer+MIC_BUFFER_SIZE)
|
||||
{
|
||||
param->mic_wend += param->mic_rx_size;
|
||||
@@ -532,48 +532,48 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
format = I2S_DATA_24BIT_CHANNEL_32BIT;
|
||||
}
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s1 ws pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S1_WS_PIN;
|
||||
gpio_init(I2S1_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s1 ck pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S1_CK_PIN;
|
||||
gpio_init(I2S1_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s1 sd pins slave tx */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = I2S1_SD_PIN;
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
||||
gpio_init(I2S1_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s2 ws pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S2_WS_PIN;
|
||||
gpio_init(I2S2_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s2 ck pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S2_CK_PIN;
|
||||
gpio_init(I2S2_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s2 sd pins slave rx */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S2_SD_PIN;
|
||||
gpio_init(I2S2_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* dma config */
|
||||
dma_reset(DMA1_CHANNEL3);
|
||||
dma_reset(DMA1_CHANNEL4);
|
||||
|
||||
|
||||
/* dma1 channel3: speaker i2s1 tx */
|
||||
dma_default_para_init(&dma_init_struct);
|
||||
dma_init_struct.buffer_size = param->spk_tx_size << 1;
|
||||
@@ -590,7 +590,7 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
dma_interrupt_enable(DMA1_CHANNEL3, DMA_FDT_INT, TRUE);
|
||||
dma_interrupt_enable(DMA1_CHANNEL3, DMA_HDT_INT, TRUE);
|
||||
nvic_irq_enable(DMA1_Channel3_IRQn, 1, 0);
|
||||
|
||||
|
||||
/* dma1 channel4: microphone i2s2 rx */
|
||||
dma_default_para_init(&dma_init_struct);
|
||||
dma_init_struct.buffer_size = param->mic_rx_size << 1;
|
||||
@@ -607,7 +607,7 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
dma_interrupt_enable(DMA1_CHANNEL4, DMA_FDT_INT, TRUE);
|
||||
dma_interrupt_enable(DMA1_CHANNEL4, DMA_HDT_INT, TRUE);
|
||||
nvic_irq_enable(DMA1_Channel4_IRQn, 2, 0);
|
||||
|
||||
|
||||
/* i2s1 tx init */
|
||||
spi_i2s_reset(SPI1);
|
||||
i2s_default_para_init(&i2s_init_struct);
|
||||
@@ -618,7 +618,7 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
|
||||
i2s_init_struct.operation_mode = I2S_MODE_SLAVE_TX;
|
||||
i2s_init(SPI1, &i2s_init_struct);
|
||||
|
||||
|
||||
/* i2s2 rx init */
|
||||
spi_i2s_reset(SPI2);
|
||||
i2s_default_para_init(&i2s_init_struct);
|
||||
@@ -629,16 +629,16 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
|
||||
i2s_init_struct.operation_mode = I2S_MODE_SLAVE_RX;
|
||||
i2s_init(SPI2, &i2s_init_struct);
|
||||
|
||||
|
||||
|
||||
spi_i2s_dma_transmitter_enable(SPI1, TRUE);
|
||||
spi_i2s_dma_receiver_enable(SPI2, TRUE);
|
||||
i2s_enable(SPI1, TRUE);
|
||||
i2s_enable(SPI2, TRUE);
|
||||
|
||||
|
||||
dma_channel_enable(DMA1_CHANNEL3, TRUE);
|
||||
dma_channel_enable(DMA1_CHANNEL4, TRUE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -650,7 +650,7 @@ void DMA1_Channel3_IRQHandler(void)
|
||||
{
|
||||
uint16_t half_size = audio_codec.spk_tx_size;
|
||||
uint16_t *pdst;
|
||||
|
||||
|
||||
if(dma_flag_get(DMA1_HDT3_FLAG) == SET)
|
||||
{
|
||||
//copy_buff(audio_codec.spk_buffer, audio_codec.spk_tx_fifo + audio_codec.r_pos, half_size);
|
||||
@@ -663,7 +663,7 @@ void DMA1_Channel3_IRQHandler(void)
|
||||
pdst = spk_dma_buffer + half_size;
|
||||
dma_flag_clear(DMA1_FDT3_FLAG);
|
||||
}
|
||||
|
||||
|
||||
switch( audio_codec.spk_stage )
|
||||
{
|
||||
case 0:
|
||||
@@ -713,7 +713,7 @@ void DMA1_Channel3_IRQHandler(void)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -725,7 +725,7 @@ void DMA1_Channel4_IRQHandler(void)
|
||||
{
|
||||
uint16_t *psrc;
|
||||
uint16_t len = audio_codec.mic_rx_size << 1;
|
||||
|
||||
|
||||
if(dma_flag_get(DMA1_HDT4_FLAG) == SET)
|
||||
{
|
||||
dma_flag_clear(DMA1_HDT4_FLAG);
|
||||
@@ -796,7 +796,7 @@ error_status audio_codec_init(void)
|
||||
uint32_t reg_len = sizeof(reg_addr_data) / sizeof(uint16_t);
|
||||
uint32_t i_index = 0;
|
||||
uint8_t i2c_cmd[2];
|
||||
|
||||
|
||||
if(AUDIO_DEFAULT_FREQ == AUDIO_FREQ_16K)
|
||||
{
|
||||
reg_addr_data[6] = WM8988_REG_FREQ16K;
|
||||
@@ -811,7 +811,7 @@ error_status audio_codec_init(void)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
if(AUDIO_DEFAULT_BITW == AUDIO_BITW_16)
|
||||
{
|
||||
reg_addr_data[5] = WM8988_REG_BITW16;
|
||||
@@ -821,12 +821,12 @@ error_status audio_codec_init(void)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* i2c init */
|
||||
hi2cx.i2cx = I2Cx_PORT;
|
||||
|
||||
|
||||
i2c_config(&hi2cx);
|
||||
|
||||
|
||||
for(i_index = 0; i_index < reg_len; i_index ++)
|
||||
{
|
||||
i2c_cmd[0] = (uint8_t)(reg_addr_data[i_index] >> 8);
|
||||
@@ -836,12 +836,12 @@ error_status audio_codec_init(void)
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* timer init */
|
||||
mclk_tmr1_init();
|
||||
|
||||
|
||||
codec_i2s_init(&audio_codec);
|
||||
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ error_status audio_codec_loop(void)
|
||||
uint16_t audio_ctrl_l;
|
||||
uint16_t audio_ctrl_r;
|
||||
uint8_t i2c_cmd[2];
|
||||
|
||||
|
||||
if(mic_mute != audio_codec.mic_mute)
|
||||
{
|
||||
mic_mute = audio_codec.mic_mute;
|
||||
@@ -883,7 +883,7 @@ error_status audio_codec_loop(void)
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(mic_volume != audio_codec.mic_volume)
|
||||
{
|
||||
mic_volume = audio_codec.mic_volume;
|
||||
@@ -902,9 +902,9 @@ error_status audio_codec_loop(void)
|
||||
if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(spk_mute != audio_codec.spk_mute)
|
||||
{
|
||||
spk_mute = audio_codec.spk_mute;
|
||||
@@ -916,7 +916,7 @@ error_status audio_codec_loop(void)
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(spk_volume != audio_codec.spk_volume)
|
||||
{
|
||||
spk_volume = audio_codec.spk_volume;
|
||||
@@ -924,10 +924,10 @@ error_status audio_codec_loop(void)
|
||||
audio_ctrl_r = WM8988_R3_ROUT1_VOLUME << 9 | 0x100;
|
||||
audio_ctrl_l |= audio_codec.spk_volume;
|
||||
audio_ctrl_r |= audio_codec.spk_volume;
|
||||
|
||||
|
||||
i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
|
||||
i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
|
||||
|
||||
|
||||
if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
|
||||
{
|
||||
return ERROR;
|
||||
@@ -937,14 +937,14 @@ error_status audio_codec_loop(void)
|
||||
if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_codec.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief audio codec 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,20 +31,20 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio_hid
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413.h"
|
||||
|
||||
/** @defgroup USB_device_audio_hid_codec_reg_definition
|
||||
/** @defgroup USB_device_audio_hid_codec_reg_definition
|
||||
* @{
|
||||
*/
|
||||
#define WM8988_R0_LEFT_INPUT_VOLUME 0x00 /*Left channel PGA control*/
|
||||
@@ -97,7 +97,7 @@ extern "C" {
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup USB_device_audio_hid_codec_pin_definition
|
||||
/** @defgroup USB_device_audio_hid_codec_pin_definition
|
||||
* @{
|
||||
*/
|
||||
#define I2S1_WS_PIN GPIO_PINS_4
|
||||
@@ -146,7 +146,7 @@ typedef struct
|
||||
uint16_t spk_threshold;
|
||||
uint16_t spk_calc;
|
||||
uint8_t spk_stage;
|
||||
|
||||
|
||||
//mic part
|
||||
uint16_t mic_buffer[MIC_BUFFER_SIZE];
|
||||
uint16_t *mic_roff;
|
||||
@@ -159,19 +159,19 @@ typedef struct
|
||||
uint16_t mic_adj_count;
|
||||
uint8_t mic_adj_stage;
|
||||
uint8_t mic_stage;
|
||||
|
||||
|
||||
uint8_t mic_mute;
|
||||
uint8_t spk_mute;
|
||||
|
||||
|
||||
uint16_t mic_volume;
|
||||
uint16_t spk_volume;
|
||||
|
||||
|
||||
uint32_t spk_tx_size;
|
||||
uint32_t mic_rx_size;
|
||||
|
||||
|
||||
uint32_t spk_enable;
|
||||
uint32_t mic_enable;
|
||||
|
||||
|
||||
}audio_codec_type;
|
||||
|
||||
error_status audio_codec_init(void);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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,
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USB_CONF_H
|
||||
#define __USB_CONF_H
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio_hid
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,7 +102,7 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio_hid
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file audio_codec.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief audio codec function
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -33,25 +33,25 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_audio_hid
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#define I2C_TIMEOUT 0xFFFFFFFF
|
||||
|
||||
|
||||
#define I2Cx_SPEED 200000
|
||||
#define I2Cx_ADDRESS 0x00
|
||||
|
||||
|
||||
#define I2Cx_PORT I2C1
|
||||
#define I2Cx_CLK CRM_I2C1_PERIPH_CLOCK
|
||||
|
||||
#define I2Cx_SCL_PIN GPIO_PINS_8
|
||||
#define I2Cx_SCL_GPIO_PORT GPIOB
|
||||
#define I2Cx_SCL_PIN GPIO_PINS_8
|
||||
#define I2Cx_SCL_GPIO_PORT GPIOB
|
||||
#define I2Cx_SCL_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
|
||||
|
||||
#define I2Cx_SDA_PIN GPIO_PINS_9
|
||||
#define I2Cx_SDA_GPIO_PORT GPIOB
|
||||
#define I2Cx_SDA_PIN GPIO_PINS_9
|
||||
#define I2Cx_SDA_GPIO_PORT GPIOB
|
||||
#define I2Cx_SDA_GPIO_CLK CRM_GPIOB_PERIPH_CLOCK
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ uint16_t reg_addr_data[] =
|
||||
(WM8988_R0_LEFT_INPUT_VOLUME << 9) | 0x012F, /*Left Input Channel Volume*/
|
||||
(WM8988_R1_RIGHT_INPUT_VOLUME << 9) | 0x012F, /*Right Input Channel Volume*/
|
||||
(WM8988_R2_LOUT1_VOLUME << 9) | 0x0179, /*Left Output Channel Volume*/
|
||||
(WM8988_R3_ROUT1_VOLUME << 9) | 0x0179, /*Right Output Channel Volume*/
|
||||
(WM8988_R3_ROUT1_VOLUME << 9) | 0x0179, /*Right Output Channel Volume*/
|
||||
(WM8988_R5_ADC_DAC_CONTROL << 9) | 0x0006, /*De-emphasis Control and Digital soft mute*/
|
||||
(WM8988_REG_BITW16),
|
||||
(WM8988_REG_FREQ16K),
|
||||
@@ -83,12 +83,12 @@ uint16_t reg_addr_data[] =
|
||||
(WM8988_R13_TREBLE_CONTROL << 9) | 0x000F, /*Treble Control*/
|
||||
(WM8988_R16_3D_CONTROL << 9) | 0x0000, /*3D stereo Enhancment*/
|
||||
(WM8988_R21_LEFT_ADC_VOLUME << 9) | 0x01C3, /*Left ADC Digital Volume*/
|
||||
(WM8988_R22_RIGHT_ADC_VOLUME << 9) | 0x01C3, /*Right ADC Digital Volume*/
|
||||
(WM8988_R22_RIGHT_ADC_VOLUME << 9) | 0x01C3, /*Right ADC Digital Volume*/
|
||||
(WM8988_R23_ADDITIONAL_1_CONTROL << 9) | 0x00C2, /*Additional Control 1*/
|
||||
(WM8988_R24_ADDITIONAL_2_CONTROL << 9) | 0x0000, /*Additional Control 2*/
|
||||
(WM8988_R27_ADDITIONAL_3_CONTROL << 9) | 0x0000, /*Additional Control 3*/
|
||||
(WM8988_R31_ADC_INPUT_MODE << 9) | 0x0000, /*ADC input mode*/
|
||||
(WM8988_R32_ADC_L_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control left*/
|
||||
(WM8988_R32_ADC_L_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control left*/
|
||||
(WM8988_R33_ADC_R_SIGNAL_PATH << 9) | 0x0000, /*ADC Signal Path Control right*/
|
||||
(WM8988_R34_LEFT_OUT_MIX_1 << 9) | 0x0152, /*Left DAC mixer Control*/
|
||||
(WM8988_R35_LEFT_OUT_MIX_2 << 9) | 0x0050, /*Left DAC mixer Control*/
|
||||
@@ -98,7 +98,7 @@ uint16_t reg_addr_data[] =
|
||||
(WM8988_R41_ROUT2_VOLUME << 9) | 0x01FF, /*Output left channel volume*/
|
||||
(WM8988_R43_LOW_POWER_PALYBACK << 9) | 0x0008, /*Output left channel volume*/
|
||||
(WM8988_R25_PWR_1_MGMT << 9) | 0x017C, /*Power Management1*/
|
||||
(WM8988_R26_PWR_2_MGMT << 9) | 0x01F8, /*Power Management2*/
|
||||
(WM8988_R26_PWR_2_MGMT << 9) | 0x01F8, /*Power Management2*/
|
||||
};
|
||||
|
||||
i2c_handle_type hi2cx;
|
||||
@@ -245,7 +245,7 @@ void audio_codec_spk_fifo_write(uint8_t *data, uint32_t len)
|
||||
{
|
||||
uint16_t ulen = len / 2, i;
|
||||
uint16_t *u16data = (uint16_t *)data;
|
||||
|
||||
|
||||
switch(audio_codec.spk_stage)
|
||||
{
|
||||
case 0:
|
||||
@@ -289,7 +289,7 @@ uint32_t audio_codec_mic_get_data(uint8_t *buffer)
|
||||
{
|
||||
case 0:
|
||||
audio_codec.mic_stage = 1;
|
||||
memset( buffer, 0, len );
|
||||
memset( buffer, 0, len );
|
||||
return len;
|
||||
case 1:
|
||||
if( audio_codec.mic_wtotal - audio_codec.mic_rtotal >= MIC_BUFFER_SIZE/2 )
|
||||
@@ -315,7 +315,7 @@ uint32_t audio_codec_mic_get_data(uint8_t *buffer)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for( i = 0; i < len/2; ++i )
|
||||
{
|
||||
*u16buf++ = *audio_codec.mic_roff++;
|
||||
@@ -399,32 +399,32 @@ void copy_buff(uint16_t *dest, uint16_t *src, uint32_t len)
|
||||
void i2c_lowlevel_init(i2c_handle_type* hi2c)
|
||||
{
|
||||
gpio_init_type gpio_initstructure;
|
||||
|
||||
|
||||
if(hi2c->i2cx == I2Cx_PORT)
|
||||
{
|
||||
{
|
||||
/* i2c periph clock enable */
|
||||
crm_periph_clock_enable(I2Cx_CLK, TRUE);
|
||||
crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
|
||||
gpio_pin_remap_config(I2C1_MUX, TRUE);
|
||||
crm_periph_clock_enable(I2Cx_SCL_GPIO_CLK, TRUE);
|
||||
crm_periph_clock_enable(I2Cx_SDA_GPIO_CLK, TRUE);
|
||||
|
||||
/* gpio configuration */
|
||||
gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
|
||||
gpio_initstructure.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
|
||||
|
||||
/* gpio configuration */
|
||||
gpio_initstructure.gpio_out_type = GPIO_OUTPUT_OPEN_DRAIN;
|
||||
gpio_initstructure.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_initstructure.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
||||
|
||||
/* configure i2c pins: scl */
|
||||
|
||||
/* configure i2c pins: scl */
|
||||
gpio_initstructure.gpio_pins = I2Cx_SCL_PIN;
|
||||
gpio_init(I2Cx_SCL_GPIO_PORT, &gpio_initstructure);
|
||||
|
||||
/* configure i2c pins: sda */
|
||||
/* configure i2c pins: sda */
|
||||
gpio_initstructure.gpio_pins = I2Cx_SDA_PIN;
|
||||
gpio_init(I2Cx_SDA_GPIO_PORT, &gpio_initstructure);
|
||||
|
||||
|
||||
i2c_init(hi2c->i2cx, I2C_FSMODE_DUTY_2_1, I2Cx_SPEED);
|
||||
|
||||
|
||||
i2c_own_address1_set(hi2c->i2cx, I2C_ADDRESS_MODE_7BIT, I2Cx_ADDRESS);
|
||||
}
|
||||
}
|
||||
@@ -439,23 +439,23 @@ void mclk_tmr1_init(void)
|
||||
gpio_init_type gpio_init_struct;
|
||||
tmr_output_config_type tmr_oc_init_structure;
|
||||
uint16_t prescaler_value = (uint16_t)(system_core_clock / 24000000) - 1;
|
||||
|
||||
|
||||
crm_periph_clock_enable(CRM_TMR1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_IOMUX_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
|
||||
|
||||
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_8;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
|
||||
tmr_base_init(TMR1, 1, prescaler_value);
|
||||
tmr_cnt_dir_set(TMR1, TMR_COUNT_UP);
|
||||
tmr_clock_source_div_set(TMR1, TMR_CLOCK_DIV1);
|
||||
|
||||
|
||||
tmr_output_default_para_init(&tmr_oc_init_structure);
|
||||
tmr_oc_init_structure.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
|
||||
tmr_oc_init_structure.oc_idle_state = FALSE;
|
||||
@@ -469,11 +469,11 @@ void mclk_tmr1_init(void)
|
||||
tmr_counter_enable(TMR1, TRUE);
|
||||
tmr_output_enable(TMR1, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief audio codec i2s reset
|
||||
* @param none
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void codec_i2s_reset(void)
|
||||
@@ -496,24 +496,24 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
dma_init_type dma_init_struct;
|
||||
i2s_init_type i2s_init_struct;
|
||||
i2s_data_channel_format_type format = I2S_DATA_16BIT_CHANNEL_16BIT;
|
||||
|
||||
|
||||
crm_periph_clock_enable(I2S1_GPIO_CRM_CLK, TRUE);
|
||||
crm_periph_clock_enable(I2S2_GPIO_CRM_CLK, TRUE);
|
||||
crm_periph_clock_enable(CRM_DMA1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_SPI1_PERIPH_CLOCK, TRUE);
|
||||
crm_periph_clock_enable(CRM_SPI2_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
param->spk_freq = param->audio_freq;
|
||||
|
||||
|
||||
param->spk_tx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_SPK_CHANEL_NUM / 2;
|
||||
param->mic_rx_size = (param->audio_freq / 1000) * (param->audio_bitw / 8) * AUDIO_MIC_CHANEL_NUM / 2;
|
||||
|
||||
|
||||
memset(param->spk_buffer, 0, SPK_BUFFER_SIZE*sizeof(uint16_t));
|
||||
memset(param->mic_buffer, 0, MIC_BUFFER_SIZE*sizeof(uint16_t));
|
||||
|
||||
|
||||
param->mic_wend = param->mic_woff = param->mic_roff = param->mic_buffer;
|
||||
param->spk_rend = param->spk_woff = param->spk_roff = param->spk_buffer;
|
||||
|
||||
|
||||
while(param->mic_wend < param->mic_buffer+MIC_BUFFER_SIZE)
|
||||
{
|
||||
param->mic_wend += param->mic_rx_size;
|
||||
@@ -532,50 +532,50 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
{
|
||||
format = I2S_DATA_24BIT_CHANNEL_32BIT;
|
||||
}
|
||||
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s1 ws pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S1_WS_PIN;
|
||||
gpio_init(I2S1_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s1 ck pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S1_CK_PIN;
|
||||
gpio_init(I2S1_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s1 sd pins slave tx */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = I2S1_SD_PIN;
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_MODERATE;
|
||||
gpio_init(I2S1_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s2 ws pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S2_WS_PIN;
|
||||
gpio_init(I2S2_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s2 ck pins */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_DOWN;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S2_CK_PIN;
|
||||
gpio_init(I2S2_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* i2s2 sd pins slave rx */
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_UP;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_INPUT;
|
||||
gpio_init_struct.gpio_pins = I2S2_SD_PIN;
|
||||
gpio_init(I2S2_GPIO, &gpio_init_struct);
|
||||
|
||||
|
||||
/* dma config */
|
||||
dma_reset(DMA1_CHANNEL3);
|
||||
dma_reset(DMA1_CHANNEL4);
|
||||
|
||||
|
||||
/* dma1 channel3: speaker i2s1 tx */
|
||||
dma_default_para_init(&dma_init_struct);
|
||||
dma_init_struct.buffer_size = param->spk_tx_size << 1;
|
||||
@@ -592,7 +592,7 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
dma_interrupt_enable(DMA1_CHANNEL3, DMA_FDT_INT, TRUE);
|
||||
dma_interrupt_enable(DMA1_CHANNEL3, DMA_HDT_INT, TRUE);
|
||||
nvic_irq_enable(DMA1_Channel3_IRQn, 1, 0);
|
||||
|
||||
|
||||
/* dma1 channel4: microphone i2s2 rx */
|
||||
dma_default_para_init(&dma_init_struct);
|
||||
dma_init_struct.buffer_size = param->mic_rx_size << 1;
|
||||
@@ -609,7 +609,7 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
dma_interrupt_enable(DMA1_CHANNEL4, DMA_FDT_INT, TRUE);
|
||||
dma_interrupt_enable(DMA1_CHANNEL4, DMA_HDT_INT, TRUE);
|
||||
nvic_irq_enable(DMA1_Channel4_IRQn, 2, 0);
|
||||
|
||||
|
||||
/* i2s1 tx init */
|
||||
spi_i2s_reset(SPI1);
|
||||
i2s_default_para_init(&i2s_init_struct);
|
||||
@@ -620,7 +620,7 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
|
||||
i2s_init_struct.operation_mode = I2S_MODE_SLAVE_TX;
|
||||
i2s_init(SPI1, &i2s_init_struct);
|
||||
|
||||
|
||||
/* i2s2 rx init */
|
||||
spi_i2s_reset(SPI2);
|
||||
i2s_default_para_init(&i2s_init_struct);
|
||||
@@ -631,16 +631,16 @@ void codec_i2s_init(audio_codec_type *param)
|
||||
i2s_init_struct.clock_polarity = I2S_CLOCK_POLARITY_LOW;
|
||||
i2s_init_struct.operation_mode = I2S_MODE_SLAVE_RX;
|
||||
i2s_init(SPI2, &i2s_init_struct);
|
||||
|
||||
|
||||
|
||||
spi_i2s_dma_transmitter_enable(SPI1, TRUE);
|
||||
spi_i2s_dma_receiver_enable(SPI2, TRUE);
|
||||
i2s_enable(SPI1, TRUE);
|
||||
i2s_enable(SPI2, TRUE);
|
||||
|
||||
|
||||
dma_channel_enable(DMA1_CHANNEL3, TRUE);
|
||||
dma_channel_enable(DMA1_CHANNEL4, TRUE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -652,7 +652,7 @@ void DMA1_Channel3_IRQHandler(void)
|
||||
{
|
||||
uint16_t half_size = audio_codec.spk_tx_size;
|
||||
uint16_t *pdst;
|
||||
|
||||
|
||||
if(dma_flag_get(DMA1_HDT3_FLAG) == SET)
|
||||
{
|
||||
//copy_buff(audio_codec.spk_buffer, audio_codec.spk_tx_fifo + audio_codec.r_pos, half_size);
|
||||
@@ -665,7 +665,7 @@ void DMA1_Channel3_IRQHandler(void)
|
||||
pdst = spk_dma_buffer + half_size;
|
||||
dma_flag_clear(DMA1_FDT3_FLAG);
|
||||
}
|
||||
|
||||
|
||||
switch( audio_codec.spk_stage )
|
||||
{
|
||||
case 0:
|
||||
@@ -715,7 +715,7 @@ void DMA1_Channel3_IRQHandler(void)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -727,7 +727,7 @@ void DMA1_Channel4_IRQHandler(void)
|
||||
{
|
||||
uint16_t *psrc;
|
||||
uint16_t len = audio_codec.mic_rx_size << 1;
|
||||
|
||||
|
||||
if(dma_flag_get(DMA1_HDT4_FLAG) == SET)
|
||||
{
|
||||
dma_flag_clear(DMA1_HDT4_FLAG);
|
||||
@@ -798,7 +798,7 @@ error_status audio_codec_init(void)
|
||||
uint32_t reg_len = sizeof(reg_addr_data) / sizeof(uint16_t);
|
||||
uint32_t i_index = 0;
|
||||
uint8_t i2c_cmd[2];
|
||||
|
||||
|
||||
if(AUDIO_DEFAULT_FREQ == AUDIO_FREQ_16K)
|
||||
{
|
||||
reg_addr_data[6] = WM8988_REG_FREQ16K;
|
||||
@@ -813,7 +813,7 @@ error_status audio_codec_init(void)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
if(AUDIO_DEFAULT_BITW == AUDIO_BITW_16)
|
||||
{
|
||||
reg_addr_data[5] = WM8988_REG_BITW16;
|
||||
@@ -823,12 +823,12 @@ error_status audio_codec_init(void)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* i2c init */
|
||||
hi2cx.i2cx = I2Cx_PORT;
|
||||
|
||||
|
||||
i2c_config(&hi2cx);
|
||||
|
||||
|
||||
for(i_index = 0; i_index < reg_len; i_index ++)
|
||||
{
|
||||
i2c_cmd[0] = (uint8_t)(reg_addr_data[i_index] >> 8);
|
||||
@@ -838,12 +838,12 @@ error_status audio_codec_init(void)
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* timer init */
|
||||
mclk_tmr1_init();
|
||||
|
||||
|
||||
codec_i2s_init(&audio_codec);
|
||||
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ error_status audio_codec_loop(void)
|
||||
uint16_t audio_ctrl_l;
|
||||
uint16_t audio_ctrl_r;
|
||||
uint8_t i2c_cmd[2];
|
||||
|
||||
|
||||
if(mic_mute != audio_codec.mic_mute)
|
||||
{
|
||||
mic_mute = audio_codec.mic_mute;
|
||||
@@ -885,7 +885,7 @@ error_status audio_codec_loop(void)
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(mic_volume != audio_codec.mic_volume)
|
||||
{
|
||||
mic_volume = audio_codec.mic_volume;
|
||||
@@ -904,9 +904,9 @@ error_status audio_codec_loop(void)
|
||||
if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(spk_mute != audio_codec.spk_mute)
|
||||
{
|
||||
spk_mute = audio_codec.spk_mute;
|
||||
@@ -918,7 +918,7 @@ error_status audio_codec_loop(void)
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(spk_volume != audio_codec.spk_volume)
|
||||
{
|
||||
spk_volume = audio_codec.spk_volume;
|
||||
@@ -926,10 +926,10 @@ error_status audio_codec_loop(void)
|
||||
audio_ctrl_r = WM8988_R3_ROUT1_VOLUME << 9 | 0x100;
|
||||
audio_ctrl_l |= audio_codec.spk_volume;
|
||||
audio_ctrl_r |= audio_codec.spk_volume;
|
||||
|
||||
|
||||
i2c_cmd[0] = (uint8_t)(audio_ctrl_l >> 8);
|
||||
i2c_cmd[1] = (uint8_t)audio_ctrl_l & 0xFF;
|
||||
|
||||
|
||||
if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
|
||||
{
|
||||
return ERROR;
|
||||
@@ -939,14 +939,14 @@ error_status audio_codec_loop(void)
|
||||
if(i2c_master_transmit(&hi2cx, WM8988_I2C_ADDR_CSB_LOW, (uint8_t *)i2c_cmd, 2, 0xFFFF) != I2C_OK)
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_composite_vcp_keyboard
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -101,11 +101,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_composite_vcp_keyboard
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -144,7 +144,7 @@ void keyboard_send_string(void *udev, uint8_t *string, uint8_t len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ int main(void)
|
||||
uint16_t data_len;
|
||||
|
||||
uint32_t timeout;
|
||||
|
||||
|
||||
uint8_t send_zero_packet = 0;
|
||||
|
||||
/* config nvic priority group */
|
||||
@@ -198,7 +198,7 @@ int main(void)
|
||||
|
||||
if(data_len == 0)
|
||||
send_zero_packet = 0;
|
||||
|
||||
|
||||
timeout = 5000000;
|
||||
do
|
||||
{
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_custom_hid
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,11 +102,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_custom_hid
|
||||
* @{
|
||||
*/
|
||||
@@ -134,11 +134,11 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_keyboard
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -107,11 +107,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_keyboard
|
||||
* @{
|
||||
*/
|
||||
@@ -134,11 +134,11 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_mouse
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -106,11 +106,11 @@ void usb_delay_ms(uint32_t ms);
|
||||
void usb_delay_us(uint32_t us);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_mouse
|
||||
* @{
|
||||
*/
|
||||
@@ -134,11 +134,11 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file msc_diskio.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb mass storage disk interface 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "usb_conf.h"
|
||||
#include "usb_std.h"
|
||||
@@ -38,7 +38,7 @@ extern "C" {
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_msc
|
||||
* @{
|
||||
*/
|
||||
@@ -59,11 +59,11 @@ usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_siz
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_msc
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,11 +102,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_msc
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file msc_diskio.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb mass storage disk function
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -29,7 +29,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_msc
|
||||
* @{
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH] =
|
||||
/**
|
||||
* @brief get disk inquiry
|
||||
* @param lun: logical units number
|
||||
* @retval inquiry string
|
||||
* @retval inquiry string
|
||||
*/
|
||||
uint8_t *get_inquiry(uint8_t lun)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ uint8_t *get_inquiry(uint8_t lun)
|
||||
* @param addr: logical address
|
||||
* @param read_buf: pointer to read buffer
|
||||
* @param len: read length
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type msc_disk_read(uint8_t lun, uint32_t addr, uint8_t *read_buf, uint32_t len)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ usb_sts_type msc_disk_read(uint8_t lun, uint32_t addr, uint8_t *read_buf, uint32
|
||||
* @param addr: logical address
|
||||
* @param buf: pointer to write buffer
|
||||
* @param len: write length
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type msc_disk_write(uint8_t lun, uint32_t addr, uint8_t *buf, uint32_t len)
|
||||
{
|
||||
@@ -131,13 +131,13 @@ usb_sts_type msc_disk_write(uint8_t lun, uint32_t addr, uint8_t *buf, uint32_t l
|
||||
* @param lun: logical units number
|
||||
* @param blk_nbr: pointer to number of block
|
||||
* @param blk_size: pointer to block size
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
|
||||
{
|
||||
uint32_t flash_s = *((uint32_t *)0x1FFFF7E0);
|
||||
msc_flash_size = (flash_s << 10) - (USB_FLASH_ADDR_OFFSET - FLASH_BASE);
|
||||
|
||||
|
||||
if(flash_s < 256)
|
||||
{
|
||||
sector_size = SECTOR_SIZE_1K;
|
||||
@@ -146,7 +146,7 @@ usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_siz
|
||||
{
|
||||
sector_size = SECTOR_SIZE_2K;
|
||||
}
|
||||
|
||||
|
||||
switch(lun)
|
||||
{
|
||||
case INTERNAL_FLASH_LUN:
|
||||
@@ -165,8 +165,8 @@ usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_siz
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_printer
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,11 +102,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_printer
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_vcp_loopback
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,11 +102,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_vcp_loopback
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_vcp_loopback
|
||||
* @{
|
||||
*/
|
||||
@@ -72,8 +72,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -106,11 +106,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_vcp_loopback
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
@@ -142,10 +142,10 @@ int main(void)
|
||||
system_clock_config();
|
||||
|
||||
at32_board_init();
|
||||
|
||||
|
||||
/* usart gpio config */
|
||||
usart_gpio_config();
|
||||
|
||||
|
||||
/* hardware usart config: usart2 */
|
||||
usb_usart_config(linecoding);
|
||||
|
||||
@@ -168,13 +168,13 @@ int main(void)
|
||||
{
|
||||
/* get usb vcp receive data */
|
||||
data_len = usb_vcp_get_rxdata(&usb_core_dev, usb_buffer);
|
||||
|
||||
/* send data to hardware usart */
|
||||
|
||||
/* send data to hardware usart */
|
||||
if(data_len > 0)
|
||||
{
|
||||
usart_send_data(usb_buffer, data_len);
|
||||
}
|
||||
|
||||
|
||||
/* if hardware usart received data,usb send data to host */
|
||||
usart_rx_data_len = usart_receive_data();
|
||||
if(usart_rx_data_len || send_zero_packet == 1)
|
||||
@@ -186,8 +186,8 @@ int main(void)
|
||||
send_zero_packet = 0;
|
||||
|
||||
timeout = 50000;
|
||||
|
||||
if((hw_usart_read_index + usart_rx_data_len) < usart_buffer_size)
|
||||
|
||||
if((hw_usart_read_index + usart_rx_data_len) < usart_buffer_size)
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -195,11 +195,11 @@ int main(void)
|
||||
if(usb_vcp_send_data(&usb_core_dev, &usart_rx_buffer[hw_usart_read_index], usart_rx_data_len) == SUCCESS)
|
||||
{
|
||||
hw_usart_read_index = hw_usart_read_index + usart_rx_data_len;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}while(timeout --);
|
||||
|
||||
|
||||
}
|
||||
/* process the fifo overflow */
|
||||
else
|
||||
@@ -245,7 +245,7 @@ void usart_send_data(uint8_t *send_data, uint16_t len)
|
||||
{
|
||||
;
|
||||
}while(usart_flag_get(USART2, USART_TDBE_FLAG) == RESET);
|
||||
|
||||
|
||||
usart_data_transmit(USART2, send_data[index]);
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ uint16_t usart_receive_data(void)
|
||||
else
|
||||
usart_data_len = (usart_buffer_size-1) + hw_usart_rx_index - hw_usart_read_index;
|
||||
}
|
||||
|
||||
|
||||
return usart_data_len;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void usb_usart_config( linecoding_type linecoding)
|
||||
/* enable the usart2 and gpio clock */
|
||||
crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, FALSE);
|
||||
crm_periph_clock_enable(CRM_USART2_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
/* stop bit */
|
||||
switch(linecoding.format)
|
||||
{
|
||||
@@ -327,9 +327,9 @@ void usb_usart_config( linecoding_type linecoding)
|
||||
{
|
||||
/* hardware usart not support data bits for 5/6/7 */
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
break;
|
||||
break;
|
||||
case 0x8:
|
||||
usart_data_bit = USART_DATA_8BITS;
|
||||
break;
|
||||
@@ -337,7 +337,7 @@ void usb_usart_config( linecoding_type linecoding)
|
||||
case 0x10:
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
break;
|
||||
}
|
||||
/* parity */
|
||||
switch(linecoding.parity)
|
||||
@@ -360,13 +360,13 @@ void usb_usart_config( linecoding_type linecoding)
|
||||
}
|
||||
|
||||
nvic_irq_enable(USART2_IRQn, 0, 0);
|
||||
|
||||
|
||||
/* configure usart2 param */
|
||||
usart_init(USART2, linecoding.bitrate, usart_data_bit, usart_stop_bit);
|
||||
usart_parity_selection_config(USART2, usart_parity_select);
|
||||
usart_transmitter_enable(USART2, TRUE);
|
||||
usart_receiver_enable(USART2, TRUE);
|
||||
|
||||
|
||||
/* enable usart2 interrupt */
|
||||
usart_interrupt_enable(USART2, USART_RDBF_INT, TRUE);
|
||||
usart_enable(USART2, TRUE);
|
||||
@@ -379,9 +379,9 @@ void usb_usart_config( linecoding_type linecoding)
|
||||
*/
|
||||
void usart_gpio_config(void)
|
||||
{
|
||||
gpio_init_type gpio_init_struct;
|
||||
gpio_init_type gpio_init_struct;
|
||||
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
/* configure the usart2 tx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
@@ -389,7 +389,7 @@ void usart_gpio_config(void)
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_2;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOA, &gpio_init_struct);
|
||||
|
||||
|
||||
/* configure the usart2 rx pin */
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of clock program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief at32f413 config 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,
|
||||
@@ -150,7 +150,7 @@ extern "C" {
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief header file of main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file flash_fat16.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief fat16 file system header file
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file msc_diskio.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb mass storage disk interface 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "usb_conf.h"
|
||||
#include "usb_std.h"
|
||||
@@ -38,7 +38,7 @@ extern "C" {
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_virtual_msc_iap
|
||||
* @{
|
||||
*/
|
||||
@@ -55,11 +55,11 @@ usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_siz
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file usb_conf.h
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb config 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 AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_virtual_msc_iap
|
||||
* @{
|
||||
*/
|
||||
@@ -68,8 +68,8 @@ extern "C" {
|
||||
* @brief user custom endpoint buffer
|
||||
* EPTn_TX_ADDR, EPTn_RX_ADDR must less than usb buffer size
|
||||
*/
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
|
||||
/* ept0 tx start address 0x40, size 0x40,
|
||||
so rx start address is 0x40 + 0x40 = 0x80 */
|
||||
#define EPT0_TX_ADDR 0x40 /*!< usb endpoint 0 tx buffer address offset */
|
||||
#define EPT0_RX_ADDR 0x80 /*!< usb endpoint 0 rx buffer address offset */
|
||||
@@ -102,11 +102,11 @@ void usb_delay_us(uint32_t us);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file readme.txt
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief readme
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_clock.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief system clock config program
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* includes ------------------------------------------------------------------*/
|
||||
#include "at32f413_clock.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief system clock config program
|
||||
* @note the system clock is configured as follow:
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file at32f413_int.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main interrupt service routines.
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_virtual_msc_iap
|
||||
* @{
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ void SysTick_Handler(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file flash_fat16.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief fat16 file system
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -29,7 +29,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_virtual_msc_iap
|
||||
* @{
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ const uint8_t fat16_sector[FAT16_SECTOR_SIZE] =
|
||||
};
|
||||
|
||||
|
||||
const uint8_t fat16_root_dir_sector[FAT16_DIR_SIZE]=
|
||||
const uint8_t fat16_root_dir_sector[FAT16_DIR_SIZE]=
|
||||
{
|
||||
0x20, /*11 - Archive Attribute set */
|
||||
0x00, /*12 - Reserved */
|
||||
@@ -118,7 +118,7 @@ const uint8_t fat16_root_dir_sector[FAT16_DIR_SIZE]=
|
||||
0x38, /*57 - Write Date */
|
||||
};
|
||||
|
||||
const uint8_t fat16_table_sector0[FAT16_TABLE_SIZE] =
|
||||
const uint8_t fat16_table_sector0[FAT16_TABLE_SIZE] =
|
||||
{
|
||||
0xF8,
|
||||
0xFF,
|
||||
@@ -126,7 +126,7 @@ const uint8_t fat16_table_sector0[FAT16_TABLE_SIZE] =
|
||||
0xFF
|
||||
};
|
||||
|
||||
uint8_t fat16_file_name[FAT16_FILENAME_SIZE] =
|
||||
uint8_t fat16_file_name[FAT16_FILENAME_SIZE] =
|
||||
{
|
||||
'R',
|
||||
'e',
|
||||
@@ -161,7 +161,7 @@ void flash_fat16_set_upgrade_flag(void);
|
||||
* @param dst: dest buffer pointer
|
||||
* @param src: src buffer pointer
|
||||
* @param len: copy length
|
||||
* @retval nubmer of data copy
|
||||
* @retval nubmer of data copy
|
||||
*/
|
||||
uint32_t fat16_memory_copy(uint8_t *dst, const uint8_t *src, uint32_t len)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ uint32_t fat16_memory_copy(uint8_t *dst, const uint8_t *src, uint32_t len)
|
||||
* @param dst: dest buffer pointer
|
||||
* @param set: set value
|
||||
* @param len: set length
|
||||
* @retval nubmer of data set
|
||||
* @retval nubmer of data set
|
||||
*/
|
||||
uint32_t fat16_memory_memset(uint8_t *dst, uint32_t set, uint32_t len)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ uint32_t fat16_memory_memset(uint8_t *dst, uint32_t set, uint32_t len)
|
||||
* @param dst: dest buffer pointer
|
||||
* @param src: src buffer pointer
|
||||
* @param len: compare length
|
||||
* @retval compare result
|
||||
* @retval compare result
|
||||
*/
|
||||
uint32_t fat16_memory_cmp(uint8_t *dst, uint8_t *src, uint32_t len)
|
||||
{
|
||||
@@ -211,32 +211,32 @@ uint32_t fat16_memory_cmp(uint8_t *dst, uint8_t *src, uint32_t len)
|
||||
/**
|
||||
* @brief clear iap upgrade flag
|
||||
* @param none
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
void flash_fat16_clear_upgrade_flag(void)
|
||||
{
|
||||
flash_unlock();
|
||||
flash_sector_erase(flash_iap.flash_app_addr - flash_iap.sector_size);
|
||||
flash_lock();
|
||||
flash_lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set iap upgrade complete flag
|
||||
* @param none
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
void flash_fat16_set_upgrade_flag(void)
|
||||
{
|
||||
flash_unlock();
|
||||
flash_word_program(flash_iap.flash_app_addr - flash_iap.sector_size,
|
||||
flash_word_program(flash_iap.flash_app_addr - flash_iap.sector_size,
|
||||
IAP_UPGRADE_COMPLETE_FLAG);
|
||||
flash_lock();
|
||||
flash_lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get iap upgrade complete flag
|
||||
* @param none
|
||||
* @retval the iap flag
|
||||
* @retval the iap flag
|
||||
*/
|
||||
uint8_t flash_fat16_get_upgrade_flag(void)
|
||||
{
|
||||
@@ -254,8 +254,8 @@ uint8_t flash_fat16_get_upgrade_flag(void)
|
||||
/**
|
||||
* @brief read a logical block address
|
||||
* @param fat_lbk: logical block address to read
|
||||
* @param data: pointer to array to store data read
|
||||
* @param len: data length
|
||||
* @param data: pointer to array to store data read
|
||||
* @param len: data length
|
||||
* @retval read length
|
||||
*/
|
||||
uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
@@ -266,20 +266,20 @@ uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
case FLASH_FAT16_BOOT_SECTOR_ADDR:
|
||||
i_index += fat16_memory_copy(data, fat16_sector, FAT16_SECTOR_SIZE);
|
||||
i_index += 2;
|
||||
|
||||
|
||||
fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
|
||||
|
||||
|
||||
break;
|
||||
case FLASH_FAT16_1_ADDR:
|
||||
case FLASH_FAT16_2_ADDR:
|
||||
i_index += fat16_memory_copy(data, fat16_table_sector0, FAT16_TABLE_SIZE);
|
||||
|
||||
|
||||
fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
|
||||
break;
|
||||
case FLASH_FAT16_ROOT_ADDR:
|
||||
i_index += fat16_memory_copy(data, fat16_file_name, FAT16_FILENAME_SIZE);
|
||||
i_index += fat16_memory_copy(data + i_index, fat16_root_dir_sector, FAT16_DIR_SIZE);
|
||||
|
||||
|
||||
fat16_memory_memset(data+i_index, 0, FAT16_BYTE_PER_SIZE-i_index);
|
||||
break;
|
||||
default:
|
||||
@@ -293,8 +293,8 @@ uint32_t flash_fat16_read(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
/**
|
||||
* @brief write a logical block address
|
||||
* @param fat_lbk: logical block address to read
|
||||
* @param data: pointer to array to store data read
|
||||
* @param len: data length
|
||||
* @param data: pointer to array to store data read
|
||||
* @param len: data length
|
||||
* @retval read length
|
||||
*/
|
||||
uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
@@ -314,7 +314,7 @@ uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
flash_fat16_sector_write(fat_lbk, data, len);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -323,7 +323,7 @@ uint32_t flash_fat16_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
* @brief set file name
|
||||
* @param file_name: file name
|
||||
* @param len: filename length
|
||||
* @retval filename length
|
||||
* @retval filename length
|
||||
*/
|
||||
uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len)
|
||||
{
|
||||
@@ -332,30 +332,30 @@ uint32_t flash_fat16_set_name(const uint8_t *file_name, uint8_t len)
|
||||
{
|
||||
fat16_file_name[i_index] = file_name[i_index];
|
||||
}
|
||||
|
||||
|
||||
for(; i_index < 8; i_index ++)
|
||||
{
|
||||
fat16_file_name[i_index] = ' ';
|
||||
}
|
||||
}
|
||||
return i_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief boot dir write
|
||||
* @param fat_lbk: logical block address
|
||||
* @param data: pointer to array to store data
|
||||
* @param data: pointer to array to store data
|
||||
* @param len: data length
|
||||
* @retval nubmer of data
|
||||
* @retval nubmer of data
|
||||
*/
|
||||
uint32_t flash_fat16_boot_dir_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
{
|
||||
fat_dir_type *pdir = (fat_dir_type *)data;
|
||||
uint32_t i_index = 2, loop_len = 0;
|
||||
|
||||
|
||||
pdir ++;
|
||||
pdir ++;
|
||||
loop_len += 64;
|
||||
|
||||
|
||||
while(i_index ++ < 512 && loop_len < len)
|
||||
{
|
||||
if((pdir->attr == 0x20) && ((pdir + 1)->attr == 0x00))
|
||||
@@ -368,7 +368,7 @@ uint32_t flash_fat16_boot_dir_write(uint32_t fat_lbk, uint8_t *data, uint32_t le
|
||||
}
|
||||
loop_len += 32;
|
||||
}
|
||||
|
||||
|
||||
if(i_index <= 512 && loop_len < len)
|
||||
{
|
||||
fat16_memory_copy((uint8_t *)&g_file_attr, (const uint8_t *)pdir, 32);
|
||||
@@ -380,26 +380,26 @@ uint32_t flash_fat16_boot_dir_write(uint32_t fat_lbk, uint8_t *data, uint32_t le
|
||||
{
|
||||
fat16_memory_memset((uint8_t *)&g_file_attr, 0, 32);
|
||||
}
|
||||
return len;
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get offset address
|
||||
* @param file_name: file name
|
||||
* @retval offset address
|
||||
* @retval offset address
|
||||
*/
|
||||
uint32_t flash_fat16_addr_offset(uint8_t *file_name)
|
||||
{
|
||||
uint8_t i_index = 0, offset_shift = 20;
|
||||
uint32_t offset = 0;
|
||||
uint8_t *pfile = file_name;
|
||||
|
||||
|
||||
if(*pfile != 'A')
|
||||
{
|
||||
return INVAILD_OFFSET_ADDR;
|
||||
}
|
||||
pfile += 1;
|
||||
|
||||
|
||||
for(i_index = 0; i_index < 6; i_index ++)
|
||||
{
|
||||
if(*pfile >= '0' && *pfile <= '9')
|
||||
@@ -421,7 +421,7 @@ uint32_t flash_fat16_addr_offset(uint8_t *file_name)
|
||||
pfile ++;
|
||||
offset_shift -= 4;
|
||||
}
|
||||
|
||||
|
||||
if((offset < (flash_iap.flash_app_addr - flash_iap.flash_base_addr)) ||
|
||||
(offset > flash_iap.flash_size ))
|
||||
{
|
||||
@@ -433,20 +433,20 @@ uint32_t flash_fat16_addr_offset(uint8_t *file_name)
|
||||
/**
|
||||
* @brief write sector
|
||||
* @param fat_lbk: logical block address
|
||||
* @param data: pointer to array to store data
|
||||
* @param data: pointer to array to store data
|
||||
* @param len: data length
|
||||
* @retval nubmer of data
|
||||
* @retval nubmer of data
|
||||
*/
|
||||
uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
{
|
||||
uint32_t file_size = g_file_attr.file_size;
|
||||
uint32_t flash_offset = 0;
|
||||
uint32_t status;
|
||||
|
||||
|
||||
/* check the suffix is .bin or .BIN*/
|
||||
if((fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[8],
|
||||
if((fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[8],
|
||||
(uint8_t *)FILE_SUFFIX1_NAME, FILE_SUFFIX1_LEN) == 0) ||
|
||||
(fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[8],
|
||||
(fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[8],
|
||||
(uint8_t *)FILE_SUFFIX2_NAME, FILE_SUFFIX2_LEN) == 0))
|
||||
{
|
||||
/* check the upgrade status */
|
||||
@@ -454,12 +454,12 @@ uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(flash_iap.msc_up_status == UPGRADE_READY)
|
||||
{
|
||||
/* get offset address from filename */
|
||||
flash_offset = flash_fat16_addr_offset(g_file_attr.file_name);
|
||||
|
||||
|
||||
if(flash_offset == INVAILD_OFFSET_ADDR)
|
||||
{
|
||||
/* use default app address */
|
||||
@@ -471,10 +471,10 @@ uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
}
|
||||
/* clear upgrade flag */
|
||||
flash_fat16_clear_upgrade_flag();
|
||||
|
||||
|
||||
flash_iap.msc_up_status = UPGRAGE_ONGOING;
|
||||
}
|
||||
|
||||
|
||||
if(flash_iap.flash_app_size >= g_file_attr.file_size)
|
||||
{
|
||||
if((flash_iap.file_write_nr + len) >= file_size)
|
||||
@@ -483,9 +483,9 @@ uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
}
|
||||
/* write data to flash and check crc */
|
||||
status = flash_write_data(flash_iap.write_addr + flash_iap.file_write_nr, data, len);
|
||||
|
||||
|
||||
flash_iap.file_write_nr += len;
|
||||
|
||||
|
||||
if(status == 0)
|
||||
{
|
||||
if(flash_iap.file_write_nr >= file_size)
|
||||
@@ -493,7 +493,7 @@ uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
/* upgrade finish */
|
||||
flash_iap.file_write_nr = 0;
|
||||
flash_iap.msc_up_status = UPGRADE_SUCCESS;
|
||||
|
||||
|
||||
/* set the upgrade done flag to flash */
|
||||
flash_fat16_set_upgrade_flag();
|
||||
}
|
||||
@@ -510,9 +510,9 @@ uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
/* upgrade file is large than flash size */
|
||||
flash_iap.msc_up_status = UPGRADE_LARGE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if((fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[0],
|
||||
else if((fat16_memory_cmp((uint8_t *)&g_file_attr.file_name[0],
|
||||
(uint8_t *)"JUMP", 4) == 0))
|
||||
{
|
||||
/* receive jump command file */
|
||||
@@ -522,17 +522,17 @@ uint32_t flash_fat16_sector_write(uint32_t fat_lbk, uint8_t *data, uint32_t len)
|
||||
{
|
||||
/* unkonw upgrade status */
|
||||
flash_iap.msc_up_status = UPGRADE_UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief crc check
|
||||
* @param address: flash address
|
||||
* @param data: pointer to array to store data
|
||||
* @param data: pointer to array to store data
|
||||
* @param len: data length
|
||||
* @retval crc result
|
||||
* @retval crc result
|
||||
*/
|
||||
uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len)
|
||||
{
|
||||
@@ -543,10 +543,10 @@ uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len)
|
||||
uint32_t remain_len = len % sizeof(uint32_t);
|
||||
uint32_t *u32data = (uint32_t *)data;
|
||||
uint32_t *flash_addr = (uint32_t *)address;
|
||||
|
||||
|
||||
/* enable crc clock */
|
||||
crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, TRUE);
|
||||
|
||||
|
||||
if(remain_len)
|
||||
{
|
||||
wlen += 1;
|
||||
@@ -555,14 +555,14 @@ uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len)
|
||||
data[len+i_index] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* calculate write buffer */
|
||||
crc_data_reset();
|
||||
for(i_index = 0; i_index < wlen; i_index ++)
|
||||
{
|
||||
data_crc = crc_one_word_calculate(u32data[i_index]);
|
||||
}
|
||||
|
||||
|
||||
/* calculate flash data */
|
||||
crc_data_reset();
|
||||
for(i_index = 0; i_index < wlen; i_index ++)
|
||||
@@ -570,20 +570,20 @@ uint32_t flash_crc_check(uint32_t address, uint8_t *data, uint32_t len)
|
||||
flash_crc = crc_one_word_calculate(*flash_addr++);
|
||||
}
|
||||
crm_periph_clock_enable(CRM_CRC_PERIPH_CLOCK, FALSE);
|
||||
|
||||
|
||||
if(data_crc != flash_crc)
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief read data from flash
|
||||
* @param address: flash address
|
||||
* @param data: pointer to array to store data
|
||||
* @param data: pointer to array to store data
|
||||
* @param len: data length
|
||||
* @retval read length
|
||||
* @retval read length
|
||||
*/
|
||||
uint32_t flash_read_data(uint32_t address, uint8_t *data, uint32_t len)
|
||||
{
|
||||
@@ -600,9 +600,9 @@ uint32_t flash_read_data(uint32_t address, uint8_t *data, uint32_t len)
|
||||
/**
|
||||
* @brief write data to flash
|
||||
* @param address: flash address
|
||||
* @param data: pointer to array to store data
|
||||
* @param data: pointer to array to store data
|
||||
* @param len: data length
|
||||
* @retval write status
|
||||
* @retval write status
|
||||
*/
|
||||
uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len)
|
||||
{
|
||||
@@ -613,7 +613,7 @@ uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if((waddr & flash_iap.sector_mask) == 0)
|
||||
{
|
||||
flash_unlock();
|
||||
@@ -633,10 +633,10 @@ uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len)
|
||||
{
|
||||
flash_sector_erase(waddr);
|
||||
}
|
||||
|
||||
|
||||
flash_lock();
|
||||
}
|
||||
|
||||
|
||||
waddr = address;
|
||||
flash_unlock();
|
||||
for(i_index = 0; i_index < len; i_index ++)
|
||||
@@ -644,14 +644,14 @@ uint32_t flash_write_data(uint32_t address, uint8_t *data, uint32_t len)
|
||||
flash_byte_program(waddr+i_index, data[i_index]);
|
||||
}
|
||||
flash_lock();
|
||||
|
||||
|
||||
return flash_crc_check(address, data, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief flash fat16 iap init
|
||||
* @param none
|
||||
* @retval none
|
||||
* @retval none
|
||||
*/
|
||||
void flash_fat16_init(void)
|
||||
{
|
||||
@@ -660,11 +660,11 @@ void flash_fat16_init(void)
|
||||
flash_iap.flash_app_addr = FLASH_APP_START_ADDR;
|
||||
flash_iap.write_addr = FLASH_APP_START_ADDR;
|
||||
flash_iap.flash_size = flash_size << 10;
|
||||
|
||||
flash_iap.flash_app_size = flash_iap.flash_size -
|
||||
(flash_iap.flash_app_addr -
|
||||
|
||||
flash_iap.flash_app_size = flash_iap.flash_size -
|
||||
(flash_iap.flash_app_addr -
|
||||
flash_iap.flash_base_addr);
|
||||
|
||||
|
||||
if(flash_size < 0x100)
|
||||
{
|
||||
flash_iap.sector_size = FLASH_SECTOR_1K_SIZE;
|
||||
@@ -681,8 +681,8 @@ void flash_fat16_init(void)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file main.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief main program
|
||||
**************************************************************************
|
||||
* Copyright notice & Disclaimer
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
**************************************************************************
|
||||
* @file msc_diskio.c
|
||||
* @version v2.0.3
|
||||
* @date 2022-02-11
|
||||
* @version v2.0.4
|
||||
* @date 2022-04-02
|
||||
* @brief usb mass storage disk function
|
||||
**************************************************************************
|
||||
* 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,
|
||||
@@ -30,7 +30,7 @@
|
||||
/** @addtogroup AT32F413_periph_examples
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup 413_USB_device_virtual_msc_iap
|
||||
* @{
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ uint8_t scsi_inquiry[MSC_SUPPORT_MAX_LUN][SCSI_INQUIRY_DATA_LENGTH] =
|
||||
/**
|
||||
* @brief get disk inquiry
|
||||
* @param lun: logical units number
|
||||
* @retval inquiry string
|
||||
* @retval inquiry string
|
||||
*/
|
||||
uint8_t *get_inquiry(uint8_t lun)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ uint8_t *get_inquiry(uint8_t lun)
|
||||
* @param addr: logical address
|
||||
* @param read_buf: pointer to read buffer
|
||||
* @param len: read length
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type msc_disk_read(uint8_t lun, uint32_t addr, uint8_t *read_buf, uint32_t len)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ usb_sts_type msc_disk_read(uint8_t lun, uint32_t addr, uint8_t *read_buf, uint32
|
||||
* @param addr: logical address
|
||||
* @param buf: pointer to write buffer
|
||||
* @param len: write length
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type msc_disk_write(uint8_t lun, uint32_t addr, uint8_t *buf, uint32_t len)
|
||||
{
|
||||
@@ -112,7 +112,7 @@ usb_sts_type msc_disk_write(uint8_t lun, uint32_t addr, uint8_t *buf, uint32_t l
|
||||
* @param lun: logical units number
|
||||
* @param blk_nbr: pointer to number of block
|
||||
* @param blk_size: pointer to block size
|
||||
* @retval status of usb_sts_type
|
||||
* @retval status of usb_sts_type
|
||||
*/
|
||||
usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_size)
|
||||
{
|
||||
@@ -134,8 +134,8 @@ usb_sts_type msc_disk_capacity(uint8_t lun, uint32_t *blk_nbr, uint32_t *blk_siz
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user