iicsmb.c (46743) | iicsmb.c (49195) |
---|---|
1/*- 2 * Copyright (c) 1998 Nicolas Souchu 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Nicolas Souchu 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: iicsmb.c,v 1.2 1998/10/31 11:31:07 nsouch Exp $ | 26 * $Id: iicsmb.c,v 1.3 1999/05/08 21:59:05 dfr Exp $ |
27 * 28 */ 29 30/* 31 * I2C to SMB bridge 32 * 33 * Example: 34 * --- 43 unchanged lines hidden (view full) --- 78 char low; /* low byte received first */ 79 char high; /* high byte */ 80 81 device_t smbus; 82}; 83 84static int iicsmb_probe(device_t); 85static int iicsmb_attach(device_t); | 27 * 28 */ 29 30/* 31 * I2C to SMB bridge 32 * 33 * Example: 34 * --- 43 unchanged lines hidden (view full) --- 78 char low; /* low byte received first */ 79 char high; /* high byte */ 80 81 device_t smbus; 82}; 83 84static int iicsmb_probe(device_t); 85static int iicsmb_attach(device_t); |
86static void iicsmb_print_child(device_t, device_t); | |
87 88static void iicsmb_intr(device_t dev, int event, char *buf); 89static int iicsmb_callback(device_t dev, int index, caddr_t data); 90static int iicsmb_quick(device_t dev, u_char slave, int how); 91static int iicsmb_sendb(device_t dev, u_char slave, char byte); 92static int iicsmb_recvb(device_t dev, u_char slave, char *byte); 93static int iicsmb_writeb(device_t dev, u_char slave, char cmd, char byte); 94static int iicsmb_writew(device_t dev, u_char slave, char cmd, short word); --- 6 unchanged lines hidden (view full) --- 101static devclass_t iicsmb_devclass; 102 103static device_method_t iicsmb_methods[] = { 104 /* device interface */ 105 DEVMETHOD(device_probe, iicsmb_probe), 106 DEVMETHOD(device_attach, iicsmb_attach), 107 108 /* bus interface */ | 86 87static void iicsmb_intr(device_t dev, int event, char *buf); 88static int iicsmb_callback(device_t dev, int index, caddr_t data); 89static int iicsmb_quick(device_t dev, u_char slave, int how); 90static int iicsmb_sendb(device_t dev, u_char slave, char byte); 91static int iicsmb_recvb(device_t dev, u_char slave, char *byte); 92static int iicsmb_writeb(device_t dev, u_char slave, char cmd, char byte); 93static int iicsmb_writew(device_t dev, u_char slave, char cmd, short word); --- 6 unchanged lines hidden (view full) --- 100static devclass_t iicsmb_devclass; 101 102static device_method_t iicsmb_methods[] = { 103 /* device interface */ 104 DEVMETHOD(device_probe, iicsmb_probe), 105 DEVMETHOD(device_attach, iicsmb_attach), 106 107 /* bus interface */ |
109 DEVMETHOD(bus_print_child, iicsmb_print_child), | 108 DEVMETHOD(bus_print_child, bus_generic_print_child), |
110 111 /* iicbus interface */ 112 DEVMETHOD(iicbus_intr, iicsmb_intr), 113 114 /* smbus interface */ 115 DEVMETHOD(smbus_callback, iicsmb_callback), 116 DEVMETHOD(smbus_quick, iicsmb_quick), 117 DEVMETHOD(smbus_sendb, iicsmb_sendb), --- 34 unchanged lines hidden (view full) --- 152 struct iicsmb_softc *sc = (struct iicsmb_softc *)device_get_softc(dev); 153 154 /* probe and attach the smbus */ 155 device_probe_and_attach(sc->smbus); 156 157 return (0); 158} 159 | 109 110 /* iicbus interface */ 111 DEVMETHOD(iicbus_intr, iicsmb_intr), 112 113 /* smbus interface */ 114 DEVMETHOD(smbus_callback, iicsmb_callback), 115 DEVMETHOD(smbus_quick, iicsmb_quick), 116 DEVMETHOD(smbus_sendb, iicsmb_sendb), --- 34 unchanged lines hidden (view full) --- 151 struct iicsmb_softc *sc = (struct iicsmb_softc *)device_get_softc(dev); 152 153 /* probe and attach the smbus */ 154 device_probe_and_attach(sc->smbus); 155 156 return (0); 157} 158 |
160static void 161iicsmb_print_child(device_t bus, device_t dev) 162{ 163 printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); 164 165 return; 166} 167 | |
168/* 169 * iicsmb_intr() 170 * 171 * iicbus interrupt handler 172 */ 173static void 174iicsmb_intr(device_t dev, int event, char *buf) 175{ --- 324 unchanged lines hidden --- | 159/* 160 * iicsmb_intr() 161 * 162 * iicbus interrupt handler 163 */ 164static void 165iicsmb_intr(device_t dev, int event, char *buf) 166{ --- 324 unchanged lines hidden --- |