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

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

add missing copyright headers
remove unused flags

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 * Copyright (c) 2009 Lukas Mejdrech
3 * Copyright (c) 2011 Martin Decky
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/*
31 * This code is based upon the NE2000 driver for MINIX,
32 * distributed according to a BSD-style license.
33 *
34 * Copyright (c) 1987, 1997, 2006 Vrije Universiteit
35 * Copyright (c) 1992, 1994 Philip Homburg
36 * Copyright (c) 1996 G. Falzoni
37 *
38 */
39
40/** @addtogroup ne2k
41 * @{
42 */
43
44/** @file
45 * NE1000 and NE2000 network interface definitions.
46 */
47
48#ifndef __NET_NETIF_NE2000_H__
49#define __NET_NETIF_NE2000_H__
50
51#include <libarch/ddi.h>
52#include "dp8390_port.h"
53
54/** DP8390 register offset.
55 */
56#define NE_DP8390 0x00
57
58/** Data register.
59 */
60#define NE_DATA 0x10
61
62/** Reset register.
63 */
64#define NE_RESET 0x1f
65
66/** NE1000 data start.
67 */
68#define NE1000_START 0x2000
69
70/** NE1000 data size.
71 */
72#define NE1000_SIZE 0x2000
73
74/** NE2000 data start.
75 */
76#define NE2000_START 0x4000
77
78/** NE2000 data size.
79 */
80#define NE2000_SIZE 0x4000
81
82/** Reads 1 byte register.
83 * @param[in] dep The network interface structure.
84 * @param[in] reg The register offset.
85 * @returns The read value.
86 */
87#define inb_ne(dep, reg) (inb(dep->de_base_port + reg))
88
89/** Writes 1 byte register.
90 * @param[in] dep The network interface structure.
91 * @param[in] reg The register offset.
92 * @param[in] data The value to be written.
93 */
94#define outb_ne(dep, reg, data) (outb(dep->de_base_port + reg, data))
95
96/** Reads 1 word (2 bytes) register.
97 * @param[in] dep The network interface structure.
98 * @param[in] reg The register offset.
99 * @returns The read value.
100 */
101#define inw_ne(dep, reg) (inw(dep->de_base_port + reg))
102
103/** Writes 1 word (2 bytes) register.
104 * @param[in] dep The network interface structure.
105 * @param[in] reg The register offset.
106 * @param[in] data The value to be written.
107 */
108#define outw_ne(dep, reg, data) (outw(dep->de_base_port + reg, data))
109
110struct dpeth;
111
112int ne_probe(struct dpeth *dep);
113
114#endif
115
116/** @}
117 */
Note: See TracBrowser for help on using the repository browser.