Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

toshoboe.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      toshoboe.h
00004  * Version:       0.1
00005  * Description:   Driver for the Toshiba OBOE (or type-O)
00006  *                FIR Chipset. 
00007  * Status:        Experimental.
00008  * Author:        James McKenzie <james@fishsoup.dhs.org>
00009  * Created at:    Sat May 8  12:35:27 1999
00010  * 
00011  *     Copyright (c) 1999-2000 James McKenzie, All Rights Reserved.
00012  *      
00013  *     This program is free software; you can redistribute it and/or 
00014  *     modify it under the terms of the GNU General Public License as 
00015  *     published by the Free Software Foundation; either version 2 of 
00016  *     the License, or (at your option) any later version.
00017  *  
00018  *     Neither James McKenzie nor Cambridge University admit liability nor
00019  *     provide warranty for any of this software. This material is 
00020  *     provided "AS-IS" and at no charge.
00021  *
00022  *     Applicable Models : Libretto 100CT. and many more
00023  *
00024  ********************************************************************/
00025 
00026 #ifndef TOSHOBOE_H
00027 #define TOSHOBOE_H
00028 
00029 /* Registers */
00030 /*Receive and transmit task registers (read only) */
00031 #define OBOE_RCVT       (0x00+(self->base))
00032 #define OBOE_XMTT       (0x01+(self->base))
00033 #define OBOE_XMTT_OFFSET        0x40
00034 
00035 /*Page pointers to the TaskFile structure */
00036 #define OBOE_TFP2       (0x02+(self->base))
00037 #define OBOE_TFP0       (0x04+(self->base))
00038 #define OBOE_TFP1       (0x05+(self->base))
00039 
00040 /*Dunno */
00041 #define OBOE_REG_3      (0x03+(self->base))
00042 
00043 /*Number of tasks to use in Xmit and Recv queues */
00044 #define OBOE_NTR        (0x07+(self->base))
00045 #define OBOE_NTR_XMIT4  0x00
00046 #define OBOE_NTR_XMIT8  0x10
00047 #define OBOE_NTR_XMIT16 0x30
00048 #define OBOE_NTR_XMIT32 0x70
00049 #define OBOE_NTR_XMIT64 0xf0
00050 #define OBOE_NTR_RECV4  0x00
00051 #define OBOE_NTR_RECV8  0x01
00052 #define OBOE_NTR_RECV6  0x03
00053 #define OBOE_NTR_RECV32 0x07
00054 #define OBOE_NTR_RECV64 0x0f
00055 
00056 /* Dunno */
00057 #define OBOE_REG_9      (0x09+(self->base))
00058 
00059 /* Interrupt Status Register */
00060 #define OBOE_ISR        (0x0c+(self->base))
00061 #define OBOE_ISR_TXDONE 0x80
00062 #define OBOE_ISR_RXDONE 0x40
00063 #define OBOE_ISR_20     0x20
00064 #define OBOE_ISR_10     0x10
00065 #define OBOE_ISR_8      0x08         /*This is collision or parity or something */
00066 #define OBOE_ISR_4      0x08
00067 #define OBOE_ISR_2      0x08
00068 #define OBOE_ISR_1      0x08
00069 
00070 /*Dunno */
00071 #define OBOE_REG_D      (0x0d+(self->base))
00072 
00073 /*Register Lock Register */
00074 #define OBOE_LOCK       ((self->base)+0x0e)
00075 
00076 
00077 
00078 /*Speed control registers */
00079 #define OBOE_PMDL       (0x10+(self->base))
00080 #define OBOE_PMDL_SIR   0x18
00081 #define OBOE_PMDL_MIR   0xa0
00082 #define OBOE_PMDL_FIR   0x40
00083 
00084 #define OBOE_SMDL       (0x18+(self->base))
00085 #define OBOE_SMDL_SIR   0x20
00086 #define OBOE_SMDL_MIR   0x01
00087 #define OBOE_SMDL_FIR   0x0f
00088 
00089 #define OBOE_UDIV       (0x19+(self->base))
00090 
00091 /*Dunno */
00092 #define OBOE_REG_11     (0x11+(self->base))
00093 
00094 /*Chip Reset Register */
00095 #define OBOE_RST        (0x15+(self->base))
00096 #define OBOE_RST_WRAP   0x8
00097 
00098 /*Dunno */
00099 #define OBOE_REG_1A     (0x1a+(self->base))
00100 #define OBOE_REG_1B     (0x1b+(self->base))
00101 
00102 /* The PCI ID of the OBOE chip */
00103 #ifndef PCI_DEVICE_ID_FIR701
00104 #define PCI_DEVICE_ID_FIR701    0x0701
00105 #endif
00106 
00107 typedef unsigned int dword;
00108 typedef unsigned short int word;
00109 typedef unsigned char byte;
00110 typedef dword Paddr;
00111 
00112 struct OboeTask
00113   {
00114     __u16 len;
00115     __u8 unused;
00116     __u8 control;
00117     __u32 buffer;
00118   };
00119 
00120 #define OBOE_NTASKS 64
00121 
00122 struct OboeTaskFile
00123   {
00124     struct OboeTask recv[OBOE_NTASKS];
00125     struct OboeTask xmit[OBOE_NTASKS];
00126   };
00127 
00128 #define OBOE_TASK_BUF_LEN (sizeof(struct OboeTaskFile) << 1)
00129 
00130 /*These set the number of slots in use */
00131 #define TX_SLOTS        4
00132 #define RX_SLOTS        4
00133 
00134 /* You need also to change this, toshiba uses 4,8 and 4,4 */
00135 /* It makes no difference if you are only going to use ONETASK mode */
00136 /* remember each buffer use XX_BUF_SZ more _PHYSICAL_ memory */
00137 #define OBOE_NTR_VAL    (OBOE_NTR_XMIT4 | OBOE_NTR_RECV4)
00138 
00139 struct toshoboe_cb
00140   {
00141     struct device *netdev;      /* Yes! we are some kind of netdevice */
00142     struct net_device_stats stats;
00143 
00144     struct irlap_cb    *irlap;  /* The link layer we are binded to */
00145     struct qos_info     qos;    /* QoS capabilities for this device */
00146 
00147     chipio_t io;                /* IrDA controller information */
00148 
00149     __u32 flags;                /* Interface flags */
00150     __u32 new_speed;
00151 
00152     struct pci_dev *pdev;       /*PCI device */
00153     int base;                   /*IO base */
00154     int txpending;              /*how many tx's are pending */
00155     int txs, rxs;               /*Which slots are we at  */
00156     void *taskfilebuf;          /*The unaligned taskfile buffer */
00157     struct OboeTaskFile *taskfile;  /*The taskfile   */
00158     void *xmit_bufs[TX_SLOTS];  /*The buffers   */
00159     void *recv_bufs[RX_SLOTS];
00160     int open;
00161     int stopped;                /*Stopped by some or other APM stuff*/
00162   };
00163 
00164 
00165 #endif
00166 
00167