Rev 4723 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4723 | 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 ne2k |
27 | /** @addtogroup ne2k |
28 | * @{ |
28 | * @{ |
29 | */ |
29 | */ |
30 | 30 | ||
31 | /** @file |
31 | /** @file |
32 | * \todo |
32 | * NE1000 and NE2000 network interface initialization and probe functions implementation. |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <stdio.h> |
35 | #include <stdio.h> |
36 | #include <unistd.h> |
36 | #include <unistd.h> |
37 | 37 | ||
Line 58... | Line 58... | ||
58 | #include "dp8390.h" |
58 | #include "dp8390.h" |
59 | #include "ne2000.h" |
59 | #include "ne2000.h" |
60 | 60 | ||
61 | #if ENABLE_NE2000 |
61 | #if ENABLE_NE2000 |
62 | 62 | ||
- | 63 | /** Number of bytes to transfer. |
|
- | 64 | */ |
|
63 | #define N 100 |
65 | #define N 100 |
64 | 66 | ||
65 | //#define MILLIS_TO_TICKS(m) (((m)*HZ/1000)+1) |
67 | //#define MILLIS_TO_TICKS(m) (((m)*HZ/1000)+1) |
66 | 68 | ||
- | 69 | /** Sleeps for the defined millicesonds. |
|
- | 70 | * @param[in] millis The number of milliseconds to sleep. |
|
- | 71 | */ |
|
- | 72 | #define milli_delay( millis ) usleep(( millis ) * 1000 ) |
|
- | 73 | ||
- | 74 | /** Type definition of the testing function. |
|
- | 75 | */ |
|
67 | _PROTOTYPE( typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat) ); |
76 | _PROTOTYPE( typedef int (*testf_t), (dpeth_t *dep, int pos, u8_t *pat) ); |
68 | 77 | ||
- | 78 | /** First data pattern. |
|
- | 79 | */ |
|
69 | u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 }; |
80 | u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 }; |
- | 81 | ||
- | 82 | /** Second data pattern. |
|
- | 83 | */ |
|
70 | u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF }; |
84 | u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF }; |
- | 85 | ||
- | 86 | /** Third data pattern. |
|
- | 87 | */ |
|
71 | u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 }; |
88 | u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 }; |
- | 89 | ||
- | 90 | /** Fourth data pattern. |
|
- | 91 | */ |
|
72 | u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 }; |
92 | u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 }; |
73 | 93 | ||
- | 94 | /** Tests 8 bit NE2000 network interface. |
|
74 | _PROTOTYPE( static int test_8, (dpeth_t *dep, int pos, u8_t *pat) ); |
95 | * @param[in,out] dep The network interface structure. |
75 | _PROTOTYPE( static int test_16, (dpeth_t *dep, int pos, u8_t *pat) ); |
96 | * @param[in] pos The starting position. |
76 | _PROTOTYPE( static void ne_stop, (dpeth_t *dep) ); |
97 | * @param[in] pat The data pattern to be written. |
- | 98 | * @returns True on success. |
|
- | 99 | * @returns FALSE otherwise. |
|
- | 100 | */ |
|
77 | //_PROTOTYPE( static void milli_delay, (unsigned long millis) ); |
101 | static int test_8(dpeth_t *dep, int pos, u8_t *pat); |
78 | 102 | ||
- | 103 | /** Tests 16 bit NE2000 network interface. |
|
- | 104 | * @param[in,out] dep The network interface structure. |
|
- | 105 | * @param[in] pos The starting position. |
|
- | 106 | * @param[in] pat The data pattern to be written. |
|
- | 107 | * @returns True on success. |
|
- | 108 | * @returns FALSE otherwise. |
|
- | 109 | */ |
|
79 | #define milli_delay( millis ) usleep(( millis ) * 1000 ) |
110 | static int test_16(dpeth_t *dep, int pos, u8_t *pat); |
80 | 111 | ||
- | 112 | /** Stops the NE2000 network interface. |
|
- | 113 | * @param[in,out] dep The network interface structure. |
|
- | 114 | */ |
|
- | 115 | static void ne_stop(dpeth_t *dep); |
|
- | 116 | //_PROTOTYPE( static void milli_delay, (unsigned long millis) ); |
|
- | 117 | ||
- | 118 | /** Initializes the NE2000 network interface. |
|
- | 119 | * @param[in,out] dep The network interface structure. |
|
- | 120 | */ |
|
81 | _PROTOTYPE( void ne_init, (struct dpeth *dep) ); |
121 | void ne_init(struct dpeth *dep); |
82 | 122 | ||
83 | /*===========================================================================* |
123 | /*===========================================================================* |
84 | * ne_probe * |
124 | * ne_probe * |
85 | *===========================================================================*/ |
125 | *===========================================================================*/ |
86 | int ne_probe(dep) |
126 | int ne_probe(dep) |