1 #ifndef USBS_I386_SORO12_INL
2 #define USBS_I386_SORO12_INL
3 //==========================================================================
5 // usbS_i386_sorod12.inl
7 // Hardware specific parts for the SoRo D12 PC 104 USB card.
9 //==========================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 2006, eCosCentric
15 // eCos is free software; you can redistribute it and/or modify it under
16 // the terms of the GNU General Public License as published by the Free
17 // Software Foundation; either version 2 or (at your option) any later version.
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
37 // -------------------------------------------
38 //####ECOSGPLCOPYRIGHTEND####
39 //==========================================================================
40 //#####DESCRIPTIONBEGIN####
42 // Author(s): Frank M. Pagliughi (fmp), ASL
45 // This code is a hardware specific device driver for the SoRo Systems
46 // USB-D12-104, a PC/104 (ISA) Full-Speed USB slave board, which turns
47 // a PC/104 stack into a USB slave device. The board contains a
48 // Philips PDIUSBD12 Peripheral Controller Chip mapped into the PC's
49 // I/O space, with jumper-selectable I/O base address, IRQ, and DMA
50 // settings. The eCos config tool is used to adjust settings for this
51 // driver to match the physical jumper settings. The chip could run in
52 // polled mode without an IRQ, but this wouldn't be a great idea other
53 // than maybe a debug environment.
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
60 #include <pkgconf/devs_usb_i386_sorod12.h>
62 // These routines read or write 8 bit values to the data area.
64 static inline byte d12_read_data_byte(d12_addr_type base_addr)
66 #if defined(CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED)
68 HAL_READ_UINT8((unsigned) base_addr, val);
75 static inline void d12_write_data_byte(d12_addr_type base_addr, byte val)
77 #if defined(CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED)
78 HAL_WRITE_UINT8((unsigned) base_addr, val);
84 // This routine writes a command to the device.
86 static inline void d12_write_cmd(d12_addr_type base_addr, byte cmd)
88 #if defined(CYGSEM_DEVS_USB_I386_SOROD12_IO_MAPPED)
89 HAL_WRITE_UINT8((unsigned) base_addr+1, cmd);
95 // ------------------------------------------------------------------------
96 // Reads 'n' bytes from the data address of the D12 and places them into
97 // the buf[] array. Buf can be NULL, in which case the specified number of
98 // bytes are read and discarded.
100 static uint8 d12_read_data(d12_addr_type base_addr, byte *buf, uint8 n)
106 buf[i] = d12_read_data_byte(base_addr);
110 d12_read_data_byte(base_addr);
117 // ------------------------------------------------------------------------
118 // Writes 'n' bytes out the data reg of the chip
120 static void d12_write_data(d12_addr_type base_addr, const byte *buf, uint8 n)
125 d12_write_data_byte(base_addr, buf[i]);
128 #endif // USBS_I386_SORO12_INL