Changeset 8f5e2527 in mainline
- Timestamp:
- 2011-01-06T13:58:09Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95ff5c4
- Parents:
- 4765152
- Location:
- uspace/srv/hw/netif/dp8390
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/netif/dp8390/dp8390.c
r4765152 r8f5e2527 1 /*2 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:3 *4 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.5 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.6 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.7 * * Any deviations from these conditions require written permission from the copyright holder in advance8 *9 *10 * Disclaimer11 *12 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR13 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES14 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.15 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,18 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY19 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.22 *23 * Changes:24 * 2009 ported to HelenOS, Lukas Mejdrech25 */26 27 1 /** @addtogroup dp8390 28 2 * @{ … … 43 17 #include "dp8390_drv.h" 44 18 #include "dp8390_port.h" 45 46 /*47 * dp8390.c48 *49 * Created: before Dec 28, 1992 by Philip Homburg <philip@f-mnx.phicoh.com>50 *51 * Modified Mar 10 1994 by Philip Homburg52 * Become a generic dp8390 driver.53 *54 * Modified Dec 20 1996 by G. Falzoni <falzoni@marina.scn.de>55 * Added support for 3c503 boards.56 */57 19 58 20 #include "local.h" … … 81 43 static void outsw(port_t port, void * buf, size_t size); 82 44 83 //static u16_t eth_ign_proto;84 //static char *progname;85 86 /* Configuration */87 /*typedef struct dp_conf88 {89 port_t dpc_port;90 int dpc_irq;91 phys_bytes dpc_mem;92 char *dpc_envvar;93 } dp_conf_t;94 */95 //dp_conf_t dp_conf[]= /* Card addresses */96 //{97 /* I/O port, IRQ, Buffer address, Env. var. */98 /* { 0x280, 3, 0xD0000, "DPETH0" },99 { 0x300, 5, 0xC8000, "DPETH1" },100 { 0x380, 10, 0xD8000, "DPETH2" },101 };102 */103 /* Test if dp_conf has exactly DE_PORT_NR entries. If not then you will see104 * the error: "array size is negative".105 */106 //extern int ___dummy[DE_PORT_NR == sizeof(dp_conf)/sizeof(dp_conf[0]) ? 1 : -1];107 108 /* Card inits configured out? */109 #if !ENABLE_WDETH110 #define wdeth_probe(dep) (0)111 #endif112 #if !ENABLE_NE2000113 #define ne_probe(dep) (0)114 #endif115 #if !ENABLE_3C503116 #define el2_probe(dep) (0)117 #endif118 119 45 /* Some clones of the dp8390 and the PC emulator 'Bochs' require the CR_STA 120 46 * on writes to the CR register. Additional CR_STAs do not appear to hurt … … 123 49 #define CR_EXTRA CR_STA 124 50 125 //#if ENABLE_PCI126 //_PROTOTYPE(static void pci_conf, (void) );127 //#endif128 //_PROTOTYPE(static void do_vwrite, (message *mp, int from_int,129 // int vectored) );130 //_PROTOTYPE(static void do_vwrite_s, (message *mp, int from_int) );131 //_PROTOTYPE(static void do_vread, (message *mp, int vectored) );132 //_PROTOTYPE(static void do_vread_s, (message *mp) );133 //_PROTOTYPE(static void do_init, (message *mp) );134 //_PROTOTYPE(static void do_int, (dpeth_t *dep) );135 //_PROTOTYPE(static void do_getstat, (message *mp) );136 //_PROTOTYPE(static void do_getstat_s, (message *mp) );137 //_PROTOTYPE(static void do_getname, (message *mp) );138 //_PROTOTYPE(static void do_stop, (message *mp) );139 51 _PROTOTYPE(static void dp_init, (dpeth_t *dep) ); 140 //_PROTOTYPE(static void dp_confaddr, (dpeth_t *dep) );141 52 _PROTOTYPE(static void dp_reinit, (dpeth_t *dep) ); 142 53 _PROTOTYPE(static void dp_reset, (dpeth_t *dep) ); 143 //_PROTOTYPE(static void dp_check_ints, (dpeth_t *dep) );144 54 _PROTOTYPE(static void dp_recv, (dpeth_t *dep) ); 145 55 _PROTOTYPE(static void dp_send, (dpeth_t *dep) ); 146 //_PROTOTYPE(static void dp8390_stop, (void) );147 _PROTOTYPE(static void dp_getblock, (dpeth_t *dep, int page,148 size_t offset, size_t size, void *dst) );149 56 _PROTOTYPE(static void dp_pio8_getblock, (dpeth_t *dep, int page, 150 57 size_t offset, size_t size, void *dst) ); … … 153 60 _PROTOTYPE(static int dp_pkt2user, (dpeth_t *dep, int page, 154 61 int length) ); 155 //_PROTOTYPE(static int dp_pkt2user_s, (dpeth_t *dep, int page,156 // int length) );157 _PROTOTYPE(static void dp_user2nic, (dpeth_t *dep, iovec_dat_t *iovp,158 vir_bytes offset, int nic_addr, vir_bytes count) );159 //_PROTOTYPE(static void dp_user2nic_s, (dpeth_t *dep, iovec_dat_s_t *iovp,160 // vir_bytes offset, int nic_addr, vir_bytes count) );161 62 _PROTOTYPE(static void dp_pio8_user2nic, (dpeth_t *dep, 162 63 iovec_dat_t *iovp, vir_bytes offset, 163 64 int nic_addr, vir_bytes count) ); 164 //_PROTOTYPE(static void dp_pio8_user2nic_s, (dpeth_t *dep,165 // iovec_dat_s_t *iovp, vir_bytes offset,166 // int nic_addr, vir_bytes count) );167 65 _PROTOTYPE(static void dp_pio16_user2nic, (dpeth_t *dep, 168 66 iovec_dat_t *iovp, vir_bytes offset, 169 67 int nic_addr, vir_bytes count) ); 170 //_PROTOTYPE(static void dp_pio16_user2nic_s, (dpeth_t *dep,171 // iovec_dat_s_t *iovp, vir_bytes offset,172 // int nic_addr, vir_bytes count) );173 _PROTOTYPE(static void dp_nic2user, (dpeth_t *dep, int nic_addr,174 iovec_dat_t *iovp, vir_bytes offset, vir_bytes count) );175 //_PROTOTYPE(static void dp_nic2user_s, (dpeth_t *dep, int nic_addr,176 // iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count) );177 68 _PROTOTYPE(static void dp_pio8_nic2user, (dpeth_t *dep, int nic_addr, 178 69 iovec_dat_t *iovp, vir_bytes offset, vir_bytes count) ); 179 //_PROTOTYPE(static void dp_pio8_nic2user_s, (dpeth_t *dep, int nic_addr,180 // iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count) );181 70 _PROTOTYPE(static void dp_pio16_nic2user, (dpeth_t *dep, int nic_addr, 182 71 iovec_dat_t *iovp, vir_bytes offset, vir_bytes count) ); 183 //_PROTOTYPE(static void dp_pio16_nic2user_s, (dpeth_t *dep, int nic_addr,184 // iovec_dat_s_t *iovp, vir_bytes offset, vir_bytes count) );185 72 _PROTOTYPE(static void dp_next_iovec, (iovec_dat_t *iovp) ); 186 //_PROTOTYPE(static void dp_next_iovec_s, (iovec_dat_s_t *iovp) );187 73 _PROTOTYPE(static void conf_hw, (dpeth_t *dep) ); 188 //_PROTOTYPE(static void update_conf, (dpeth_t *dep, dp_conf_t *dcp) );189 _PROTOTYPE(static void map_hw_buffer, (dpeth_t *dep) );190 //_PROTOTYPE(static int calc_iovec_size, (iovec_dat_t *iovp) );191 //_PROTOTYPE(static int calc_iovec_size_s, (iovec_dat_s_t *iovp) );192 74 _PROTOTYPE(static void reply, (dpeth_t *dep, int err, int may_block) ); 193 //_PROTOTYPE(static void mess_reply, (message *req, message *reply) );194 75 _PROTOTYPE(static void get_userdata, (int user_proc, 195 76 vir_bytes user_addr, vir_bytes count, void *loc_addr) ); 196 //_PROTOTYPE(static void get_userdata_s, (int user_proc,197 // cp_grant_id_t grant, vir_bytes offset, vir_bytes count,198 // void *loc_addr) );199 //_PROTOTYPE(static void put_userdata, (int user_proc,200 // vir_bytes user_addr, vir_bytes count, void *loc_addr) );201 //_PROTOTYPE(static void put_userdata_s, (int user_proc,202 // cp_grant_id_t grant, size_t count, void *loc_addr) );203 77 _PROTOTYPE(static void insb, (port_t port, void *buf, size_t size) ); 204 78 _PROTOTYPE(static void insw, (port_t port, void *buf, size_t size) ); 205 //_PROTOTYPE(static void do_vir_insb, (port_t port, int proc,206 // vir_bytes buf, size_t size) );207 //_PROTOTYPE(static void do_vir_insw, (port_t port, int proc,208 // vir_bytes buf, size_t size) );209 //_PROTOTYPE(static void do_vir_outsb, (port_t port, int proc,210 // vir_bytes buf, size_t size) );211 //_PROTOTYPE(static void do_vir_outsw, (port_t port, int proc,212 // vir_bytes buf, size_t size) );213 79 214 80 int do_probe(dpeth_t * dep){ … … 494 360 i < 5 ? ':' : '\n'); 495 361 } 496 497 /* Map buffer */498 map_hw_buffer(dep);499 362 500 363 /* Initialization of the dp8390 following the mandatory procedure … … 567 430 dep->de_sendq_head= 0; 568 431 dep->de_sendq_tail= 0; 569 if (!dep->de_prog_IO) 570 { 571 dep->de_user2nicf= dp_user2nic; 572 // dep->de_user2nicf_s= dp_user2nic_s; 573 dep->de_nic2userf= dp_nic2user; 574 // dep->de_nic2userf_s= dp_nic2user_s; 575 dep->de_getblockf= dp_getblock; 576 } 577 else if (dep->de_16bit) 432 if (dep->de_16bit) 578 433 { 579 434 dep->de_user2nicf= dp_pio16_user2nic; … … 938 793 939 794 /*===========================================================================* 940 * dp_getblock *941 *===========================================================================*/942 static void dp_getblock(dep, page, offset, size, dst)943 dpeth_t *dep;944 int page;945 size_t offset;946 size_t size;947 void *dst;948 {949 // int r;950 951 offset = page * DP_PAGESIZE + offset;952 953 memcpy(dst, dep->de_locmem + offset, size);954 }955 956 /*===========================================================================*957 795 * dp_pio8_getblock * 958 796 *===========================================================================*/ … … 1051 889 } 1052 890 return OK; 1053 }1054 1055 /*===========================================================================*1056 * dp_user2nic *1057 *===========================================================================*/1058 static void dp_user2nic(dep, iovp, offset, nic_addr, count)1059 dpeth_t *dep;1060 iovec_dat_t *iovp;1061 vir_bytes offset;1062 int nic_addr;1063 vir_bytes count;1064 {1065 vir_bytes vir_hw;//, vir_user;1066 //int bytes, i, r;1067 int i, r;1068 vir_bytes bytes;1069 1070 vir_hw = (vir_bytes)dep->de_locmem + nic_addr;1071 1072 i= 0;1073 while (count > 0)1074 {1075 if (i >= IOVEC_NR)1076 {1077 dp_next_iovec(iovp);1078 i= 0;1079 continue;1080 }1081 assert(i < iovp->iod_iovec_s);1082 if (offset >= iovp->iod_iovec[i].iov_size)1083 {1084 offset -= iovp->iod_iovec[i].iov_size;1085 i++;1086 continue;1087 }1088 bytes = iovp->iod_iovec[i].iov_size - offset;1089 if (bytes > count)1090 bytes = count;1091 1092 r= sys_vircopy(iovp->iod_proc_nr, D,1093 iovp->iod_iovec[i].iov_addr + offset,1094 SELF, D, vir_hw, bytes);1095 if (r != OK)1096 panic("DP8390", "dp_user2nic: sys_vircopy failed", r);1097 1098 count -= bytes;1099 vir_hw += bytes;1100 offset += bytes;1101 }1102 assert(count == 0);1103 891 } 1104 892 … … 1281 1069 1282 1070 /*===========================================================================* 1283 * dp_nic2user *1284 *===========================================================================*/1285 static void dp_nic2user(dep, nic_addr, iovp, offset, count)1286 dpeth_t *dep;1287 int nic_addr;1288 iovec_dat_t *iovp;1289 vir_bytes offset;1290 vir_bytes count;1291 {1292 vir_bytes vir_hw;//, vir_user;1293 vir_bytes bytes;1294 int i, r;1295 1296 vir_hw = (vir_bytes)dep->de_locmem + nic_addr;1297 1298 i= 0;1299 while (count > 0)1300 {1301 if (i >= IOVEC_NR)1302 {1303 dp_next_iovec(iovp);1304 i= 0;1305 continue;1306 }1307 assert(i < iovp->iod_iovec_s);1308 if (offset >= iovp->iod_iovec[i].iov_size)1309 {1310 offset -= iovp->iod_iovec[i].iov_size;1311 i++;1312 continue;1313 }1314 bytes = iovp->iod_iovec[i].iov_size - offset;1315 if (bytes > count)1316 bytes = count;1317 1318 r= sys_vircopy(SELF, D, vir_hw,1319 iovp->iod_proc_nr, D,1320 iovp->iod_iovec[i].iov_addr + offset, bytes);1321 if (r != OK)1322 panic("DP8390", "dp_nic2user: sys_vircopy failed", r);1323 1324 count -= bytes;1325 vir_hw += bytes;1326 offset += bytes;1327 }1328 assert(count == 0);1329 }1330 1331 /*===========================================================================*1332 1071 * dp_pio8_nic2user * 1333 1072 *===========================================================================*/ … … 1514 1253 // if (dep->de_mode != DEM_ENABLED) 1515 1254 // return; 1516 if (!wdeth_probe(dep) && !ne_probe(dep) && !el2_probe(dep)) 1517 { 1255 if (!ne_probe(dep)) { 1518 1256 printf("%s: No ethernet card found at %#lx\n", 1519 1257 dep->de_name, dep->de_base_port); … … 1528 1266 dep->de_flags = DEF_EMPTY; 1529 1267 // dep->de_stat = empty_stat; 1530 }1531 1532 /*===========================================================================*1533 * map_hw_buffer *1534 *===========================================================================*/1535 static void map_hw_buffer(dep)1536 dpeth_t *dep;1537 {1538 // int r;1539 // size_t o, size;1540 // char *buf, *abuf;1541 1542 if (dep->de_prog_IO)1543 {1544 #if 01545 if(debug){1546 printf(1547 "map_hw_buffer: programmed I/O, no need to map buffer\n");1548 }1549 #endif1550 dep->de_locmem = (char *)-dep->de_ramsize; /* trap errors */1551 return;1552 }else{1553 printf("map_hw_buffer: no buffer!\n");1554 }1555 1556 // size = dep->de_ramsize + PAGE_SIZE; /* Add PAGE_SIZE for1557 // * alignment1558 // */1559 // buf= malloc(size);1560 // if (buf == NULL)1561 // panic(__FILE__, "map_hw_buffer: cannot malloc size", size);1562 // o= PAGE_SIZE - ((vir_bytes)buf % PAGE_SIZE);1563 // abuf= buf + o;1564 // printf("buf at 0x%x, abuf at 0x%x\n", buf, abuf);1565 1566 // r= sys_vm_map(SELF, 1 /* map */, (vir_bytes)abuf,1567 // dep->de_ramsize, (phys_bytes)dep->de_linmem);1568 // if (r != OK)1569 // panic(__FILE__, "map_hw_buffer: sys_vm_map failed", r);1570 // dep->de_locmem = abuf;1571 1268 } 1572 1269 … … 1665 1362 } 1666 1363 1667 /*1668 * $PchId: dp8390.c,v 1.25 2005/02/10 17:32:07 philip Exp $1669 */1670 1671 1364 /** @} 1672 1365 */ -
uspace/srv/hw/netif/dp8390/dp8390.h
r4765152 r8f5e2527 1 /*2 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:3 *4 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.5 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.6 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.7 * * Any deviations from these conditions require written permission from the copyright holder in advance8 *9 *10 * Disclaimer11 *12 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR13 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES14 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.15 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,18 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY19 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.22 *23 * Changes:24 * 2009 ported to HelenOS, Lukas Mejdrech25 */26 27 1 /** @addtogroup dp8390 28 2 * @{ … … 44 18 */ 45 19 #define DP8390_IO_SIZE 0x020 46 47 /*48 dp8390.h49 50 Created: before Dec 28, 1992 by Philip Homburg51 */52 20 53 21 /* National Semiconductor DP8390 Network Interface Controller. */ … … 330 298 * hardwired in the board, the probe should modify these fields. 331 299 * Futhermore, the probe routine should also fill in de_initf and 332 * de_stopf fields with the appropriate function pointers and set 333 * de_prog_IO iff programmed I/O is to be used. 300 * de_stopf fields with the appropriate function pointers. 334 301 */ 335 302 port_t de_base_port; 336 303 phys_bytes de_linmem; 337 char *de_locmem;338 304 int de_irq; 339 305 int de_int_pending; … … 341 307 dp_initf_t de_initf; 342 308 dp_stopf_t de_stopf; 343 int de_prog_IO;344 309 char de_name[sizeof("dp8390#n")]; 345 310 … … 360 325 /* should be here - read even for ne2k isa init... */ 361 326 char de_pci; /* TRUE iff PCI device */ 362 363 #if ENABLE_PCI364 /* PCI config */365 // char de_pci; /* TRUE iff PCI device */366 // u8_t de_pcibus;367 // u8_t de_pcidev;368 // u8_t de_pcifunc;369 #endif370 327 371 328 /* Do it yourself send queue */ … … 418 375 #define DEM_ENABLED 0x2 419 376 420 //#if !__minix_vmd 421 #define debug 1 /* Standard Minix lacks debug variable */ 422 //#endif 423 424 /* 425 * $PchId: dp8390.h,v 1.10 2005/02/10 17:26:06 philip Exp $ 426 */ 377 #define debug 1 427 378 428 379 #endif -
uspace/srv/hw/netif/dp8390/dp8390_module.c
r4765152 r8f5e2527 131 131 fibril_rwlock_write_unlock(&netif_globals.lock); 132 132 } 133 ipc_answer_0(iid, EOK);134 133 } 135 134 -
uspace/srv/hw/netif/dp8390/local.h
r4765152 r8f5e2527 1 /*2 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:3 *4 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.5 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.6 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.7 * * Any deviations from these conditions require written permission from the copyright holder in advance8 *9 *10 * Disclaimer11 *12 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR13 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES14 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.15 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,18 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY19 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.22 *23 * Changes:24 * 2009 ported to HelenOS, Lukas Mejdrech25 */26 27 1 /** @addtogroup dp8390 28 2 * @{ … … 38 12 #include "dp8390_port.h" 39 13 40 /*41 local.h42 */43 44 /** WDETH switch.45 */46 #define ENABLE_WDETH 047 48 /** NE2000 switch.49 */50 #define ENABLE_NE2000 151 52 /** 3C503 switch.53 */54 #define ENABLE_3C503 055 56 /** PCI support switch.57 */58 #define ENABLE_PCI 059 60 14 struct dpeth; 61 15 62 /* 3c503.c */63 /* * Probes a 3C503 network interface.64 * @param[in] dep The network interface structure.65 * @returns 1 if the NE2000 network interface is present.66 * @returns 0 otherwise.67 */68 //_PROTOTYPE(int el2_probe, (struct dpeth*dep) );69 70 /* ne2000.c */71 /** Probes a NE2000 or NE1000 network interface.72 * @param[in] dep The network interface structure.73 * @returns 1 if the NE2000 network interface is present.74 * @returns 0 otherwise.75 */76 16 int ne_probe(struct dpeth * dep); 77 //_PROTOTYPE(int ne_probe, (struct dpeth *dep) );78 //_PROTOTYPE(void ne_init, (struct dpeth *dep) );79 80 /* rtl8029.c */81 /* * Probes a RTL8029 network interface.82 * @param[in] dep The network interface structure.83 * @returns 1 if the NE2000 network interface is present.84 * @returns 0 otherwise.85 */86 //_PROTOTYPE(int rtl_probe, (struct dpeth *dep) );87 88 /* wdeth.c */89 /* * Probes a WDETH network interface.90 * @param[in] dep The network interface structure.91 * @returns 1 if the NE2000 network interface is present.92 * @returns 0 otherwise.93 */94 //_PROTOTYPE(int wdeth_probe, (struct dpeth*dep) );95 17 96 18 #endif -
uspace/srv/hw/netif/dp8390/ne2000.c
r4765152 r8f5e2527 1 /*2 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:3 *4 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.5 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.6 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.7 * * Any deviations from these conditions require written permission from the copyright holder in advance8 *9 *10 * Disclaimer11 *12 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR13 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES14 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.15 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,18 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY19 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.22 *23 * Changes:24 * 2009 ported to HelenOS, Lukas Mejdrech25 */26 27 1 /** @addtogroup ne2k 28 2 * @{ … … 37 11 38 12 #include "dp8390_port.h" 39 40 /*41 ne2000.c42 43 Driver for the ne2000 ethernet cards. This file contains only the ne200044 specific code, the rest is in dp8390.c45 46 Created: March 15, 1994 by Philip Homburg <philip@f-mnx.phicoh.com>47 */48 49 //#include "../drivers.h"50 51 //#include <net/gen/ether.h>52 //#include <net/gen/eth_io.h>53 //#if __minix_vmd54 //#include "config.h"55 //#endif56 13 57 14 #include "local.h" … … 59 16 #include "ne2000.h" 60 17 61 #if ENABLE_NE200062 63 18 /** Number of bytes to transfer. 64 19 */ 65 20 #define N 100 66 67 //#define MILLIS_TO_TICKS(m) (((m)*HZ/1000)+1)68 21 69 22 /** Sleeps for the defined millicesonds. … … 114 67 */ 115 68 static void ne_stop(dpeth_t *dep); 116 //_PROTOTYPE(static void milli_delay, (unsigned long millis) );117 69 118 70 /** Initializes the NE2000 network interface. … … 196 148 dep->de_initf= ne_init; 197 149 dep->de_stopf= ne_stop; 198 dep->de_prog_IO= 1;199 150 return 1; 200 151 } … … 401 352 outb_ne(dep, NE_RESET, byte); 402 353 } 403 /*404 static void milli_delay(unsigned long millis)405 {406 tickdelay(MILLIS_TO_TICKS(millis));407 }408 */409 #endif /* ENABLE_NE2000 */410 411 /*412 * $PchId: ne2000.c,v 1.10 2004/08/03 12:03:00 philip Exp $413 */414 354 415 355 /** @} -
uspace/srv/hw/netif/dp8390/ne2000.h
r4765152 r8f5e2527 1 /*2 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:3 *4 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.5 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.6 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.7 * * Any deviations from these conditions require written permission from the copyright holder in advance8 *9 *10 * Disclaimer11 *12 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR13 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES14 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.15 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,18 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY19 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.22 *23 * Changes:24 * 2009 ported to HelenOS, Lukas Mejdrech25 */26 27 /*28 ne2000.h29 30 Created: March 15, 1994 by Philip Homburg <philip@f-mnx.phicoh.com>31 */32 33 1 /** @addtogroup ne2k 34 2 * @{ … … 104 72 #endif /* __NET_NETIF_NE2000_H__ */ 105 73 106 /*107 * $PchId: ne2000.h,v 1.4 2004/08/03 12:03:20 philip Exp $108 */109 110 74 /** @} 111 75 */
Note:
See TracChangeset
for help on using the changeset viewer.