source: mainline/uspace/srv/hw/netif/dp8390/dp8390_port.h@ 66b628a

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 66b628a was 66b628a, checked in by martin@…>, 15 years ago

further code simplification

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2 * Copyright (c) 2009 Lukas Mejdrech
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup dp8390
30 * @{
31 */
32
33/** @file
34 * DP8390 network interface types and structures ports.
35 */
36
37#ifndef __NET_NETIF_DP8390_PORT_H__
38#define __NET_NETIF_DP8390_PORT_H__
39
40#include <errno.h>
41#include <mem.h>
42#include <stdio.h>
43#include <libarch/ddi.h>
44#include <sys/types.h>
45
46/** Compares two memory blocks.
47 * @param[in] first The first memory block.
48 * @param[in] second The second memory block.
49 * @param[in] size The blocks size in bytes.
50 * @returns 0 if equeal.
51 * @returns -1 if the first is greater than the second.
52 * @returns 1 if the second is greater than the first.
53 */
54#define memcmp(first, second, size) bcmp((char *) (first), (char *) (second), (size))
55
56/** Reads 1 byte.
57 * @param[in] port The address to be read.
58 * @returns The read value.
59 */
60#define inb(port) pio_read_8((ioport8_t *) (port))
61
62/** Reads 1 word (2 bytes).
63 * @param[in] port The address to be read.
64 * @returns The read value.
65 */
66#define inw(port) pio_read_16((ioport16_t *) (port))
67
68/** Writes 1 byte.
69 * @param[in] port The address to be written.
70 * @param[in] value The value to be written.
71 */
72#define outb(port, value) pio_write_8((ioport8_t *) (port), (value))
73
74/** Writes 1 word (2 bytes).
75 * @param[in] port The address to be written.
76 * @param[in] value The value to be written.
77 */
78#define outw(port, value) pio_write_16((ioport16_t *) (port), (value))
79
80/** Type definition of a port.
81 */
82typedef long port_t;
83
84/** Ethernet statistics.
85 */
86typedef struct eth_stat {
87 /** Number of receive errors.
88 */
89 unsigned long ets_recvErr;
90 /** Number of send error.
91 */
92 unsigned long ets_sendErr;
93 /** Number of buffer overwrite warnings.
94 */
95 unsigned long ets_OVW;
96 /** Number of crc errors of read.
97 */
98 unsigned long ets_CRCerr;
99 /** Number of frames not alligned (number of bits % 8 != 0).
100 */
101 unsigned long ets_frameAll;
102 /** Number of packets missed due to slow processing.
103 */
104 unsigned long ets_missedP;
105 /** Number of packets received.
106 */
107 unsigned long ets_packetR;
108 /** Number of packets transmitted.
109 */
110 unsigned long ets_packetT;
111 /** Number of transmission defered (Tx was busy).
112 */
113 unsigned long ets_transDef;
114 /** Number of collissions.
115 */
116 unsigned long ets_collision;
117 /** Number of Tx aborted due to excess collisions.
118 */
119 unsigned long ets_transAb;
120 /** Number of carrier sense lost.
121 */
122 unsigned long ets_carrSense;
123 /** Number of FIFO underruns (processor too busy).
124 */
125 unsigned long ets_fifoUnder;
126 /** Number of FIFO overruns (processor too busy).
127 */
128 unsigned long ets_fifoOver;
129 /** Number of times unable to transmit collision sig.
130 */
131 unsigned long ets_CDheartbeat;
132 /** Number of times out of window collision.
133 */
134 unsigned long ets_OWC;
135} eth_stat_t;
136
137/** Minimum Ethernet packet size in bytes.
138 */
139#define ETH_MIN_PACK_SIZE 60
140
141/** Maximum Ethernet packet size in bytes.
142 */
143#define ETH_MAX_PACK_SIZE_TAGGED 1518
144
145/** Ethernet address type definition.
146 */
147typedef struct ether_addr {
148 /** Address data.
149 */
150 uint8_t ea_addr[6];
151} ether_addr_t;
152
153#endif
154
155/** @}
156 */
Note: See TracBrowser for help on using the repository browser.