wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | |
| 2 | /******************************************************************************/ |
| 3 | /* */ |
| 4 | /* Broadcom BCM5700 Linux Network Driver, Copyright (c) 2000 Broadcom */ |
| 5 | /* Corporation. */ |
| 6 | /* All rights reserved. */ |
| 7 | /* */ |
| 8 | /* This program is free software; you can redistribute it and/or modify */ |
| 9 | /* it under the terms of the GNU General Public License as published by */ |
| 10 | /* the Free Software Foundation, located in the file LICENSE. */ |
| 11 | /* */ |
| 12 | /* History: */ |
| 13 | /* 02/25/00 Hav Khauv Initial version. */ |
| 14 | /******************************************************************************/ |
| 15 | |
| 16 | #ifndef LM_H |
| 17 | #define LM_H |
| 18 | |
| 19 | #include "bcm570x_queue.h" |
| 20 | #include "bcm570x_bits.h" |
| 21 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 22 | /******************************************************************************/ |
| 23 | /* Basic types. */ |
| 24 | /******************************************************************************/ |
| 25 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 26 | typedef char LM_CHAR, *PLM_CHAR; |
| 27 | typedef unsigned int LM_UINT, *PLM_UINT; |
| 28 | typedef unsigned char LM_UINT8, *PLM_UINT8; |
| 29 | typedef unsigned short LM_UINT16, *PLM_UINT16; |
| 30 | typedef unsigned int LM_UINT32, *PLM_UINT32; |
| 31 | typedef unsigned int LM_COUNTER, *PLM_COUNTER; |
| 32 | typedef void LM_VOID, *PLM_VOID; |
| 33 | typedef char LM_BOOL, *PLM_BOOL; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 34 | |
| 35 | /* 64bit value. */ |
| 36 | typedef struct { |
| 37 | #ifdef BIG_ENDIAN_HOST |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 38 | LM_UINT32 High; |
| 39 | LM_UINT32 Low; |
| 40 | #else /* BIG_ENDIAN_HOST */ |
| 41 | LM_UINT32 Low; |
| 42 | LM_UINT32 High; |
| 43 | #endif /* !BIG_ENDIAN_HOST */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 44 | } LM_UINT64, *PLM_UINT64; |
| 45 | |
| 46 | typedef LM_UINT64 LM_PHYSICAL_ADDRESS, *PLM_PHYSICAL_ADDRESS; |
| 47 | |
| 48 | /* void LM_INC_PHYSICAL_ADDRESS(PLM_PHYSICAL_ADDRESS pAddr,LM_UINT32 IncSize) */ |
| 49 | #define LM_INC_PHYSICAL_ADDRESS(pAddr, IncSize) \ |
| 50 | { \ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 51 | LM_UINT32 OrgLow; \ |
| 52 | \ |
| 53 | OrgLow = (pAddr)->Low; \ |
| 54 | (pAddr)->Low += IncSize; \ |
| 55 | if((pAddr)->Low < OrgLow) { \ |
| 56 | (pAddr)->High++; /* Wrap around. */ \ |
| 57 | } \ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | } |
| 59 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 60 | #ifndef NULL |
| 61 | #define NULL ((void *) 0) |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 62 | #endif /* NULL */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 63 | |
| 64 | #ifndef OFFSETOF |
| 65 | #define OFFSETOF(_s, _m) (MM_UINT_PTR(&(((_s *) 0)->_m))) |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 66 | #endif /* OFFSETOF */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 67 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 68 | /******************************************************************************/ |
| 69 | /* Simple macros. */ |
| 70 | /******************************************************************************/ |
| 71 | |
| 72 | #define IS_ETH_BROADCAST(_pEthAddr) \ |
| 73 | (((unsigned char *) (_pEthAddr))[0] == ((unsigned char) 0xff)) |
| 74 | |
| 75 | #define IS_ETH_MULTICAST(_pEthAddr) \ |
| 76 | (((unsigned char *) (_pEthAddr))[0] & ((unsigned char) 0x01)) |
| 77 | |
| 78 | #define IS_ETH_ADDRESS_EQUAL(_pEtherAddr1, _pEtherAddr2) \ |
| 79 | ((((unsigned char *) (_pEtherAddr1))[0] == \ |
| 80 | ((unsigned char *) (_pEtherAddr2))[0]) && \ |
| 81 | (((unsigned char *) (_pEtherAddr1))[1] == \ |
| 82 | ((unsigned char *) (_pEtherAddr2))[1]) && \ |
| 83 | (((unsigned char *) (_pEtherAddr1))[2] == \ |
| 84 | ((unsigned char *) (_pEtherAddr2))[2]) && \ |
| 85 | (((unsigned char *) (_pEtherAddr1))[3] == \ |
| 86 | ((unsigned char *) (_pEtherAddr2))[3]) && \ |
| 87 | (((unsigned char *) (_pEtherAddr1))[4] == \ |
| 88 | ((unsigned char *) (_pEtherAddr2))[4]) && \ |
| 89 | (((unsigned char *) (_pEtherAddr1))[5] == \ |
| 90 | ((unsigned char *) (_pEtherAddr2))[5])) |
| 91 | |
| 92 | #define COPY_ETH_ADDRESS(_Src, _Dst) \ |
| 93 | ((unsigned char *) (_Dst))[0] = ((unsigned char *) (_Src))[0]; \ |
| 94 | ((unsigned char *) (_Dst))[1] = ((unsigned char *) (_Src))[1]; \ |
| 95 | ((unsigned char *) (_Dst))[2] = ((unsigned char *) (_Src))[2]; \ |
| 96 | ((unsigned char *) (_Dst))[3] = ((unsigned char *) (_Src))[3]; \ |
| 97 | ((unsigned char *) (_Dst))[4] = ((unsigned char *) (_Src))[4]; \ |
| 98 | ((unsigned char *) (_Dst))[5] = ((unsigned char *) (_Src))[5]; |
| 99 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 100 | /******************************************************************************/ |
| 101 | /* Constants. */ |
| 102 | /******************************************************************************/ |
| 103 | |
| 104 | #define ETHERNET_ADDRESS_SIZE 6 |
| 105 | #define ETHERNET_PACKET_HEADER_SIZE 14 |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 106 | #define MIN_ETHERNET_PACKET_SIZE 64 /* with 4 byte crc. */ |
| 107 | #define MAX_ETHERNET_PACKET_SIZE 1518 /* with 4 byte crc. */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 108 | #define MIN_ETHERNET_PACKET_SIZE_NO_CRC 60 |
| 109 | #define MAX_ETHERNET_PACKET_SIZE_NO_CRC 1514 |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 110 | #define MAX_ETHERNET_PACKET_BUFFER_SIZE 1536 /* A nice even number. */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 111 | |
| 112 | #ifndef LM_MAX_MC_TABLE_SIZE |
| 113 | #define LM_MAX_MC_TABLE_SIZE 32 |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 114 | #endif /* LM_MAX_MC_TABLE_SIZE */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 115 | #define LM_MC_ENTRY_SIZE (ETHERNET_ADDRESS_SIZE+1) |
| 116 | #define LM_MC_INSTANCE_COUNT_INDEX (LM_MC_ENTRY_SIZE-1) |
| 117 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 118 | /* Receive filter masks. */ |
| 119 | #define LM_ACCEPT_UNICAST 0x0001 |
| 120 | #define LM_ACCEPT_MULTICAST 0x0002 |
| 121 | #define LM_ACCEPT_ALL_MULTICAST 0x0004 |
| 122 | #define LM_ACCEPT_BROADCAST 0x0008 |
| 123 | #define LM_ACCEPT_ERROR_PACKET 0x0010 |
| 124 | |
| 125 | #define LM_PROMISCUOUS_MODE 0x10000 |
| 126 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 127 | /******************************************************************************/ |
| 128 | /* PCI registers. */ |
| 129 | /******************************************************************************/ |
| 130 | |
| 131 | #define PCI_VENDOR_ID_REG 0x00 |
| 132 | #define PCI_DEVICE_ID_REG 0x02 |
| 133 | |
| 134 | #define PCI_COMMAND_REG 0x04 |
| 135 | #define PCI_IO_SPACE_ENABLE 0x0001 |
| 136 | #define PCI_MEM_SPACE_ENABLE 0x0002 |
| 137 | #define PCI_BUSMASTER_ENABLE 0x0004 |
| 138 | #define PCI_MEMORY_WRITE_INVALIDATE 0x0010 |
| 139 | #define PCI_PARITY_ERROR_ENABLE 0x0040 |
| 140 | #define PCI_SYSTEM_ERROR_ENABLE 0x0100 |
| 141 | #define PCI_FAST_BACK_TO_BACK_ENABLE 0x0200 |
| 142 | |
| 143 | #define PCI_STATUS_REG 0x06 |
| 144 | #define PCI_REV_ID_REG 0x08 |
| 145 | |
| 146 | #define PCI_CACHE_LINE_SIZE_REG 0x0c |
| 147 | |
| 148 | #define PCI_IO_BASE_ADDR_REG 0x10 |
| 149 | #define PCI_IO_BASE_ADDR_MASK 0xfffffff0 |
| 150 | |
| 151 | #define PCI_MEM_BASE_ADDR_LOW 0x10 |
| 152 | #define PCI_MEM_BASE_ADDR_HIGH 0x14 |
| 153 | |
| 154 | #define PCI_SUBSYSTEM_VENDOR_ID_REG 0x2c |
| 155 | #define PCI_SUBSYSTEM_ID_REG 0x2e |
| 156 | #define PCI_INT_LINE_REG 0x3c |
| 157 | |
| 158 | #define PCIX_CAP_REG 0x40 |
| 159 | #define PCIX_ENABLE_RELAXED_ORDERING BIT_17 |
| 160 | |
| 161 | /******************************************************************************/ |
| 162 | /* Fragment structure. */ |
| 163 | /******************************************************************************/ |
| 164 | |
| 165 | typedef struct { |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 166 | LM_UINT32 FragSize; |
| 167 | LM_PHYSICAL_ADDRESS FragBuf; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 168 | } LM_FRAG, *PLM_FRAG; |
| 169 | |
| 170 | typedef struct { |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 171 | /* FragCount is initialized for the caller to the maximum array size, on */ |
| 172 | /* return FragCount is the number of the actual fragments in the array. */ |
| 173 | LM_UINT32 FragCount; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 174 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 175 | /* Total buffer size. */ |
| 176 | LM_UINT32 TotalSize; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 177 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 178 | /* Fragment array buffer. */ |
| 179 | LM_FRAG Fragments[1]; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 180 | } LM_FRAG_LIST, *PLM_FRAG_LIST; |
| 181 | |
| 182 | #define DECLARE_FRAG_LIST_BUFFER_TYPE(_FRAG_LIST_TYPE_NAME, _MAX_FRAG_COUNT) \ |
| 183 | typedef struct { \ |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 184 | LM_FRAG_LIST FragList; \ |
| 185 | LM_FRAG FragListBuffer[_MAX_FRAG_COUNT-1]; \ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 186 | } _FRAG_LIST_TYPE_NAME, *P##_FRAG_LIST_TYPE_NAME |
| 187 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 188 | /******************************************************************************/ |
| 189 | /* Status codes. */ |
| 190 | /******************************************************************************/ |
| 191 | |
| 192 | #define LM_STATUS_SUCCESS 0 |
| 193 | #define LM_STATUS_FAILURE 1 |
| 194 | |
| 195 | #define LM_STATUS_INTERRUPT_ACTIVE 2 |
| 196 | #define LM_STATUS_INTERRUPT_NOT_ACTIVE 3 |
| 197 | |
| 198 | #define LM_STATUS_LINK_ACTIVE 4 |
| 199 | #define LM_STATUS_LINK_DOWN 5 |
| 200 | #define LM_STATUS_LINK_SETTING_MISMATCH 6 |
| 201 | |
| 202 | #define LM_STATUS_TOO_MANY_FRAGMENTS 7 |
| 203 | #define LM_STATUS_TRANSMIT_ABORTED 8 |
| 204 | #define LM_STATUS_TRANSMIT_ERROR 9 |
| 205 | #define LM_STATUS_RECEIVE_ABORTED 10 |
| 206 | #define LM_STATUS_RECEIVE_ERROR 11 |
| 207 | #define LM_STATUS_INVALID_PACKET_SIZE 12 |
| 208 | #define LM_STATUS_OUT_OF_MAP_REGISTERS 13 |
| 209 | #define LM_STATUS_UNKNOWN_ADAPTER 14 |
| 210 | |
| 211 | typedef LM_UINT LM_STATUS, *PLM_STATUS; |
| 212 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 213 | /******************************************************************************/ |
| 214 | /* Requested media type. */ |
| 215 | /******************************************************************************/ |
| 216 | |
| 217 | #define LM_REQUESTED_MEDIA_TYPE_AUTO 0 |
| 218 | #define LM_REQUESTED_MEDIA_TYPE_BNC 1 |
| 219 | #define LM_REQUESTED_MEDIA_TYPE_UTP_AUTO 2 |
| 220 | #define LM_REQUESTED_MEDIA_TYPE_UTP_10MBPS 3 |
| 221 | #define LM_REQUESTED_MEDIA_TYPE_UTP_10MBPS_FULL_DUPLEX 4 |
| 222 | #define LM_REQUESTED_MEDIA_TYPE_UTP_100MBPS 5 |
| 223 | #define LM_REQUESTED_MEDIA_TYPE_UTP_100MBPS_FULL_DUPLEX 6 |
| 224 | #define LM_REQUESTED_MEDIA_TYPE_UTP_1000MBPS 7 |
| 225 | #define LM_REQUESTED_MEDIA_TYPE_UTP_1000MBPS_FULL_DUPLEX 8 |
| 226 | #define LM_REQUESTED_MEDIA_TYPE_FIBER_100MBPS 9 |
| 227 | #define LM_REQUESTED_MEDIA_TYPE_FIBER_100MBPS_FULL_DUPLEX 10 |
| 228 | #define LM_REQUESTED_MEDIA_TYPE_FIBER_1000MBPS 11 |
| 229 | #define LM_REQUESTED_MEDIA_TYPE_FIBER_1000MBPS_FULL_DUPLEX 12 |
| 230 | #define LM_REQUESTED_MEDIA_TYPE_MAC_LOOPBACK 0xfffe |
| 231 | #define LM_REQUESTED_MEDIA_TYPE_PHY_LOOPBACK 0xffff |
| 232 | |
| 233 | typedef LM_UINT32 LM_REQUESTED_MEDIA_TYPE, *PLM_REQUESTED_MEDIA_TYPE; |
| 234 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 235 | /******************************************************************************/ |
| 236 | /* Media type. */ |
| 237 | /******************************************************************************/ |
| 238 | |
| 239 | #define LM_MEDIA_TYPE_UNKNOWN -1 |
| 240 | #define LM_MEDIA_TYPE_AUTO 0 |
| 241 | #define LM_MEDIA_TYPE_UTP 1 |
| 242 | #define LM_MEDIA_TYPE_BNC 2 |
| 243 | #define LM_MEDIA_TYPE_AUI 3 |
| 244 | #define LM_MEDIA_TYPE_FIBER 4 |
| 245 | |
| 246 | typedef LM_UINT32 LM_MEDIA_TYPE, *PLM_MEDIA_TYPE; |
| 247 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 248 | /******************************************************************************/ |
| 249 | /* Line speed. */ |
| 250 | /******************************************************************************/ |
| 251 | |
| 252 | #define LM_LINE_SPEED_UNKNOWN 0 |
| 253 | #define LM_LINE_SPEED_10MBPS 1 |
| 254 | #define LM_LINE_SPEED_100MBPS 2 |
| 255 | #define LM_LINE_SPEED_1000MBPS 3 |
| 256 | |
| 257 | typedef LM_UINT32 LM_LINE_SPEED, *PLM_LINE_SPEED; |
| 258 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 259 | /******************************************************************************/ |
| 260 | /* Duplex mode. */ |
| 261 | /******************************************************************************/ |
| 262 | |
| 263 | #define LM_DUPLEX_MODE_UNKNOWN 0 |
| 264 | #define LM_DUPLEX_MODE_HALF 1 |
| 265 | #define LM_DUPLEX_MODE_FULL 2 |
| 266 | |
| 267 | typedef LM_UINT32 LM_DUPLEX_MODE, *PLM_DUPLEX_MODE; |
| 268 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 269 | /******************************************************************************/ |
| 270 | /* Power state. */ |
| 271 | /******************************************************************************/ |
| 272 | |
| 273 | #define LM_POWER_STATE_D0 0 |
| 274 | #define LM_POWER_STATE_D1 1 |
| 275 | #define LM_POWER_STATE_D2 2 |
| 276 | #define LM_POWER_STATE_D3 3 |
| 277 | |
| 278 | typedef LM_UINT32 LM_POWER_STATE, *PLM_POWER_STATE; |
| 279 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 280 | /******************************************************************************/ |
| 281 | /* Task offloading. */ |
| 282 | /******************************************************************************/ |
| 283 | |
| 284 | #define LM_TASK_OFFLOAD_NONE 0x0000 |
| 285 | #define LM_TASK_OFFLOAD_TX_IP_CHECKSUM 0x0001 |
| 286 | #define LM_TASK_OFFLOAD_RX_IP_CHECKSUM 0x0002 |
| 287 | #define LM_TASK_OFFLOAD_TX_TCP_CHECKSUM 0x0004 |
| 288 | #define LM_TASK_OFFLOAD_RX_TCP_CHECKSUM 0x0008 |
| 289 | #define LM_TASK_OFFLOAD_TX_UDP_CHECKSUM 0x0010 |
| 290 | #define LM_TASK_OFFLOAD_RX_UDP_CHECKSUM 0x0020 |
| 291 | #define LM_TASK_OFFLOAD_TCP_SEGMENTATION 0x0040 |
| 292 | |
| 293 | typedef LM_UINT32 LM_TASK_OFFLOAD, *PLM_TASK_OFFLOAD; |
| 294 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 295 | /******************************************************************************/ |
| 296 | /* Flow control. */ |
| 297 | /******************************************************************************/ |
| 298 | |
| 299 | #define LM_FLOW_CONTROL_NONE 0x00 |
| 300 | #define LM_FLOW_CONTROL_RECEIVE_PAUSE 0x01 |
| 301 | #define LM_FLOW_CONTROL_TRANSMIT_PAUSE 0x02 |
| 302 | #define LM_FLOW_CONTROL_RX_TX_PAUSE (LM_FLOW_CONTROL_RECEIVE_PAUSE | \ |
| 303 | LM_FLOW_CONTROL_TRANSMIT_PAUSE) |
| 304 | |
| 305 | /* This value can be or-ed with RECEIVE_PAUSE and TRANSMIT_PAUSE. If the */ |
| 306 | /* auto-negotiation is disabled and the RECEIVE_PAUSE and TRANSMIT_PAUSE */ |
| 307 | /* bits are set, then flow control is enabled regardless of link partner's */ |
| 308 | /* flow control capability. */ |
| 309 | #define LM_FLOW_CONTROL_AUTO_PAUSE 0x80000000 |
| 310 | |
| 311 | typedef LM_UINT32 LM_FLOW_CONTROL, *PLM_FLOW_CONTROL; |
| 312 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 313 | /******************************************************************************/ |
| 314 | /* Wake up mode. */ |
| 315 | /******************************************************************************/ |
| 316 | |
| 317 | #define LM_WAKE_UP_MODE_NONE 0 |
| 318 | #define LM_WAKE_UP_MODE_MAGIC_PACKET 1 |
| 319 | #define LM_WAKE_UP_MODE_NWUF 2 |
| 320 | #define LM_WAKE_UP_MODE_LINK_CHANGE 4 |
| 321 | |
| 322 | typedef LM_UINT32 LM_WAKE_UP_MODE, *PLM_WAKE_UP_MODE; |
| 323 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 324 | /******************************************************************************/ |
| 325 | /* Counters. */ |
| 326 | /******************************************************************************/ |
| 327 | |
| 328 | #define LM_COUNTER_FRAMES_XMITTED_OK 0 |
| 329 | #define LM_COUNTER_FRAMES_RECEIVED_OK 1 |
| 330 | #define LM_COUNTER_ERRORED_TRANSMIT_COUNT 2 |
| 331 | #define LM_COUNTER_ERRORED_RECEIVE_COUNT 3 |
| 332 | #define LM_COUNTER_RCV_CRC_ERROR 4 |
| 333 | #define LM_COUNTER_ALIGNMENT_ERROR 5 |
| 334 | #define LM_COUNTER_SINGLE_COLLISION_FRAMES 6 |
| 335 | #define LM_COUNTER_MULTIPLE_COLLISION_FRAMES 7 |
| 336 | #define LM_COUNTER_FRAMES_DEFERRED 8 |
| 337 | #define LM_COUNTER_MAX_COLLISIONS 9 |
| 338 | #define LM_COUNTER_RCV_OVERRUN 10 |
| 339 | #define LM_COUNTER_XMIT_UNDERRUN 11 |
| 340 | #define LM_COUNTER_UNICAST_FRAMES_XMIT 12 |
| 341 | #define LM_COUNTER_MULTICAST_FRAMES_XMIT 13 |
| 342 | #define LM_COUNTER_BROADCAST_FRAMES_XMIT 14 |
| 343 | #define LM_COUNTER_UNICAST_FRAMES_RCV 15 |
| 344 | #define LM_COUNTER_MULTICAST_FRAMES_RCV 16 |
| 345 | #define LM_COUNTER_BROADCAST_FRAMES_RCV 17 |
| 346 | |
| 347 | typedef LM_UINT32 LM_COUNTER_TYPE, *PLM_COUNTER_TYPE; |
| 348 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 349 | /******************************************************************************/ |
| 350 | /* Forward definition. */ |
| 351 | /******************************************************************************/ |
| 352 | |
| 353 | typedef struct _LM_DEVICE_BLOCK *PLM_DEVICE_BLOCK; |
| 354 | typedef struct _LM_PACKET *PLM_PACKET; |
| 355 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 356 | /******************************************************************************/ |
| 357 | /* Function prototypes. */ |
| 358 | /******************************************************************************/ |
| 359 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 360 | LM_STATUS LM_GetAdapterInfo (PLM_DEVICE_BLOCK pDevice); |
| 361 | LM_STATUS LM_InitializeAdapter (PLM_DEVICE_BLOCK pDevice); |
| 362 | LM_STATUS LM_ResetAdapter (PLM_DEVICE_BLOCK pDevice); |
| 363 | LM_STATUS LM_DisableInterrupt (PLM_DEVICE_BLOCK pDevice); |
| 364 | LM_STATUS LM_EnableInterrupt (PLM_DEVICE_BLOCK pDevice); |
| 365 | LM_STATUS LM_SendPacket (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket); |
| 366 | LM_STATUS LM_ServiceInterrupts (PLM_DEVICE_BLOCK pDevice); |
| 367 | LM_STATUS LM_QueueRxPackets (PLM_DEVICE_BLOCK pDevice); |
| 368 | LM_STATUS LM_SetReceiveMask (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Mask); |
| 369 | LM_STATUS LM_Halt (PLM_DEVICE_BLOCK pDevice); |
| 370 | LM_STATUS LM_Abort (PLM_DEVICE_BLOCK pDevice); |
| 371 | LM_STATUS LM_MulticastAdd (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pMcAddress); |
| 372 | LM_STATUS LM_MulticastDel (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pMcAddress); |
| 373 | LM_STATUS LM_MulticastClear (PLM_DEVICE_BLOCK pDevice); |
Mike Frysinger | 061af9d | 2009-02-11 19:04:25 -0500 | [diff] [blame] | 374 | LM_STATUS LM_SetMacAddress (PLM_DEVICE_BLOCK pDevice); |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 375 | LM_STATUS LM_LoopbackAddress (PLM_DEVICE_BLOCK pDevice, PLM_UINT8 pAddress); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 376 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 377 | LM_UINT32 LM_GetCrcCounter (PLM_DEVICE_BLOCK pDevice); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 378 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 379 | LM_WAKE_UP_MODE LM_PMCapabilities (PLM_DEVICE_BLOCK pDevice); |
| 380 | LM_STATUS LM_NwufAdd (PLM_DEVICE_BLOCK pDevice, LM_UINT32 ByteMaskSize, |
| 381 | LM_UINT8 * pByteMask, LM_UINT8 * pPattern); |
| 382 | LM_STATUS LM_NwufRemove (PLM_DEVICE_BLOCK pDevice, LM_UINT32 ByteMaskSize, |
| 383 | LM_UINT8 * pByteMask, LM_UINT8 * pPattern); |
| 384 | LM_STATUS LM_SetPowerState (PLM_DEVICE_BLOCK pDevice, |
| 385 | LM_POWER_STATE PowerLevel); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 386 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 387 | LM_VOID LM_ReadPhy (PLM_DEVICE_BLOCK pDevice, LM_UINT32 PhyReg, |
| 388 | PLM_UINT32 pData32); |
| 389 | LM_VOID LM_WritePhy (PLM_DEVICE_BLOCK pDevice, LM_UINT32 PhyReg, |
| 390 | LM_UINT32 Data32); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 391 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 392 | LM_STATUS LM_ControlLoopBack (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Control); |
| 393 | LM_STATUS LM_SetupPhy (PLM_DEVICE_BLOCK pDevice); |
| 394 | int LM_BlinkLED (PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlinkDuration); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 395 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 396 | /******************************************************************************/ |
| 397 | /* These are the OS specific functions called by LMAC. */ |
| 398 | /******************************************************************************/ |
| 399 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 400 | LM_STATUS MM_ReadConfig16 (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset, |
| 401 | LM_UINT16 * pValue16); |
| 402 | LM_STATUS MM_WriteConfig16 (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset, |
| 403 | LM_UINT16 Value16); |
| 404 | LM_STATUS MM_ReadConfig32 (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset, |
| 405 | LM_UINT32 * pValue32); |
| 406 | LM_STATUS MM_WriteConfig32 (PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset, |
| 407 | LM_UINT32 Value32); |
| 408 | LM_STATUS MM_MapMemBase (PLM_DEVICE_BLOCK pDevice); |
| 409 | LM_STATUS MM_MapIoBase (PLM_DEVICE_BLOCK pDevice); |
| 410 | LM_STATUS MM_IndicateRxPackets (PLM_DEVICE_BLOCK pDevice); |
| 411 | LM_STATUS MM_IndicateTxPackets (PLM_DEVICE_BLOCK pDevice); |
| 412 | LM_STATUS MM_StartTxDma (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket); |
| 413 | LM_STATUS MM_CompleteTxDma (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket); |
| 414 | LM_STATUS MM_AllocateMemory (PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlockSize, |
| 415 | PLM_VOID * pMemoryBlockVirt); |
| 416 | LM_STATUS MM_AllocateSharedMemory (PLM_DEVICE_BLOCK pDevice, |
| 417 | LM_UINT32 BlockSize, |
| 418 | PLM_VOID * pMemoryBlockVirt, |
| 419 | PLM_PHYSICAL_ADDRESS pMemoryBlockPhy, |
| 420 | LM_BOOL Cached); |
| 421 | LM_STATUS MM_GetConfig (PLM_DEVICE_BLOCK pDevice); |
| 422 | LM_STATUS MM_IndicateStatus (PLM_DEVICE_BLOCK pDevice, LM_STATUS Status); |
| 423 | LM_STATUS MM_InitializeUmPackets (PLM_DEVICE_BLOCK pDevice); |
| 424 | LM_STATUS MM_FreeRxBuffer (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket); |
| 425 | LM_STATUS MM_CoalesceTxBuffer (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket); |
| 426 | LM_STATUS LM_MbufWorkAround (PLM_DEVICE_BLOCK pDevice); |
| 427 | LM_STATUS LM_SetLinkSpeed (PLM_DEVICE_BLOCK pDevice, |
| 428 | LM_REQUESTED_MEDIA_TYPE RequestedMediaType); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 429 | |
| 430 | #if INCLUDE_5703_A0_FIX |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 431 | LM_STATUS LM_Load5703DmaWFirmware (PLM_DEVICE_BLOCK pDevice); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 432 | #endif |
| 433 | |
Vadim Bendebury | 6ddfee5 | 2007-05-24 15:52:25 -0700 | [diff] [blame] | 434 | #endif /* LM_H */ |