USBD_DrvStart
Description
Device driver Start()
function. This function is called once each time a device is started.
Files
Every device driver’s usbd_drv.c
Prototype
static void USBD_DrvStart (USBD_DRV *p_drv USBD_ERR *p_err);
Arguments
p_drv
Pointer to USB device driver structure.
p_err
Pointer to variable that will receive the return error code from this function.
Returned Value
None.
Callers
USB device core layer.
Notes / Warnings
- The
Start()
function performs the following operations:- Typically, activates the pull-up on the D+ pin to simulate attachment to host. Some MCUs/MPUs have an internal pull-up that is activated by a device controller register; for others, this may be a general purpose I/O pin. This is generally performed via the device’s BSP function pointer,
Conn()
, implemented inusbd_bsp_<driver_name>.c
(seeUSBD_BSP_Conn
). The device’sBSP Conn()
is also responsible for enabling the host interrupt controller. - Clear all interrupt flags.
- Locally enable interrupts on the hardware device. The host interrupt controller should have already been configured within the device driver
Init()
function. - Enable the controller.
- Set
p_err
equal toUSBD_ERR_NONE
if no errors have occurred. Otherwise, setp_err
to an appropriate device error code.
- Typically, activates the pull-up on the D+ pin to simulate attachment to host. Some MCUs/MPUs have an internal pull-up that is activated by a device controller register; for others, this may be a general purpose I/O pin. This is generally performed via the device’s BSP function pointer,