Functions | Variables
usb_dcd_interface.c File Reference

This file defines the interface between the usb device core and the device controller drivers. Device controller drivers(dcd) register with usb device protocol core. The protocol core expects a set of function pointers to be populated by the device controller with its own implementation and uses them to take care of enumeration and normal data traffic. The dcd inturn uses a set of call backs to interact with the host for event handling. More...

#include "types.h"
#include "error.h"
#include <string.h>
#include "usb_dcd_interface.h"
#include "usb_dev_dman.h"

Functions

usbDcd_tUSBDcdIntfAllocateDcdObject (void)
 extern'd Gadget list. More...
 
uint32_t USBDcdIntfRegisterDcd (usbDcd_t **pDcdObjPtr, char *name)
 This function registers the dcd object (in turn the Device controller) with the device protocol core. The gadget object obtains a pointer to the device controller object through this function. More...
 
void USBDcdIntfUnRegisterDcd (usbDcd_t *pDcdObj)
 Unregister the dcd from the core. More...
 

Variables

usbGadgetObj_t gadgetList [MAX_NUM_DEVICE_CONTROLLERS]
 List of gadget controllers present in the system. More...
 

Detailed Description

This file defines the interface between the usb device core and the device controller drivers. Device controller drivers(dcd) register with usb device protocol core. The protocol core expects a set of function pointers to be populated by the device controller with its own implementation and uses them to take care of enumeration and normal data traffic. The dcd inturn uses a set of call backs to interact with the host for event handling.

Function Documentation

usbDcd_t* USBDcdIntfAllocateDcdObject ( void  )

extern'd Gadget list.

Maximum number of Device controllers supported.

uint32_t USBDcdIntfRegisterDcd ( usbDcd_t **  pDcdObjPtr,
char *  name 
)

This function registers the dcd object (in turn the Device controller) with the device protocol core. The gadget object obtains a pointer to the device controller object through this function.

Parameters
pDcdObjPtr- pointer to pointer to dcdobject. Instantiated by the specific dcd ( for example DWC3 driver) so that the dcd interface layer can copy its contents to the usb gadget object to complete the registration process.
name- check for a match between core object name and the specific dcd name.This way we are able to ensure that any gadget can be mounted on any particular controller.
Note
This function is not re-entrant and hence need to be executed atomically.
Return values
errorstatus- Status of the API call. Can be any of the following, S_PASS - indicates the operation is success E_FAIL - indicates that registration failed E_INVALID_PARAM - dcd object pointer not valid
void USBDcdIntfUnRegisterDcd ( usbDcd_t pDcdObj)

Unregister the dcd from the core.

Parameters
pDcdObjpointer to usb dcd interface object

Variable Documentation

List of gadget controllers present in the system.

Copyright (c) Texas Instruments Incorporated 2015-2016

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Copyright 2016, Texas Instruments Incorporated