lpbb.c (184130) | lpbb.c (185003) |
---|---|
1/*- 2 * Copyright (c) 1998, 2001 Nicolas Souchu, Marc Bouget 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 * 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 * 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998, 2001 Nicolas Souchu, Marc Bouget 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 * 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 * 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/ppbus/lpbb.c 184130 2008-10-21 18:30:10Z jhb $"); | 30__FBSDID("$FreeBSD: head/sys/dev/ppbus/lpbb.c 185003 2008-11-16 17:42:02Z jhb $"); |
31 32/* 33 * I2C Bit-Banging over parallel port 34 * 35 * See the Official Philips interface description in lpbb(4) 36 */ 37 38#include <sys/param.h> --- 40 unchanged lines hidden (view full) --- 79 80 return (0); 81} 82 83static int 84lpbb_attach(device_t dev) 85{ 86 device_t bitbang; | 31 32/* 33 * I2C Bit-Banging over parallel port 34 * 35 * See the Official Philips interface description in lpbb(4) 36 */ 37 38#include <sys/param.h> --- 40 unchanged lines hidden (view full) --- 79 80 return (0); 81} 82 83static int 84lpbb_attach(device_t dev) 85{ 86 device_t bitbang; |
87 | 87 |
88 /* add generic bit-banging code */ 89 bitbang = device_add_child(dev, "iicbb", -1); 90 device_probe_and_attach(bitbang); 91 92 return (0); 93} 94 95static int --- 58 unchanged lines hidden (view full) --- 154static void 155lpbb_setsda(device_t dev, char val) 156{ 157 device_t ppbus = device_get_parent(dev); 158 159 mtx_lock(&Giant); 160 if (val == 0) 161 ppb_wdtr(ppbus, (u_char)SDA_out); | 88 /* add generic bit-banging code */ 89 bitbang = device_add_child(dev, "iicbb", -1); 90 device_probe_and_attach(bitbang); 91 92 return (0); 93} 94 95static int --- 58 unchanged lines hidden (view full) --- 154static void 155lpbb_setsda(device_t dev, char val) 156{ 157 device_t ppbus = device_get_parent(dev); 158 159 mtx_lock(&Giant); 160 if (val == 0) 161 ppb_wdtr(ppbus, (u_char)SDA_out); |
162 else | 162 else |
163 ppb_wdtr(ppbus, (u_char)~SDA_out); 164 mtx_unlock(&Giant); 165} 166 167static void 168lpbb_setscl(device_t dev, unsigned char val) 169{ 170 device_t ppbus = device_get_parent(dev); 171 172 mtx_lock(&Giant); 173 if (val == 0) 174 ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) & ~SCL_out)); | 163 ppb_wdtr(ppbus, (u_char)~SDA_out); 164 mtx_unlock(&Giant); 165} 166 167static void 168lpbb_setscl(device_t dev, unsigned char val) 169{ 170 device_t ppbus = device_get_parent(dev); 171 172 mtx_lock(&Giant); 173 if (val == 0) 174 ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) & ~SCL_out)); |
175 else 176 ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) | SCL_out)); | 175 else 176 ppb_wctr(ppbus, (u_char)(ppb_rctr(ppbus) | SCL_out)); |
177 mtx_unlock(&Giant); 178} 179 180static int 181lpbb_detect(device_t dev) 182{ 183 device_t ppbus = device_get_parent(dev); 184 --- 75 unchanged lines hidden --- | 177 mtx_unlock(&Giant); 178} 179 180static int 181lpbb_detect(device_t dev) 182{ 183 device_t ppbus = device_get_parent(dev); 184 --- 75 unchanged lines hidden --- |