mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
1.replace API prefix usb* with usbh* in USB host stack to distinct with USB device stack;
2.adjust some viable and micro name 3.some other small fix
This commit is contained in:
1 parent
8fd0a7f9c6
commit
0fb9c54efd
8 files changed
+419
-440
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -9,22 +9,22 @@ core/usbhost.c
|
||||
core/hub.c
|
||||
""")
|
||||
|
||||
if GetDepend('RT_USB_CLASS_ADK'):
|
||||
if GetDepend('RT_USBH_ADK'):
|
||||
src += Glob('class/adk.c')
|
||||
src += Glob('udev/adkapp.c')
|
||||
src += Glob('class/adkapp.c')
|
||||
|
||||
if GetDepend('RT_USB_CLASS_MASS_STORAGE'):
|
||||
if GetDepend('RT_USBH_MSTORAGE'):
|
||||
src += Glob('class/mass.c')
|
||||
src += Glob('udev/udisk.c')
|
||||
src += Glob('class/udisk.c')
|
||||
|
||||
if GetDepend('RT_USB_CLASS_HID'):
|
||||
if GetDepend('RT_USBH_HID'):
|
||||
src += Glob('class/hid.c')
|
||||
|
||||
if GetDepend('RT_USB_HID_MOUSE'):
|
||||
src += Glob('udev/umouse.c')
|
||||
if GetDepend('RT_USBH_HID_MOUSE'):
|
||||
src += Glob('class/umouse.c')
|
||||
|
||||
if GetDepend('RT_USB_HID_KEYBOARD'):
|
||||
src += Glob('udev/ukbd.c')
|
||||
if GetDepend('RT_USBH_HID_KEYBOARD'):
|
||||
src += Glob('class/ukbd.c')
|
||||
|
||||
CPPPATH = [cwd, cwd + '/class', cwd + '/core', \
|
||||
cwd + '/include', cwd + '../../../include']
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -34,7 +34,7 @@ struct uadkinst
|
||||
|
||||
struct rt_device device;
|
||||
};
|
||||
typedef struct uadkinst* uadkinst_t;
|
||||
typedef struct uadkinst* uadk_t;
|
||||
|
||||
#define USB_ACCESSORY_VENDOR_ID 0x18D1
|
||||
#define USB_ACCESSORY_PRODUCT_ID 0x2D00
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -34,7 +34,7 @@ static rt_list_t _driver_list;
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usb_class_driver_init(void)
|
||||
rt_err_t rt_usbh_class_driver_init(void)
|
||||
{
|
||||
rt_list_init(&_driver_list);
|
||||
|
||||
@@ -49,7 +49,7 @@ rt_err_t rt_usb_class_driver_init(void)
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
|
||||
rt_err_t rt_usb_class_driver_register(ucd_t drv)
|
||||
rt_err_t rt_usbh_class_driver_register(ucd_t drv)
|
||||
{
|
||||
if (drv == RT_NULL) return -RT_ERROR;
|
||||
|
||||
@@ -66,7 +66,7 @@ rt_err_t rt_usb_class_driver_register(ucd_t drv)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usb_class_driver_unregister(ucd_t drv)
|
||||
rt_err_t rt_usbh_class_driver_unregister(ucd_t drv)
|
||||
{
|
||||
RT_ASSERT(drv != RT_NULL);
|
||||
|
||||
@@ -84,12 +84,12 @@ rt_err_t rt_usb_class_driver_unregister(ucd_t drv)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usb_class_driver_run(ucd_t drv, void* args)
|
||||
rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args)
|
||||
{
|
||||
RT_ASSERT(drv != RT_NULL);
|
||||
|
||||
if(drv->run != RT_NULL)
|
||||
drv->run(args);
|
||||
if(drv->enable != RT_NULL)
|
||||
drv->enable(args);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -102,12 +102,12 @@ rt_err_t rt_usb_class_driver_run(ucd_t drv, void* args)
|
||||
*
|
||||
* @return the error code, RT_EOK on successfully.
|
||||
*/
|
||||
rt_err_t rt_usb_class_driver_stop(ucd_t drv, void* args)
|
||||
rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args)
|
||||
{
|
||||
RT_ASSERT(drv != RT_NULL);
|
||||
|
||||
if(drv->stop != RT_NULL)
|
||||
drv->stop(args);
|
||||
if(drv->disable != RT_NULL)
|
||||
drv->disable(args);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ rt_err_t rt_usb_class_driver_stop(ucd_t drv, void* args)
|
||||
*
|
||||
* @return the registered usb class driver on successful, or RT_NULL on failure.
|
||||
*/
|
||||
ucd_t rt_usb_class_driver_find(int class_code, int subclass_code)
|
||||
ucd_t rt_usbh_class_driver_find(int class_code, int subclass_code)
|
||||
{
|
||||
struct rt_list_node *node;
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -24,7 +24,9 @@
|
||||
#include <rtthread.h>
|
||||
#include <drivers/usb_host.h>
|
||||
|
||||
#if defined(RT_USB_HID_KEYBOARD) || defined(RT_USB_HID_MOUSE)
|
||||
#define USB_HOST_CONTROLLER_NAME "usbh"
|
||||
|
||||
#if defined(RT_USBH_HID_KEYBOARD) || defined(RT_USBH_HID_MOUSE)
|
||||
#include <hid.h>
|
||||
#endif
|
||||
|
||||
@@ -34,54 +36,64 @@
|
||||
*
|
||||
* @return none.
|
||||
*/
|
||||
int rt_usb_host_init(void)
|
||||
rt_err_t rt_usb_host_init(void)
|
||||
{
|
||||
ucd_t drv;
|
||||
#ifdef RT_USB_CLASS_HID
|
||||
rt_device_t uhc;
|
||||
#ifdef RT_USBH_HID
|
||||
uprotocal_t protocal;
|
||||
#endif
|
||||
|
||||
/* initialize usb hub thread */
|
||||
rt_usb_hub_thread();
|
||||
uhc = rt_device_find(USB_HOST_CONTROLLER_NAME);
|
||||
if(uhc == RT_NULL)
|
||||
{
|
||||
rt_kprintf("can't find usb host controller %s\n", USB_HOST_CONTROLLER_NAME);
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
/* initialize usb hub */
|
||||
rt_usbh_hub_init();
|
||||
|
||||
/* initialize class driver */
|
||||
rt_usb_class_driver_init();
|
||||
rt_usbh_class_driver_init();
|
||||
|
||||
#ifdef RT_USB_CLASS_MASS_STORAGE
|
||||
#ifdef RT_USBH_MSTORAGE
|
||||
/* register mass storage class driver */
|
||||
drv = rt_usb_class_driver_storage();
|
||||
rt_usb_class_driver_register(drv);
|
||||
drv = rt_usbh_class_driver_storage();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USB_CLASS_HID
|
||||
#ifdef RT_USBH_HID
|
||||
/* register hid class driver */
|
||||
drv = rt_usb_class_driver_hid();
|
||||
rt_usb_class_driver_register(drv);
|
||||
drv = rt_usbh_class_driver_hid();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
|
||||
#ifdef RT_USB_HID_KEYBOARD
|
||||
#ifdef RT_USBH_HID_KEYBOARD
|
||||
/* register hid keyboard protocal */
|
||||
protocal = rt_usb_hid_protocal_kbd();
|
||||
rt_usb_hid_protocal_register(protocal);
|
||||
protocal = rt_usbh_hid_protocal_kbd();
|
||||
rt_usbh_hid_protocal_register(protocal);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USB_HID_MOUSE
|
||||
#ifdef RT_USBH_HID_MOUSE
|
||||
/* register hid mouse protocal */
|
||||
protocal = rt_usb_hid_protocal_mouse();
|
||||
rt_usb_hid_protocal_register(protocal);
|
||||
protocal = rt_usbh_hid_protocal_mouse();
|
||||
rt_usbh_hid_protocal_register(protocal);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RT_USB_CLASS_ADK
|
||||
#ifdef RT_USBH_ADK
|
||||
/* register adk class driver */
|
||||
drv = rt_usb_class_driver_adk();
|
||||
rt_usb_class_driver_register(drv);
|
||||
drv = rt_usbh_class_driver_adk();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
#endif
|
||||
|
||||
/* register hub class driver */
|
||||
drv = rt_usb_class_driver_hub();
|
||||
rt_usb_class_driver_register(drv);
|
||||
drv = rt_usbh_class_driver_hub();
|
||||
rt_usbh_class_driver_register(drv);
|
||||
|
||||
return 0;
|
||||
/* initialize usb host controller */
|
||||
rt_device_init(uhc);
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_COMPONENT_EXPORT(rt_usb_host_init);
|
||||
|
||||
Reference in new issue
Block a user