usb: Move driver into library
This raised the opportunity to structure the library more cleanly for each supported platform.
This commit is contained in:
parent
ebc76fc13b
commit
6ef3f0f153
|
@ -0,0 +1,6 @@
|
||||||
|
SRC_C += platform_device.c
|
||||||
|
SRC_CC += mem.cc
|
||||||
|
INC_DIR += $(LIB_INC_DIR)/arm
|
||||||
|
|
||||||
|
vpath platform_device.c $(LIB_DIR)/arm
|
||||||
|
vpath mem.cc $(LIB_DIR)/arm
|
|
@ -0,0 +1,12 @@
|
||||||
|
include $(REP_DIR)/lib/mk/usb.inc
|
||||||
|
include $(REP_DIR)/lib/mk/arm/usb.inc
|
||||||
|
|
||||||
|
CC_OPT += -DCONFIG_USB_EHCI_S5P -DCONFIG_USB_EHCI_TT_NEWSCHED
|
||||||
|
INC_DIR += $(CONTRIB_DIR)/arch/arm/plat-samsung/include
|
||||||
|
SRC_CC += platform.cc
|
||||||
|
|
||||||
|
vpath platform.cc $(LIB_DIR)/arm/platform_arndale
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
include $(REP_DIR)/lib/mk/usb.inc
|
||||||
|
include $(REP_DIR)/lib/mk/arm/usb.inc
|
||||||
|
|
||||||
|
CC_OPT += -DCONFIG_USB_EHCI_HCD_OMAP -DCONFIG_USB_EHCI_TT_NEWSCHED -DVERBOSE_DEBUG
|
||||||
|
SRC_C += usbnet.c smsc95xx.c
|
||||||
|
SRC_CC += platform.cc
|
||||||
|
|
||||||
|
vpath platform.cc $(LIB_DIR)/arm/platform_panda
|
||||||
|
vpath %.c $(CONTRIB_DIR)/drivers/net/usb
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
LIB_DIR = $(REP_DIR)/src/lib/usb
|
||||||
|
LIB_INC_DIR = $(LIB_DIR)/include
|
||||||
|
|
||||||
|
LIBS += base cxx dde_kit libc-setjmp
|
||||||
|
SRC_CC += main.cc lx_emul.cc irq.cc timer.cc event.cc storage.cc \
|
||||||
|
input_component.cc nic.cc
|
||||||
|
SRC_C += dummies.c scsi.c evdev.c
|
||||||
|
|
||||||
|
CONTRIB_DIR := $(REP_DIR)/contrib
|
||||||
|
DRIVERS_DIR := $(CONTRIB_DIR)/drivers
|
||||||
|
USB_DIR := $(DRIVERS_DIR)/usb
|
||||||
|
|
||||||
|
#
|
||||||
|
# The order of include-search directories is important, we need to look into
|
||||||
|
# 'contrib' before falling back to our custom 'lx_emul.h' header.
|
||||||
|
#
|
||||||
|
INC_DIR += $(LIB_INC_DIR)
|
||||||
|
INC_DIR += $(CONTRIB_DIR)/include
|
||||||
|
|
||||||
|
CC_OPT += -U__linux__ -D__KERNEL__
|
||||||
|
CC_OPT += -DCONFIG_USB_DEVICEFS -DCONFIG_HOTPLUG -DDEBUG
|
||||||
|
|
||||||
|
CC_WARN = -Wall -Wno-unused-variable -Wno-uninitialized \
|
||||||
|
-Wno-unused-function \
|
||||||
|
|
||||||
|
CC_C_OPT += -Wno-implicit-function-declaration -Wno-unused-but-set-variable \
|
||||||
|
-Wno-pointer-sign
|
||||||
|
|
||||||
|
#
|
||||||
|
# Suffix of global 'module_init' function
|
||||||
|
#
|
||||||
|
MOD_SUFFIX =
|
||||||
|
CC_OPT += -DMOD_SUFFIX=$(MOD_SUFFIX)
|
||||||
|
|
||||||
|
# USB core
|
||||||
|
SRC_C += $(addprefix usb/core/,$(notdir $(wildcard $(USB_DIR)/core/*.c)))
|
||||||
|
SRC_C += usb/usb-common.c
|
||||||
|
|
||||||
|
# USB host-controller driver
|
||||||
|
SRC_C += $(addprefix usb/host/, ehci-hcd.c)
|
||||||
|
|
||||||
|
# USB hid
|
||||||
|
SRC_C += $(addprefix hid/usbhid/,hid-core.c hid-quirks.c)
|
||||||
|
SRC_C += hid/hid-input.c hid/hid-core.c input/evdev.c input/input.c
|
||||||
|
|
||||||
|
# USB storage
|
||||||
|
SRC_C += $(addprefix usb/storage/,scsiglue.c protocol.c transport.c usb.c \
|
||||||
|
initializers.c option_ms.c sierra_ms.c usual-tables.c)
|
||||||
|
|
||||||
|
# SCSI
|
||||||
|
SRC_C += $(addprefix scsi/,scsi.c constants.c)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Determine the header files included by the contrib code. For each
|
||||||
|
# of these header files we create a symlink to 'lx_emul.h'.
|
||||||
|
#
|
||||||
|
GEN_INCLUDES := $(shell grep -rh "^\#include .*\/" $(CONTRIB_DIR) |\
|
||||||
|
sed "s/^\#include *[<\"]\(.*\)[>\"].*/\1/" | sort | uniq)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Filter out original Linux headers that exist in the contrib directory
|
||||||
|
#
|
||||||
|
NO_GEN_INCLUDES := $(shell cd $(CONTRIB_DIR); find -name "*.h" | sed "s/.\///" | sed "s/.*include\///")
|
||||||
|
GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES))
|
||||||
|
|
||||||
|
#
|
||||||
|
# Put Linux headers in 'GEN_INC' dir, since some include use "../../" paths use
|
||||||
|
# three level include hierarchy
|
||||||
|
#
|
||||||
|
GEN_INC := $(shell pwd)/include/include/include
|
||||||
|
|
||||||
|
$(shell mkdir -p $(GEN_INC))
|
||||||
|
|
||||||
|
GEN_INCLUDES := $(addprefix $(GEN_INC)/,$(GEN_INCLUDES))
|
||||||
|
INC_DIR += $(GEN_INC)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Make sure to create the header symlinks prior building
|
||||||
|
#
|
||||||
|
$(SRC_C:.c=.o) $(SRC_CC:.cc=.o): $(GEN_INCLUDES)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add suffix, since there are two hid-core.c with the same module init function
|
||||||
|
#
|
||||||
|
hid/hid-core.o: MOD_SUFFIX="_core"
|
||||||
|
|
||||||
|
$(GEN_INCLUDES):
|
||||||
|
$(VERBOSE)mkdir -p $(dir $@)
|
||||||
|
$(VERBOSE)ln -s $(LIB_INC_DIR)/lx_emul.h $@
|
||||||
|
|
||||||
|
vpath %.c $(DRIVERS_DIR)
|
||||||
|
vpath %.c $(USB_DIR)/host
|
||||||
|
vpath %.c $(LIB_DIR)
|
||||||
|
vpath %.cc $(LIB_DIR)
|
||||||
|
vpath %.cc $(LIB_DIR)/signal
|
||||||
|
vpath %.c $(LIB_DIR)/input
|
||||||
|
vpath %.cc $(LIB_DIR)/input
|
||||||
|
vpath %.cc $(LIB_DIR)/storage
|
||||||
|
vpath %.c $(LIB_DIR)/storage
|
||||||
|
vpath %.cc $(LIB_DIR)/nic
|
|
@ -0,0 +1,10 @@
|
||||||
|
include $(REP_DIR)/lib/mk/usb.inc
|
||||||
|
|
||||||
|
CC_OPT += -DCONFIG_PCI
|
||||||
|
INC_DIR += $(LIB_INC_DIR)/x86
|
||||||
|
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c)
|
||||||
|
SRC_CC += pci_driver.cc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,132 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* \brief USB driver main program
|
* \brief Startup USB driver library
|
||||||
* \author Norman Feske
|
* \author Sebastian Sumpf
|
||||||
* \author Sebastian Sumpf <sebastian.sumpf@genode-labs.com>
|
* \date 2013-02-20
|
||||||
* \date 2012-01-29
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
int main()
|
||||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
|
||||||
*
|
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
|
||||||
* under the terms of the GNU General Public License version 2.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Genode */
|
|
||||||
#include <base/rpc_server.h>
|
|
||||||
#include <base/printf.h>
|
|
||||||
#include <base/sleep.h>
|
|
||||||
#include <cap_session/connection.h>
|
|
||||||
#include <os/config.h>
|
|
||||||
#include <util/xml_node.h>
|
|
||||||
|
|
||||||
#include <nic_session/nic_session.h>
|
|
||||||
/* Local */
|
|
||||||
#include "storage/component.h"
|
|
||||||
#include "routine.h"
|
|
||||||
#include "signal.h"
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include <dde_kit/timer.h>
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace Genode;
|
|
||||||
|
|
||||||
extern "C" int subsys_usb_init();
|
|
||||||
extern "C" void subsys_input_init();
|
|
||||||
extern "C" void module_evdev_init();
|
|
||||||
extern "C" void module_hid_init();
|
|
||||||
extern "C" void module_hid_init_core();
|
|
||||||
extern "C" void module_usb_stor_init();
|
|
||||||
|
|
||||||
extern "C" void start_input_service(void *ep);
|
|
||||||
|
|
||||||
Routine *Routine::_current = 0;
|
|
||||||
Routine *Routine::_dead = 0;
|
|
||||||
bool Routine::_all = false;
|
|
||||||
|
|
||||||
void breakpoint() { PDBG("BREAK"); }
|
|
||||||
|
|
||||||
|
|
||||||
static void init(Services *services)
|
|
||||||
{
|
{
|
||||||
/* start jiffies */
|
extern void start_usb_driver();
|
||||||
dde_kit_timer_init(0, 0);
|
start_usb_driver();
|
||||||
|
|
||||||
/* USB */
|
|
||||||
subsys_usb_init();
|
|
||||||
|
|
||||||
/* input + HID */
|
|
||||||
if (services->hid) {
|
|
||||||
subsys_input_init();
|
|
||||||
module_evdev_init();
|
|
||||||
|
|
||||||
/* HID */
|
|
||||||
module_hid_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* host controller */
|
|
||||||
platform_hcd_init(services);
|
|
||||||
|
|
||||||
/* storage */
|
|
||||||
if (services->stor)
|
|
||||||
module_usb_stor_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int, char **)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Initialize server entry point
|
|
||||||
*/
|
|
||||||
enum { STACK_SIZE = 4096 };
|
|
||||||
static Cap_connection cap;
|
|
||||||
static Rpc_entrypoint ep_hid(&cap, STACK_SIZE, "usb_hid_ep");
|
|
||||||
static Signal_receiver recv;
|
|
||||||
|
|
||||||
Services services;
|
|
||||||
|
|
||||||
try {
|
|
||||||
config()->xml_node().sub_node("hid");
|
|
||||||
start_input_service(&ep_hid);
|
|
||||||
services.hid = true;
|
|
||||||
} catch (Config::Invalid) {
|
|
||||||
PDBG("No <config> node found - not starting any USB services");
|
|
||||||
return 0;
|
|
||||||
} catch (Xml_node::Nonexistent_sub_node) {
|
|
||||||
PDBG("No <hid> config node found - not starting the USB HID (Input) service");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
config()->xml_node().sub_node("storage");
|
|
||||||
services.stor = true;
|
|
||||||
} catch (Xml_node::Nonexistent_sub_node) {
|
|
||||||
PDBG("No <storage> config node found - not starting the USB Storage (Block) service");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
config()->xml_node().sub_node("nic");
|
|
||||||
services.nic = true;
|
|
||||||
} catch (Xml_node::Nonexistent_sub_node) {
|
|
||||||
PDBG("No <nic> config node found - not starting the USB Nic (Network) service");
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer::init(&recv);
|
|
||||||
Irq::init(&recv);
|
|
||||||
Event::init(&recv);
|
|
||||||
Service_handler::s()->receiver(&recv);
|
|
||||||
Storage::init(&recv);
|
|
||||||
Nic::init(&recv);
|
|
||||||
|
|
||||||
Routine::add(0, 0, "Main", true);
|
|
||||||
Routine::current_use_first();
|
|
||||||
init(&services);
|
|
||||||
|
|
||||||
Routine::remove();
|
|
||||||
|
|
||||||
/* will never be reached */
|
|
||||||
sleep_forever();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,149 +1,3 @@
|
||||||
TARGET = usb_drv
|
TARGET = usb_drv
|
||||||
LIBS = dde_kit libc-setjmp
|
SRC_CC = main.cc
|
||||||
SRC_CC = main.cc lx_emul.cc irq.cc timer.cc event.cc storage.cc \
|
LIBS = usb
|
||||||
input_component.cc nic.cc
|
|
||||||
SRC_C = dummies.c scsi.c evdev.c
|
|
||||||
|
|
||||||
CONTRIB_DIR := $(REP_DIR)/contrib
|
|
||||||
DRIVERS_DIR := $(CONTRIB_DIR)/drivers
|
|
||||||
USB_DIR := $(DRIVERS_DIR)/usb
|
|
||||||
|
|
||||||
#
|
|
||||||
# The order of include-search directories is important, we need to look into
|
|
||||||
# 'contrib' before falling back to our custom 'lx_emul.h' header.
|
|
||||||
#
|
|
||||||
INC_DIR += $(PRG_DIR)
|
|
||||||
INC_DIR += $(CONTRIB_DIR)/include
|
|
||||||
|
|
||||||
CC_OPT += -U__linux__ -D__KERNEL__
|
|
||||||
CC_OPT += -DCONFIG_USB_DEVICEFS -DCONFIG_HOTPLUG -DDEBUG
|
|
||||||
|
|
||||||
CC_WARN = -Wall -Wno-unused-variable -Wno-uninitialized \
|
|
||||||
-Wno-unused-function \
|
|
||||||
|
|
||||||
CC_C_OPT += -Wno-implicit-function-declaration -Wno-unused-but-set-variable \
|
|
||||||
-Wno-pointer-sign
|
|
||||||
|
|
||||||
#
|
|
||||||
# Suffix of global 'module_init' function
|
|
||||||
#
|
|
||||||
MOD_SUFFIX =
|
|
||||||
CC_OPT += -DMOD_SUFFIX=$(MOD_SUFFIX)
|
|
||||||
|
|
||||||
# USB core
|
|
||||||
SRC_C += $(addprefix usb/core/,$(notdir $(wildcard $(USB_DIR)/core/*.c)))
|
|
||||||
SRC_C += usb/usb-common.c
|
|
||||||
|
|
||||||
# USB host-controller driver
|
|
||||||
SRC_C += $(addprefix usb/host/, ehci-hcd.c)
|
|
||||||
|
|
||||||
# USB hid
|
|
||||||
SRC_C += $(addprefix hid/usbhid/,hid-core.c hid-quirks.c)
|
|
||||||
SRC_C += hid/hid-input.c hid/hid-core.c input/evdev.c input/input.c
|
|
||||||
|
|
||||||
# USB storage
|
|
||||||
SRC_C += $(addprefix usb/storage/,scsiglue.c protocol.c transport.c usb.c \
|
|
||||||
initializers.c option_ms.c sierra_ms.c usual-tables.c)
|
|
||||||
|
|
||||||
# SCSI
|
|
||||||
SRC_C += $(addprefix scsi/,scsi.c constants.c)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Determine the header files included by the contrib code. For each
|
|
||||||
# of these header files we create a symlink to 'lx_emul.h'.
|
|
||||||
#
|
|
||||||
GEN_INCLUDES := $(shell grep -rh "^\#include .*\/" $(CONTRIB_DIR) |\
|
|
||||||
sed "s/^\#include *[<\"]\(.*\)[>\"].*/\1/" | sort | uniq)
|
|
||||||
#
|
|
||||||
# Filter out some black-listed headers
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
########################
|
|
||||||
## Platform specifics ##
|
|
||||||
########################
|
|
||||||
|
|
||||||
SUPPORTED = x86_32 platform_panda
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# x86_32
|
|
||||||
#
|
|
||||||
ifeq ($(filter-out $(SPECS),x86_32),)
|
|
||||||
INC_DIR += $(PRG_DIR)/x86_32
|
|
||||||
CC_OPT += -DCONFIG_PCI
|
|
||||||
SRC_C += $(addprefix usb/host/,pci-quirks.c uhci-hcd.c)
|
|
||||||
SRC_CC += pci_driver.cc
|
|
||||||
|
|
||||||
#
|
|
||||||
# Panda board
|
|
||||||
#
|
|
||||||
else ifeq ($(filter-out $(SPECS),platform_panda),)
|
|
||||||
CC_OPT += -DCONFIG_USB_EHCI_HCD_OMAP -DCONFIG_USB_EHCI_TT_NEWSCHED -DVERBOSE_DEBUG
|
|
||||||
INC_DIR += $(PRG_DIR)/arm
|
|
||||||
SRC_C += platform_device.c usbnet.c smsc95xx.c
|
|
||||||
SRC_CC += platform.cc mem.cc
|
|
||||||
vpath %.c $(PRG_DIR)/arm/platform
|
|
||||||
vpath %.cc $(PRG_DIR)/arm/platform
|
|
||||||
vpath %.cc $(PRG_DIR)/arm/platform/platform_panda
|
|
||||||
vpath %.c $(CONTRIB_DIR)/drivers/net/usb
|
|
||||||
|
|
||||||
else ifeq ($(filter-out $(SPECS),platform_arndale),)
|
|
||||||
CC_OPT += -DCONFIG_USB_EHCI_S5P -DCONFIG_USB_EHCI_TT_NEWSCHED
|
|
||||||
INC_DIR += $(PRG_DIR)/arm
|
|
||||||
INC_DIR += $(CONTRIB_DIR)/arch/arm/plat-samsung/include
|
|
||||||
SRC_C += platform_device.c
|
|
||||||
SRC_CC += platform.cc
|
|
||||||
vpath %.c $(PRG_DIR)/arm/platform
|
|
||||||
vpath %.cc $(PRG_DIR)/arm/platform/platform_arndale
|
|
||||||
|
|
||||||
#
|
|
||||||
# Unsupported
|
|
||||||
#
|
|
||||||
else
|
|
||||||
$(error Skip USB because it requires one of the following: $(SUPPORTED))
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
|
||||||
# Filter out original Linux headers that exist in the contrib directory
|
|
||||||
#
|
|
||||||
NO_GEN_INCLUDES := $(shell cd $(CONTRIB_DIR)/include; find -name "*.h" | sed "s/.\///")
|
|
||||||
GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES))
|
|
||||||
|
|
||||||
#
|
|
||||||
# Put Linux headers in 'GEN_INC' dir, since some include use "../../" paths use
|
|
||||||
# three level include hierarchy
|
|
||||||
#
|
|
||||||
GEN_INC := $(shell pwd)/include/include/include
|
|
||||||
|
|
||||||
$(shell mkdir -p $(GEN_INC))
|
|
||||||
|
|
||||||
GEN_INCLUDES := $(addprefix $(GEN_INC)/,$(GEN_INCLUDES))
|
|
||||||
INC_DIR += $(GEN_INC)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Make sure to create the header symlinks prior building
|
|
||||||
#
|
|
||||||
$(SRC_C:.c=.o) $(SRC_CC:.cc=.o): $(GEN_INCLUDES)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Add suffix, since there are two hid-core.c with the same module init function
|
|
||||||
#
|
|
||||||
hid/hid-core.o: MOD_SUFFIX="_core"
|
|
||||||
|
|
||||||
$(GEN_INCLUDES):
|
|
||||||
$(VERBOSE)mkdir -p $(dir $@)
|
|
||||||
$(VERBOSE)ln -s $(REP_DIR)/src/drivers/usb/lx_emul.h $@
|
|
||||||
|
|
||||||
vpath %.c $(DRIVERS_DIR)
|
|
||||||
vpath %.c $(USB_DIR)/host
|
|
||||||
vpath %.cc $(PRG_DIR)/signal
|
|
||||||
vpath %.c $(PRG_DIR)/input
|
|
||||||
vpath %.cc $(PRG_DIR)/input
|
|
||||||
vpath %.cc $(PRG_DIR)/storage
|
|
||||||
vpath %.c $(PRG_DIR)/storage
|
|
||||||
vpath %.cc $(PRG_DIR)/nic
|
|
||||||
|
|
||||||
clean cleanall:
|
|
||||||
$(VERBOSE) rm -r include
|
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* \brief USB driver main program
|
||||||
|
* \author Norman Feske
|
||||||
|
* \author Sebastian Sumpf <sebastian.sumpf@genode-labs.com>
|
||||||
|
* \date 2012-01-29
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Genode */
|
||||||
|
#include <base/rpc_server.h>
|
||||||
|
#include <base/printf.h>
|
||||||
|
#include <base/sleep.h>
|
||||||
|
#include <cap_session/connection.h>
|
||||||
|
#include <os/config.h>
|
||||||
|
#include <util/xml_node.h>
|
||||||
|
|
||||||
|
#include <nic_session/nic_session.h>
|
||||||
|
/* Local */
|
||||||
|
#include "storage/component.h"
|
||||||
|
#include "routine.h"
|
||||||
|
#include "signal.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include <dde_kit/timer.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
|
extern "C" int subsys_usb_init();
|
||||||
|
extern "C" void subsys_input_init();
|
||||||
|
extern "C" void module_evdev_init();
|
||||||
|
extern "C" void module_hid_init();
|
||||||
|
extern "C" void module_hid_init_core();
|
||||||
|
extern "C" void module_usb_stor_init();
|
||||||
|
|
||||||
|
extern "C" void start_input_service(void *ep);
|
||||||
|
|
||||||
|
Routine *Routine::_current = 0;
|
||||||
|
Routine *Routine::_dead = 0;
|
||||||
|
bool Routine::_all = false;
|
||||||
|
|
||||||
|
void breakpoint() { PDBG("BREAK"); }
|
||||||
|
|
||||||
|
|
||||||
|
static void init(Services *services)
|
||||||
|
{
|
||||||
|
/* start jiffies */
|
||||||
|
dde_kit_timer_init(0, 0);
|
||||||
|
|
||||||
|
/* USB */
|
||||||
|
subsys_usb_init();
|
||||||
|
|
||||||
|
/* input + HID */
|
||||||
|
if (services->hid) {
|
||||||
|
subsys_input_init();
|
||||||
|
module_evdev_init();
|
||||||
|
|
||||||
|
/* HID */
|
||||||
|
module_hid_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* host controller */
|
||||||
|
platform_hcd_init(services);
|
||||||
|
|
||||||
|
/* storage */
|
||||||
|
if (services->stor)
|
||||||
|
module_usb_stor_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void start_usb_driver()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Initialize server entry point
|
||||||
|
*/
|
||||||
|
enum { STACK_SIZE = 4096 };
|
||||||
|
static Cap_connection cap;
|
||||||
|
static Rpc_entrypoint ep_hid(&cap, STACK_SIZE, "usb_hid_ep");
|
||||||
|
static Signal_receiver recv;
|
||||||
|
|
||||||
|
Services services;
|
||||||
|
|
||||||
|
try {
|
||||||
|
config()->xml_node().sub_node("hid");
|
||||||
|
start_input_service(&ep_hid);
|
||||||
|
services.hid = true;
|
||||||
|
} catch (Config::Invalid) {
|
||||||
|
PDBG("No <config> node found - not starting any USB services");
|
||||||
|
return;
|
||||||
|
} catch (Xml_node::Nonexistent_sub_node) {
|
||||||
|
PDBG("No <hid> config node found - not starting the USB HID (Input) service");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
config()->xml_node().sub_node("storage");
|
||||||
|
services.stor = true;
|
||||||
|
} catch (Xml_node::Nonexistent_sub_node) {
|
||||||
|
PDBG("No <storage> config node found - not starting the USB Storage (Block) service");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
config()->xml_node().sub_node("nic");
|
||||||
|
services.nic = true;
|
||||||
|
} catch (Xml_node::Nonexistent_sub_node) {
|
||||||
|
PDBG("No <nic> config node found - not starting the USB Nic (Network) service");
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer::init(&recv);
|
||||||
|
Irq::init(&recv);
|
||||||
|
Event::init(&recv);
|
||||||
|
Service_handler::s()->receiver(&recv);
|
||||||
|
Storage::init(&recv);
|
||||||
|
Nic::init(&recv);
|
||||||
|
|
||||||
|
Routine::add(0, 0, "Main", true);
|
||||||
|
Routine::current_use_first();
|
||||||
|
init(&services);
|
||||||
|
|
||||||
|
Routine::remove();
|
||||||
|
|
||||||
|
/* will never be reached */
|
||||||
|
sleep_forever();
|
||||||
|
}
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include <lx_emul.h>
|
#include <lx_emul.h>
|
||||||
|
|
||||||
#include "scsi.h"
|
#include <storage/scsi.h>
|
||||||
|
|
||||||
#define DEBUG_SCSI 0
|
#define DEBUG_SCSI 0
|
||||||
|
|
Loading…
Reference in New Issue