update version to v2.0.8

This commit is contained in:
Artery-MCU
2022-11-22 18:18:07 +08:00
parent d95c5fb9e8
commit d4910499d3
1365 changed files with 13037 additions and 14600 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 usb_core.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb core 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 usbd_int.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb interrupt header file
**************************************************************************
* Copyright notice & Disclaimer

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbd_core.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb device 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

View File

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

View File

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

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_int.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb host interrupt request
**************************************************************************
* 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
@@ -140,10 +138,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;

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
@@ -158,7 +156,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 */
@@ -175,9 +173,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 */
@@ -186,7 +188,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
@@ -199,7 +201,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 */
@@ -216,9 +218,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 */
@@ -227,7 +233,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 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_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 iap 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 iap 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 cdc 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,281 +1,279 @@
/**
**************************************************************************
* @file usbh_cdc_class.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb host cdc class 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
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_MSC_CLASS_H
#define __USBH_MSC_CLASS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "usbh_core.h"
#include "usb_conf.h"
/** @addtogroup AT32F415_middlewares_usbh_class
* @{
*/
/** @addtogroup USBH_cdc_class
* @{
*/
/** @defgroup USBH_cdc_class_definition
* @{
*/
/*Communication Class codes*/
#define USB_CDC_CLASS 0x02
#define COMMUNICATION_INTERFACE_CLASS_CODE 0x02
/*Data Interface Class Codes*/
#define DATA_INTERFACE_CLASS_CODE 0x0A
/*Communication sub class codes*/
#define RESERVED 0x00
#define DIRECT_LINE_CONTROL_MODEL 0x01
#define ABSTRACT_CONTROL_MODEL 0x02
#define TELEPHONE_CONTROL_MODEL 0x03
#define MULTICHANNEL_CONTROL_MODEL 0x04
#define CAPI_CONTROL_MODEL 0x05
#define ETHERNET_NETWORKING_CONTROL_MODEL 0x06
#define ATM_NETWORKING_CONTROL_MODEL 0x07
/*Communication Interface Class Control Protocol Codes*/
#define NO_CLASS_SPECIFIC_PROTOCOL_CODE 0x00
#define COMMON_AT_COMMAND 0x01
#define VENDOR_SPECIFIC 0xFF
#define CS_INTERFACE 0x24
#define CDC_PAGE_SIZE_64 0x40
/*Class-Specific Request Codes*/
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
#define CDC_SET_COMM_FEATURE 0x02
#define CDC_GET_COMM_FEATURE 0x03
#define CDC_CLEAR_COMM_FEATURE 0x04
#define CDC_SET_AUX_LINE_STATE 0x10
#define CDC_SET_HOOK_STATE 0x11
#define CDC_PULSE_SETUP 0x12
#define CDC_SEND_PULSE 0x13
#define CDC_SET_PULSE_TIME 0x14
#define CDC_RING_AUX_JACK 0x15
#define CDC_SET_LINE_CODING 0x20
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
#define CDC_SEND_BREAK 0x23
#define CDC_SET_RINGER_PARMS 0x30
#define CDC_GET_RINGER_PARMS 0x31
#define CDC_SET_OPERATION_PARMS 0x32
#define CDC_GET_OPERATION_PARMS 0x33
#define CDC_SET_LINE_PARMS 0x34
#define CDC_GET_LINE_PARMS 0x35
#define CDC_DIAL_DIGITS 0x36
#define CDC_SET_UNIT_PARAMETER 0x37
#define CDC_GET_UNIT_PARAMETER 0x38
#define CDC_CLEAR_UNIT_PARAMETER 0x39
#define CDC_GET_PROFILE 0x3A
#define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
#define CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN FILTER 0x41
#define CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN FILTER 0x42
#define CDC_SET_ETHERNET_PACKET_FILTER 0x43
#define CDC_GET_ETHERNET_STATISTIC 0x44
#define CDC_SET_ATM_DATA_FORMAT 0x50
#define CDC_GET_ATM_DEVICE_STATISTICS 0x51
#define CDC_SET_ATM_DEFAULT_VC 0x52
#define CDC_GET_ATM_VC_STATISTICS 0x53
/* wValue for SetControlLineState*/
#define CDC_ACTIVATE_CARRIER_SIGNAL_RTS 0x0002
#define CDC_DEACTIVATE_CARRIER_SIGNAL_RTS 0x0000
#define CDC_ACTIVATE_SIGNAL_DTR 0x0001
#define CDC_DEACTIVATE_SIGNAL_DTR 0x0000
#define LINE_CODING_STRUCTURE_SIZE 0x07
/* states for cdc state machine */
typedef enum
{
CDC_IDLE = 0x0,
CDC_SEND_DATA = 0x1,
CDC_SEND_DATA_WAIT = 0x2,
CDC_RECEIVE_DATA = 0x3,
CDC_RECEIVE_DATA_WAIT = 0x4,
} cdc_data_state_type;
typedef enum
{
CDC_IDLE_STATE = 0x0,
CDC_SET_LINE_CODING_STATE = 0x1,
CDC_GET_LAST_LINE_CODING_STATE = 0x2,
CDC_TRANSFER_DATA = 0x3,
CDC_ERROR_STATE = 0x4,
} cdc_state_type;
/*line coding structure*/
typedef union _cdc_line_coding_structure
{
uint8_t array[LINE_CODING_STRUCTURE_SIZE];
struct
{
uint32_t data_baudrate; /*data terminal rate, in bits per second*/
uint8_t char_format; /* Stop bits
0 - 1 Stop bit
1 - 1.5 Stop bits
2 - 2 Stop bits*/
uint8_t parity_type; /* parity
0 - none
1 - odd
2 - even
3 - mark
4 - space*/
uint8_t data_bits; /* data bits (5, 6, 7, 8 or 16). */
}line_coding_b;
} cdc_line_coding_type;
/* header functional descriptor */
typedef struct _functional_descriptor_header
{
uint8_t bfunctionlength; /* size of this descriptor. */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* header functional descriptor subtype as */
uint16_t bcdcdc; /* usb class definitions for communication
devices specification release number in
binary-coded decimal. */
} cdc_headerfuncdesc_type;
/* call management functional descriptor */
typedef struct _callmgmt_functional_descriptor
{
uint8_t blength; /* size of this functional descriptor, in bytes */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* call management functional descriptor subtype */
uint8_t bmcapabilities; /* bmcapabilities: d0+d1 */
uint8_t bdatainterface; /* bdatainterface: 1 */
} cdc_callmgmtfuncdesc_type;
/* abstract control management functional descriptor */
typedef struct _abstractcntrlmgmt_functional_descriptor
{
uint8_t blength; /* size of this functional descriptor, in bytes */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* abstract control management functional
descriptor subtype */
uint8_t bmcapabilities; /* the capabilities that this configuration supports */
} cdc_abstcntrlmgmtfuncdesc_type;
/* union functional descriptor */
typedef struct _union_functional_descriptor
{
uint8_t blength; /* size of this functional descriptor, in bytes */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* union functional descriptor subtype */
uint8_t bmasterinterface; /* the interface number of the communication or
data class interface */
uint8_t bslaveinterface0; /* interface number of first slave */
} cdc_unionfuncdesc_type;
typedef struct _usbh_cdcinterfacedesc
{
cdc_headerfuncdesc_type cdc_headerfuncdesc;
cdc_callmgmtfuncdesc_type cdc_callmgmtfuncdesc;
cdc_abstcntrlmgmtfuncdesc_type cdc_abstcntrlmgmtfuncdesc;
cdc_unionfuncdesc_type cdc_unionfuncdesc;
} cdc_interfacedesc_type;
/* structure for cdc process */
typedef struct
{
uint8_t notif_channel;
uint8_t notif_endpoint;
uint8_t buff[8];
uint16_t notif_endpoint_size;
} cdc_common_interface_type;
typedef struct
{
uint8_t in_channel;
uint8_t out_channel;
uint8_t out_endpoint;
uint8_t in_endpoint;
uint8_t buff[8];
uint16_t out_endpoint_size;
uint16_t in_endpoint_size;
} cdc_data_interface_type;
typedef struct
{
cdc_common_interface_type common_interface;
cdc_data_interface_type data_interface;
cdc_interfacedesc_type cdc_desc;
cdc_line_coding_type linecoding;
cdc_line_coding_type *puserlinecoding;
cdc_state_type state;
cdc_data_state_type data_tx_state;
cdc_data_state_type data_rx_state;
uint8_t *rx_data;
uint8_t *tx_data;
uint32_t rx_len;
uint32_t tx_len;
}usbh_cdc_type;
extern usbh_class_handler_type uhost_cdc_class_handler;
extern usbh_cdc_type usbh_cdc;
void cdc_start_transmission(usbh_core_type *phost, uint8_t *data, uint32_t len);
void cdc_start_reception(usbh_core_type *uhost, uint8_t *data, uint32_t len);
__weak void cdc_transmit_complete(usbh_core_type *uhost);
__weak void cdc_receive_complete(usbh_core_type *uhost);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif
/**
**************************************************************************
* @file usbh_cdc_class.h
* @brief usb host cdc class 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
* software is governed by this copyright notice and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
* GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
* TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
* STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
* INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
*
**************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_MSC_CLASS_H
#define __USBH_MSC_CLASS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "usbh_core.h"
#include "usb_conf.h"
/** @addtogroup AT32F415_middlewares_usbh_class
* @{
*/
/** @addtogroup USBH_cdc_class
* @{
*/
/** @defgroup USBH_cdc_class_definition
* @{
*/
/*Communication Class codes*/
#define USB_CDC_CLASS 0x02
#define COMMUNICATION_INTERFACE_CLASS_CODE 0x02
/*Data Interface Class Codes*/
#define DATA_INTERFACE_CLASS_CODE 0x0A
/*Communication sub class codes*/
#define RESERVED 0x00
#define DIRECT_LINE_CONTROL_MODEL 0x01
#define ABSTRACT_CONTROL_MODEL 0x02
#define TELEPHONE_CONTROL_MODEL 0x03
#define MULTICHANNEL_CONTROL_MODEL 0x04
#define CAPI_CONTROL_MODEL 0x05
#define ETHERNET_NETWORKING_CONTROL_MODEL 0x06
#define ATM_NETWORKING_CONTROL_MODEL 0x07
/*Communication Interface Class Control Protocol Codes*/
#define NO_CLASS_SPECIFIC_PROTOCOL_CODE 0x00
#define COMMON_AT_COMMAND 0x01
#define VENDOR_SPECIFIC 0xFF
#define CS_INTERFACE 0x24
#define CDC_PAGE_SIZE_64 0x40
/*Class-Specific Request Codes*/
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
#define CDC_SET_COMM_FEATURE 0x02
#define CDC_GET_COMM_FEATURE 0x03
#define CDC_CLEAR_COMM_FEATURE 0x04
#define CDC_SET_AUX_LINE_STATE 0x10
#define CDC_SET_HOOK_STATE 0x11
#define CDC_PULSE_SETUP 0x12
#define CDC_SEND_PULSE 0x13
#define CDC_SET_PULSE_TIME 0x14
#define CDC_RING_AUX_JACK 0x15
#define CDC_SET_LINE_CODING 0x20
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
#define CDC_SEND_BREAK 0x23
#define CDC_SET_RINGER_PARMS 0x30
#define CDC_GET_RINGER_PARMS 0x31
#define CDC_SET_OPERATION_PARMS 0x32
#define CDC_GET_OPERATION_PARMS 0x33
#define CDC_SET_LINE_PARMS 0x34
#define CDC_GET_LINE_PARMS 0x35
#define CDC_DIAL_DIGITS 0x36
#define CDC_SET_UNIT_PARAMETER 0x37
#define CDC_GET_UNIT_PARAMETER 0x38
#define CDC_CLEAR_UNIT_PARAMETER 0x39
#define CDC_GET_PROFILE 0x3A
#define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
#define CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN FILTER 0x41
#define CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN FILTER 0x42
#define CDC_SET_ETHERNET_PACKET_FILTER 0x43
#define CDC_GET_ETHERNET_STATISTIC 0x44
#define CDC_SET_ATM_DATA_FORMAT 0x50
#define CDC_GET_ATM_DEVICE_STATISTICS 0x51
#define CDC_SET_ATM_DEFAULT_VC 0x52
#define CDC_GET_ATM_VC_STATISTICS 0x53
/* wValue for SetControlLineState*/
#define CDC_ACTIVATE_CARRIER_SIGNAL_RTS 0x0002
#define CDC_DEACTIVATE_CARRIER_SIGNAL_RTS 0x0000
#define CDC_ACTIVATE_SIGNAL_DTR 0x0001
#define CDC_DEACTIVATE_SIGNAL_DTR 0x0000
#define LINE_CODING_STRUCTURE_SIZE 0x07
/* states for cdc state machine */
typedef enum
{
CDC_IDLE = 0x0,
CDC_SEND_DATA = 0x1,
CDC_SEND_DATA_WAIT = 0x2,
CDC_RECEIVE_DATA = 0x3,
CDC_RECEIVE_DATA_WAIT = 0x4,
} cdc_data_state_type;
typedef enum
{
CDC_IDLE_STATE = 0x0,
CDC_SET_LINE_CODING_STATE = 0x1,
CDC_GET_LAST_LINE_CODING_STATE = 0x2,
CDC_TRANSFER_DATA = 0x3,
CDC_ERROR_STATE = 0x4,
} cdc_state_type;
/*line coding structure*/
typedef union _cdc_line_coding_structure
{
uint8_t array[LINE_CODING_STRUCTURE_SIZE];
struct
{
uint32_t data_baudrate; /*data terminal rate, in bits per second*/
uint8_t char_format; /* Stop bits
0 - 1 Stop bit
1 - 1.5 Stop bits
2 - 2 Stop bits*/
uint8_t parity_type; /* parity
0 - none
1 - odd
2 - even
3 - mark
4 - space*/
uint8_t data_bits; /* data bits (5, 6, 7, 8 or 16). */
}line_coding_b;
} cdc_line_coding_type;
/* header functional descriptor */
typedef struct _functional_descriptor_header
{
uint8_t bfunctionlength; /* size of this descriptor. */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* header functional descriptor subtype as */
uint16_t bcdcdc; /* usb class definitions for communication
devices specification release number in
binary-coded decimal. */
} cdc_headerfuncdesc_type;
/* call management functional descriptor */
typedef struct _callmgmt_functional_descriptor
{
uint8_t blength; /* size of this functional descriptor, in bytes */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* call management functional descriptor subtype */
uint8_t bmcapabilities; /* bmcapabilities: d0+d1 */
uint8_t bdatainterface; /* bdatainterface: 1 */
} cdc_callmgmtfuncdesc_type;
/* abstract control management functional descriptor */
typedef struct _abstractcntrlmgmt_functional_descriptor
{
uint8_t blength; /* size of this functional descriptor, in bytes */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* abstract control management functional
descriptor subtype */
uint8_t bmcapabilities; /* the capabilities that this configuration supports */
} cdc_abstcntrlmgmtfuncdesc_type;
/* union functional descriptor */
typedef struct _union_functional_descriptor
{
uint8_t blength; /* size of this functional descriptor, in bytes */
uint8_t bdescriptortype; /* cs_interface (0x24) */
uint8_t bdescriptorsubtype; /* union functional descriptor subtype */
uint8_t bmasterinterface; /* the interface number of the communication or
data class interface */
uint8_t bslaveinterface0; /* interface number of first slave */
} cdc_unionfuncdesc_type;
typedef struct _usbh_cdcinterfacedesc
{
cdc_headerfuncdesc_type cdc_headerfuncdesc;
cdc_callmgmtfuncdesc_type cdc_callmgmtfuncdesc;
cdc_abstcntrlmgmtfuncdesc_type cdc_abstcntrlmgmtfuncdesc;
cdc_unionfuncdesc_type cdc_unionfuncdesc;
} cdc_interfacedesc_type;
/* structure for cdc process */
typedef struct
{
uint8_t notif_channel;
uint8_t notif_endpoint;
uint8_t buff[8];
uint16_t notif_endpoint_size;
} cdc_common_interface_type;
typedef struct
{
uint8_t in_channel;
uint8_t out_channel;
uint8_t out_endpoint;
uint8_t in_endpoint;
uint8_t buff[8];
uint16_t out_endpoint_size;
uint16_t in_endpoint_size;
} cdc_data_interface_type;
typedef struct
{
cdc_common_interface_type common_interface;
cdc_data_interface_type data_interface;
cdc_interfacedesc_type cdc_desc;
cdc_line_coding_type linecoding;
cdc_line_coding_type *puserlinecoding;
cdc_state_type state;
cdc_data_state_type data_tx_state;
cdc_data_state_type data_rx_state;
uint8_t *rx_data;
uint8_t *tx_data;
uint32_t rx_len;
uint32_t tx_len;
}usbh_cdc_type;
extern usbh_class_handler_type uhost_cdc_class_handler;
extern usbh_cdc_type usbh_cdc;
void cdc_start_transmission(usbh_core_type *phost, uint8_t *data, uint32_t len);
void cdc_start_reception(usbh_core_type *uhost, uint8_t *data, uint32_t len);
__weak void cdc_transmit_complete(usbh_core_type *uhost);
__weak void cdc_receive_complete(usbh_core_type *uhost);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_msc_bot_scsi.c
* @version v2.0.7
* @date 2022-08-16
* @brief usb host msc bulk-only transfer and scsi type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,6 @@
/**
**************************************************************************
* @file usbh_msc_bot_scsi.h
* @version v2.0.7
* @date 2022-08-16
* @brief usb host msc bulk-only transfer and scsi header file
**************************************************************************
* Copyright notice & Disclaimer

View File

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

View File

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