oboereg.h revision 1.1.120.1       1  1.1.120.1      yamt /*	$NetBSD: oboereg.h,v 1.1.120.1 2008/05/18 12:34:21 yamt Exp $	*/
      2        1.1  augustss 
      3        1.1  augustss /*-
      4        1.1  augustss  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5        1.1  augustss  * All rights reserved.
      6        1.1  augustss  *
      7        1.1  augustss  * This code is derived from software contributed to The NetBSD Foundation
      8        1.1  augustss  * by Jan Sparud.
      9        1.1  augustss  *
     10        1.1  augustss  * Redistribution and use in source and binary forms, with or without
     11        1.1  augustss  * modification, are permitted provided that the following conditions
     12        1.1  augustss  * are met:
     13        1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     14        1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     15        1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     16        1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     17        1.1  augustss  *    documentation and/or other materials provided with the distribution.
     18        1.1  augustss  *
     19        1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20        1.1  augustss  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21        1.1  augustss  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22        1.1  augustss  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23        1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24        1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25        1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26        1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27        1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28        1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29        1.1  augustss  * POSSIBILITY OF SUCH DAMAGE.
     30        1.1  augustss  */
     31        1.1  augustss 
     32        1.1  augustss /*
     33        1.1  augustss  * Toshiba OBOE SIR/FIR driver header file.
     34        1.1  augustss  */
     35        1.1  augustss 
     36        1.1  augustss #ifndef OBOE_H
     37        1.1  augustss #define OBOE_H
     38        1.1  augustss 
     39        1.1  augustss /* Registers */
     40        1.1  augustss /*Receive and transmit task registers (read only) */
     41        1.1  augustss #define OBOE_RCVT	(0x00)
     42        1.1  augustss #define OBOE_XMTT	(0x01)
     43        1.1  augustss #define OBOE_XMTT_OFFSET	0x40
     44        1.1  augustss 
     45        1.1  augustss /*Page pointers to the TaskFile structure */
     46        1.1  augustss #define OBOE_TFP2	(0x02)
     47        1.1  augustss #define OBOE_TFP0	(0x04)
     48        1.1  augustss #define OBOE_TFP1	(0x05)
     49        1.1  augustss 
     50        1.1  augustss /*Dunno */
     51        1.1  augustss #define OBOE_REG_3	(0x03)
     52        1.1  augustss 
     53        1.1  augustss /*Number of tasks to use in Xmit and Recv queues */
     54        1.1  augustss #define OBOE_NTR	(0x07)
     55        1.1  augustss #define OBOE_NTR_XMIT4	0x00
     56        1.1  augustss #define OBOE_NTR_XMIT8	0x10
     57        1.1  augustss #define OBOE_NTR_XMIT16	0x30
     58        1.1  augustss #define OBOE_NTR_XMIT32	0x70
     59        1.1  augustss #define OBOE_NTR_XMIT64	0xf0
     60        1.1  augustss #define OBOE_NTR_RECV4	0x00
     61        1.1  augustss #define OBOE_NTR_RECV8	0x01
     62        1.1  augustss #define OBOE_NTR_RECV6	0x03
     63        1.1  augustss #define OBOE_NTR_RECV32	0x07
     64        1.1  augustss #define OBOE_NTR_RECV64	0x0f
     65        1.1  augustss 
     66        1.1  augustss /* Dunno */
     67        1.1  augustss #define OBOE_REG_9	(0x09)
     68        1.1  augustss 
     69        1.1  augustss /* Interrupt Status Register */
     70        1.1  augustss #define OBOE_ISR	(0x0c)
     71        1.1  augustss #define OBOE_ISR_TXDONE	0x80
     72        1.1  augustss #define OBOE_ISR_RXDONE	0x40
     73        1.1  augustss #define OBOE_ISR_20	0x20
     74        1.1  augustss #define OBOE_ISR_10	0x10
     75        1.1  augustss #define OBOE_ISR_8	0x08         /*This is collision or parity or something */
     76        1.1  augustss #define OBOE_ISR_4	0x08
     77        1.1  augustss #define OBOE_ISR_2	0x08
     78        1.1  augustss #define OBOE_ISR_1	0x08
     79        1.1  augustss 
     80        1.1  augustss /*Dunno */
     81        1.1  augustss #define OBOE_REG_D	(0x0d)
     82        1.1  augustss 
     83        1.1  augustss /*Register Lock Register */
     84        1.1  augustss #define OBOE_LOCK	(0x0e)
     85        1.1  augustss 
     86        1.1  augustss /*Speed control registers */
     87        1.1  augustss #define OBOE_PMDL	(0x10)
     88        1.1  augustss #define OBOE_PMDL_SIR	0x18
     89        1.1  augustss #define OBOE_PMDL_MIR	0xa0
     90        1.1  augustss #define OBOE_PMDL_FIR	0x40
     91        1.1  augustss 
     92        1.1  augustss #define OBOE_SMDL	(0x18)
     93        1.1  augustss #define OBOE_SMDL_SIR	0x20
     94        1.1  augustss #define OBOE_SMDL_MIR	0x01
     95        1.1  augustss #define OBOE_SMDL_FIR	0x0f
     96        1.1  augustss 
     97        1.1  augustss #define OBOE_UDIV	(0x19)
     98        1.1  augustss 
     99        1.1  augustss /*Dunno */
    100        1.1  augustss #define OBOE_REG_11	(0x11)
    101        1.1  augustss 
    102        1.1  augustss /*Chip Reset Register */
    103        1.1  augustss #define OBOE_RST	(0x15)
    104        1.1  augustss #define OBOE_RST_WRAP	0x8
    105        1.1  augustss 
    106        1.1  augustss /*Dunno */
    107        1.1  augustss #define OBOE_REG_1A	(0x1a)
    108        1.1  augustss #define OBOE_REG_1B	(0x1b)
    109        1.1  augustss 
    110        1.1  augustss #define OBOE_IOSIZE	0x1f
    111        1.1  augustss 
    112        1.1  augustss #define IO_BAR		0x10
    113        1.1  augustss 
    114        1.1  augustss typedef unsigned int dword;
    115        1.1  augustss typedef unsigned short int word;
    116        1.1  augustss typedef unsigned char byte;
    117        1.1  augustss typedef dword Paddr;
    118        1.1  augustss 
    119        1.1  augustss struct OboeTask {
    120        1.1  augustss 	uint16_t len;
    121        1.1  augustss 	uint8_t unused;
    122        1.1  augustss 	uint8_t control;
    123        1.1  augustss 	uint32_t buffer;
    124        1.1  augustss };
    125        1.1  augustss 
    126        1.1  augustss #define OBOE_NTASKS 64
    127        1.1  augustss 
    128        1.1  augustss struct OboeTaskFile {
    129        1.1  augustss 	struct OboeTask recv[OBOE_NTASKS];
    130        1.1  augustss 	struct OboeTask xmit[OBOE_NTASKS];
    131        1.1  augustss };
    132        1.1  augustss 
    133        1.1  augustss #define OBOE_TASK_BUF_LEN (sizeof(struct OboeTaskFile) << 1)
    134        1.1  augustss 
    135        1.1  augustss /*These set the number of slots in use */
    136        1.1  augustss #define TX_SLOTS	8
    137        1.1  augustss #define RX_SLOTS	8
    138        1.1  augustss 
    139        1.1  augustss #define RX_BUF_SZ 	4196
    140        1.1  augustss #define TX_BUF_SZ	4196
    141        1.1  augustss 
    142        1.1  augustss /* You need also to change this, toshiba uses 4,8 and 4,4 */
    143        1.1  augustss /* It makes no difference if you are only going to use ONETASK mode */
    144        1.1  augustss /* remember each buffer use XX_BUF_SZ more _PHYSICAL_ memory */
    145        1.1  augustss #define OBOE_NTR_VAL 	(OBOE_NTR_XMIT8 | OBOE_NTR_RECV8)
    146        1.1  augustss 
    147        1.1  augustss #define OUTB(sc, val, off) \
    148        1.1  augustss   bus_space_write_1(sc->sc_iot, sc->sc_ioh, off, val)
    149        1.1  augustss 
    150        1.1  augustss #define INB(sc, off) \
    151        1.1  augustss   bus_space_read_1(sc->sc_iot, sc->sc_ioh, off)
    152        1.1  augustss 
    153        1.1  augustss #endif
    154