update version to v2.1.0

This commit is contained in:
Artery-MCU
2023-08-08 19:30:55 +08:00
parent d7bcb64bf8
commit f49a554036
408 changed files with 224076 additions and 1271 deletions

View File

@@ -248,8 +248,13 @@ typedef struct
/**
* @brief min and max define
*/
#ifndef MIN
#define MIN(a, b) (uint16_t)(((a) < (b)) ? (a) : (b)) /*!< min define*/
#endif
#ifndef MAX
#define MAX(a, b) (uint16_t)(((a) > (b)) ? (a) : (b)) /*!< max define*/
#endif
/**
* @brief low byte and high byte define

View File

@@ -156,7 +156,7 @@ static usb_sts_type usbd_set_address(usbd_core_type *udev)
else
{
udev->device_addr = dev_addr;
usbd_set_device_addr(udev, udev->device_addr);
usbd_set_device_addr(udev, udev->device_addr);
if(dev_addr != 0)
{
@@ -396,9 +396,11 @@ usb_sts_type usbd_interface_request(usbd_core_type *udev)
usb_setup_type *setup = &udev->setup;
switch(udev->conn_state)
{
case USB_CONN_STATE_DEFAULT:
case USB_CONN_STATE_ADDRESSED:
case USB_CONN_STATE_CONFIGURED:
udev->class_handler->setup_handler(udev, &udev->setup);
if(setup->wLength == 0)
ret = udev->class_handler->setup_handler(udev, &udev->setup);
if(setup->wLength == 0 && ret == USB_OK)
{
usbd_ctrl_send_status(udev);
}
@@ -422,9 +424,10 @@ usb_sts_type usbd_endpoint_request(usbd_core_type *udev)
uint8_t ept_addr = LBYTE(setup->wIndex);
usb_ept_info *ept_info;
if((setup->bmRequestType & USB_REQ_TYPE_RESERVED) == USB_REQ_TYPE_CLASS)
if((setup->bmRequestType & USB_REQ_TYPE_RESERVED) != USB_REQ_TYPE_STANDARD)
{
udev->class_handler->setup_handler(udev, &udev->setup);
return ret;
}
switch(setup->bRequest)
{
@@ -436,6 +439,17 @@ usb_sts_type usbd_endpoint_request(usbd_core_type *udev)
{
usbd_set_stall(udev, ept_addr);
}
if((ept_addr & 0x80) != 0)
{
ept_info = &udev->ept_in[ept_addr & 0x7F];
}
else
{
ept_info = &udev->ept_out[ept_addr & 0x7F];
}
ept_info->status = 0x0000;
usbd_ctrl_send(udev, (uint8_t *)(&ept_info->status), 2);
break;
case USB_CONN_STATE_CONFIGURED:
{

View File

@@ -192,8 +192,12 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
audio_set_interface(udev, setup);
usbd_ctrl_send_status(pudev);
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -52,7 +52,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -209,7 +209,12 @@ static usb_sts_type class_audio_setup_handler(void *udev, usb_setup_type *setup)
usbd_ctrl_send_status(pudev);
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;
@@ -286,7 +291,12 @@ static usb_sts_type class_hid_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
paudio_hid->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -52,7 +52,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -173,7 +173,12 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
pcdc->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -54,7 +54,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -66,8 +66,8 @@ const static unsigned char _asciimap[128] =
0x00,// ACK
0x00,// BEL
0x2A,// BS Backspace
0x2B,// TAB Tab
0x28,// LF Enter
0x2B,// TAB Tab
0x28,// LF Enter
0x00,// VT
0x00,// FF
0x00,// CR
@@ -185,7 +185,7 @@ const static unsigned char _asciimap[128] =
0x31|SHIFT,// |
0x30|SHIFT,// }
0x35|SHIFT,// ~
0 // DEL
0 // DEL
};
linecoding_type linecoding_vcpkybrd =
@@ -349,7 +349,12 @@ static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
vcpkybrd->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;
@@ -424,7 +429,12 @@ static usb_sts_type keyboard_class_setup_handler(void *udev, usb_setup_type *set
case USB_STD_REQ_SET_INTERFACE:
vcpkybrd->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -52,7 +52,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -228,7 +228,12 @@ static usb_sts_type cdc_class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
pcdc->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;
@@ -298,7 +303,10 @@ static usb_sts_type msc_class_setup_handler(void *udev, usb_setup_type *setup)
}
bot_scsi_clear_feature(udev, setup->wIndex);
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -231,7 +231,7 @@ typedef struct
uint32_t blk_nbr[MSC_SUPPORT_MAX_LUN];
uint32_t blk_size[MSC_SUPPORT_MAX_LUN];
uint32_t blk_addr;
uint64_t blk_addr;
uint32_t blk_len;
uint32_t data_len;

View File

@@ -56,7 +56,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -43,11 +43,11 @@
#pragma data_alignment=4
#endif
ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL = {
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
};
#if defined ( __ICCARM__ ) /* iar compiler */

