Example #1
0
/**************************************************************************//*!
 *
 * @name  USB_Class_CDC_DeInit
 *
 * @brief   The function de-initializes the Device and Controller layer
 *
 * @param   controller_ID               : Controller ID
 *
 * @return status:
 *                        USB_OK        : When Successfull
 *                        Others        : When Error
 *
 ******************************************************************************
 *This function de-initializes the CDC Class layer
 *****************************************************************************/
uint_8 USB_Class_CDC_DeInit
(
    uint_8 controller_ID              /* [IN] Controller ID */
)
{
    uint_8 status = USB_OK;
#ifdef COMPOSITE_DEV
    UNUSED(controller_ID)
#endif
    /* save the callback pointer */
    g_cdc_class_callback = NULL;

    /* free the vendor request callback pointer */
    g_vendor_req_callback = NULL;

#ifndef COMPOSITE_DEV
    /* call common class deinit function */
    status = USB_Class_DeInit(controller_ID);

    if(status == USB_OK)
    /* Call device deinit function */
        status = _usb_device_deinit();
#endif
    return status;
}
Example #2
0
/**************************************************************************//*!
 *
 * @name  USB_Class_CDC_DeInit
 *
 * @brief   The funtion de-initializes the Device and Controller layer
 *
 * @param   controller_ID               : Controller ID
 *
 * @return status:
 *                        USB_OK        : When Successfull
 *                        Others        : When Error
 *
 ******************************************************************************
 *This function de-initializes the CDC Class layer
 *****************************************************************************/
uint_8 USB_Class_CDC_DeInit 
(
    uint_8 controller_ID              /* [IN] Controller ID */
) 
{
    uint_8 status;
    
    /* save the callback pointer */
    g_cdc_class_callback = NULL;
    
    /* free the vendor request callback pointer */
    g_vendor_req_callback = NULL;
    
    /* call common class deinit function */
    status = USB_Class_DeInit(controller_ID);
    
    if(status == USB_OK)
    /* Call device deinit function */
    	status = USB_Device_DeInit();
    return status;
}
Example #3
0
/*
** ===================================================================
**     Method      :  usb_mems_USB_Class_Mems_DeInit (component USB_MEMS_CLASS)
**     Description :
**         The funtion de-initializes the Device and Controller layer
**     Parameters  :
**         NAME            - DESCRIPTION
**         controller_ID   - 
**     Returns     :
**         ---             - Error code
** ===================================================================
*/
uint_8 USB_Class_Mems_DeInit(
uint_8 controller_ID
)
{
    uint_8 status;

    /* free the Mems class callback pointer */
    g_mems_class_callback = NULL;

    /* free the vendor request callback pointer */
    g_vendor_req_callback = NULL;

    /* free the callback to ask application for class specific params*/
    g_param_callback = NULL;

    /* Call common class deinit function */
    status = USB_Class_DeInit(controller_ID);

    if(status == USB_OK)
    /* Call device deinit function */
    status = _usb_device_deinit();

    return status;
}
Example #4
0
/**************************************************************************//*!
 *
 * @name  USB_Class_Video_DeInit
 *
 * @brief   The funtion de-initializes the Device and Controller layer
 *
 * @param   controller_ID               : Controller ID
 *
 * @return status:
 *                        USB_OK        : When Successfull
 *                        Others        : When Error
 *
 ******************************************************************************
 *This function de-initializes the Video Class layer
 *****************************************************************************/
uint_8 USB_Class_Video_DeInit 
(
    uint_8 controller_ID              /* [IN] Controller ID */
) 
{
    uint_8 status = USB_OK;
#ifdef COMPOSITE_DEV
    UNUSED(controller_ID)
#endif
    /* free the Audio class callback pointer */
    g_video_class_callback = NULL;
        
    /* free the callback to ask application for class specific params*/
    g_param_callback = NULL;
#ifndef COMPOSITE_DEV    
    /* Call common class deinit function */
    status = USB_Class_DeInit(controller_ID);
    
    if(status == USB_OK)
    /* Call device deinit function */
    	status = _usb_device_deinit();
#endif
    return status;
} 
 /**************************************************************************//*!
 *
 * @name  USB_Composite_DeInit
 *
 * @brief   The funtion De-initializes the Device and Controller layer
 *
 * @param   controller_ID               : Controller ID
 * @param   composite_callback_ptr      : Pointer to app callback  
 *
 * @return status:
 *                        USB_OK        : When Successfull
 *                        Others        : When Error
 *
 ******************************************************************************
 *This function De-initializes the Composite layer
 *****************************************************************************/ 
uint_8 USB_Composite_DeInit(
    uint_8    controller_ID                           /* [IN] Controller ID */
)
{    
    uint_8 count,status = USB_OK;
    DEV_ARCHITECTURE_STRUCT_PTR dev_arc_ptr;
    CLASS_ARC_STRUCT_PTR dev_class_ptr;   
    
     /* Call common class deinit function */
    status = USB_Class_DeInit(controller_ID);
    
    if(status == USB_OK)
    /* Call device deinit function */
    	status = _usb_device_deinit();
    
    /* Get device architecture */
    dev_arc_ptr = (DEV_ARCHITECTURE_STRUCT *)USB_Desc_Get_Class_Architecture(controller_ID);
    for(count = 0; count < dev_arc_ptr->cl_count; count++)
    {
        /* Initializes sub_classes */
        dev_class_ptr = (CLASS_ARC_STRUCT_PTR)dev_arc_ptr->value[count];
        switch(dev_class_ptr->class_type)  
        {
#ifdef USE_HID_CLASS
            case HID_COMP_CC:
                status = USB_Class_HID_DeInit(controller_ID);
            break;
#endif
#ifdef USE_AUDIO_CLASS    
            case AUDIO_COMP_CC:
               status = USB_Class_Audio_DeInit(controller_ID);
            break;
#endif
#ifdef USE_VIDEO_CLASS     
            case VIDEO_COMP_CC:
                status = USB_Class_Video_DeInit(controller_ID);
            break;
#endif
#ifdef USE_CDC_CLASS    
            case CDC_COMP_CC:
                status = USB_Class_CDC_DeInit(controller_ID);
                break;
#endif
#ifdef USE_MSD_CLASS    
            case MSD_COMP_CC:
                status = USB_Class_MSC_DeInit(controller_ID);
                break;
#endif
#ifdef USE_PHDC_CLASS
            case PHDC_COMP_CC:
                status = USB_Class_PHDC_DeInit(controller_ID);
                break;
#endif
#ifdef USE_DFU_CLASS
            case DFU_COMP_CC:
                status = USB_Class_HID_DeInit(controller_ID);
                break;
        #endif
        }
    }
    return status;    
}