if_ep_isa.c (54197) | if_ep_isa.c (54198) |
---|---|
1/* 2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * | 1/* 2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * |
30 * $FreeBSD: head/sys/dev/ep/if_ep_isa.c 54197 1999-12-06 08:40:59Z mdodd $ | 30 * $FreeBSD: head/sys/dev/ep/if_ep_isa.c 54198 1999-12-06 08:59:52Z mdodd $ |
31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/socket.h> 37 38#include <sys/module.h> --- 58 unchanged lines hidden (view full) --- 97 * cards check for contention (ie: if one card writes a 0 bit and another 98 * writes a 1 bit then the host sees a 0. At the end of the cycle; each card 99 * compares the data on the bus; if there is a difference then that card goes 100 * into ID_WAIT state again). In the meantime; one bit of data is returned in 101 * the AX register which is conveniently returned to us by inb(). Hence; we 102 * read 16 times getting one bit of data with each read. 103 */ 104 | 31 */ 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/socket.h> 37 38#include <sys/module.h> --- 58 unchanged lines hidden (view full) --- 97 * cards check for contention (ie: if one card writes a 0 bit and another 98 * writes a 1 bit then the host sees a 0. At the end of the cycle; each card 99 * compares the data on the bus; if there is a difference then that card goes 100 * into ID_WAIT state again). In the meantime; one bit of data is returned in 101 * the AX register which is conveniently returned to us by inb(). Hence; we 102 * read 16 times getting one bit of data with each read. 103 */ 104 |
105static int | 105static u_int16_t |
106get_eeprom_data(id_port, offset) | 106get_eeprom_data(id_port, offset) |
107 int id_port; 108 int offset; | 107 int id_port; 108 int offset; |
109{ | 109{ |
110 int i, data = 0; 111 outb(id_port, 0x80 + offset); 112 for (i = 0; i < 16; i++) { | 110 int i; 111 u_int16_t data = 0; 112 113 outb(id_port, EEPROM_CMD_RD|offset); |
113 DELAY(BIT_DELAY_MULTIPLE * 1000); | 114 DELAY(BIT_DELAY_MULTIPLE * 1000); |
114 data = (data << 1) | (inw(id_port) & 1); 115 } 116 return (data); | 115 for (i = 0; i < 16; i++) { 116 DELAY(50); 117 data = (data << 1) | (inw(id_port) & 1); 118 } 119 return (data); |
117} 118 119const char * 120ep_isa_match_id (id, isa_devs) 121 u_int32_t id; 122 struct isa_ident * isa_devs; 123{ 124 struct isa_ident * i = isa_devs; --- 214 unchanged lines hidden --- | 120} 121 122const char * 123ep_isa_match_id (id, isa_devs) 124 u_int32_t id; 125 struct isa_ident * isa_devs; 126{ 127 struct isa_ident * i = isa_devs; --- 214 unchanged lines hidden --- |