View File

@@ -143,7 +143,7 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
pcshid->hid_state = HID_REQ_SET_REPORT;
usbd_ctrl_recv(pudev, pcshid->hid_set_report, setup->wLength);
break;
case HID_REQ_GET_REPORT:
case HID_REQ_GET_REPORT:
usbd_ctrl_send(pudev, pcshid->hid_get_report, setup->wLength);
break;
default:
@@ -174,7 +174,12 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
pcshid->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -52,7 +52,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief custom hid device descriptor handler structure

View File

@@ -171,7 +171,12 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
piap->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -55,7 +55,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief hid device descriptor handler structure

View File

@@ -54,133 +54,133 @@ const static unsigned char _asciimap[128] =
{
0x00,// NUL
0x00,// SOH
0x00,// STX
0x00,// ETX
0x00,// EOT
0x00,// ENQ
0x00,// ACK
0x00,// BEL
0x2A,// BS Backspace
0x2B,// TAB Tab
0x28,// LF Enter
0x00,// VT
0x00,// FF
0x00,// CR
0x00,// SO
0x00,// SI
0x00,// DEL
0x00,// DC1
0x00,// DC2
0x00,// DC3
0x00,// DC4
0x00,// NAK
0x00,// SYN
0x00,// ETB
0x00,// CAN
0x00,// EM
0x00,// SUB
0x00,// ESC
0x00,// FS
0x00,// GS
0x00,// RS
0x00,// US
0x00,// STX
0x00,// ETX
0x00,// EOT
0x00,// ENQ
0x00,// ACK
0x00,// BEL
0x2A,// BS Backspace
0x2B,// TAB Tab
0x28,// LF Enter
0x00,// VT
0x00,// FF
0x00,// CR
0x00,// SO
0x00,// SI
0x00,// DEL
0x00,// DC1
0x00,// DC2
0x00,// DC3
0x00,// DC4
0x00,// NAK
0x00,// SYN
0x00,// ETB
0x00,// CAN
0x00,// EM
0x00,// SUB
0x00,// ESC
0x00,// FS
0x00,// GS
0x00,// RS
0x00,// US
0x2C,// ' '
0x1E|SHIFT,// !
0x34|SHIFT,// "
0x20|SHIFT,// #
0x21|SHIFT,// $
0x22|SHIFT,// %
0x24|SHIFT,// &
0x34, // '
0x26|SHIFT,// (
0x27|SHIFT,// )
0x25|SHIFT,// *
0x2E|SHIFT,// +
0x36,// ,
0x2D,// -
0x37,// .
0x38,// /
0x27,// 0
0x1E,// 1
0x1F,// 2
0x20,// 3
0x21,// 4
0x22,// 5
0x23,// 6
0x24,// 7
0x25,// 8
0x26,// 9
0x33|SHIFT,// :
0x33, // ;
0x36|SHIFT,// <
0x2E, // =
0x37|SHIFT,// >
0x38|SHIFT,// ?
0x1F|SHIFT,// @
0x04|SHIFT,// A
0x05|SHIFT,// B
0x06|SHIFT,// C
0x07|SHIFT,// D
0x08|SHIFT,// E
0x09|SHIFT,// F
0x0A|SHIFT,// G
0x0B|SHIFT,// H
0x0C|SHIFT,// I
0x0D|SHIFT,// J
0x0E|SHIFT,// K
0x0F|SHIFT,// L
0x10|SHIFT,// M
0x11|SHIFT,// N
0x12|SHIFT,// O
0x13|SHIFT,// P
0x14|SHIFT,// Q
0x15|SHIFT,// R
0x16|SHIFT,// S
0x17|SHIFT,// T
0x18|SHIFT,// U
0x19|SHIFT,// V
0x1A|SHIFT,// W
0x1B|SHIFT,// X
0x1C|SHIFT,// Y
0x1D|SHIFT,// Z
0x2F, // [
0x31, // bslash
0x30, // ]
0x23|SHIFT,// ^
0x2D|SHIFT,// _
0x35, // `
0x04, // a
0x05, // b
0x06, // c
0x07, // d
0x08, // e
0x09, // f
0x0A, // g
0x0B, // h
0x0C, // i
0x0D, // j
0x0E, // k
0x0F, // l
0x10, // m
0x11, // n
0x12, // o
0x13, // p
0x14, // q
0x15, // r
0x16, // s
0x17, // t
0x18, // u
0x19, // v
0x1A, // w
0x1B, // x
0x1C, // y
0x1D, // z
0x2f|SHIFT,//
0x31|SHIFT,// |
0x30|SHIFT,// }
0x35|SHIFT,// ~
0 // DEL
0x2C,// ' '
0x1E|SHIFT,// !
0x34|SHIFT,// "
0x20|SHIFT,// #
0x21|SHIFT,// $
0x22|SHIFT,// %
0x24|SHIFT,// &
0x34, // '
0x26|SHIFT,// (
0x27|SHIFT,// )
0x25|SHIFT,// *
0x2E|SHIFT,// +
0x36,// ,
0x2D,// -
0x37,// .
0x38,// /
0x27,// 0
0x1E,// 1
0x1F,// 2
0x20,// 3
0x21,// 4
0x22,// 5
0x23,// 6
0x24,// 7
0x25,// 8
0x26,// 9
0x33|SHIFT,// :
0x33, // ;
0x36|SHIFT,// <
0x2E, // =
0x37|SHIFT,// >
0x38|SHIFT,// ?
0x1F|SHIFT,// @
0x04|SHIFT,// A
0x05|SHIFT,// B
0x06|SHIFT,// C
0x07|SHIFT,// D
0x08|SHIFT,// E
0x09|SHIFT,// F
0x0A|SHIFT,// G
0x0B|SHIFT,// H
0x0C|SHIFT,// I
0x0D|SHIFT,// J
0x0E|SHIFT,// K
0x0F|SHIFT,// L
0x10|SHIFT,// M
0x11|SHIFT,// N
0x12|SHIFT,// O
0x13|SHIFT,// P
0x14|SHIFT,// Q
0x15|SHIFT,// R
0x16|SHIFT,// S
0x17|SHIFT,// T
0x18|SHIFT,// U
0x19|SHIFT,// V
0x1A|SHIFT,// W
0x1B|SHIFT,// X
0x1C|SHIFT,// Y
0x1D|SHIFT,// Z
0x2F, // [
0x31, // bslash
0x30, // ]
0x23|SHIFT,// ^
0x2D|SHIFT,// _
0x35, // `
0x04, // a
0x05, // b
0x06, // c
0x07, // d
0x08, // e
0x09, // f
0x0A, // g
0x0B, // h
0x0C, // i
0x0D, // j
0x0E, // k
0x0F, // l
0x10, // m
0x11, // n
0x12, // o
0x13, // p
0x14, // q
0x15, // r
0x16, // s
0x17, // t
0x18, // u
0x19, // v
0x1A, // w
0x1B, // x
0x1C, // y
0x1D, // z
0x2f|SHIFT,//
0x31|SHIFT,// |
0x30|SHIFT,// }
0x35|SHIFT,// ~
0 // DEL
};
/* usb device class handler */
@@ -297,7 +297,12 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
pkeyboard->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -53,7 +53,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief keyboard device descriptor handler structure

