update version to v2.0.2

This commit is contained in:
Artery-MCU
2022-01-21 15:54:53 +08:00
parent 47b90bbacd
commit 79c8fdf6b4
1190 changed files with 14716 additions and 25013 deletions

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_hid_class.c
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host hid class type
**************************************************************************
* Copyright notice & Disclaimer
@@ -396,7 +396,7 @@ usb_sts_type uhost_process_handler(void *uhost)
break;
case USB_HID_GET:
usbh_interrupt_recv(puhost, phid->chin, phid->buffer, phid->in_maxpacket);
usbh_interrupt_recv(puhost, phid->chin, (uint8_t *)phid->buffer, phid->in_maxpacket);
phid->state = USB_HID_POLL;
phid->poll_timer = usbh_get_frame(puhost->usb_reg);
break;
@@ -414,11 +414,11 @@ usb_sts_type uhost_process_handler(void *uhost)
puhost->urb_state[phid->chin] = URB_IDLE;
if(phid->protocol == USB_HID_MOUSE_PROTOCOL_CODE)
{
usbh_hid_mouse_decode(phid->buffer);
usbh_hid_mouse_decode((uint8_t *)phid->buffer);
}
else if(phid->protocol == USB_HID_KEYBOARD_PROTOCOL_CODE)
{
usbh_hid_keyboard_decode(phid->buffer);
usbh_hid_keyboard_decode((uint8_t *)phid->buffer);
}
}

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_hid_class.h
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host hid class header file
**************************************************************************
* Copyright notice & Disclaimer
@@ -124,7 +124,7 @@ typedef struct
usb_hid_ctrl_state_type ctrl_state;
usb_hid_state_type state;
uint16_t poll_timer;
uint8_t buffer[64];
uint32_t buffer[16];
}usbh_hid_type;
extern usbh_class_handler_type uhost_class_handler;

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_hid_keyboard.c
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host hid keyboard type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_hid_keyboard.h
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host hid keyboard header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_hid_mouse.c
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host hid mouse type
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_hid_mouse.h
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host hid mouse header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_msc_bot_scsi.c
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host msc bulk-only transfer and scsi type
**************************************************************************
* Copyright notice & Disclaimer
@@ -598,7 +598,7 @@ usb_sts_type msc_bot_scsi_init(usbh_msc_type *msc_struct)
msc_struct->max_lun = 0;
msc_struct->use_lun = 0;
msc_struct->bot_trans.msc_struct = &usbh_msc;
msc_struct->bot_trans.cmd_state = CMD_STATE_WAIT;
msc_struct->bot_trans.cmd_state = CMD_STATE_SEND;
msc_struct->bot_trans.bot_state = BOT_STATE_SEND_CBW;
return USB_OK;
}

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_msc_bot_scsi.h
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host msc bulk-only transfer and scsi header file
**************************************************************************
* Copyright notice & Disclaimer

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_msc_class.c
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host msc class type
**************************************************************************
* Copyright notice & Disclaimer
@@ -221,11 +221,10 @@ usb_sts_type uhost_process_handler(void *uhost)
case USBH_MSC_INIT:
if(pmsc->cur_lun < pmsc->max_lun)
{
pmsc->l_unit_n[pmsc->cur_lun].ready = MSC_NOT_READY;
switch(pmsc->l_unit_n[pmsc->cur_lun].state)
{
case USBH_MSC_INIT:
pmsc->l_unit_n[pmsc->cur_lun].ready = MSC_NOT_READY;
pmsc->l_unit_n[pmsc->cur_lun].state = USBH_MSC_INQUIRY;
break;
case USBH_MSC_INQUIRY:
@@ -279,6 +278,7 @@ usb_sts_type uhost_process_handler(void *uhost)
}
else if(status == USB_FAIL)
{
pmsc->l_unit_n[pmsc->cur_lun].ready = MSC_NOT_READY;
pmsc->cur_lun ++;
}
break;
@@ -373,7 +373,7 @@ msc_error_type usbh_msc_is_ready(void *uhost, uint8_t lun)
{
usbh_core_type *puhost = (usbh_core_type *)uhost;
usbh_msc_type *pmsc = (usbh_msc_type *)puhost->class_handler->pdata;
return pmsc->l_unit_n[pmsc->cur_lun].ready;
return pmsc->l_unit_n[lun].ready;
}
/**
@@ -390,6 +390,7 @@ usb_sts_type usbh_msc_read(void *uhost, uint32_t address, uint32_t len, uint8_t
usbh_core_type *puhost = (usbh_core_type *)uhost;
usbh_msc_type *pmsc = (usbh_msc_type *)puhost->class_handler->pdata;
usb_sts_type status;
uint32_t timeout = 0;
if(puhost->conn_sts == 0 || puhost->global_state != USBH_CLASS
|| pmsc->l_unit_n[lun].state != USBH_MSC_IDLE)
{
@@ -399,8 +400,15 @@ usb_sts_type usbh_msc_read(void *uhost, uint32_t address, uint32_t len, uint8_t
pmsc->state = USBH_MSC_READ10;
pmsc->l_unit_n[lun].state = USBH_MSC_READ10;
pmsc->use_lun = lun;
timeout = puhost->timer;
while(1)
{
if(puhost->conn_sts == 0 || (puhost->timer - timeout) > (len * 10000))
{
pmsc->l_unit_n[lun].state = USBH_MSC_IDLE;
return USB_FAIL;
}
status = usbh_msc_bot_scsi_read(uhost, &pmsc->bot_trans, address, buffer, len, lun);
if(status == USB_OK)
{
@@ -430,6 +438,7 @@ usb_sts_type usbh_msc_write(void *uhost, uint32_t address, uint32_t len, uint8_t
usbh_core_type *puhost = (usbh_core_type *)uhost;
usbh_msc_type *pmsc = (usbh_msc_type *)puhost->class_handler->pdata;
usb_sts_type status;
uint32_t timeout = 0;
if(puhost->conn_sts == 0 || puhost->global_state != USBH_CLASS
|| pmsc->l_unit_n[lun].state != USBH_MSC_IDLE)
{
@@ -441,8 +450,14 @@ usb_sts_type usbh_msc_write(void *uhost, uint32_t address, uint32_t len, uint8_t
pmsc->l_unit_n[lun].state = USBH_MSC_WRITE;
pmsc->use_lun = lun;
timeout = puhost->timer;
while(1)
{
if(puhost->conn_sts == 0 || (puhost->timer - timeout) > (len * 10000))
{
pmsc->l_unit_n[lun].state = USBH_MSC_IDLE;
return USB_FAIL;
}
status = usbh_msc_bot_scsi_write(uhost, &pmsc->bot_trans, address, buffer, len, lun);
if(status == USB_OK)
{

View File

@@ -1,8 +1,8 @@
/**
**************************************************************************
* @file usbh_msc_class.h
* @version v2.0.0
* @date 2021-11-26
* @version v2.0.2
* @date 2021-12-31
* @brief usb host msc class header file
**************************************************************************
* Copyright notice & Disclaimer