USB_STATUS usb_class_cdc_bind_acm_interface
   (
      CLASS_CALL_STRUCT_PTR            ccs_ptr,
      
      INTERFACE_DESCRIPTOR_PTR         if_desc
   )
{
    
    usb_class_cdc_bind_ctrl_interface(ccs_ptr, if_desc);
    usb_class_cdc_register_interface(ccs_ptr, &data_anchor);

    return USB_OK;
}
예제 #2
0
usb_status usb_class_cdc_bind_data_interfaces
   (
      /* [IN] pointer to device instance */
      usb_device_instance_handle      dev_handle,

      cdc_class_call_struct_t *            ccs_ptr
   ) 
{
    dev_instance_t*                  dev_ptr;
    usb_cdc_desc_union_t *            union_desc;
    interface_descriptor_t*          if_desc;
    int32_t i, j;
 
    #ifdef _HOST_DEBUG_
        DEBUG_LOG_TRACE("usb_class_cdc_bind_data_interfaces");
    #endif
    dev_ptr = (dev_instance_t*)dev_handle;
    
    if (usb_class_cdc_intf_validate(ccs_ptr)) {
        union_desc = ((usb_acm_class_intf_struct_t *) ccs_ptr->class_intf_handle)->union_desc;

        /* Now link all already initialized interfaces
            that should be controlled by this ACM */
        for(i = 0; i < dev_ptr->configuration.interface_count; i++)
        {
			if_desc = dev_ptr->configuration.interface[i].lpinterfaceDesc;
			
            for (j = 0; j < union_desc->bFunctionLength - 3; j++)
                if (if_desc->bInterfaceNumber == union_desc->bSlaveInterface[j]) {
                    /* the found (data) interface if_desc should be controlled by this ACM */
                    usb_class_cdc_bind_data_interface((void *)ccs_ptr, if_desc);
                    break;
                }
        }
        /* Store control interface for data interfaces included later */
        usb_class_cdc_register_interface(ccs_ptr, &ctrl_anchor);
    }
    
    #ifdef _HOST_DEBUG_
        DEBUG_LOG_TRACE("usb_class_cdc_bind_data_interfaces, SUCCESSFULL");
    #endif

    return USB_OK;
}
예제 #3
0
usb_status usb_class_cdc_bind_acm_interface
   (
      cdc_class_call_struct_t *            ccs_ptr,
      
      interface_descriptor_t*         if_desc
   )
{
    #ifdef _HOST_DEBUG_
        DEBUG_LOG_TRACE("usb_class_cdc_bind_acm_interface");
    #endif
    
    usb_class_cdc_bind_ctrl_interface(ccs_ptr, if_desc);
    usb_class_cdc_register_interface(ccs_ptr, &data_anchor);
   
    #ifdef _HOST_DEBUG_
        DEBUG_LOG_TRACE("usb_class_cdc_bind_acm_interface, SUCCESSFULL");
    #endif

    return USB_OK;
}
USB_STATUS usb_class_cdc_bind_data_interfaces
   (
      /* [IN] pointer to device instance */
      _usb_device_instance_handle      dev_handle,

      CLASS_CALL_STRUCT_PTR            ccs_ptr
   ) 
{
    USB_CDC_DESC_UNION_PTR            union_desc;
    INTERFACE_DESCRIPTOR_PTR          if_desc;
    int_32 i, j;
 
    union_desc = ((USB_ACM_CLASS_INTF_STRUCT_PTR) ccs_ptr->class_intf_handle)->union_desc;

    /* Now link all already initialized interfaces
        that should be controlled by this ACM */
    for (i = 0; ; i++) {
        if (USB_OK != _usb_hostdev_get_descriptor(
            dev_handle,
            NULL,
            USB_DESC_TYPE_IF,  /* search for all interfaces */
            i,                 /* Index of descriptor */
            0,                 /* Index of interface alternate */
            &if_desc))
                break;
        for (j = 0; j < union_desc->bFunctionLength - 3; j++)
            if (if_desc->bInterfaceNumber == union_desc->bSlaveInterface[j]) {
                /* the found (data) interface if_desc should be controlled by this ACM */
                usb_class_cdc_bind_data_interface((pointer2)ccs_ptr, if_desc);
                break;
            }
    }
    /* Store control interface for data interfaces included later */
    usb_class_cdc_register_interface(ccs_ptr, &ctrl_anchor);
    
    return USB_OK;
}