add common usb host waiter and drivers initialization which is required for xHCI support Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
118 lines
3.3 KiB
C
118 lines
3.3 KiB
C
/****************************************************************************
|
|
* drivers/usbhost/usbhost_drivers.c
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership. The
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations
|
|
* under the License.
|
|
*
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <nuttx/usb/usbhost.h>
|
|
|
|
/****************************************************************************
|
|
* Private Functions
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Public Functions
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: usbhost_waiter_initialize
|
|
*
|
|
* Description:
|
|
* Initialize all enabled USB host device drivers.
|
|
*
|
|
****************************************************************************/
|
|
|
|
void usbhost_drivers_initialize(void)
|
|
{
|
|
int ret;
|
|
|
|
UNUSED(ret);
|
|
|
|
/* First, register all of the class drivers needed to support the drivers
|
|
* that we care about:
|
|
*/
|
|
|
|
uinfo("Register class drivers\n");
|
|
|
|
#ifdef CONFIG_USBHOST_HUB
|
|
/* Initialize USB hub class support */
|
|
|
|
ret = usbhost_hub_initialize();
|
|
if (ret < 0)
|
|
{
|
|
uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_USBHOST_MSC
|
|
/* Register the USB mass storage class */
|
|
|
|
ret = usbhost_msc_initialize();
|
|
if (ret != OK)
|
|
{
|
|
uerr("ERROR: Failed to register the mass storage class: %d\n", ret);
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_USBHOST_CDCACM
|
|
/* Register the CDC/ACM serial class */
|
|
|
|
ret = usbhost_cdcacm_initialize();
|
|
if (ret != OK)
|
|
{
|
|
uerr("ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_USBHOST_HIDKBD
|
|
/* Initialize the HID keyboard class */
|
|
|
|
ret = usbhost_kbdinit();
|
|
if (ret != OK)
|
|
{
|
|
uerr("ERROR: Failed to register the HID keyboard class\n");
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_USBHOST_HIDMOUSE
|
|
/* Initialize the HID mouse class */
|
|
|
|
ret = usbhost_mouse_init();
|
|
if (ret != OK)
|
|
{
|
|
uerr("ERROR: Failed to register the HID mouse class\n");
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_USBHOST_FT232R
|
|
/* Initialize the FT232R class */
|
|
|
|
ret = usbhost_ft232r_initialize();
|
|
if (ret != OK)
|
|
{
|
|
uerr("ERROR: Failed to register the FT232R class\n");
|
|
}
|
|
#endif
|
|
}
|