static int nsh_usbhostinitialize(void) { int pid; int ret; /* First, register all of the class drivers needed to support the drivers * that we care about: */ syslog(LOG_INFO, "Register class drivers\n"); #ifdef CONFIG_USBHOST_MSC /* Register the USB host Mass Storage Class */ ret = usbhost_msc_initialize(); if (ret != OK) { syslog(LOG_ERR, "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) { syslog(LOG_ERR, "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret); } #endif /* Then get an instance of the USB host interface */ syslog(LOG_INFO, "Initialize USB host\n"); g_usbconn = lpc17_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ syslog(LOG_INFO, "Start nsh_waiter\n"); pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, (main_t)nsh_waiter, (FAR char * const *)NULL); return pid < 0 ? -ENOEXEC : OK; } return -ENODEV; }
static int nsh_usbhostinitialize(void) { int pid; int ret; /* First, register all of the class drivers needed to support the drivers * that we care about: */ message("nsh_usbhostinitialize: Register class drivers\n"); ret = usbhost_storageinit(); if (ret != OK) { message("nsh_usbhostinitialize: Failed to register the mass storage class\n"); } /* Then get an instance of the USB host interface */ message("nsh_usbhostinitialize: Initialize USB host\n"); g_usbconn = lpc17_usbhost_initialize(0); if (g_usbconn) { /* Start a thread to handle device connection. */ message("nsh_usbhostinitialize: Start nsh_waiter\n"); #ifndef CONFIG_CUSTOM_STACK pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, CONFIG_USBHOST_STACKSIZE, (main_t)nsh_waiter, (FAR char * const *)NULL); #else pid = task_create("usbhost", CONFIG_USBHOST_DEFPRIO, (main_t)nsh_waiter, (FAR char * const *)NULL); #endif return pid < 0 ? -ENOEXEC : OK; } return -ENODEV; }
struct usbhost_connection_s *arch_usbhost_initialize(void) { return lpc17_usbhost_initialize(0); }