4 #include <libchip/smc91111exp.h> 7 #define LAN91CXX_TCR 0x00 8 #define LAN91CXX_EPH_STATUS 0x01 9 #define LAN91CXX_RCR 0x02 10 #define LAN91CXX_COUNTER 0x03 11 #define LAN91CXX_MIR 0x04 12 #define LAN91CXX_MCR 0x05 13 #define LAN91CXX_RPCR 0x05 14 #define LAN91CXX_RESERVED_0 0x06 15 #define LAN91CXX_BS 0x07 16 #define LAN91CXX_CONFIG 0x08 17 #define LAN91CXX_BASE_REG 0x09 18 #define LAN91CXX_IA01 0x0a 19 #define LAN91CXX_IA23 0x0b 20 #define LAN91CXX_IA45 0x0c 21 #define LAN91CXX_GENERAL 0x0d 22 #define LAN91CXX_CONTROL 0x0e 23 #define LAN91CXX_BS2 0x0f 24 #define LAN91CXX_MMU_COMMAND 0x10 25 #define LAN91CXX_PNR 0x11 26 #define LAN91CXX_FIFO_PORTS 0x12 27 #define LAN91CXX_POINTER 0x13 28 #define LAN91CXX_DATA_HIGH 0x14 29 #define LAN91CXX_DATA 0x15 30 #define LAN91CXX_INTERRUPT 0x16 31 #define LAN91CXX_BS3 0x17 32 #define LAN91CXX_MT01 0x18 33 #define LAN91CXX_MT23 0x19 34 #define LAN91CXX_MT45 0x1a 35 #define LAN91CXX_MT67 0x1b 36 #define LAN91CXX_MGMT 0x1c 37 #define LAN91CXX_REVISION 0x1d 38 #define LAN91CXX_ERCV 0x1e 39 #define LAN91CXX_BS4 0x1f 41 #define LAN91CXX_RCR_SOFT_RST 0x8000 42 #define LAN91CXX_RCR_FILT_CAR 0x4000 43 #define LAN91CXX_RCR_ABORT_ENB 0x2000 44 #define LAN91CXX_RCR_STRIP_CRC 0x0200 45 #define LAN91CXX_RCR_RXEN 0x0100 46 #define LAN91CXX_RCR_ALMUL 0x0004 47 #define LAN91CXX_RCR_PRMS 0x0002 48 #define LAN91CXX_RCR_RX_ABORT 0x0001 50 #define LAN91CXX_TCR_SWFDUP 0x8000 51 #define LAN91CXX_TCR_ETEN_TYPE 0x4000 52 #define LAN91CXX_TCR_EPH_LOOP 0x2000 53 #define LAN91CXX_TCR_STP_SQET 0x1000 54 #define LAN91CXX_TCR_FDUPLX 0x0800 55 #define LAN91CXX_TCR_MON_CSN 0x0400 56 #define LAN91CXX_TCR_NOCRC 0x0100 57 #define LAN91CXX_TCR_PAD_EN 0x0080 58 #define LAN91CXX_TCR_FORCOL 0x0004 59 #define LAN91CXX_TCR_LLOOP 0x0002 60 #define LAN91CXX_TCR_TXENA 0x0001 62 #define LAN91CXX_POINTER_RCV 0x8000 63 #define LAN91CXX_POINTER_AUTO_INCR 0x4000 64 #define LAN91CXX_POINTER_READ 0x2000 65 #define LAN91CXX_POINTER_ETEN 0x1000 66 #define LAN91CXX_POINTER_NOT_EMPTY 0x0800 69 #define LAN91CXX_INTERRUPT_TX_IDLE_M 0x8000 70 #define LAN91CXX_INTERRUPT_ERCV_INT_M 0x4000 71 #define LAN91CXX_INTERRUPT_EPH_INT_M 0x2000 72 #define LAN91CXX_INTERRUPT_RX_OVRN_INT_M 0x1000 73 #define LAN91CXX_INTERRUPT_ALLOC_INT_M 0x0800 74 #define LAN91CXX_INTERRUPT_TX_EMPTY_INT_M 0x0400 75 #define LAN91CXX_INTERRUPT_TX_INT_M 0x0200 76 #define LAN91CXX_INTERRUPT_RCV_INT_M 0x0100 77 #define LAN91CXX_INTERRUPT_TX_IDLE 0x0080 78 #define LAN91CXX_INTERRUPT_ERCV_INT 0x0040 79 #define LAN91CXX_INTERRUPT_EPH_INT 0x0020 80 #define LAN91CXX_INTERRUPT_RX_OVRN_INT 0x0010 81 #define LAN91CXX_INTERRUPT_ALLOC_INT 0x0008 82 #define LAN91CXX_INTERRUPT_TX_EMPTY_INT 0x0004 83 #define LAN91CXX_INTERRUPT_TX_INT 0x0002 84 #define LAN91CXX_INTERRUPT_RCV_INT 0x0001 86 #define LAN91CXX_INTERRUPT_TX_SET 0x0006 87 #define LAN91CXX_INTERRUPT_TX_SET_ACK 0x0004 88 #define LAN91CXX_INTERRUPT_TX_FIFO_ACK 0x0002 89 #define LAN91CXX_INTERRUPT_TX_SET_M 0x0600 91 #define LAN91CXX_CONTROL_RCV_BAD 0x4000 92 #define LAN91CXX_CONTROL_AUTO_RELEASE 0x0800 93 #define LAN91CXX_CONTROL_LE_ENABLE 0x0080 94 #define LAN91CXX_CONTROL_CR_ENABLE 0x0040 95 #define LAN91CXX_CONTROL_TE_ENABLE 0x0020 98 #define LAN91CXX_CONTROL_EEPROM_SELECT 0x0004 99 #define LAN91CXX_CONTROL_RELOAD 0x0002 100 #define LAN91CXX_CONTROL_STORE 0x0001 101 #define LAN91CXX_CONTROL_EEPROM_BUSY 0x0003 102 #define LAN91CXX_ESA_EEPROM_OFFSET 0x0020 104 #define LAN91CXX_STATUS_TX_UNRN 0x8000 105 #define LAN91CXX_STATUS_LINK_OK 0x4000 106 #define LAN91CXX_STATUS_CTR_ROL 0x1000 107 #define LAN91CXX_STATUS_EXC_DEF 0x0800 108 #define LAN91CXX_STATUS_LOST_CARR 0x0400 109 #define LAN91CXX_STATUS_LATCOL 0x0200 110 #define LAN91CXX_STATUS_WAKEUP 0x0100 111 #define LAN91CXX_STATUS_TX_DEFR 0x0080 112 #define LAN91CXX_STATUS_LTX_BRD 0x0040 113 #define LAN91CXX_STATUS_SQET 0x0020 114 #define LAN91CXX_STATUS_16COL 0x0010 115 #define LAN91CXX_STATUS_LTX_MULT 0x0008 116 #define LAN91CXX_STATUS_MUL_COL 0x0004 117 #define LAN91CXX_STATUS_SNGL_COL 0x0002 118 #define LAN91CXX_STATUS_TX_SUC 0x0001 120 #define LAN91CXX_MMU_COMMAND_BUSY 0x0001 122 #define LAN91CXX_MMU_noop 0x0000 123 #define LAN91CXX_MMU_alloc_for_tx 0x0020 124 #define LAN91CXX_MMU_reset_mmu 0x0040 125 #define LAN91CXX_MMU_rem_rx_frame 0x0060 126 #define LAN91CXX_MMU_rem_tx_frame 0x0070 127 #define LAN91CXX_MMU_remrel_rx_frame 0x0080 128 #define LAN91CXX_MMU_rel_packet 0x00a0 129 #define LAN91CXX_MMU_enq_packet 0x00c0 130 #define LAN91CXX_MMU_reset_tx_fifo 0x00e0 132 #define LAN91CXX_CONTROLBYTE_CRC 0x1000 133 #define LAN91CXX_CONTROLBYTE_ODD 0x2000 134 #define LAN91CXX_CONTROLBYTE_RX 0x4000 136 #define LAN91CXX_RX_STATUS_ALIGNERR 0x8000 137 #define LAN91CXX_RX_STATUS_BCAST 0x4000 138 #define LAN91CXX_RX_STATUS_BADCRC 0x2000 139 #define LAN91CXX_RX_STATUS_ODDFRM 0x1000 140 #define LAN91CXX_RX_STATUS_TOOLONG 0x0800 141 #define LAN91CXX_RX_STATUS_TOOSHORT 0x0400 142 #define LAN91CXX_RX_STATUS_HASHVALMASK 0x007e 143 #define LAN91CXX_RX_STATUS_MCAST 0x0001 144 #define LAN91CXX_RX_STATUS_BAD \ 145 (LAN91CXX_RX_STATUS_ALIGNERR | \ 146 LAN91CXX_RX_STATUS_BADCRC | \ 147 LAN91CXX_RX_STATUS_TOOLONG | \ 148 LAN91CXX_RX_STATUS_TOOSHORT) 150 #define LAN91CXX_RX_STATUS_IS_ODD(__cpd,__stat) ((__stat) & LAN91CXX_RX_STATUS_ODDFRM) 151 #define LAN91CXX_CONTROLBYTE_IS_ODD(__cpd,__val) ((__val) & LAN91CXX_CONTROLBYTE_ODD) 154 #define LAN91CXX_ECOR 0x8000 155 #define LAN91CXX_ECOR_RESET (1<<7) 156 #define LAN91CXX_ECOR_LEVIRQ (1<<6) 157 #define LAN91CXX_ECOR_ATTWR (1<<2) 158 #define LAN91CXX_ECOR_ENABLE (1<<0) 160 #define LAN91CXX_ECSR 0x8002 161 #define LAN91CXX_ECSR_IOIS8 (1<<5) 162 #define LAN91CXX_ECSR_PWRDWN (1<<2) 163 #define LAN91CXX_ECSR_INTR (1<<1) 166 #define LAN91CXX_MGMT_MDO 0x0001 167 #define LAN91CXX_MGMT_MDI 0x0002 168 #define LAN91CXX_MGMT_MCLK 0x0004 169 #define LAN91CXX_MGMT_MDOE 0x0008 172 #define LAN91CXX_PHY_CTRL 0 173 #define LAN91CXX_PHY_STAT 1 174 #define LAN91CXX_PHY_ID1 2 175 #define LAN91CXX_PHY_ID2 3 176 #define LAN91CXX_PHY_AUTO_AD 4 177 #define LAN91CXX_PHY_AUTO_CAP 5 178 #define LAN91CXX_PHY_CONFIG1 16 179 #define LAN91CXX_PHY_CONFIG2 17 180 #define LAN91CXX_PHY_STATUS_OUT 18 181 #define LAN91CXX_PHY_MASK 19 184 #define LAN91CXX_PHY_CTRL_COLTST (1 << 7) 185 #define LAN91CXX_PHY_CTRL_DPLX (1 << 8) 186 #define LAN91CXX_PHY_CTRL_ANEG_RST (1 << 9) 187 #define LAN91CXX_PHY_CTRL_MII_DIS (1 << 10) 188 #define LAN91CXX_PHY_CTRL_PDN (1 << 11) 189 #define LAN91CXX_PHY_CTRL_ANEG_EN (1 << 12) 190 #define LAN91CXX_PHY_CTRL_SPEED (1 << 13) 191 #define LAN91CXX_PHY_CTRL_LPBK (1 << 14) 192 #define LAN91CXX_PHY_CTRL_RST (1 << 15) 195 #define PHY_CFG1_LNKDIS 0x8000 196 #define PHY_CFG1_XMTDIS 0x4000 197 #define PHY_CFG1_XMTPDN 0x2000 198 #define PHY_CFG1_BYPSCR 0x0400 199 #define PHY_CFG1_UNSCDS 0x0200 200 #define PHY_CFG1_EQLZR 0x0100 201 #define PHY_CFG1_CABLE 0x0080 202 #define PHY_CFG1_RLVL0 0x0040 203 #define PHY_CFG1_TLVL_SHIFT 2 204 #define PHY_CFG1_TLVL_MASK 0x003C 205 #define PHY_CFG1_TRF_MASK 0x0003 208 #define PHY_CFG2_REG 0x11 209 #define PHY_CFG2_APOLDIS 0x0020 210 #define PHY_CFG2_JABDIS 0x0010 211 #define PHY_CFG2_MREG 0x0008 212 #define PHY_CFG2_INTMDIO 0x0004 215 #define PHY_INT_REG 0x12 216 #define PHY_INT_INT 0x8000 217 #define PHY_INT_LNKFAIL 0x4000 218 #define PHY_INT_LOSSSYNC 0x2000 219 #define PHY_INT_CWRD 0x1000 220 #define PHY_INT_SSD 0x0800 221 #define PHY_INT_ESD 0x0400 222 #define PHY_INT_RPOL 0x0200 223 #define PHY_INT_JAB 0x0100 224 #define PHY_INT_SPDDET 0x0080 225 #define PHY_INT_DPLXDET 0x0040 228 #define PHY_MASK_REG 0x13 230 #define LAN91CXX_RPCR_LEDA_LINK (0 << 2) 231 #define LAN91CXX_RPCR_LEDA_TXRX (4 << 2) 232 #define LAN91CXX_RPCR_LEDA_RX (6 << 2) 233 #define LAN91CXX_RPCR_LEDA_TX (7 << 2) 234 #define LAN91CXX_RPCR_LEDB_LINK (0 << 5) 235 #define LAN91CXX_RPCR_LEDB_TXRX (4 << 5) 236 #define LAN91CXX_RPCR_LEDB_RX (6 << 5) 237 #define LAN91CXX_RPCR_LEDB_TX (7 << 5) 238 #define LAN91CXX_RPCR_ANEG (1 << 11) 239 #define LAN91CXX_RPCR_DPLX (1 << 12) 240 #define LAN91CXX_RPCR_SPEED (1 << 13) 243 #define PHY_CNTL_REG 0x00 244 #define PHY_CNTL_RST 0x8000 245 #define PHY_CNTL_LPBK 0x4000 246 #define PHY_CNTL_SPEED 0x2000 247 #define PHY_CNTL_ANEG_EN 0x1000 248 #define PHY_CNTL_PDN 0x0800 249 #define PHY_CNTL_MII_DIS 0x0400 250 #define PHY_CNTL_ANEG_RST 0x0200 251 #define PHY_CNTL_DPLX 0x0100 252 #define PHY_CNTL_COLTST 0x0080 255 #define PHY_STAT_REG 0x01 256 #define PHY_STAT_CAP_T4 0x8000 257 #define PHY_STAT_CAP_TXF 0x4000 258 #define PHY_STAT_CAP_TXH 0x2000 259 #define PHY_STAT_CAP_TF 0x1000 260 #define PHY_STAT_CAP_TH 0x0800 261 #define PHY_STAT_CAP_SUPR 0x0040 262 #define PHY_STAT_ANEG_ACK 0x0020 263 #define PHY_STAT_REM_FLT 0x0010 264 #define PHY_STAT_CAP_ANEG 0x0008 265 #define PHY_STAT_LINK 0x0004 266 #define PHY_STAT_JAB 0x0002 267 #define PHY_STAT_EXREG 0x0001 268 #define PHY_STAT_RESERVED 0x0780 271 #define PHY_ID1_REG 0x02 272 #define PHY_ID2_REG 0x03 275 #define PHY_AD_REG 0x04 276 #define PHY_AD_NP 0x8000 277 #define PHY_AD_ACK 0x4000 278 #define PHY_AD_RF 0x2000 279 #define PHY_AD_T4 0x0200 280 #define PHY_AD_TX_FDX 0x0100 281 #define PHY_AD_TX_HDX 0x0080 282 #define PHY_AD_10_FDX 0x0040 283 #define PHY_AD_10_HDX 0x0020 284 #define PHY_AD_CSMA 0x0001 287 static int debugflag_out = 0;
289 #define dbc_printf(lvl,format, args...) do { \ 290 if (!debugflag_out) { \ 292 printk(format,##args); \ 297 #define db64_printf(format, args...) dbc_printf(64,format,##args); 298 #define db16_printf(format, args...) dbc_printf(16,format,##args); 299 #define db9_printf(format, args...) dbc_printf(9,format,##args); 300 #define db4_printf(format, args...) dbc_printf(4,format,##args); 301 #define db2_printf(format, args...) dbc_printf(2,format,##args); 302 #define db1_printf(format, args...) dbc_printf(1,format,##args); 303 #define db_printf(format, args...) dbc_printf(0xffff,format,##args); 306 #define DEBUG_FUNCTION() do { db_printf("# %s\n", __FUNCTION__); } while (0) 308 #define DEBUG_FUNCTION() do {} while(0) 315 unsigned int tx_good ;
316 unsigned int tx_max_collisions ;
317 unsigned int tx_late_collisions ;
318 unsigned int tx_underrun ;
319 unsigned int tx_carrier_loss ;
320 unsigned int tx_deferred ;
321 unsigned int tx_sqetesterrors ;
322 unsigned int tx_single_collisions;
323 unsigned int tx_mult_collisions ;
324 unsigned int tx_total_collisions ;
325 unsigned int rx_good ;
326 unsigned int rx_crc_errors ;
327 unsigned int rx_align_errors ;
328 unsigned int rx_resource_errors ;
329 unsigned int rx_overrun_errors ;
330 unsigned int rx_collisions ;
331 unsigned int rx_short_frames ;
332 unsigned int rx_too_long_frames ;
333 unsigned int rx_symbol_errors ;
334 unsigned int interrupts ;
335 unsigned int rx_count ;
336 unsigned int rx_deliver ;
337 unsigned int rx_resource ;
338 unsigned int rx_restart ;
339 unsigned int tx_count ;
340 unsigned int tx_complete ;
341 unsigned int tx_dropped ;
343 #define INCR_STAT(c,n) (((c)->stats.n)++) 350 struct arpcom arpcom;
360 unsigned int lastPhy18;
364 unsigned short* base;
367 unsigned char enaddr[6];
383 #ifdef LAN91CXX_32BIT_RX 384 typedef unsigned int rxd_t;
386 typedef unsigned short rxd_t;
394 {LAN91CXX_TCR ,
"LAN91CXX_TCR" ,0},
395 {LAN91CXX_EPH_STATUS ,
"LAN91CXX_EPH_STATUS",0},
396 {LAN91CXX_RCR ,
"LAN91CXX_RCR" ,0},
397 {LAN91CXX_COUNTER ,
"LAN91CXX_COUNTER" ,0},
398 {LAN91CXX_MIR ,
"LAN91CXX_MIR" ,0},
399 {LAN91CXX_MCR ,
"LAN91CXX_MCR" ,0},
400 {LAN91CXX_RPCR ,
"LAN91CXX_RPCR" ,0},
401 {LAN91CXX_RESERVED_0 ,
"LAN91CXX_RESERVED_0",0},
402 {LAN91CXX_BS ,
"LAN91CXX_BS" ,0},
403 {LAN91CXX_CONFIG ,
"LAN91CXX_CONFIG" ,0},
404 {LAN91CXX_BASE_REG ,
"LAN91CXX_BASE_REG" ,0},
405 {LAN91CXX_IA01 ,
"LAN91CXX_IA01" ,0},
406 {LAN91CXX_IA23 ,
"LAN91CXX_IA23" ,0},
407 {LAN91CXX_IA45 ,
"LAN91CXX_IA45" ,0},
408 {LAN91CXX_GENERAL ,
"LAN91CXX_GENERAL" ,0},
409 {LAN91CXX_CONTROL ,
"LAN91CXX_CONTROL" ,0},
410 {LAN91CXX_BS2 ,
"LAN91CXX_BS2" ,0},
411 {LAN91CXX_MMU_COMMAND,
"LAN91CXX_MMU_COMMAND",0},
412 {LAN91CXX_PNR ,
"LAN91CXX_PNR" ,0},
413 {LAN91CXX_FIFO_PORTS ,
"LAN91CXX_FIFO_PORTS" ,0},
414 {LAN91CXX_POINTER ,
"LAN91CXX_POINTER" ,0},
415 {LAN91CXX_DATA_HIGH ,
"LAN91CXX_DATA_HIGH" ,0},
416 {LAN91CXX_DATA ,
"LAN91CXX_DATA" ,0},
417 {LAN91CXX_INTERRUPT ,
"LAN91CXX_INTERRUPT" ,0},
418 {LAN91CXX_BS3 ,
"LAN91CXX_BS3" ,0},
419 {LAN91CXX_MT01 ,
"LAN91CXX_MT01" ,0},
420 {LAN91CXX_MT23 ,
"LAN91CXX_MT23" ,0},
421 {LAN91CXX_MT45 ,
"LAN91CXX_MT45" ,0},
422 {LAN91CXX_MT67 ,
"LAN91CXX_MT67" ,0},
424 {LAN91CXX_REVISION ,
"LAN91CXX_REVISION" ,0},
425 {LAN91CXX_ERCV ,
"LAN91CXX_ERCV" ,0},
426 {LAN91CXX_BS4 ,
"LAN91CXX_BS4" ,0},
433 static char *dbg_prefix =
"";
435 #ifndef SMSC_PLATFORM_DEFINED_GET_REG 436 static __inline__
unsigned short 444 HAL_WRITE_UINT16(cpd->base+(LAN91CXX_BS), CYG_CPU_TO_LE16(regno>>3));
445 HAL_READ_UINT16(cpd->base+((regno&0x7)), val);
446 val = CYG_LE16_TO_CPU(val);
451 while ((c = dbg->reg) != -1) {
453 db_printf(
"%sread reg [%d:%x] -> 0x%04x (%-20s)\n", dbg_prefix, regno>>3,(regno&0x7)*2, val, dbg->name);
459 db2_printf(
"%sread reg %d:%x -> 0x%04x\n", dbg_prefix, regno>>3,(regno&0x7)*2, val);
466 #ifndef SMSC_PLATFORM_DEFINED_PUT_REG 467 static __inline__
void 474 while ((c = dbg->reg) != -1) {
476 db_printf(
"%swrite reg [%d:%x] <- 0x%04x (%-20s)\n", dbg_prefix, regno>>3, (regno&0x07)*2, val, dbg->name);
482 db2_printf(
"%swrite reg %d:%x <- 0x%04x\n", dbg_prefix, regno>>3,(regno&0x7)*2, val);
487 HAL_WRITE_UINT16(cpd->base+(LAN91CXX_BS), CYG_CPU_TO_LE16(regno>>3));
488 HAL_WRITE_UINT16(cpd->base+((regno&0x7)), CYG_CPU_TO_LE16(val));
495 #ifndef SMSC_PLATFORM_DEFINED_PUT_DATA 498 static __inline__
void 501 db2_printf(
"%s[wdata] <- 0x%04x\n", dbg_prefix, val);
503 HAL_WRITE_UINT16(cpd->base+((LAN91CXX_DATA & 0x7)), val);
508 static __inline__
void 511 db2_printf(
"%s[bdata] <- 0x%02x\n", dbg_prefix, val);
513 HAL_WRITE_UINT8(((
unsigned char *)(cpd->base+((LAN91CXX_DATA & 0x7))))+1, val);
519 #ifndef SMSC_PLATFORM_DEFINED_GET_DATA 521 static __inline__ rxd_t
526 #ifdef LAN91CXX_32BIT_RX 527 HAL_READ_UINT32(cpd->base+((LAN91CXX_DATA_HIGH & 0x7)), val);
529 HAL_READ_UINT16(cpd->base+((LAN91CXX_DATA & 0x7)), val);
532 db2_printf(
"%s[rdata] -> 0x%08x\n", dbg_prefix, val);
539 #ifndef SMSC_PLATFORM_DEFINED_GET_BANKSEL 540 static __inline__
unsigned short 545 HAL_READ_UINT16(cpd->base+(LAN91CXX_BS), val);
546 val = CYG_LE16_TO_CPU(val);
547 db2_printf(
"read bank sel val 0x%04x\n", val);
Definition: deflate.c:115
Definition: smc91111.h:347
Definition: smc91111.h:389
Definition: smc91111exp.h:6
Interface to Kernel Print Methods.
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83
Definition: smc91111.h:314