View File

@@ -161,6 +161,13 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
pmouse->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;
default:

View File

@@ -53,7 +53,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief mouse device descriptor handler structure

View File

@@ -42,11 +42,11 @@
#pragma data_alignment=4
#endif
ALIGNED_HEAD uint8_t page00_inquiry_data[] ALIGNED_TAIL = {
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
};
#if defined ( __ICCARM__ ) /* iar compiler */

View File

@@ -197,7 +197,7 @@ typedef struct
uint32_t blk_nbr[MSC_SUPPORT_MAX_LUN];
uint32_t blk_size[MSC_SUPPORT_MAX_LUN];
uint32_t blk_addr;
uint64_t blk_addr;
uint32_t blk_len;
uint32_t data_len;

View File

@@ -165,7 +165,10 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
}
bot_scsi_clear_feature(udev, setup->wIndex);
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;

View File

@@ -54,7 +54,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -163,7 +163,12 @@ static usb_sts_type class_setup_handler(void *udev, usb_setup_type *setup)
case USB_STD_REQ_SET_INTERFACE:
pprter->alt_setting = setup->wValue;
break;
case USB_STD_REQ_CLEAR_FEATURE:
break;
case USB_STD_REQ_SET_FEATURE:
break;
default:
usbd_ctrl_unsupport(pudev);
break;
}
break;
@@ -234,6 +239,9 @@ static usb_sts_type class_out_handler(void *udev, uint8_t ept_num)
usb_sts_type status = USB_OK;
usbd_core_type *pudev = (usbd_core_type *)udev;
printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
/* get endpoint receive data length */
pprter->g_rxlen = usbd_get_recv_len(pudev, ept_num);
/*set recv flag*/
pprter->g_rx_completed = 1;
@@ -291,6 +299,35 @@ static usb_sts_type class_event_handler(void *udev, usbd_event_type event)
return status;
}
/**
* @brief usb device class rx data process
* @param udev: to the structure of usbd_core_type
* @param recv_data: receive buffer
* @retval receive data len
*/
uint16_t usb_printer_get_rxdata(void *udev, uint8_t *recv_data)
{
uint16_t i_index = 0;
uint16_t tmp_len = 0;
usbd_core_type *pudev = (usbd_core_type *)udev;
printer_type *pprter = (printer_type *)pudev->class_handler->pdata;
if(pprter->g_rx_completed == 0)
{
return 0;
}
pprter->g_rx_completed = 0;
tmp_len = pprter->g_rxlen;
for(i_index = 0; i_index < pprter->g_rxlen; i_index ++)
{
recv_data[i_index] = pprter->g_rx_buff[i_index];
}
usbd_ept_recv(pudev, USBD_PRINTER_BULK_OUT_EPT, pprter->g_rx_buff, USBD_PRINTER_OUT_MAXPACKET_SIZE);
return tmp_len;
}
/**
* @brief usb device class send data
* @param udev: to the structure of usbd_core_type

View File

@@ -68,6 +68,7 @@ typedef struct
uint32_t g_printer_port_status;
uint8_t g_rx_buff[USBD_PRINTER_OUT_MAXPACKET_SIZE];
uint8_t g_printer_data[USBD_PRINTER_OUT_MAXPACKET_SIZE];
uint32_t g_rxlen;
__IO uint8_t g_tx_completed;
__IO uint8_t g_rx_completed;
}printer_type;

View File

@@ -54,7 +54,10 @@ static usbd_desc_t *get_device_config_string(void);
static uint16_t usbd_unicode_convert(uint8_t *string, uint8_t *unicode_buf);
static void usbd_int_to_unicode (uint32_t value , uint8_t *pbuf , uint8_t len);
static void get_serial_num(void);
static uint8_t g_usbd_desc_buffer[256];
#if defined ( __ICCARM__ ) /* iar compiler */
#pragma data_alignment=4
#endif
ALIGNED_HEAD static uint8_t g_usbd_desc_buffer[256] ALIGNED_TAIL;
/**
* @brief device descriptor handler structure

View File

@@ -22,8 +22,8 @@
**************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBH_MSC_CLASS_H
#define __USBH_MSC_CLASS_H
#ifndef __USBH_CDC_CLASS_H
#define __USBH_CDC_CLASS_H
#ifdef __cplusplus
extern "C" {