00001 /********************************************************************* 00002 * 00003 * Filename: w83977af_ir.h 00004 * Version: 00005 * Description: 00006 * Status: Experimental. 00007 * Author: Paul VanderSpek 00008 * Created at: Thu Nov 19 13:55:34 1998 00009 * Modified at: Tue Jan 11 13:08:19 2000 00010 * Modified by: Dag Brattli <dagb@cs.uit.no> 00011 * 00012 * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved. 00013 * 00014 * This program is free software; you can redistribute it and/or 00015 * modify it under the terms of the GNU General Public License as 00016 * published by the Free Software Foundation; either version 2 of 00017 * the License, or (at your option) any later version. 00018 * 00019 * Neither Dag Brattli nor University of Tromsų admit liability nor 00020 * provide warranty for any of this software. This material is 00021 * provided "AS-IS" and at no charge. 00022 * 00023 ********************************************************************/ 00024 00025 #ifndef W83977AF_IR_H 00026 #define W83977AF_IR_H 00027 00028 #include <asm/io.h> 00029 00030 /* Flags for configuration register CRF0 */ 00031 #define ENBNKSEL 0x01 00032 #define APEDCRC 0x02 00033 #define TXW4C 0x04 00034 #define RXW4C 0x08 00035 00036 /* Bank 0 */ 00037 #define RBR 0x00 /* Receiver buffer register */ 00038 #define TBR 0x00 /* Transmitter buffer register */ 00039 00040 #define ICR 0x01 /* Interrupt configuration register */ 00041 #define ICR_ERBRI 0x01 /* Receiver buffer register interrupt */ 00042 #define ICR_ETBREI 0x02 /* Transeiver empty interrupt */ 00043 #define ICR_EUSRI 0x04//* IR status interrupt */ 00044 #define ICR_EHSRI 0x04 00045 #define ICR_ETXURI 0x04 /* Tx underrun */ 00046 #define ICR_EDMAI 0x10 /* DMA interrupt */ 00047 #define ICR_ETXTHI 0x20 /* Transmitter threshold interrupt */ 00048 #define ICR_EFSFI 0x40 /* Frame status FIFO interrupt */ 00049 #define ICR_ETMRI 0x80 /* Timer interrupt */ 00050 00051 #define UFR 0x02 /* FIFO control register */ 00052 #define UFR_EN_FIFO 0x01 /* Enable FIFO's */ 00053 #define UFR_RXF_RST 0x02 /* Reset Rx FIFO */ 00054 #define UFR_TXF_RST 0x04 /* Reset Tx FIFO */ 00055 #define UFR_RXTL 0x80 /* Rx FIFO threshold (set to 16) */ 00056 #define UFR_TXTL 0x20 /* Tx FIFO threshold (set to 17) */ 00057 00058 #define ISR 0x02 /* Interrupt status register */ 00059 #define ISR_RXTH_I 0x01 /* Receive threshold interrupt */ 00060 #define ISR_TXEMP_I 0x02 /* Transmitter empty interrupt */ 00061 #define ISR_FEND_I 0x04 00062 #define ISR_DMA_I 0x10 00063 #define ISR_TXTH_I 0x20 /* Transmitter threshold interrupt */ 00064 #define ISR_FSF_I 0x40 00065 #define ISR_TMR_I 0x80 /* Timer interrupt */ 00066 00067 #define UCR 0x03 /* Uart control register */ 00068 #define UCR_DLS8 0x03 /* 8N1 */ 00069 00070 #define SSR 0x03 /* Sets select register */ 00071 #define SET0 UCR_DLS8 /* Make sure we keep 8N1 */ 00072 #define SET1 (0x80|UCR_DLS8) /* Make sure we keep 8N1 */ 00073 #define SET2 0xE0 00074 #define SET3 0xE4 00075 #define SET4 0xE8 00076 #define SET5 0xEC 00077 #define SET6 0xF0 00078 #define SET7 0xF4 00079 00080 #define HCR 0x04 00081 #define HCR_MODE_MASK ~(0xD0) 00082 #define HCR_SIR 0x60 00083 #define HCR_MIR_576 0x20 00084 #define HCR_MIR_1152 0x80 00085 #define HCR_FIR 0xA0 00086 #define HCR_EN_DMA 0x04 00087 #define HCR_EN_IRQ 0x08 00088 #define HCR_TX_WT 0x08 00089 00090 #define USR 0x05 /* IR status register */ 00091 #define USR_RDR 0x01 /* Receive data ready */ 00092 #define USR_TSRE 0x40 /* Transmitter empty? */ 00093 00094 #define AUDR 0x07 00095 #define AUDR_SFEND 0x08 /* Set a frame end */ 00096 #define AUDR_RXBSY 0x20 /* Rx busy */ 00097 #define AUDR_UNDR 0x40 /* Transeiver underrun */ 00098 00099 /* Set 2 */ 00100 #define ABLL 0x00 /* Advanced baud rate divisor latch (low byte) */ 00101 #define ABHL 0x01 /* Advanced baud rate divisor latch (high byte) */ 00102 00103 #define ADCR1 0x02 00104 #define ADCR1_ADV_SL 0x01 00105 #define ADCR1_D_CHSW 0x08 /* the specs are wrong. its bit 3, not 4 */ 00106 #define ADCR1_DMA_F 0x02 00107 00108 #define ADCR2 0x04 00109 #define ADCR2_TXFS32 0x01 00110 #define ADCR2_RXFS32 0x04 00111 00112 #define RXFDTH 0x07 00113 00114 /* Set 3 */ 00115 #define AUID 0x00 00116 00117 /* Set 4 */ 00118 #define TMRL 0x00 /* Timer value register (low byte) */ 00119 #define TMRH 0x01 /* Timer value register (high byte) */ 00120 00121 #define IR_MSL 0x02 /* Infrared mode select */ 00122 #define IR_MSL_EN_TMR 0x01 /* Enable timer */ 00123 00124 #define TFRLL 0x04 /* Transmitter frame length (low byte) */ 00125 #define TFRLH 0x05 /* Transmitter frame length (high byte) */ 00126 #define RFRLL 0x06 /* Receiver frame length (low byte) */ 00127 #define RFRLH 0x07 /* Receiver frame length (high byte) */ 00128 00129 /* Set 5 */ 00130 00131 #define FS_FO 0x05 /* Frame status FIFO */ 00132 #define FS_FO_FSFDR 0x80 /* Frame status FIFO data ready */ 00133 #define FS_FO_LST_FR 0x40 /* Frame lost */ 00134 #define FS_FO_MX_LEX 0x10 /* Max frame len exceeded */ 00135 #define FS_FO_PHY_ERR 0x08 /* Physical layer error */ 00136 #define FS_FO_CRC_ERR 0x04 00137 #define FS_FO_RX_OV 0x02 /* Receive overrun */ 00138 #define FS_FO_FSF_OV 0x01 /* Frame status FIFO overrun */ 00139 #define FS_FO_ERR_MSK 0x5f /* Error mask */ 00140 00141 #define RFLFL 0x06 00142 #define RFLFH 0x07 00143 00144 /* Set 6 */ 00145 #define IR_CFG2 0x00 00146 #define IR_CFG2_DIS_CRC 0x02 00147 00148 /* Set 7 */ 00149 #define IRM_CR 0x07 /* Infrared module control register */ 00150 #define IRM_CR_IRX_MSL 0x40 00151 #define IRM_CR_AF_MNT 0x80 /* Automatic format */ 00152 00153 /* For storing entries in the status FIFO */ 00154 struct st_fifo_entry { 00155 int status; 00156 int len; 00157 }; 00158 00159 struct st_fifo { 00160 struct st_fifo_entry entries[10]; 00161 int head; 00162 int tail; 00163 int len; 00164 }; 00165 00166 /* Private data for each instance */ 00167 struct w83977af_ir { 00168 struct st_fifo st_fifo; 00169 00170 int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */ 00171 int tx_len; /* Number of frames in tx_buff */ 00172 00173 struct device *netdev; /* Yes! we are some kind of netdevice */ 00174 struct net_device_stats stats; 00175 00176 struct irlap_cb *irlap; /* The link layer we are binded to */ 00177 struct qos_info qos; /* QoS capabilities for this device */ 00178 00179 chipio_t io; /* IrDA controller information */ 00180 iobuff_t tx_buff; /* Transmit buffer */ 00181 iobuff_t rx_buff; /* Receive buffer */ 00182 00183 __u32 flags; /* Interface flags */ 00184 __u32 new_speed; 00185 }; 00186 00187 static inline void switch_bank( int iobase, int set) 00188 { 00189 outb(set, iobase+SSR); 00190 } 00191 00192 #endif