예제 #1
0
파일: adk.c 프로젝트: DigFarmer/aircraft
/**
 * This function will write data to usb adk device
 *
 * @param intf the interface instance.
 * 
 * @return the error code, RT_EOK on successfully.
*/
static rt_size_t rt_usbh_adk_write (rt_device_t device, rt_off_t pos, const void* buffer, 
    rt_size_t size)
{
    uadk_t adk;
    rt_size_t length;
    struct uintf* intf;

    RT_ASSERT(buffer != RT_NULL);    

    intf = (struct uintf*)device->user_data;
    adk = (uadk_t)intf->user_data;

    length = rt_usb_hcd_bulk_xfer(intf->device->hcd, adk->pipe_out, 
        (void*)buffer, size, 300);
    
    return length;
}
/**
 * This function will write data to usb adk device
 *
 * @param ifinst the interface instance.
 *
 * @return the error code, RT_EOK on successfully.
*/
static rt_size_t rt_usb_adk_write (rt_device_t device, rt_off_t pos, const void* buffer,
                                   rt_size_t size)
{
    uadkinst_t adkinst;
    rt_size_t length;
    uifinst_t ifinst;

    RT_ASSERT(buffer != RT_NULL);

    ifinst = (uifinst_t)device->user_data;
    adkinst = (uadkinst_t)ifinst->user_data;

    length = rt_usb_hcd_bulk_xfer(ifinst->uinst->hcd, adkinst->pipe_out,
                                  (void*)buffer, size, 300);

    return length;
}
예제 #3
0
파일: adk.c 프로젝트: DigFarmer/aircraft
/**
 * This function will read data from usb adk device
 *
 * @param intf the interface instance.
 * 
 * @return the error code, RT_EOK on successfully.
*/
static rt_size_t rt_usbh_adk_read(rt_device_t device, rt_off_t pos, void* buffer, 
    rt_size_t size)
{
    uadk_t adk;
    rt_size_t length;
    struct uintf* intf;

    /* check parameter */
    RT_ASSERT(device != RT_NULL);
    RT_ASSERT(buffer != RT_NULL);

    intf = (struct uintf*)device->user_data;
    adk = (uadk_t)intf->user_data;

    length = rt_usb_hcd_bulk_xfer(intf->device->hcd, adk->pipe_in, 
        buffer, size, 300);
    
    return length;

}
/**
 * This function will read data from usb adk device
 *
 * @param ifinst the interface instance.
 *
 * @return the error code, RT_EOK on successfully.
*/
static rt_size_t rt_usb_adk_read(rt_device_t device, rt_off_t pos, void* buffer,
                                 rt_size_t size)
{
    uadkinst_t adkinst;
    rt_size_t length;
    uifinst_t ifinst;

    /* check parameter */
    RT_ASSERT(device != RT_NULL);
    RT_ASSERT(buffer != RT_NULL);

    ifinst = (uifinst_t)device->user_data;
    adkinst = (uadkinst_t)ifinst->user_data;

    length = rt_usb_hcd_bulk_xfer(ifinst->uinst->hcd, adkinst->pipe_in,
                                  buffer, size, 300);

    return length;

}