update version to v2.0.8

This commit is contained in:
Artery-MCU
2022-11-22 18:16:27 +08:00
parent caea1e6d25
commit 0d6e76999d
1301 changed files with 16158 additions and 12379 deletions

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file i2c_application.c
* @version v2.0.7
* @date 2022-08-16
* @brief the driver library of the i2c peripheral
**************************************************************************
* Copyright notice & Disclaimer
@@ -891,15 +889,6 @@ i2c_status_type i2c_slave_receive_int(i2c_handle_type* hi2c, uint8_t* pdata, uin
/* enable ack */
i2c_ack_enable(hi2c->i2cx, TRUE);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
return I2C_ERR_STEP_2;
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* enable interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
@@ -1017,30 +1006,6 @@ i2c_status_type i2c_slave_transmit_int(i2c_handle_type* hi2c, uint8_t* pdata, ui
/* enable ack */
i2c_ack_enable(hi2c->i2cx, TRUE);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
return I2C_ERR_STEP_2;
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_10BIT)
{
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_3;
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* enable interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT | I2C_DATA_INT | I2C_ERR_INT, TRUE);
@@ -1139,20 +1104,11 @@ i2c_status_type i2c_slave_receive_dma(i2c_handle_type* hi2c, uint8_t* pdata, uin
/* configure the dma channel */
i2c_dma_config(hi2c, hi2c->dma_rx_channel, pdata, size);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_2;
}
/* enable dma request */
i2c_dma_enable(hi2c->i2cx, TRUE);
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* enable address interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
return I2C_OK;
}
@@ -1272,37 +1228,12 @@ i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, ui
/* configure the dma channel */
i2c_dma_config(hi2c, hi2c->dma_tx_channel, pdata, size);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_2;
}
if(hi2c->i2cx->oaddr1_bit.addr1mode == I2C_ADDRESS_MODE_10BIT)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* wait for the addr7 flag to be set */
if(i2c_wait_flag(hi2c, I2C_ADDR7F_FLAG, I2C_EVENT_CHECK_NONE, timeout) != I2C_OK)
{
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
return I2C_ERR_STEP_3;
}
}
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
/* enable dma request */
i2c_dma_enable(hi2c->i2cx, TRUE);
/* enable address interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
return I2C_OK;
}
@@ -1311,8 +1242,8 @@ i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, ui
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param timeout: maximum waiting time.
@@ -1321,7 +1252,7 @@ i2c_status_type i2c_slave_transmit_dma(i2c_handle_type* hi2c, uint8_t* pdata, ui
i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_width_type mem_address_width, uint16_t mem_address, int32_t timeout)
{
i2c_status_type err_code;
if(mem_address_width == I2C_MEM_ADDR_WIDIH_8)
{
/* send memory address */
@@ -1330,11 +1261,11 @@ i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_w
else
{
/* send memory address */
i2c_data_send(hi2c->i2cx, (mem_address >> 8) & 0xFF);
i2c_data_send(hi2c->i2cx, (mem_address >> 8) & 0xFF);
/* wait for the tdbe flag to be set */
err_code = i2c_wait_flag(hi2c, I2C_TDBE_FLAG, I2C_EVENT_CHECK_ACKFAIL, timeout);
if(err_code != I2C_OK)
{
/* generate stop condtion */
@@ -1342,21 +1273,21 @@ i2c_status_type i2c_memory_address_send(i2c_handle_type* hi2c, i2c_mem_address_w
return err_code;
}
/* send memory address */
i2c_data_send(hi2c->i2cx, mem_address & 0xFF);
i2c_data_send(hi2c->i2cx, mem_address & 0xFF);
}
return I2C_OK;
}
/**
* @brief write data to the memory device through polling mode.
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param pdata: data buffer.
@@ -1401,7 +1332,7 @@ i2c_status_type i2c_memory_write(i2c_handle_type* hi2c, i2c_mem_address_width_ty
return I2C_ERR_STEP_3;
}
/* send memory address */
if(i2c_memory_address_send(hi2c, mem_address_width, mem_address, timeout) != I2C_OK)
{
@@ -1444,8 +1375,8 @@ i2c_status_type i2c_memory_write(i2c_handle_type* hi2c, i2c_mem_address_width_ty
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param pdata: data buffer.
@@ -1657,8 +1588,8 @@ i2c_status_type i2c_memory_read(i2c_handle_type* hi2c, i2c_mem_address_width_typ
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param pdata: data buffer.
@@ -1734,8 +1665,8 @@ i2c_status_type i2c_memory_write_int(i2c_handle_type* hi2c, i2c_mem_address_widt
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param pdata: data buffer.
@@ -1851,8 +1782,8 @@ i2c_status_type i2c_memory_read_int(i2c_handle_type* hi2c, i2c_mem_address_width
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param pdata: data buffer.
@@ -1934,8 +1865,8 @@ i2c_status_type i2c_memory_write_dma(i2c_handle_type* hi2c, i2c_mem_address_widt
* @param hi2c: the handle points to the operation information.
* @param mem_address_width: memory address width.
* this parameter can be one of the following values:
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* - I2C_MEM_ADDR_WIDIH_8: memory address is 8 bit
* - I2C_MEM_ADDR_WIDIH_16: memory address is 16 bit
* @param address: memory device address.
* @param mem_address: memory address.
* @param pdata: data buffer.
@@ -2157,8 +2088,15 @@ void i2c_master_rx_isr_int(i2c_handle_type* hi2c)
*/
void i2c_slave_tx_isr_int(i2c_handle_type* hi2c)
{
/* transfer data */
if(i2c_flag_get(hi2c->i2cx, I2C_TDBE_FLAG) != RESET)
/* step 1: receive slave address */
if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* step 2: transfer data */
else if(i2c_flag_get(hi2c->i2cx, I2C_TDBE_FLAG) != RESET)
{
if(hi2c->pcount)
{
@@ -2191,8 +2129,15 @@ void i2c_slave_tx_isr_int(i2c_handle_type* hi2c)
*/
void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
{
/* receive data */
if(i2c_flag_get(hi2c->i2cx, I2C_RDBF_FLAG) != RESET)
/* step 1: receive slave address */
if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* step 2: receive data */
else if(i2c_flag_get(hi2c->i2cx, I2C_RDBF_FLAG) != RESET)
{
if(hi2c->pcount)
{
@@ -2203,7 +2148,7 @@ void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
}
}
/* step 2: received stop conditon */
/* step 3: stop conditon is received, transfer ends */
else if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
{
/* clear stop flag */
@@ -2217,6 +2162,58 @@ void i2c_slave_rx_isr_int(i2c_handle_type* hi2c)
}
}
/**
* @brief master interrupt processing function in dma mode.
* @param hi2c: the handle points to the operation information.
* @retval none.
*/
void i2c_master_tx_isr_dma(i2c_handle_type* hi2c)
{
/* tdc interrupt */
if(i2c_flag_get(hi2c->i2cx, I2C_TDC_FLAG) != RESET)
{
/* generate stop condtion */
i2c_stop_generate(hi2c->i2cx);
/* disable evt interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
}
}
/**
* @brief slave interrupt processing function in dma mode.
* @param hi2c: the handle points to the operation information.
* @retval none.
*/
void i2c_slave_tx_rx_isr_dma(i2c_handle_type* hi2c)
{
/* receive slave address */
if(i2c_flag_get(hi2c->i2cx, I2C_ADDR7F_FLAG) != RESET)
{
/* clear addr flag */
i2c_flag_clear(hi2c->i2cx, I2C_ADDR7F_FLAG);
}
/* wait for the stop flag to be set, trasnfer end */
if(i2c_flag_get(hi2c->i2cx, I2C_STOPF_FLAG) != RESET)
{
/* clear stop flag */
i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
/* disable evt interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
/* disable ack */
i2c_ack_enable(hi2c->i2cx, TRUE);
/* transfer complete */
hi2c->status = I2C_END;
}
}
/**
* @brief interrupt procession function.
* @param hi2c: the handle points to the operation information.
@@ -2238,6 +2235,13 @@ void i2c_evt_irq_handler(i2c_handle_type* hi2c)
case I2C_INT_SLA_RX:
i2c_slave_rx_isr_int(hi2c);
break;
case I2C_DMA_MA_TX:
i2c_master_tx_isr_dma(hi2c);
break;
case I2C_DMA_SLA_TX:
case I2C_DMA_SLA_RX:
i2c_slave_tx_rx_isr_dma(hi2c);
break;
default:
break;
}
@@ -2259,36 +2263,24 @@ void i2c_dma_tx_irq_handler(i2c_handle_type* hi2c)
/* clear the transfer complete flag */
dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_tx_channel));
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
hi2c->pcount = 0;
switch(hi2c->mode)
{
case I2C_DMA_MA_TX:
/* wait for the tdc flag to be set */
hi2c->status = i2c_wait_flag(hi2c, I2C_TDC_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout);
/* generate stop condtion */
i2c_stop_generate(hi2c->i2cx);
/* enable tdc interrupt, generate stop condition in tdc interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
break;
case I2C_DMA_SLA_TX:
/* wait for the ackfail flag to be set */
hi2c->status = i2c_wait_flag(hi2c, I2C_ACKFAIL_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout);
/* clear ackfail flag */
i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
/* enable ackfail interrupt, generate stop condition in ackfail interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_ERR_INT, TRUE);
break;
default:
break;
}
hi2c->pcount = 0;
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
}
}
@@ -2308,6 +2300,11 @@ void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
/* clear the transfer complete flag */
dma_flag_clear(DMA_GET_TC_FLAG(hi2c->dma_rx_channel));
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
hi2c->pcount = 0;
switch(hi2c->mode)
{
case I2C_DMA_MA_RX:
@@ -2319,25 +2316,17 @@ void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
/* generate stop condtion */
i2c_stop_generate(hi2c->i2cx);
}
/* transfer complete */
hi2c->status = I2C_END;
break;
case I2C_DMA_SLA_RX:
/* wait for the stop flag to be set */
hi2c->status = i2c_wait_flag(hi2c, I2C_STOPF_FLAG, I2C_EVENT_CHECK_NONE, hi2c->timeout);
/* clear stop flag */
i2c_flag_clear(hi2c->i2cx, I2C_STOPF_FLAG);
/* enable stop interrupt, wait for the stop flag to be set */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, TRUE);
break;
default:
break;
}
hi2c->pcount = 0;
/* disable dma request */
i2c_dma_enable(hi2c->i2cx, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
}
}
@@ -2348,48 +2337,75 @@ void i2c_dma_rx_irq_handler(i2c_handle_type* hi2c)
*/
void i2c_err_irq_handler(i2c_handle_type* hi2c)
{
hi2c->error_code = I2C_ERR_INTERRUPT;
/* buserr */
if(i2c_flag_get(hi2c->i2cx, I2C_BUSERR_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_BUSERR_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
}
/* arlost */
if(i2c_flag_get(hi2c->i2cx, I2C_ARLOST_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_ARLOST_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
}
/* ackfail */
if(i2c_flag_get(hi2c->i2cx, I2C_ACKFAIL_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_ACKFAIL_FLAG);
switch(hi2c->mode)
{
case I2C_DMA_SLA_TX:
/* disable ack */
i2c_ack_enable(hi2c->i2cx, FALSE);
/* disable evt interrupt */
i2c_interrupt_enable(hi2c->i2cx, I2C_EVT_INT, FALSE);
/* transfer complete */
hi2c->status = I2C_END;
break;
default:
hi2c->error_code = I2C_ERR_INTERRUPT;
break;
}
}
/* ouf */
if(i2c_flag_get(hi2c->i2cx, I2C_OUF_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_OUF_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
}
/* pecerr */
if(i2c_flag_get(hi2c->i2cx, I2C_PECERR_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_PECERR_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
}
/* tmout */
if(i2c_flag_get(hi2c->i2cx, I2C_TMOUT_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_TMOUT_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
}
/* alertf */
if(i2c_flag_get(hi2c->i2cx, I2C_ALERTF_FLAG) != RESET)
{
i2c_flag_clear(hi2c->i2cx, I2C_ALERTF_FLAG);
hi2c->error_code = I2C_ERR_INTERRUPT;
}
/* disable all interrupts */

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file i2c_application.h
* @version v2.0.7
* @date 2022-08-16
* @brief i2c application libray header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio config
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio device descriptor
**************************************************************************
* Copyright notice & Disclaimer
@@ -170,9 +168,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUDIO_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */
0x01, /* bmaControls0: mute */
0x02, /* bmaControls1: volume */
0x02, /* bControlSize: 2 byte */
0x03, /* bmaControls0: mute & volume*/
0x00,
0x00, /* bmaControls1 */
0x00,
0x00, /* bmaControls2 */
0x00,
0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
@@ -211,9 +213,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUDIO_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */
0x01, /* bmaControls0: mute*/
0x02, /* bmaControls1: volume */
0x02, /* bControlSize: 2 byte */
0x03, /* bmaControls0: mute & volume*/
0x00,
0x00, /* bmaControls1: 0x0000 */
0x00,
0x00, /* bmaControls2: 0x0000 */
0x00,
0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio descriptor header file
**************************************************************************
* Copyright notice & Disclaimer
@@ -151,7 +149,7 @@ extern "C" {
* @brief audio interface config
*/
#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x1E)
#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define AUDIO_MIC_INTERFACE 0x01
#define AUDIO_SPK_INTERFACE 0x02
@@ -160,7 +158,7 @@ extern "C" {
*/
#define AUDIO_INPUT_TERMINAL_SIZE 0x0C
#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define AUDIO_FEATURE_UNIT_SIZE 0x09
#define AUDIO_FEATURE_UNIT_SIZE 0x0D
/**
* @brief audio terminal id define

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_conf.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio config
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio class file
**************************************************************************
* Copyright notice & Disclaimer
@@ -137,10 +135,10 @@ typedef struct
uint32_t hid_protocol;
uint32_t hid_set_idle;
uint32_t alt_setting;
uint8_t hid_state;
uint8_t hid_set_report[64];
uint8_t g_rxhid_buff[USBD_AUHID_OUT_MAXPACKET_SIZE];
uint8_t g_txhid_buff[USBD_AUHID_IN_MAXPACKET_SIZE];
uint8_t hid_state;
}usb_audio_hid_type;
extern usbd_class_handler audio_hid_class_handler;

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio device descriptor
**************************************************************************
* Copyright notice & Disclaimer
@@ -155,7 +153,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_MIC_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
LBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),
HBYTE(AUDIO_INPUT_TERMINAL_MICROPHONE),/* wTerminalType: terminal is microphone */
AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bAssocTerminal: no association */
0x00, /* bAssocTerminal: no association */
AUDIO_MIC_CHR, /* bNrChannels: two channel */
#if (AUDIO_MIC_CHR == 2)
0x03, /* wChannelConfig: left front and right front */
@@ -172,9 +170,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_MIC_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_MIC_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */
0x01, /* bmaControls0: mute */
0x02, /* bmaControls1: volume */
0x02, /* bControlSize: 2 byte */
0x03, /* bmaControls0: mute & volume*/
0x00,
0x00, /* bmaControls1 */
0x00,
0x00, /* bmaControls2 */
0x00,
0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
@@ -183,7 +185,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_MIC_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
LBYTE(AUDIO_TERMINAL_TYPE_STREAMING),
HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
AUDIO_MIC_INPUT_TERMINAL_ID, /* bAssocTerminal: unused */
0x00, /* bAssocTerminal: unused */
AUDIO_MIC_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
0x00, /* iTerminal: unused */
#endif
@@ -196,7 +198,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_SPK_INPUT_TERMINAL_ID, /* bTerminalID: id of this input terminal*/
LBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
HBYTE(AUDIO_TERMINAL_TYPE_STREAMING), /* wTerminalType: usb streaming */
AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bAssocTerminal: no association */
0x00, /* bAssocTerminal: no association */
AUDIO_SPK_CHR, /* bNrChannels: two channel */
#if (AUDIO_SPK_CHR == 2)
0x03, /* wChannelConfig: left front and right front */
@@ -213,9 +215,13 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_AC_FEATURE_UNIT, /* bDescriptorSubtype: feature unit type*/
AUDIO_SPK_FEATURE_UNIT_ID, /* bUnitID: id of this feature unit */
AUDIO_SPK_INPUT_TERMINAL_ID, /* bSourceID: from input terminal */
0x01, /* bControlSize: 1 byte */
0x01, /* bmaControls0: mute*/
0x02, /* bmaControls1: volume */
0x02, /* bControlSize: 2 byte */
0x03, /* bmaControls0: mute & volume*/
0x00,
0x00, /* bmaControls1: 0x0000 */
0x00,
0x00, /* bmaControls2: 0x0000 */
0x00,
0x00, /* iFeature: unused */
AUDIO_OUTPUT_TERMINAL_SIZE, /* bLength: descriptor size */
@@ -224,7 +230,7 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_AUHID_CONFIG_DESC_SIZE] AL
AUDIO_SPK_OUTPUT_TERMINAL_ID, /* bTerminalID: id of this output terminal*/
LBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
HBYTE(AUDIO_OUTPUT_TERMINAL_SPEAKER), /* wTerminalType: usb speaker */
AUDIO_SPK_INPUT_TERMINAL_ID, /* bAssocTerminal: unused */
0x00, /* bAssocTerminal: unused */
AUDIO_SPK_FEATURE_UNIT_ID, /* bSourceID: from feature unit terminal */
0x00, /* iTerminal: unused */
#endif

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file audio_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb audio descriptor header file
**************************************************************************
* Copyright notice & Disclaimer
@@ -150,7 +148,7 @@ extern "C" {
* @brief audio interface config
*/
#define AUDIO_INTERFACE_NUM (AUDIO_SUPPORT_SPK + AUDIO_SUPPORT_MIC)
#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x1E)
#define AUDIO_INTERFACE_LEN ((0x08 + AUDIO_INTERFACE_NUM) + AUDIO_INTERFACE_NUM * 0x22)
#define AUDIO_MIC_INTERFACE 0x01
#define AUDIO_SPK_INTERFACE 0x02
@@ -159,7 +157,7 @@ extern "C" {
*/
#define AUDIO_INPUT_TERMINAL_SIZE 0x0C
#define AUDIO_OUTPUT_TERMINAL_SIZE 0x09
#define AUDIO_FEATURE_UNIT_SIZE 0x09
#define AUDIO_FEATURE_UNIT_SIZE 0x0D
/**
* @brief audio terminal id define

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_keyboard_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_keyboard_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard class file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_keyboard_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_keyboard_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc and keyboard descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_msc_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_msc_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc class file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_msc_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc device descriptor
**************************************************************************
* Copyright notice & Disclaimer
@@ -202,8 +200,8 @@ ALIGNED_HEAD static uint8_t g_usbd_configuration[USBD_CDC_MSC_CONFIG_DESC_SIZE]
0x05, /* bFunctionLength: size of this descriptor in bytes */
USBD_CDC_CS_INTERFACE, /* bDescriptorType: CDC interface descriptor type */
USBD_CDC_SUBTYPE_UFD, /* bDescriptorSubtype: Union Function Descriptor subtype 0x06 */
0x00, /* bControlInterface: The interface number of the communications or data class interface 0x00 */
0x01, /* bSubordinateInterface0: interface number of first subordinate interface in the union */
0x01, /* bControlInterface: The interface number of the communications or data class interface 0x00 */
0x02, /* bSubordinateInterface0: interface number of first subordinate interface in the union */
USB_DEVICE_EPT_LEN, /* bLength: size of endpoint descriptor in bytes */
USB_DESCIPTOR_TYPE_ENDPOINT, /* bDescriptorType: endpoint descriptor type */

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file cdc_msc_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb cdc descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_bot_scsi.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb mass storage bulk-only transport and scsi command
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file custom_hid_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb custom hid class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file custom_hid_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb custom hid header file
**************************************************************************
* Copyright notice & Disclaimer
@@ -75,9 +73,10 @@ typedef struct
uint32_t hid_protocol;
uint32_t hid_set_idle;
uint32_t alt_setting;
uint8_t hid_state;
uint8_t hid_set_report[64];
uint8_t hid_get_report[64];
uint8_t hid_state;
}custom_hid_type;
/**

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file custom_hid_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file custom_hid_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb custom hid descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file hid_iap_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid iap class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file hid_iap_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid iap header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file hid_iap_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file hid_iap_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file keyboard_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid keyboard class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file keyboard_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid keyboard header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file keyboard_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid keyboard device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file keyboard_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb keyboard descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file mouse_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid mouse class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file mouse_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid mouse header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file mouse_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb hid mouse device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file mouse_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb mouse descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_bot_scsi.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb mass storage bulk-only transport and scsi command
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_bot_scsi.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb mass storage bulk-only transport and scsi command header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb msc class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb msc class file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb msc device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file msc_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb msc descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file printer_class.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb printer class type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file printer_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb printer class file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file printer_desc.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb printer device descriptor
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file printer_desc.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb printer descriptor header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usb_std.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb standard header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbd_core.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb device core header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usb_int.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbd_sdr.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb standard request header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbd_core.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb driver
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbd_int.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb interrupt request
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbd_sdr.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb standard device request
**************************************************************************
* Copyright notice & Disclaimer