Lines Matching full:device

46  * This function will do USB_REQ_GET_PROTOCOL request to set idle period to the usb adk device
57 uinst_t device; in rt_usbh_adk_get_protocol() local
62 RT_ASSERT(intf->device != RT_NULL); in rt_usbh_adk_get_protocol()
64 device = intf->device; in rt_usbh_adk_get_protocol()
73 if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, (void*)protocol, 2, in rt_usbh_adk_get_protocol()
79 * This function will do USB_REQ_SEND_STRING request to set idle period to the usb adk device
91 uinst_t device; in rt_usbh_adk_send_string() local
96 RT_ASSERT(intf->device != RT_NULL); in rt_usbh_adk_send_string()
98 device = intf->device; in rt_usbh_adk_send_string()
107 if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, (void*)str, in rt_usbh_adk_send_string()
113 * This function will do USB_REQ_START request to set idle period to the usb adk device
124 uinst_t device; in rt_usbh_adk_start() local
129 RT_ASSERT(intf->device != RT_NULL); in rt_usbh_adk_start()
131 device = intf->device; in rt_usbh_adk_start()
140 if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, in rt_usbh_adk_start()
146 * This function will read data from usb adk device
152 static rt_size_t rt_usbh_adk_read(rt_device_t device, rt_off_t pos, void* buffer, in rt_usbh_adk_read() argument
160 RT_ASSERT(device != RT_NULL); in rt_usbh_adk_read()
163 intf = (struct uintf*)device->user_data; in rt_usbh_adk_read()
166 length = rt_usb_hcd_bulk_xfer(intf->device->hcd, adk->pipe_in, in rt_usbh_adk_read()
174 * This function will write data to usb adk device
180 static rt_size_t rt_usbh_adk_write (rt_device_t device, rt_off_t pos, const void* buffer, in rt_usbh_adk_write() argument
189 intf = (struct uintf*)device->user_data; in rt_usbh_adk_write()
192 length = rt_usb_hcd_bulk_xfer(intf->device->hcd, adk->pipe_out, in rt_usbh_adk_write()
211 * This function will run adk class driver when usb device is detected and identified
212 * as a adk class device, it will continue the enumulate process.
236 dev_desc = &intf->device->dev_desc; in rt_usbh_adk_enable()
243 RT_DEBUG_LOG(RT_DEBUG_USB, ("found android accessory device\n")); in rt_usbh_adk_enable()
247 RT_DEBUG_LOG(RT_DEBUG_USB, ("switch device\n")); in rt_usbh_adk_enable()
317 ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &adk->pipe_in, in rt_usbh_adk_enable()
324 ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &adk->pipe_out, in rt_usbh_adk_enable()
333 rt_kprintf("pipe error, unsupported device\n"); in rt_usbh_adk_enable()
338 ret = rt_usbh_set_configure(intf->device, 1); in rt_usbh_adk_enable()
341 /* register adk device */ in rt_usbh_adk_enable()
342 adk->device.type = RT_Device_Class_Char; in rt_usbh_adk_enable()
344 adk->device.ops = &adk_device_ops; in rt_usbh_adk_enable()
346 adk->device.init = RT_NULL; in rt_usbh_adk_enable()
347 adk->device.open = RT_NULL; in rt_usbh_adk_enable()
348 adk->device.close = RT_NULL; in rt_usbh_adk_enable()
349 adk->device.read = rt_usbh_adk_read; in rt_usbh_adk_enable()
350 adk->device.write = rt_usbh_adk_write; in rt_usbh_adk_enable()
351 adk->device.control = RT_NULL; in rt_usbh_adk_enable()
353 adk->device.user_data = (void*)intf; in rt_usbh_adk_enable()
355 rt_device_register(&adk->device, "adkdev", RT_DEVICE_FLAG_RDWR); in rt_usbh_adk_enable()
361 * This function will be invoked when usb device plug out is detected and it would clean
385 rt_usb_hcd_free_pipe(intf->device->hcd, adk->pipe_in); in rt_usbh_adk_disable()
388 rt_usb_hcd_free_pipe(intf->device->hcd, adk->pipe_out); in rt_usbh_adk_disable()
390 /* unregister adk device */ in rt_usbh_adk_disable()
391 rt_device_unregister(&adk->device); in rt_usbh_adk_disable()