Home | History | Annotate | Line # | Download | only in dev
if_esreg.h revision 1.10
      1  1.10  msaitoh /*	$NetBSD: if_esreg.h,v 1.10 2023/06/24 05:31:04 msaitoh Exp $	*/
      2   1.1   chopps 
      3   1.1   chopps /*
      4   1.1   chopps  * Copyright (c) 1995 Michael L. Hitch
      5   1.1   chopps  * All rights reserved.
      6   1.1   chopps  *
      7   1.1   chopps  * Redistribution and use in source and binary forms, with or without
      8   1.1   chopps  * modification, are permitted provided that the following conditions
      9   1.1   chopps  * are met:
     10   1.1   chopps  * 1. Redistributions of source code must retain the above copyright
     11   1.1   chopps  *    notice, this list of conditions and the following disclaimer.
     12   1.1   chopps  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1   chopps  *    notice, this list of conditions and the following disclaimer in the
     14   1.1   chopps  *    documentation and/or other materials provided with the distribution.
     15   1.1   chopps  *
     16   1.1   chopps  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17   1.1   chopps  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18   1.1   chopps  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19   1.1   chopps  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20   1.1   chopps  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21   1.1   chopps  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22   1.1   chopps  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23   1.1   chopps  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24   1.1   chopps  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25   1.1   chopps  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26   1.1   chopps  */
     27   1.1   chopps 
     28   1.1   chopps /*
     29   1.1   chopps  * SMC 91C90 register definitions
     30   1.1   chopps  */
     31   1.1   chopps 
     32   1.1   chopps union smcregs {
     33   1.1   chopps 	struct {
     34   1.1   chopps 		volatile u_short tcr;	/* Transmit Control Register */
     35   1.1   chopps 		volatile u_short ephsr;	/* EPH Status Register */
     36   1.1   chopps 		volatile u_short rcr;	/* Receive Control Register */
     37   1.1   chopps 		volatile u_short ecr;	/* Counter Register */
     38   1.1   chopps 		volatile u_short mir;	/* Memory Information Register */
     39   1.1   chopps 		volatile u_short mcr;	/* Memory Configuration Register */
     40   1.1   chopps 		volatile u_short resv;
     41   1.1   chopps 		volatile u_short bsr;	/* Bank Select Register */
     42   1.1   chopps 	} b0;
     43   1.1   chopps 	struct {
     44   1.1   chopps 		volatile u_short cr;	/* Configuration Register */
     45   1.1   chopps 		volatile u_short bar;	/* Base Address Register */
     46   1.1   chopps 		volatile u_short iar[3]; /* Individual Address Registers */
     47   1.1   chopps 		volatile u_short gpr;	/* General Purpose Register */
     48   1.1   chopps 		volatile u_short ctr;	/* Control Register */
     49   1.1   chopps 		volatile u_short bsr;	/* Bank Select Register */
     50   1.1   chopps 	} b1;
     51   1.1   chopps 	struct {
     52   1.1   chopps 		volatile u_short mmucr;	/* MMU Command Register */
     53   1.1   chopps 		volatile u_char pnr;	/* Packet Number Register */
     54   1.1   chopps 		volatile u_char arr;	/* Allocation Result Register */
     55   1.1   chopps 		volatile u_short fifo;	/* FIFO Ports Register */
     56   1.1   chopps 		volatile u_short ptr;	/* Pointer Register */
     57   1.1   chopps 		volatile u_short data;	/* Data Register */
     58   1.1   chopps 		volatile u_short datax;	/* Data Register (2nd mapping) */
     59   1.1   chopps 		volatile u_char ist;	/* Interrupt Status Register */
     60   1.1   chopps 		volatile u_char msk;	/* Interrupt Mask Register */
     61   1.1   chopps 		volatile u_short bsr;	/* Bank Select Register */
     62   1.1   chopps 	} b2;
     63   1.1   chopps 	struct {
     64   1.1   chopps 		volatile u_short mt[4];	/* Multicast Table */
     65   1.1   chopps 		volatile u_short resv[3];
     66   1.1   chopps 		volatile u_short bsr;	/* Bank Select Register */
     67   1.1   chopps 	} b3;
     68   1.3   chopps /*
     69   1.3   chopps  * Bank 2 registers defined as u_short fields
     70   1.3   chopps  */
     71   1.3   chopps 	struct {
     72   1.3   chopps 		volatile u_short mmucr;	/* MMU Command Register */
     73   1.3   chopps 		volatile u_short pnrarr;/* Packet Number/Allocation Result */
     74   1.3   chopps 		volatile u_short fifo;	/* FIFO Ports Register */
     75   1.3   chopps 		volatile u_short ptr;	/* Pointer Register */
     76   1.3   chopps 		volatile u_short data;	/* Data Register */
     77   1.3   chopps 		volatile u_short datax;	/* Data Register (2nd mapping) */
     78   1.3   chopps 		volatile u_short istmsk;/* Interrupt Status/Mask Register */
     79   1.3   chopps 		volatile u_short bsr;	/* Bank Select Register */
     80   1.3   chopps 	} w2;
     81   1.1   chopps };
     82   1.1   chopps 
     83   1.1   chopps /* Transmit Control Register */
     84   1.1   chopps #define	TCR_PAD_EN	0x8000		/* Pad short frames */
     85   1.1   chopps #define	TCR_TXENA	0x0100		/* Transmit enabled */
     86   1.1   chopps #define	TCR_MON_CSN	0x0004		/* Monitor carrier */
     87   1.1   chopps 
     88   1.1   chopps /* EPH Status Register */
     89   1.1   chopps #define	EPHSR_16COL	0x1000		/* 16 collisions reached */
     90   1.9   andvar #define	EPHSR_MULCOL	0x0400		/* Multiple collisions */
     91   1.6      wiz #define	EPHSR_TX_SUC	0x0100		/* Last transmit successful */
     92   1.1   chopps #define	EPHSR_LOST_CAR	0x0004		/* Lost carrier */
     93   1.1   chopps 
     94   1.1   chopps /* Receive Control Register */
     95   1.1   chopps #define	RCR_ALLMUL	0x0400		/* Accept all Multicast frames */
     96   1.1   chopps #define	RCR_PRMS	0x0200		/* Promiscuous mode */
     97   1.1   chopps #define	RCR_EPH_RST	0x0080		/* Software activated Reset */
     98   1.1   chopps #define	RCR_FILT_CAR	0x0040		/* Filter carrier */
     99   1.1   chopps #define	RCR_STRIP_CRC	0x0002		/* Strip CRC */
    100   1.1   chopps #define	RCR_RXEN	0x0001		/* Receiver enabled */
    101   1.1   chopps 
    102   1.1   chopps /* Counter Register */
    103   1.1   chopps #define	ECR_MCC		0xf000		/* Multiple collision count */
    104   1.1   chopps #define	ECR_SCC		0x0f00		/* Single collision count */
    105   1.1   chopps #define	ECR_EDTX	0x00f0		/* Excess deferred TX count */
    106   1.1   chopps #define	ECR_DTX		0x000f		/* Deferred TX count */
    107   1.1   chopps 
    108   1.1   chopps /* Configuration Register */
    109   1.1   chopps #define	CR_RAM32K	0x2000		/* 32Kx16 RAM */
    110   1.1   chopps #define	CR_NO_WAIT_ST	0x0010		/* No wait state */
    111   1.1   chopps #define	CR_SET_SQLCH	0x0002		/* Squelch level 240mv */
    112   1.1   chopps 
    113   1.1   chopps /* Control Register */
    114   1.5   mhitch #define	CTR_TE_ENA	0x2000		/* Transmit Error enable */
    115   1.1   chopps #define	CTR_AUTO_RLSE	0x0008		/* Auto Release */
    116   1.1   chopps 
    117   1.1   chopps /* MMU Command Register */
    118   1.1   chopps #define	MMUCR_NOOP	0x0000		/* No operation */
    119   1.1   chopps #define	MMUCR_ALLOC	0x2000		/* Allocate memory for TX */
    120   1.8   andvar #define	MMUCR_RESET	0x4000		/* Reset to initial state */
    121   1.1   chopps #define	MMUCR_REM_RX	0x6000		/* Remove frame from top of RX FIFO */
    122   1.1   chopps #define	MMUCR_REMRLS_RX	0x8000		/* Remove & release from top of RX FIFO */
    123   1.1   chopps #define	MMUCR_RLSPKT	0xa000		/* Release specific packet */
    124   1.1   chopps #define	MMUCR_ENQ_TX	0xc000		/* Enqueue packet into TX FIFO */
    125   1.1   chopps #define	MMUCR_RESET_TX	0xe000		/* Reset TX FIFOs */
    126   1.1   chopps #define	MMUCR_BUSY	0x0100		/* MMU busy */
    127   1.1   chopps 
    128   1.1   chopps /* Allocation Result Register */
    129   1.1   chopps #define	ARR_FAILED	0x80		/* Allocation failed */
    130   1.1   chopps #define	ARR_APN		0x1f		/* Allocated packet number */
    131   1.1   chopps 
    132   1.1   chopps /* FIFO Ports Register */
    133   1.1   chopps #define	FIFO_TEMPTY	0x8000		/* TX queue empty */
    134   1.1   chopps #define	FIFO_TXPNR	0x1f00		/* TX done packet number */
    135   1.1   chopps #define	FIFO_REMPTY	0x0080		/* RX FIFO empty */
    136   1.1   chopps #define	FIFO_RXPNR	0x001f		/* RX FIFO packet number */
    137   1.1   chopps 
    138   1.1   chopps /* Pointer Register */
    139   1.1   chopps #define	PTR_RCV		0x0080		/* Use Receive area */
    140   1.1   chopps #define	PTR_AUTOINCR	0x0040		/* Auto increment pointer on access */
    141   1.1   chopps #define	PTR_READ	0x0020		/* Read access */
    142   1.1   chopps 
    143   1.1   chopps /* Interrupt Status Register */
    144   1.1   chopps #define	IST_EPHINT	0x20		/* EPH Interrupt */
    145   1.1   chopps #define	IST_RX_OVRN	0x10		/* RX Overrun */
    146   1.1   chopps #define	IST_ALLOC	0x08		/* MMU Allocation completed */
    147   1.1   chopps #define	IST_TX_EMPTY	0x04		/* TX FIFO empty */
    148   1.1   chopps #define	IST_TX		0x02		/* TX complete */
    149   1.1   chopps #define	IST_RX		0x01		/* RX complete */
    150   1.1   chopps 
    151  1.10  msaitoh /* Interrupt Acknowledge Register */
    152   1.1   chopps #define	ACK_RX_OVRN	IST_RX_OVRN
    153   1.1   chopps #define	ACK_TX_EMPTY	IST_TX_EMPTY
    154   1.1   chopps #define	ACK_TX		IST_TX
    155   1.1   chopps 
    156   1.1   chopps /* Interrupt Mask Register */
    157   1.1   chopps #define	MSK_EPHINT	0x20		/* EPH Interrupt */
    158   1.1   chopps #define	MSK_RX_OVRN	0x10		/* RX Overrun */
    159   1.1   chopps #define	MSK_ALLOC	0x08		/* MMU Allocation completed */
    160   1.1   chopps #define	MSK_TX_EMPTY	0x04		/* TX FIFO empty */
    161   1.1   chopps #define	MSK_TX		0x02		/* TX complete */
    162   1.1   chopps #define	MSK_RX		0x01		/* RX complete */
    163   1.2  mycroft 
    164   1.2  mycroft /* Bank Select Register */
    165   1.4   mhitch #define	BSR_MASK	0x0300
    166   1.2  mycroft #define	BSR_BANK0	0x0000		/* Select bank 0 */
    167   1.2  mycroft #define	BSR_BANK1	0x0100		/* Select bank 1 */
    168   1.2  mycroft #define	BSR_BANK2	0x0200		/* Select bank 2 */
    169   1.2  mycroft #define	BSR_BANK3	0x0300		/* Select bank 3 */
    170   1.1   chopps 
    171   1.1   chopps /* Packet Receive Frame Status Word */
    172   1.1   chopps #define	RFSW_ALGNERR	0x8000		/* Alignment Error */
    173   1.1   chopps #define	RFSW_BRDCST	0x4000		/* Broadcast frame */
    174   1.1   chopps #define	RFSW_BADCRC	0x2000		/* Bad CRC */
    175   1.1   chopps #define	RFSW_ODDFRM	0x1000		/* Odd number of bytes in frame */
    176   1.1   chopps #define	RFSW_TOOLNG	0x0800		/* Frame was too long */
    177   1.1   chopps #define	RFSW_TOOSHORT	0x0400		/* Frame was too short */
    178   1.1   chopps #define	RFSW_HASH	0x007e		/* Multicast hash value */
    179   1.1   chopps #define	RFSW_MULTCAST	0x0001		/* Multicast frame */
    180   1.1   chopps 
    181   1.1   chopps /* Control byte */
    182   1.1   chopps #define	CTLB_ODD	0x20		/* Odd number of bytes in frame */
    183   1.1   chopps #define	CTLB_CRC	0x10		/* Append CRC to transmitted frame */
    184