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

smc-ircc.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      smc-ircc.h
00004  * Version:       0.3
00005  * Description:   Definitions for the SMC IrCC chipset
00006  * Status:        Experimental.
00007  * Author:        Thomas Davis (tadavis@jps.net)
00008  *
00009  *     Copyright (c) 1999-2000, Dag Brattli <dagb@cs.uit.no>
00010  *     Copyright (c) 1998-1999, Thomas Davis (tadavis@jps.net>
00011  *     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  *     This program is distributed in the hope that it will be useful,
00019  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  *     GNU General Public License for more details.
00022  * 
00023  *     You should have received a copy of the GNU General Public License 
00024  *     along with this program; if not, write to the Free Software 
00025  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00026  *     MA 02111-1307 USA
00027  *
00028  ********************************************************************/
00029 
00030 #ifndef SMC_IRCC_H
00031 #define SMC_IRCC_H
00032 
00033 #include <asm/spinlock.h>
00034 
00035 #include <net/irda/irport.h>
00036 
00037 /* DMA modes needed */
00038 #define DMA_TX_MODE                0x08    /* Mem to I/O, ++, demand. */
00039 #define DMA_RX_MODE                0x04    /* I/O to mem, ++, demand. */
00040 
00041 /* Master Control Register */
00042 #define IRCC_MASTER                0x07
00043 #define   IRCC_MASTER_POWERDOWN    0x80
00044 #define   IRCC_MASTER_RESET        0x40
00045 #define   IRCC_MASTER_INT_EN       0x20
00046 #define   IRCC_MASTER_ERROR_RESET  0x10
00047 
00048 /* Register block 0 */
00049 
00050 /* Interrupt Identification */
00051 #define IRCC_IIR                   0x01
00052 #define   IRCC_IIR_ACTIVE_FRAME    0x80
00053 #define   IRCC_IIR_EOM             0x40
00054 #define   IRCC_IIR_RAW_MODE        0x20
00055 #define   IRCC_IIR_FIFO            0x10
00056 
00057 /* Interrupt Enable */
00058 #define IRCC_IER                   0x02
00059 #define   IRCC_IER_ACTIVE_FRAME    0x80
00060 #define   IRCC_IER_EOM             0x40
00061 #define   IRCC_IER_RAW_MODE        0x20
00062 #define   IRCC_IER_FIFO            0x10
00063 
00064 /* Line Status Register */
00065 #define IRCC_LSR                   0x03
00066 #define   IRCC_LSR_UNDERRUN        0x80
00067 #define   IRCC_LSR_OVERRUN         0x40
00068 #define   IRCC_LSR_FRAME_ERROR     0x20
00069 #define   IRCC_LSR_SIZE_ERROR      0x10
00070 #define   IRCC_LSR_CRC_ERROR       0x80
00071 #define   IRCC_LSR_FRAME_ABORT     0x40
00072 
00073 /* Line Control Register A */
00074 #define IRCC_LCR_A                 0x04
00075 #define   IRCC_LCR_A_FIFO_RESET    0x80
00076 #define   IRCC_LCR_A_FAST          0x40
00077 #define   IRCC_LCR_A_GP_DATA       0x20
00078 #define   IRCC_LCR_A_RAW_TX        0x10
00079 #define   IRCC_LCR_A_RAW_RX        0x08
00080 #define   IRCC_LCR_A_ABORT         0x04
00081 #define   IRCC_LCR_A_DATA_DONE     0x02
00082 
00083 /* Line Control Register B */
00084 #define IRCC_LCR_B                 0x05
00085 #define   IRCC_LCR_B_SCE_DISABLED  0x00
00086 #define   IRCC_LCR_B_SCE_TRANSMIT  0x40
00087 #define   IRCC_LCR_B_SCE_RECEIVE   0x80
00088 #define   IRCC_LCR_B_SCE_UNDEFINED 0xc0
00089 #define   IRCC_LCR_B_SIP_ENABLE    0x20
00090 #define   IRCC_LCR_B_BRICK_WALL    0x10
00091 
00092 /* Bus Status Register */
00093 #define IRCC_BSR                   0x06
00094 #define   IRCC_BSR_NOT_EMPTY       0x80
00095 #define   IRCC_BSR_FIFO_FULL       0x40
00096 #define   IRCC_BSR_TIMEOUT         0x20
00097 
00098 /* Register block 1 */
00099 
00100 #define IRCC_FIFO_THRESHOLD        0x02
00101 
00102 #define IRCC_SCE_CFGA              0x00
00103 #define   IRCC_CFGA_AUX_IR         0x80
00104 #define   IRCC_CFGA_HALF_DUPLEX    0x04
00105 #define   IRCC_CFGA_TX_POLARITY    0x02
00106 #define   IRCC_CFGA_RX_POLARITY    0x01
00107 
00108 #define   IRCC_CFGA_COM            0x00
00109 #define   IRCC_CFGA_IRDA_SIR_A     0x08
00110 #define   IRCC_CFGA_ASK_SIR        0x10
00111 #define   IRCC_CFGA_IRDA_SIR_B     0x18
00112 #define   IRCC_CFGA_IRDA_HDLC      0x20
00113 #define   IRCC_CFGA_IRDA_4PPM      0x28
00114 #define   IRCC_CFGA_CONSUMER       0x30
00115 #define   IRCC_CFGA_RAW_IR         0x38
00116 #define   IRCC_CFGA_OTHER          0x40
00117 
00118 #define IRCC_IR_HDLC               0x04
00119 #define IRCC_IR_4PPM               0x01
00120 #define IRCC_IR_CONSUMER           0x02
00121 
00122 #define IRCC_SCE_CFGB              0x01
00123 #define IRCC_CFGB_LOOPBACK         0x20
00124 #define IRCC_CFGB_LPBCK_TX_CRC     0x10
00125 #define IRCC_CFGB_NOWAIT           0x08
00126 #define IRCC_CFGB_STRING_MOVE      0x04
00127 #define IRCC_CFGB_DMA_BURST        0x02
00128 #define IRCC_CFGB_DMA_ENABLE       0x01
00129 
00130 #define IRCC_CFGB_MUX_COM          0x00
00131 #define IRCC_CFGB_MUX_IR           0x40
00132 #define IRCC_CFGB_MUX_AUX          0x80
00133 #define IRCC_CFGB_MUX_INACTIVE     0xc0
00134 
00135 /* Register block 3 - Identification Registers! */
00136 #define IRCC_ID_HIGH               0x00   /* 0x10 */
00137 #define IRCC_ID_LOW                0x01   /* 0xB8 */
00138 #define IRCC_CHIP_ID               0x02   /* 0xF1 */
00139 #define IRCC_VERSION               0x03   /* 0x01 */
00140 #define IRCC_INTERFACE             0x04   /* low 4 = DMA, high 4 = IRQ */
00141 
00142 /* Register block 4 - IrDA */
00143 #define IRCC_CONTROL               0x00
00144 #define IRCC_BOF_COUNT_LO          0x01 /* Low byte */
00145 #define IRCC_BOF_COUNT_HI          0x00 /* High nibble (bit 0-3) */
00146 #define IRCC_BRICKWALL_CNT_LO      0x02 /* Low byte */
00147 #define IRCC_BRICKWALL_CNT_HI      0x03 /* High nibble (bit 4-7) */
00148 #define IRCC_TX_SIZE_LO            0x04 /* Low byte */
00149 #define IRCC_TX_SIZE_HI            0x03 /* High nibble (bit 0-3) */
00150 #define IRCC_RX_SIZE_HI            0x05 /* High nibble (bit 0-3) */
00151 #define IRCC_RX_SIZE_LO            0x06 /* Low byte */
00152 
00153 #define IRCC_1152                  0x80
00154 #define IRCC_CRC                   0x40
00155 
00156 struct smc_chip {
00157         char *name;
00158         unsigned char entr1;
00159         unsigned char entr2;
00160         unsigned char cid_index;
00161         unsigned char cid_value;
00162         int (*probe)(struct smc_chip *chip, chipio_t *info);
00163 };
00164 typedef struct smc_chip smc_chip_t;
00165 
00166 /* Private data for each instance */
00167 struct ircc_cb {
00168         struct device *netdev;     /* Yes! we are some kind of netdevice */
00169         struct irlap_cb    *irlap; /* The link layer we are binded to */
00170         
00171         chipio_t io;               /* IrDA controller information */
00172         iobuff_t tx_buff;          /* Transmit buffer */
00173         iobuff_t rx_buff;          /* Receive buffer */
00174 
00175         struct irport_cb *irport;
00176 
00177         spinlock_t lock;           /* For serializing operations */
00178         
00179         __u32 new_speed;
00180         __u32 flags;               /* Interface flags */
00181 
00182         int tx_buff_offsets[10];   /* Offsets between frames in tx_buff */
00183         int tx_len;                /* Number of frames in tx_buff */
00184 };
00185 
00186 #endif /* SMC_IRCC_H */