29 static uint8_t USBD_PRINTER_Init (
void *pudev, uint8_t ConfigIndex);
30 static uint8_t USBD_PRINTER_DeInit (
void *pudev, uint8_t ConfigIndex);
31 static uint8_t USBD_PRINTER_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req);
32 static uint8_t USBD_PRINTER_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req);
33 static uint8_t USBD_PRINTER_GetInterface (
void *pudev,
USB_DEVICE_REQ *req);
34 static uint8_t USBD_PRINTER_SetInterface (
void *pudev,
USB_DEVICE_REQ *req);
35 static uint8_t USBD_PRINTER_DataIn (
void *pudev, uint8_t EpID);
36 static uint8_t USBD_PRINTER_DataOut (
void *pudev, uint8_t EpID);
37 static uint8_t* USBD_PRINTER_GetCfgDesc (uint8_t USBSpeed, uint16_t *len);
42 static uint32_t USBD_PRINTER_AltSet = 0;
45 static uint8_t PortStatus = 0x18;
58 USBD_PRINTER_GetClassDescriptor,
59 USBD_PRINTER_ClassReqHandle,
60 USBD_PRINTER_GetInterface,
61 USBD_PRINTER_SetInterface,
67 USBD_PRINTER_GetCfgDesc,
71 const uint8_t USBD_PRINTER_CfgDesc[USB_PRINTER_CONFIG_DESC_SIZE] =
74 USB_DESCTYPE_CONFIGURATION,
75 USB_PRINTER_CONFIG_DESC_SIZE,
85 USB_DESCTYPE_INTERFACE,
96 USB_DESCTYPE_ENDPOINT,
105 USB_DESCTYPE_ENDPOINT,
127 static uint8_t USBD_PRINTER_Init (
void *pudev, uint8_t ConfigIndex)
153 static uint8_t USBD_PRINTER_DeInit (
void *pudev, uint8_t ConfigIndex)
168 static uint8_t USBD_PRINTER_ClassReqHandle (
void *pudev,
USB_DEVICE_REQ *req)
170 switch (req->bRequest)
176 case GET_PORT_STATUS:
177 USB_CtlTx (pudev, (uint8_t *)&PortStatus, 1);
198 static uint8_t USBD_PRINTER_GetClassDescriptor (
void *pudev,
USB_DEVICE_REQ *req)
209 static uint8_t USBD_PRINTER_GetInterface (
void *pudev,
USB_DEVICE_REQ *req)
211 USB_CtlTx (pudev, (uint8_t *)&USBD_PRINTER_AltSet, 1);
222 static uint8_t USBD_PRINTER_SetInterface (
void *pudev,
USB_DEVICE_REQ *req)
224 USBD_PRINTER_AltSet = (uint8_t)(req->wValue);
235 static uint8_t USBD_PRINTER_DataIn (
void *pudev, uint8_t EpID)
248 static uint8_t USBD_PRINTER_DataOut (
void *pudev, uint8_t EpID)
261 static uint8_t* USBD_PRINTER_GetCfgDesc (uint8_t USBSpeed, uint16_t *len)
263 *len =
sizeof (USBD_PRINTER_CfgDesc);
265 return (uint8_t *)USBD_PRINTER_CfgDesc;
USB printer (USB printing device) header file.
USB device class callback type define.
void USB_EP_DeInit(USB_CORE_HANDLE *pudev, uint8_t EpAddr)
Configure the endpoint when it is disabled.
void USB_EP_Init(USB_CORE_HANDLE *pudev, uint8_t EpAddr, uint8_t EpType, uint16_t EpMps)
Endpoint initialization.
uint8_t USB_CtlTx(USB_CORE_HANDLE *pudev, uint8_t *pbuf, uint16_t Len)
Transmit data on the control pipe.
#define USB_SNG_BUFTYPE
USB endpoint kind.
void USB_EP_BufConfig(USB_CORE_HANDLE *pudev, uint8_t EpAddr, uint8_t EpKind, uint32_t BufAddr)
Configure buffer for endpoint.
void USBD_EnumError(USB_DEVICE_HANDLE *pudev, USB_DEVICE_REQ *req)
Handle usb enumeration error event.
USB standard device request struct.