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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/iicbus/iiconf.c 289095 2015-10-09 23:20:08Z ian $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/lock.h> 33#include <sys/malloc.h> 34#include <sys/module.h> 35#include <sys/mutex.h> 36#include <sys/bus.h> 37 38#include <dev/iicbus/iiconf.h> 39#include <dev/iicbus/iicbus.h> 40#include "iicbus_if.h" 41 42/* |
43 * Translate IIC_Exxxxx status values to vaguely-equivelent errno values. 44 */ 45int 46iic2errno(int iic_status) 47{ 48 switch (iic_status) { 49 case IIC_NOERR: return (0); 50 case IIC_EBUSERR: return (EALREADY); 51 case IIC_ENOACK: return (EIO); 52 case IIC_ETIMEOUT: return (ETIMEDOUT); 53 case IIC_EBUSBSY: return (EWOULDBLOCK); 54 case IIC_ESTATUS: return (EPROTO); 55 case IIC_EUNDERFLOW: return (EIO); 56 case IIC_EOVERFLOW: return (EOVERFLOW); 57 case IIC_ENOTSUPP: return (EOPNOTSUPP); 58 case IIC_ENOADDR: return (EADDRNOTAVAIL); 59 case IIC_ERESOURCE: return (ENOMEM); 60 default: return (EIO); 61 } 62} 63 64/* |
65 * iicbus_intr() 66 */ 67void 68iicbus_intr(device_t bus, int event, char *buf) 69{ 70 struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); 71 72 /* call owner's intr routine */ --- 373 unchanged lines hidden --- |