USB Component  Version 5.0
MDK-Professional Middleware for USB Device and Host
 All Data Structures Functions Variables Enumerations Enumerator Groups Pages
Core Functions

Initialize and manage the USB Host Core. More...

Functions

usbStatus USBH_Initialize (uint8_t ctrl)
 Initialize USB Host stack and controller.
 
usbStatus USBH_Uninitialize (uint8_t ctrl)
 Un-initialize USB Host stack and controller.
 

Description

Initialize and manage the USB Host Core.

The USB Host Core is a hardware independent layer and contains the functions to manage USB controller and USB Devices connected to this controller. It is Interface between the USB Host Controller Driver and the USB Host Classes. The most important functions of USB Host Core:

Function Documentation

usbStatus USBH_Initialize ( uint8_t  ctrl)

Initialize USB Host stack and controller.

Parameters
[in]ctrlindex of USB Host controller.
Returns
status code that indicates the execution status of the function as defined with usbStatus.

The function USBH_Initialize prepares the USB Host Controller to detect whether an USB device gets attached or detached from the USB bus. It starts a thread responsible for the USB Device enumeration process. Call this function before calling any other USB Host functions. The function does not initialize any non-USB Host hardware features.

Code Example

#include <rl_usb.h>
int main (void) {
..
USBH_Initialize(0); // USB Host 0 Initialize
..
}
usbStatus USBH_Uninitialize ( uint8_t  ctrl)

Un-initialize USB Host stack and controller.

Parameters
[in]ctrlindex of USB Host controller.
Returns
status code that indicates the execution status of the function as defined with usbStatus.

The function USBH_Uninitialize de-initializes the USB Host Stack and the USB Host Controller Hardware. It can be used if during the application run-time the USB Host Stack needs to be disabled for whatever reason (for example for lowering power consumption). Reinitialize the USB Host Stack only with USBH_Initialize.

Code Example

#include <rl_usb.h>
int main (void) {
..
USBH_Initialize(0); // USB Host 0 Initialize
..
USBH_Uninitialize(0); // USB Host 0 Un-Initialize
..
}