# HG changeset patch # User asl # Date 1149883753 0 # Node ID b86c8bd4a1a3d914ce225d282a8b4cc728a2de6a # Parent 5ca68e635c885eed2b89ffb20d61d84d3f8dc811 * First version of the USB device driver using the philips D12 for i386 targets. diff --git a/packages/devs/usb/i386/SoRoD12/current/ChangeLog b/packages/devs/usb/i386/SoRoD12/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/usb/i386/SoRoD12/current/ChangeLog @@ -0,0 +1,36 @@ +2006-06-06 Frank Pagliughi + + * First version of the USB device driver using the philips D12 + for i386 targets. + +//=========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2006 eCosCentric Ltd +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/usb/i386/SoRoD12/current/cdl/usbs_i386_sorod12.cdl b/packages/devs/usb/i386/SoRoD12/current/cdl/usbs_i386_sorod12.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/usb/i386/SoRoD12/current/cdl/usbs_i386_sorod12.cdl @@ -0,0 +1,91 @@ +# ==================================================================== +# +# usbs_i386_sorod12.cdl +# +# Hardware specific parts for the SoRo D12 PC 104 USB card. +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 2003, 2004, 2006 eCosCentric Limited +## Copyright (C) 2006 eCosCentric Ltd +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Frank M. Pagliughi (fmp), SoRo Systems, Inc., asl +# Contributors: +# Date: 2006-04-27 +# +#####DESCRIPTIONEND#### +# ==================================================================== + +cdl_package CYGPKG_DEVS_USB_I386_SOROD12 { + display "Hardware specific part for SoRo D12 USB Device Driver" + include_dir "cyg/io/usb" + parent CYGPKG_DEVS_USB_D12 + + requires { CYGIMP_DEVS_USB_D12_HW_ACCESS_HEADER == + "" } + + cdl_option CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED { + display "I/O mapped." + flavor bool + default_value 1 + description " + The PDIUSBD12 can be mapped into the processor's I/O space or memory + space. If this is set the driver accesses the chip through HAL_READ + and HAL_WRITE macros, otherwise it uses direct memory access." + } + + cdl_option CYGNUM_DEVS_USB_I386_SOROD12_BASEADDR { + display "Base Address of D12 chip" + flavor data + no_define + legal_values 1 to 0xFF8 + default_value 544 + active_if CYGFUN_DEVS_USB_D12_EP0 + requires { CYGNUM_DEVS_USB_D12_BASEADDR == + CYGNUM_DEVS_USB_I386_SOROD12_BASEADDR } + description " + The base memory or I/O address where the USB chip resides." + } + + cdl_option CYGNUM_DEVS_USB_I386_SORODD12_IRQ { + display "IRQ for the D12 chip" + flavor data + no_define + legal_values { 3 5 7 } + default_value 5 + active_if CYGFUN_DEVS_USB_D12_EP0 + requires { CYGNUM_DEVS_USB_D12_IRQ == + CYGNUM_DEVS_USB_I386_SORODD12_IRQ } + description " + The IRQ assigned to the D12 chip." + } +} diff --git a/packages/devs/usb/i386/SoRoD12/current/include/usbs_i386_sorod12.inl b/packages/devs/usb/i386/SoRoD12/current/include/usbs_i386_sorod12.inl new file mode 100644 --- /dev/null +++ b/packages/devs/usb/i386/SoRoD12/current/include/usbs_i386_sorod12.inl @@ -0,0 +1,128 @@ +#ifndef USBS_I386_SORO12_INL +#define USBS_I386_SORO12_INL +//========================================================================== +// +// usbS_i386_sorod12.inl +// +// Hardware specific parts for the SoRo D12 PC 104 USB card. +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2006, eCosCentric +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Frank M. Pagliughi (fmp), ASL +// Date: 2004-05-22 +// +// This code is a hardware specific device driver for the SoRo Systems +// USB-D12-104, a PC/104 (ISA) Full-Speed USB slave board, which turns +// a PC/104 stack into a USB slave device. The board contains a +// Philips PDIUSBD12 Peripheral Controller Chip mapped into the PC's +// I/O space, with jumper-selectable I/O base address, IRQ, and DMA +// settings. The eCos config tool is used to adjust settings for this +// driver to match the physical jumper settings. The chip could run in +// polled mode without an IRQ, but this wouldn't be a great idea other +// than maybe a debug environment. + +// ------------------------------------------------------------------------ +// Data-Only I/O +// ------------------------------------------------------------------------ +// + +#include + +// These routines read or write 8 bit values to the data area. + +static inline byte d12_read_data_byte(d12_addr_type base_addr) +{ + #if defined(CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED) + byte val; + HAL_READ_UINT8((unsigned) base_addr, val); + return val; + #else + return *base_addr; + #endif +} + +static inline void d12_write_data_byte(d12_addr_type base_addr, byte val) +{ + #if defined(CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED) + HAL_WRITE_UINT8((unsigned) base_addr, val); + #else + *base_addr = val; + #endif +} + +// This routine writes a command to the device. + +static inline void d12_write_cmd(d12_addr_type base_addr, byte cmd) +{ + #if defined(CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED) + HAL_WRITE_UINT8((unsigned) base_addr+1, cmd); + #else + *(base_addr+1) = cmd; + #endif +} + +// ------------------------------------------------------------------------ +// Reads 'n' bytes from the data address of the D12 and places them into +// the buf[] array. Buf can be NULL, in which case the specified number of +// bytes are read and discarded. + +static uint8 d12_read_data(d12_addr_type base_addr, byte *buf, uint8 n) +{ + uint8 i; + + if (buf) { + for (i=0; i