AN050
GD32 USBFS&USBHS Firmware Library User Guide
47
fail.
5.7.6.
USB printer
Printer descriptor introduction
Device descriptor include Printer device VID(0x28e9) and PID(0x028d). In printer
configuration descriptor set, include configuration, interface and endpoint descriptor,
corresponding descriptor is shown as below.
Printer device class interface
Printer device class interface is shown in below structure, and structure function is shown in
below
Table 5-23. printer device class interface function
usb_class_core usbd_printer_cb
=
{
.
init
=
printer_init
,
.
deinit
=
printer_deinit
,
.
req_proc
=
printer_req
,
.
data_in
=
printer_in
,
.
data_out
=
printer_out
};
Table 5-23
. printer device class interface function
Function name
Functional description
printer_init
Initialize printer device
printer_deinit
Deinitialize printer device
printer_req
Printer device class request function
printer_in
IN data transfer callback
printer_out
OUT data transfer callback
Printer device class request
Priner device include device class request is shown in
Table 5-24. printer device class
Table 5-24
. printer device class request
Request name
value
Functional description
GET_DEVICE_ID
0x00
Get device ID
GET_PORT_STATUS
0x01
Get port status
SOFT_RESET
0x02
Software reset
Printer user interface
Currently, printer rountine merely implement enumeration, data transfer is subject to printer
hardware, and without corresponding user interface, which is used to implement data transfer