Rev 4723 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4723 | Rev 4743 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2009 Lukas Mejdrech |
2 | * Copyright (c) 2009 Lukas Mejdrech |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
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 |
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. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
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 |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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 |
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. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup dp8390 |
29 | /** @addtogroup dp8390 |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | 32 | ||
33 | /** @file |
33 | /** @file |
34 | * \todo |
34 | * \todo |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #ifndef __NET_NETIF_DP8390_PORT_H__ |
37 | #ifndef __NET_NETIF_DP8390_PORT_H__ |
38 | #define __NET_NETIF_DP8390_PORT_H__ |
38 | #define __NET_NETIF_DP8390_PORT_H__ |
39 | 39 | ||
40 | #include <errno.h> |
40 | #include <errno.h> |
41 | #include <mem.h> |
41 | #include <mem.h> |
42 | #include <stdio.h> |
42 | #include <stdio.h> |
43 | #include <libarch/ddi.h> |
43 | #include <libarch/ddi.h> |
44 | #include <sys/types.h> |
44 | #include <sys/types.h> |
45 | 45 | ||
46 | #define _PROTOTYPE( function, params ) function params |
46 | #define _PROTOTYPE( function, params ) function params |
47 | 47 | ||
48 | #define OK EOK |
48 | #define OK EOK |
49 | 49 | ||
50 | typedef uint8_t u8_t; |
50 | typedef uint8_t u8_t; |
51 | typedef uint16_t u16_t; |
51 | typedef uint16_t u16_t; |
52 | 52 | ||
53 | #define memcmp( first, second, size ) bcmp(( char * ) ( first ), ( char * ) ( second ), ( size )) |
53 | #define memcmp( first, second, size ) bcmp(( char * ) ( first ), ( char * ) ( second ), ( size )) |
54 | 54 | ||
55 | #define inb( port ) pio_read_8(( ioport8_t * ) ( port )) |
55 | #define inb( port ) pio_read_8(( ioport8_t * ) ( port )) |
56 | #define inw( port ) pio_read_16(( ioport16_t * ) ( port )) |
56 | #define inw( port ) pio_read_16(( ioport16_t * ) ( port )) |
57 | #define outb( port, value ) pio_write_8(( ioport8_t * ) ( port ), ( value )) |
57 | #define outb( port, value ) pio_write_8(( ioport8_t * ) ( port ), ( value )) |
58 | #define outw( port, value ) pio_write_16(( ioport16_t * ) ( port ), ( value )) |
58 | #define outw( port, value ) pio_write_16(( ioport16_t * ) ( port ), ( value )) |
59 | 59 | ||
60 | #define panic( ... ) printf( "%s%s%d", __VA_ARGS__ ) |
60 | #define panic( ... ) printf( "%s%s%d", __VA_ARGS__ ) |
61 | 61 | ||
62 | #define sys_vircopy( proc, src_s, src, me, dst_s, dst, bytes ) ({ memcpy(( void * )( dst ), ( void * )( src ), ( bytes )); EOK; }) |
62 | #define sys_vircopy( proc, src_s, src, me, dst_s, dst, bytes ) ({ memcpy(( void * )( dst ), ( void * )( src ), ( bytes )); EOK; }) |
63 | #define do_vir_insb( port, proc, src, bytes ) insb(( port ), ( void * )( src ), ( bytes )) |
63 | #define do_vir_insb( port, proc, src, bytes ) insb(( port ), ( void * )( src ), ( bytes )) |
64 | #define do_vir_insw( port, proc, src, bytes ) insw(( port ), ( void * )( src ), ( bytes )) |
64 | #define do_vir_insw( port, proc, src, bytes ) insw(( port ), ( void * )( src ), ( bytes )) |
65 | #define do_vir_outsb( port, proc, src, bytes ) outsb(( port ), ( void * )( src ), ( bytes )) |
65 | #define do_vir_outsb( port, proc, src, bytes ) outsb(( port ), ( void * )( src ), ( bytes )) |
66 | #define do_vir_outsw( port, proc, src, bytes ) outsw(( port ), ( void * )( src ), ( bytes )) |
66 | #define do_vir_outsw( port, proc, src, bytes ) outsw(( port ), ( void * )( src ), ( bytes )) |
67 | 67 | ||
68 | /* com.h */ |
68 | /* com.h */ |
69 | /* Bits in 'DL_MODE' field of DL requests. */ |
69 | /* Bits in 'DL_MODE' field of DL requests. */ |
70 | # define DL_NOMODE 0x0 |
70 | # define DL_NOMODE 0x0 |
71 | # define DL_PROMISC_REQ 0x2 |
71 | # define DL_PROMISC_REQ 0x2 |
72 | # define DL_MULTI_REQ 0x4 |
72 | # define DL_MULTI_REQ 0x4 |
73 | # define DL_BROAD_REQ 0x8 |
73 | # define DL_BROAD_REQ 0x8 |
74 | 74 | ||
75 | /* const.h */ |
75 | /* const.h */ |
76 | #define TRUE 1 /* used for turning integers into Booleans */ |
76 | #define TRUE 1 /* used for turning integers into Booleans */ |
77 | #define FALSE 0 /* used for turning integers into Booleans */ |
77 | #define FALSE 0 /* used for turning integers into Booleans */ |
78 | #define NO_NUM 0x8000 /* used as numerical argument to panic() */ |
78 | #define NO_NUM 0x8000 /* used as numerical argument to panic() */ |
79 | 79 | ||
80 | /* devio.h */ |
80 | /* devio.h */ |
81 | //typedef u16_t port_t; |
81 | //typedef u16_t port_t; |
82 | typedef int port_t; |
82 | typedef int port_t; |
83 | 83 | ||
84 | /* dl_eth.h */ |
84 | /* dl_eth.h */ |
85 | typedef struct eth_stat |
85 | typedef struct eth_stat |
86 | { |
86 | { |
87 | unsigned long ets_recvErr, /* # receive errors */ |
87 | unsigned long ets_recvErr, /* # receive errors */ |
88 | ets_sendErr, /* # send error */ |
88 | ets_sendErr, /* # send error */ |
89 | ets_OVW, /* # buffer overwrite warnings */ |
89 | ets_OVW, /* # buffer overwrite warnings */ |
90 | ets_CRCerr, /* # crc errors of read */ |
90 | ets_CRCerr, /* # crc errors of read */ |
91 | ets_frameAll, /* # frames not alligned (# bits % 8 != 0) */ |
91 | ets_frameAll, /* # frames not alligned (# bits % 8 != 0) */ |
92 | ets_missedP, /* # packets missed due to slow processing */ |
92 | ets_missedP, /* # packets missed due to slow processing */ |
93 | ets_packetR, /* # packets received */ |
93 | ets_packetR, /* # packets received */ |
94 | ets_packetT, /* # packets transmitted */ |
94 | ets_packetT, /* # packets transmitted */ |
95 | ets_transDef, /* # transmission defered (Tx was busy) */ |
95 | ets_transDef, /* # transmission defered (Tx was busy) */ |
96 | ets_collision, /* # collissions */ |
96 | ets_collision, /* # collissions */ |
97 | ets_transAb, /* # Tx aborted due to excess collisions */ |
97 | ets_transAb, /* # Tx aborted due to excess collisions */ |
98 | ets_carrSense, /* # carrier sense lost */ |
98 | ets_carrSense, /* # carrier sense lost */ |
99 | ets_fifoUnder, /* # FIFO underruns (processor too busy) */ |
99 | ets_fifoUnder, /* # FIFO underruns (processor too busy) */ |
100 | ets_fifoOver, /* # FIFO overruns (processor too busy) */ |
100 | ets_fifoOver, /* # FIFO overruns (processor too busy) */ |
101 | ets_CDheartbeat, /* # times unable to transmit collision sig*/ |
101 | ets_CDheartbeat, /* # times unable to transmit collision sig*/ |
102 | ets_OWC; /* # times out of window collision */ |
102 | ets_OWC; /* # times out of window collision */ |
103 | } eth_stat_t; |
103 | } eth_stat_t; |
104 | 104 | ||
105 | /* errno.h */ |
105 | /* errno.h */ |
106 | #define EGENERIC EINVAL |
106 | #define EGENERIC EINVAL |
107 | 107 | ||
108 | /* ether.h */ |
108 | /* ether.h */ |
109 | #define ETH_MIN_PACK_SIZE 60 |
109 | #define ETH_MIN_PACK_SIZE 60 |
110 | #define ETH_MAX_PACK_SIZE_TAGGED 1518 |
110 | #define ETH_MAX_PACK_SIZE_TAGGED 1518 |
111 | 111 | ||
112 | typedef struct ether_addr |
112 | typedef struct ether_addr |
113 | { |
113 | { |
114 | u8_t ea_addr[6]; |
114 | u8_t ea_addr[6]; |
115 | } ether_addr_t; |
115 | } ether_addr_t; |
116 | 116 | ||
117 | /* type.h */ |
117 | /* type.h */ |
118 | //TODO platform dependent types |
- | |
119 | typedef unsigned long phys_bytes; /* physical addr/length in bytes */ |
118 | typedef unsigned long phys_bytes; /* physical addr/length in bytes */ |
120 | typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */ |
119 | typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */ |
121 | 120 | ||
122 | typedef struct { |
121 | typedef struct { |
123 | vir_bytes iov_addr; /* address of an I/O buffer */ |
122 | vir_bytes iov_addr; /* address of an I/O buffer */ |
124 | vir_bytes iov_size; /* sizeof an I/O buffer */ |
123 | vir_bytes iov_size; /* sizeof an I/O buffer */ |
125 | } iovec_t; |
124 | } iovec_t; |
126 | 125 | ||
127 | #endif |
126 | #endif |
128 | 127 | ||
129 | /** @} |
128 | /** @} |
130 | */ |
129 | */ |
131 | 130 |