User Tools

Site Tools


ddekitusb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ddekitusb [2014/11/11 14:52]
127.0.0.1 external edit
ddekitusb [2014/11/11 14:58] (current)
lionelsambuc [USB host controller driver (USBD)]
Line 1: Line 1:
 +====== Information about MINIX 3 USB support ======
 +
 +
 +We are using the driver portability layer called
 +[[http://​os.inf.tu-dresden.de/​ddekit/​|Device Driver Environment kit]] to
 +provide support for USB host on the MINIX 3 operating system. The Device Driver
 +Environment was developed for reuse of legacy device drivers. It defines an
 +operating system agnostic kernel application programming interface (API) and
 +provides Linux 2.6.29 based legacy drivers for supporting USB-host among other
 +things. DDE with USB host support has been ported to MINIX 3 by Dirk Vogd.
 +
 +
 +===== Functional decomposition =====
 +
 +
 +
 +====== DdeKit ======
 +
 +
 +DDEKIT provides a BSD licensed abstraction layer for driver development. This
 +abstraction,​ defined in includes files, defines the following primitives: data
 +types, memory allocation, paging, threading, semaphores, timers, low level
 +hardware I/O, requesting interrupts and dma access. It is located inside the
 +MINIX3 source tree at /​usr/​src/​minix/​include/​ddekit and implemented in
 +/​usr/​src/​minix/​lib/​libddekit.
 +
 +
 +===== Dde-linux26 =====
 +
 +
 +The dde-linux26 is a GPLv2 package that uses ddekit host Linux device drivers.
 +Using ddekit it replaces key parts of the Linux device driver model to be able
 +to run drivers on a non Linux kernel. It contains large parts of the Linux
 +2.6.29 source code in the contrib directory and provide abstractions for a the
 +following type of drivers: common, block, common, net, partitions, scsi and usb.
 +This code only depends on ddekit and is not MINIX 3 specific.
 +
 +===== Dde-linux26-usb-drivers =====
 +
 +The Dde-linux26-usb-drivers use dde-linux26 to implement an USB stack for MINIX.
 +
 +
 +==== USB host controller driver (USBD) ====
 +
 +
 +The USB host controller driver is a MINIX 3 service that talks to the USB host
 +controller hardware using established standards like EHCI and OHCI and mediates
 +access to USB devices by implementing a virtual host controller driver.
 +
 +
 +UsbStubDriver::​
 + For new device notification
 +UsbHostControllerDriver::​
 + MINIX bus driver implementation using usbcore
 +USBCORE::
 + Linux library to implement host controllers
 +EHCI::
 + Standard way of talking to the usb host controller
 +DDELinux::
 + the support library for things like platform_device creation
 +
 +
 +
 +==== USB class driver (mass storage/​hid) ====
 +
 +
 +The USB drivers in MINIX3 will communicates with USB devices host controller
 +over a virtual host controller interface provided by USBD. The class drivers
 +uses the DDE kit and Linux drivers like SCSI to implement Their service.
 +
 +
 +UsbClassStorage::​
 + implements a minix interface like block device
 +DDE helpers::
 + helpers like the  SCSI lib part in case of the USB mass storage class
 +VHCI::
 + Virtual host controller as also used to provide usb over ethernet. This
 + driver talks to USBD using grants and messages.
 +
 +
 +===== Device manager (DEVMAN) =====
 +
 +
 +Devman is a device manager who's main goal is to enable hot-plugging of
 +hardware. Based on events from USBD and a configuration file it will create
 +device nodes and start or stop USB class drivers.
 +
 +There are two parts to devman. One is a MINIX3 service and the second one is a userland daemon.
 +
 +
 +===== Startup sequence for mass storage =====
 +
 +
 +The initialization is as follow
 +
 +  * The RC script starts the devman
 +  * The RC script start devmand
 +  * devmand read it's configuration and starts listening for events from devman
 +  * Usbd is started via the extended RC scripts that look in /​usr/​pkg/​etc/​rc.d.
 +  * The stub driver inside usbd notifies devman about new usb devices found
 +  * devman exports this information over sysfs and devmand reads about a new configurations
 +  * devman starts the mass_storage service based on it's configuration
 +  * the mass_storage service binds to the interface over the virtual host controller
 +  * After some time the device is ready to be mounted.
 +
 +===== Shutdown sequence =====
 +
 +
 +The shutdown sequence is the following
 +  * umount usb file systems
 +  * stop devmand ( also stops the running services like usb_storage)
 +  * stop usbd
 +  * umount /sys
 +  * stop devman
 +
 +
 +===== Running and developing =====
 +
 +
 +The device manager is located in the MINIX 3 sources but the remaining components are lotacted outside of this source tree and are referred from the pkgsrc tree. To get the code working go to /​usr/​pkgsrc/​minix/​dde-linux26-usb-drivers run bmake install and reboot.
 +To develop we suggest your first run bmake install and after that run bmake build-env in either the dde-linux26-usb-drivers or dde-linux26 directory. running "bmake && bmake install"​ after that will directly install the libraries in the correct location.
 +The code for dde-linux26 and dde-linux26-usb-driver is hosted on git.minix3.org
 +
 +
 +===== Updating the DDEKIT package =====
 +
 +To perform an update of the code you need to do a few things:
 +
 +  * Get your changes in the dde git repositories
 +  * Create a new set of dist files using  http://​git.minix3.org/?​p=dde-linux26-usb-drivers.git;​a=blob;​f=dist.sh;​h=f38ebd1f544bc7548d890cb15abaf91042a2a340;​hb=master
 +  * Put the dist files in the repo
 +  * in pkgsrc edit minix/​dde-linux26/​Makefile and dde-linux26-usb-drivers/​Makefile
 +  * and run bmake makesum in both directories
 +  * Update the pkgsrc git repo
  
ddekitusb.txt · Last modified: 2014/11/11 14:58 by lionelsambuc