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

  1. The Start() function performs the following operations:
    1. 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 in usbd_bsp_<driver_name>.c (see USBD_BSP_Conn). The device’s BSP Conn() is also responsible for enabling the host interrupt controller.
    2. Clear all interrupt flags.
    3. Locally enable interrupts on the hardware device. The host interrupt controller should have already been configured within the device driver Init() function.
    4. Enable the controller.
    5. Set p_err equal to USBD_ERR_NONE if no errors have occurred. Otherwise, set p_err to an appropriate device error code.