Skip to content

Commit

Permalink
Squashed 'driver-examples/mss/mss-usb/' changes from db95b80..accc716
Browse files Browse the repository at this point in the history
accc716 handle resume event
78b7a43 handle disconnect and connect event
766b5b0 add video probe control request
3d42429 update deviceClass subclass and protocol codes

git-subtree-dir: driver-examples/mss/mss-usb
git-subtree-split: accc716587c65758065653d94704a2f041316602
  • Loading branch information
Singh-Raghvendra committed Nov 1, 2023
1 parent 0611eb1 commit e02c662
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
18 changes: 9 additions & 9 deletions mpfs-usb-device-uvc/src/application/hart1/usb_user_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ uint8_t device_descriptor[USB_STD_DEVICE_DESCR_LEN] =
USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00u, /* bcdUSB LSB */
0x02u, /* bcdUSB MSB */
0xFFu, /* bDeviceClass */
0xFFu, /* bDeviceSubClass */
0xFFu, /* bDeviceProtocol */
0xEFu, /* bDeviceClass */
0x02u, /* bDeviceSubClass */
0x01u, /* bDeviceProtocol */
0x40u, /* bMaxPacketSize0 */
0x14u, /* idVendor LSB */
0x15u, /* idVendor MSB */
Expand All @@ -77,9 +77,9 @@ uint8_t hs_dev_qualifier_descriptor[USB_STD_DEV_QUAL_DESCR_LENGTH] =
USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00u, /* bcdUSB LSB */
0x02u, /* bcdUSB MSB */
0xFFu, /* bDeviceClass */
0xFFu, /* bDeviceSubClass */
0xFFu, /* bDeviceProtocol */
0xEFu, /* bDeviceClass */
0x02u, /* bDeviceSubClass */
0x01u, /* bDeviceProtocol */
0x40u, /* bMaxPacketSize0 */
0x01u, /* bNumConfigurations */
0x00u /* Reserved */
Expand All @@ -91,9 +91,9 @@ uint8_t fs_dev_qualifier_descriptor[USB_STD_DEV_QUAL_DESCR_LENGTH] =
USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00u, /* bcdUSB LSB */
0x02u, /* bcdUSB MSB */
0xFFu, /* bDeviceClass */
0xFFu, /* bDeviceSubClass */
0xFFu, /* bDeviceProtocol */
0xEFu, /* bDeviceClass */
0x02u, /* bDeviceSubClass */
0x01u, /* bDeviceProtocol */
0x40u, /* bMaxPacketSize0 */
0x01u, /* bNumConfigurations */
0x00u /* Reserved */
Expand Down
3 changes: 2 additions & 1 deletion mpfs-usb-device-uvc/src/application/hart1/vc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ static uint8_t app_usb_uvc_rx(uint8_t status, uint32_t rx_count)

static void app_usb_uvc_notification(uint8_t** buf_p, uint32_t* length_p)
{

expectedPixels = IMAGE_SIZE;
picture_index = 0u;
}

static uint8_t app_usb_uvc_cep_tx_complete(uint8_t status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ uint8_t usb_mc_plic_IRQHandler
if (usb_irq & RESUME_IRQ_MASK)
{
g_mss_usbd_cb.usbd_resume();
MSS_USB_CIF_set_index_reg(MSS_USB_CEP);
MSS_USB_CIF_enable_usbirq(DISCONNECT_IRQ_MASK | SUSPEND_IRQ_MASK);
cep_state = MSS_USB_CTRL_EP_IDLE;
MSS_USB_CIF_clr_usb_irq_reg();
MSS_USB_CIF_cep_clr_setupend();
MSS_USB_CIF_cep_clr_stall_sent();
g_mss_usbd_cb.usbd_reset();
}
if (usb_irq & SUSPEND_IRQ_MASK)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ extern "C" {
/* get status with self powered(SP) and remote wakeup(RW) bits */
#define GET_STATUS_RW_SP 0x83

/* video probe control request */
#define GET_REQUEST_DEF 0x87

#define BCDUSB_NUMBER_OF_USB_1_DOT_0 0x0100
#define BCDUSB_NUMBER_OF_USB_2_DOT_0 0x0200

Expand Down Expand Up @@ -605,6 +608,12 @@ UVC_process_request_cb
*length = setup_pkt->length;
break;

case GET_REQUEST_DEF:
memset(&videoProbeControl, 0xff, 34);
*buf_pp = (uint8_t*) &videoProbeControl;
*length = setup_pkt->length;
break;

default:
break;
}
Expand Down

0 comments on commit e02c662

Please sign in to comment.