Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4743 | Rev 4756 | ||
|---|---|---|---|
| Line 19... | Line 19... | ||
| 19 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
19 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 22 | * |
22 | * |
| 23 | * Changes: |
23 | * Changes: |
| 24 | * 2009 Lukas Mejdrech ported to HelenOS |
24 | * 2009 ported to HelenOS, Lukas Mejdrech |
| 25 | */ |
25 | */ |
| 26 | 26 | ||
| 27 | /** @addtogroup dp8390 |
27 | /** @addtogroup dp8390 |
| 28 | * @{ |
28 | * @{ |
| 29 | */ |
29 | */ |
| 30 | 30 | ||
| 31 | /** @file |
31 | /** @file |
| 32 | * \todo |
32 | * DP8390 network interface definitions. |
| 33 | */ |
33 | */ |
| 34 | 34 | ||
| 35 | #ifndef __NET_NETIF_DP8390_H__ |
35 | #ifndef __NET_NETIF_DP8390_H__ |
| 36 | #define __NET_NETIF_DP8390_H__ |
36 | #define __NET_NETIF_DP8390_H__ |
| 37 | 37 | ||
| 38 | #include "../../structures/packet/packet.h" |
38 | #include "../../structures/packet/packet.h" |
| 39 | 39 | ||
| 40 | #include "dp8390_port.h" |
40 | #include "dp8390_port.h" |
| 41 | #include "local.h" |
41 | #include "local.h" |
| 42 | 42 | ||
| - | 43 | /** Input/output size. |
|
| - | 44 | */ |
|
| 43 | #define DP8390_IO_SIZE 0x01f |
45 | #define DP8390_IO_SIZE 0x01f |
| 44 | 46 | ||
| 45 | /* |
47 | /* |
| 46 | dp8390.h |
48 | dp8390.h |
| 47 | 49 | ||
| Line 194... | Line 196... | ||
| 194 | #define RSR_MPA 0x10 /* Missed Packet */ |
196 | #define RSR_MPA 0x10 /* Missed Packet */ |
| 195 | #define RSR_PHY 0x20 /* Multicast Address Match */ |
197 | #define RSR_PHY 0x20 /* Multicast Address Match */ |
| 196 | #define RSR_DIS 0x40 /* Receiver Disabled */ |
198 | #define RSR_DIS 0x40 /* Receiver Disabled */ |
| 197 | #define RSR_DFR 0x80 /* In later manuals: Deferring */ |
199 | #define RSR_DFR 0x80 /* In later manuals: Deferring */ |
| 198 | 200 | ||
| - | 201 | /** Type definition of the receive header. |
|
| 199 | 202 | */ |
|
| 200 | typedef struct dp_rcvhdr |
203 | typedef struct dp_rcvhdr |
| 201 | { |
204 | { |
| - | 205 | /** Copy of rsr. |
|
| - | 206 | */ |
|
| 202 | u8_t dr_status; /* Copy of rsr */ |
207 | u8_t dr_status; |
| 203 | u8_t dr_next; /* Pointer to next packet */ |
208 | /** Pointer to next packet. |
| - | 209 | */ |
|
| - | 210 | u8_t dr_next; |
|
| 204 | u8_t dr_rbcl; /* Receive Byte Count Low */ |
211 | /** Receive Byte Count Low. |
| - | 212 | */ |
|
| - | 213 | u8_t dr_rbcl; |
|
| 205 | u8_t dr_rbch; /* Receive Byte Count High */ |
214 | /** Receive Byte Count High. |
| - | 215 | */ |
|
| - | 216 | u8_t dr_rbch; |
|
| 206 | } dp_rcvhdr_t; |
217 | } dp_rcvhdr_t; |
| 207 | 218 | ||
| - | 219 | /** Page size. |
|
| - | 220 | */ |
|
| 208 | #define DP_PAGESIZE 256 |
221 | #define DP_PAGESIZE 256 |
| 209 | 222 | ||
| 210 | /* Some macros to simplify accessing the dp8390 */ |
223 | /* Some macros to simplify accessing the dp8390 */ |
| - | 224 | /** Reads 1 byte from the zero page register. |
|
| - | 225 | * @param[in] dep The network interface structure. |
|
| - | 226 | * @param[in] reg The register offset. |
|
| - | 227 | * @returns The read value. |
|
| - | 228 | */ |
|
| 211 | #define inb_reg0(dep, reg) (inb(dep->de_dp8390_port+reg)) |
229 | #define inb_reg0(dep, reg) (inb(dep->de_dp8390_port+reg)) |
| - | 230 | ||
| - | 231 | /** Writes 1 byte zero page register. |
|
| - | 232 | * @param[in] dep The network interface structure. |
|
| - | 233 | * @param[in] reg The register offset. |
|
| - | 234 | * @param[in] data The value to be written. |
|
| - | 235 | */ |
|
| 212 | #define outb_reg0(dep, reg, data) (outb(dep->de_dp8390_port+reg, data)) |
236 | #define outb_reg0(dep, reg, data) (outb(dep->de_dp8390_port+reg, data)) |
| - | 237 | ||
| - | 238 | /** Reads 1 byte from the first page register. |
|
| - | 239 | * @param[in] dep The network interface structure. |
|
| - | 240 | * @param[in] reg The register offset. |
|
| - | 241 | * @returns The read value. |
|
| - | 242 | */ |
|
| 213 | #define inb_reg1(dep, reg) (inb(dep->de_dp8390_port+reg)) |
243 | #define inb_reg1(dep, reg) (inb(dep->de_dp8390_port+reg)) |
| - | 244 | ||
| - | 245 | /** Writes 1 byte first page register. |
|
| - | 246 | * @param[in] dep The network interface structure. |
|
| - | 247 | * @param[in] reg The register offset. |
|
| - | 248 | * @param[in] data The value to be written. |
|
| - | 249 | */ |
|
| 214 | #define outb_reg1(dep, reg, data) (outb(dep->de_dp8390_port+reg, data)) |
250 | #define outb_reg1(dep, reg, data) (outb(dep->de_dp8390_port+reg, data)) |
| 215 | 251 | ||
| 216 | /* Software interface to the dp8390 driver */ |
252 | /* Software interface to the dp8390 driver */ |
| 217 | 253 | ||
| 218 | struct dpeth; |
254 | struct dpeth; |
| Line 272... | Line 308... | ||
| 272 | */ |
308 | */ |
| 273 | #define MAX_PACKETS 4 |
309 | #define MAX_PACKETS 4 |
| 274 | 310 | ||
| 275 | typedef struct dpeth |
311 | typedef struct dpeth |
| 276 | { |
312 | { |
| 277 | /* Packet send queue. |
313 | /** Outgoing packets queue. |
| 278 | */ |
314 | */ |
| 279 | packet_t packet_queue; |
315 | packet_t packet_queue; |
| - | 316 | /** Outgoing packets count. |
|
| - | 317 | */ |
|
| 280 | int packet_count; |
318 | int packet_count; |
| 281 | 319 | ||
| 282 | /* Packet receive queue. |
320 | /** Received packets queue. |
| 283 | */ |
321 | */ |
| 284 | packet_t received_queue; |
322 | packet_t received_queue; |
| - | 323 | /** Received packets count. |
|
| - | 324 | */ |
|
| 285 | int received_count; |
325 | int received_count; |
| 286 | 326 | ||
| 287 | /* The de_base_port field is the starting point of the probe. |
327 | /* The de_base_port field is the starting point of the probe. |
| 288 | * The conf routine also fills de_linmem and de_irq. If the probe |
328 | * The conf routine also fills de_linmem and de_irq. If the probe |
| 289 | * routine knows the irq and/or memory address because they are |
329 | * routine knows the irq and/or memory address because they are |