Rev 4163 | Rev 4723 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4163 | Rev 4192 | ||
|---|---|---|---|
| Line 32... | Line 32... | ||
| 32 | 32 | ||
| 33 | #ifndef __NET_NETIF_DP8390_PORT_H__ |
33 | #ifndef __NET_NETIF_DP8390_PORT_H__ |
| 34 | #define __NET_NETIF_DP8390_PORT_H__ |
34 | #define __NET_NETIF_DP8390_PORT_H__ |
| 35 | 35 | ||
| 36 | #include <errno.h> |
36 | #include <errno.h> |
| - | 37 | #include <mem.h> |
|
| 37 | #include <stdio.h> |
38 | #include <stdio.h> |
| 38 | #include <libarch/ddi.h> |
39 | #include <libarch/ddi.h> |
| 39 | #include <sys/types.h> |
40 | #include <sys/types.h> |
| 40 | 41 | ||
| 41 | #define _PROTOTYPE( function, params ) function params |
42 | #define _PROTOTYPE( function, params ) function params |
| Line 43... | Line 44... | ||
| 43 | #define OK EOK |
44 | #define OK EOK |
| 44 | 45 | ||
| 45 | typedef uint8_t u8_t; |
46 | typedef uint8_t u8_t; |
| 46 | typedef uint16_t u16_t; |
47 | typedef uint16_t u16_t; |
| 47 | 48 | ||
| 48 | static inline int memcmp( const void * first, const void * second, size_t length ){ |
49 | #define memcmp( first, second, size ) bcmp(( char * ) ( first ), ( char * ) ( second ), ( size )) |
| 49 | uint8_t * f; |
- | |
| 50 | uint8_t * s; |
- | |
| 51 | - | ||
| 52 | if( ! first ){ |
- | |
| 53 | return second ? 1 : 0; |
- | |
| 54 | } |
- | |
| 55 | if( ! second ) return -1; |
- | |
| 56 | f = ( uint8_t * ) first; |
- | |
| 57 | s = ( uint8_t * ) second; |
- | |
| 58 | while(( length > 0 ) && (( * f ) == ( * s ))){ |
- | |
| 59 | -- length; |
- | |
| 60 | ++ f; |
- | |
| 61 | ++ s; |
- | |
| 62 | } |
- | |
| 63 | return length ? ((( * f ) < ( * s )) ? 1 : -1 ): 0; |
- | |
| 64 | } |
- | |
| 65 | 50 | ||
| 66 | #define inb( port ) pio_read_8(( ioport8_t * ) ( port )) |
51 | #define inb( port ) pio_read_8(( ioport8_t * ) ( port )) |
| 67 | #define inw( port ) pio_read_16(( ioport16_t * ) ( port )) |
52 | #define inw( port ) pio_read_16(( ioport16_t * ) ( port )) |
| 68 | #define outb( port, value ) pio_write_8(( ioport8_t * ) ( port ), ( value )) |
53 | #define outb( port, value ) pio_write_8(( ioport8_t * ) ( port ), ( value )) |
| 69 | #define outw( port, value ) pio_write_16(( ioport16_t * ) ( port ), ( value )) |
54 | #define outw( port, value ) pio_write_16(( ioport16_t * ) ( port ), ( value )) |
| 70 | 55 | ||
| 71 | #define panic( ... ) { printf( __VA_ARGS__ ); return; } |
56 | #define panic( ... ) printf( "%s%s%d", __VA_ARGS__ ) |
| - | 57 | ||
| - | 58 | #define sys_vircopy( proc, src_s, src, me, dst_s, dst, bytes ) ({ memcpy(( void * )( dst ), ( void * )( src ), ( bytes )); EOK; }) |
|
| - | 59 | #define do_vir_insb( port, proc, src, bytes ) insb(( port ), ( void * )( src ), ( bytes )) |
|
| - | 60 | #define do_vir_insw( port, proc, src, bytes ) insw(( port ), ( void * )( src ), ( bytes )) |
|
| - | 61 | #define do_vir_outsb( port, proc, src, bytes ) outsb(( port ), ( void * )( src ), ( bytes )) |
|
| - | 62 | #define do_vir_outsw( port, proc, src, bytes ) outsw(( port ), ( void * )( src ), ( bytes )) |
|
| 72 | 63 | ||
| 73 | /* com.h */ |
64 | /* com.h */ |
| 74 | /* Bits in 'DL_MODE' field of DL requests. */ |
65 | /* Bits in 'DL_MODE' field of DL requests. */ |
| 75 | # define DL_NOMODE 0x0 |
66 | # define DL_NOMODE 0x0 |
| 76 | # define DL_PROMISC_REQ 0x2 |
67 | # define DL_PROMISC_REQ 0x2 |
| Line 81... | Line 72... | ||
| 81 | #define TRUE 1 /* used for turning integers into Booleans */ |
72 | #define TRUE 1 /* used for turning integers into Booleans */ |
| 82 | #define FALSE 0 /* used for turning integers into Booleans */ |
73 | #define FALSE 0 /* used for turning integers into Booleans */ |
| 83 | #define NO_NUM 0x8000 /* used as numerical argument to panic() */ |
74 | #define NO_NUM 0x8000 /* used as numerical argument to panic() */ |
| 84 | 75 | ||
| 85 | /* devio.h */ |
76 | /* devio.h */ |
| 86 | typedef u16_t port_t; |
77 | //typedef u16_t port_t; |
| - | 78 | typedef int port_t; |
|
| 87 | 79 | ||
| 88 | /* dl_eth.h */ |
80 | /* dl_eth.h */ |
| 89 | typedef struct eth_stat |
81 | typedef struct eth_stat |
| 90 | { |
82 | { |
| 91 | unsigned long ets_recvErr, /* # receive errors */ |
83 | unsigned long ets_recvErr, /* # receive errors */ |