iicbus_if.m (302408) | iicbus_if.m (323931) |
---|---|
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# $FreeBSD: stable/11/sys/dev/iicbus/iicbus_if.m 281828 2015-04-21 11:50:31Z jah $ | 26# $FreeBSD: stable/11/sys/dev/iicbus/iicbus_if.m 323931 2017-09-22 15:53:22Z ian $ |
27# 28 29#include <sys/bus.h> 30#include <dev/iicbus/iic.h> 31 32INTERFACE iicbus; 33 34CODE { | 27# 28 29#include <sys/bus.h> 30#include <dev/iicbus/iic.h> 31 32INTERFACE iicbus; 33 34CODE { |
35 static int iicbus_nosupport(void) 36 { 37 38 return (ENODEV); 39 } 40 |
|
35 static u_int 36 iicbus_default_frequency(device_t bus, u_char speed) 37 { 38 39 return (100000); 40 } 41}; 42 --- 21 unchanged lines hidden (view full) --- 64 65# 66# Send REPEATED_START condition 67# 68METHOD int repeated_start { 69 device_t dev; 70 u_char slave; 71 int timeout; | 41 static u_int 42 iicbus_default_frequency(device_t bus, u_char speed) 43 { 44 45 return (100000); 46 } 47}; 48 --- 21 unchanged lines hidden (view full) --- 70 71# 72# Send REPEATED_START condition 73# 74METHOD int repeated_start { 75 device_t dev; 76 u_char slave; 77 int timeout; |
72}; | 78} DEFAULT iicbus_nosupport; |
73 74# 75# Send START condition 76# 77METHOD int start { 78 device_t dev; 79 u_char slave; 80 int timeout; | 79 80# 81# Send START condition 82# 83METHOD int start { 84 device_t dev; 85 u_char slave; 86 int timeout; |
81}; | 87} DEFAULT iicbus_nosupport; |
82 83# 84# Send STOP condition 85# 86METHOD int stop { 87 device_t dev; | 88 89# 90# Send STOP condition 91# 92METHOD int stop { 93 device_t dev; |
88}; | 94} DEFAULT iicbus_nosupport; |
89 90# 91# Read from I2C bus 92# 93METHOD int read { 94 device_t dev; 95 char *buf; 96 int len; 97 int *bytes; 98 int last; 99 int delay; | 95 96# 97# Read from I2C bus 98# 99METHOD int read { 100 device_t dev; 101 char *buf; 102 int len; 103 int *bytes; 104 int last; 105 int delay; |
100}; | 106} DEFAULT iicbus_nosupport; |
101 102# 103# Write to the I2C bus 104# 105METHOD int write { 106 device_t dev; 107 const char *buf; 108 int len; 109 int *bytes; 110 int timeout; | 107 108# 109# Write to the I2C bus 110# 111METHOD int write { 112 device_t dev; 113 const char *buf; 114 int len; 115 int *bytes; 116 int timeout; |
111}; | 117} DEFAULT iicbus_nosupport; |
112 113# 114# Reset I2C bus 115# 116METHOD int reset { 117 device_t dev; 118 u_char speed; 119 u_char addr; --- 22 unchanged lines hidden --- | 118 119# 120# Reset I2C bus 121# 122METHOD int reset { 123 device_t dev; 124 u_char speed; 125 u_char addr; --- 22 unchanged lines hidden --- |