Code Example
This example shows how to initialize the host controller. Note the following:
- There is only one external interface function, usbh_lms_hc(). To link this host controller to the system, you call the usbh_hc_init() function with this function as a parameter.
- The last parameter in the usbh_hc_init() call is the number of the host controller.
void start_usb_host_stack ( void )
{
int rc;
rc = hcc_mem_init();
if ( rc == 0 )
{
rc = usbh_init(); /* Initialize USB host stack */
}
if ( rc == 0 )
{
/* Attach LMS host controller */
rc = usbh_hc_init( 0, usbh_lms_hc, 0 );
}
if ( rc == 0 )
{
rc = usbh_start(); /* Start USB host stack */
}
if ( rc == 0 )
{
rc = usbh_hc_start( 0 ); /* Start LMS Host controller */
}
.....
}