aroarfw
i2c.h
Go to the documentation of this file.
1 //i2c.h:
2 
3 /*
4  * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2013
5  *
6  * This file is part of aroarfw, a RoarAudio framework for
7  * embedded systems (µControlers).
8  *
9  * This file is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 3
11  * or (at your option) any later version as published by
12  * the Free Software Foundation.
13  *
14  * aroarfw is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this software; see the file COPYING. If not, write to
21  * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 #ifndef _AROARFW_I2C_H_
26 #define _AROARFW_I2C_H_
27 
28 #include <stdint.h>
29 #include <aroarfw/types.h>
30 
32 #define I2C_OFFSET_IFVERSION 0x00
34 #define I2C_OFFSET_STATUS0 0x01
36 #define I2C_OFFSET_BANKSELECT 0x02
38 #define I2C_OFFSET_DEVERROR 0x03
40 #define I2C_OFFSET_BANKDATA 0x04
41 
43 #define RI2C_INTERFACE_VERSION 0x00
44 
46 #define RI2C_STATUS0_NONE 0x00
48 #define RI2C_STATUS0_DEVICE_READY 0x01
50 #define RI2C_STATUS0_SELFCHECK_PASSED 0x02
52 #define RI2C_STATUS0_SELFCHECK_ERROR 0x04
54 #define RI2C_STATUS0_UPDATES_PENDING 0x08
55 
57 #define RI2C_STATUS1_NONE 0x00
59 #define RI2C_STATUS2_NONE 0x00
60 
62 #define RI2C_CAPS0_BRIDGE_NONE 0x00
64 #define RI2C_CAPS0_BRIDGE_NETWORK 0x01
66 #define RI2C_CAPS0_BRIDGE_ETHERNET 0x02
68 #define RI2C_CAPS0_BRIDGE_I2C 0x04
70 #define RI2C_CAPS0_BRIDGE_SPI 0x08
72 #define RI2C_CAPS0_BRIDGE_DMX512 0x10
74 #define RI2C_CAPS0_BRIDGE_MIDI 0x20
76 #define RI2C_CAPS0_BRIDGE_WAVEFORM 0x40
78 #define RI2C_CAPS0_BRIDGE_RESERVED7 0x80
79 
81 typedef uint8_t ri2c_addr_t;
82 
84 typedef enum {
87 
88 // 1-63: RAF Defined types
91 
92 //$ for i in `seq 64 127`; do v=`expr $i - 64`; printf " //! Vendor specific device type %i\n RI2C_DEV_VENDOR%.2i = %#0.2x,\n" $v $v $i; done
220  RI2C_DEV_VENDOR63 = 0x7f
222 
224 typedef enum {
230 
232 typedef enum {
233 // 0-31: Generic
242 // 32-63: RAF Defined
243 
244 // DISPLAY interface?
247 
248 // 64-95: RAF Defined Type/Sub-Type specific
249 
250 //$ for i in `seq 64 95`; do v=`expr $i - 64`; printf " //! Assigned Type and Subtype specific bank %i\n RI2C_BANK_TYPEST%.2i = %#0.2x,\n" $v $v $i; done
315 
316 // 96-127: Vendor + Type/Sub-Type specific
317 //$ for i in `seq 96 127`; do v=`expr $i - 96`; printf " //! Vendor, Type and Subtype specific bank %i\n RI2C_BANK_VENDOR%.2i = %#0.2x,\n" $v $v $i; done
381  RI2C_BANK_VENDOR31 = 0x7f
383 
385 typedef struct {
387  uint8_t vendor;
389  uint8_t type;
391  uint8_t subtype;
393  uint8_t revision;
395  uint8_t parentvendor;
397  uint8_t parenttype;
399  uint8_t parentsubtype;
401  uint8_t caps[3];
404 } __RPACKED__ ri2c_devinfo_data_t;
405 
406 #endif
407 
408 //ll
ri2c_bank_t
Type for memory banks (commands)
Definition: i2c.h:232
@ RI2C_BANK_DMX512
DMX512 data.
Definition: i2c.h:246
@ RI2C_BANK_VENDOR02
Vendor, Type and Subtype specific bank 2.
Definition: i2c.h:323
@ RI2C_BANK_VENDOR13
Vendor, Type and Subtype specific bank 13.
Definition: i2c.h:345
@ RI2C_BANK_TYPEST06
Assigned Type and Subtype specific bank 6.
Definition: i2c.h:264
@ RI2C_BANK_TYPEST15
Assigned Type and Subtype specific bank 15.
Definition: i2c.h:282
@ RI2C_BANK_VENDOR12
Vendor, Type and Subtype specific bank 12.
Definition: i2c.h:343
@ RI2C_BANK_TYPEST26
Assigned Type and Subtype specific bank 26.
Definition: i2c.h:304
@ RI2C_BANK_VENDOR05
Vendor, Type and Subtype specific bank 5.
Definition: i2c.h:329
@ RI2C_BANK_VENDOR23
Vendor, Type and Subtype specific bank 23.
Definition: i2c.h:365
@ RI2C_BANK_VENDOR28
Vendor, Type and Subtype specific bank 28.
Definition: i2c.h:375
@ RI2C_BANK_VENDOR30
Vendor, Type and Subtype specific bank 30.
Definition: i2c.h:379
@ RI2C_BANK_TYPEST11
Assigned Type and Subtype specific bank 11.
Definition: i2c.h:274
@ RI2C_BANK_TYPEST24
Assigned Type and Subtype specific bank 24.
Definition: i2c.h:300
@ RI2C_BANK_DEVINFO
Generic device information.
Definition: i2c.h:235
@ RI2C_BANK_TYPEST30
Assigned Type and Subtype specific bank 30.
Definition: i2c.h:312
@ RI2C_BANK_TYPEST21
Assigned Type and Subtype specific bank 21.
Definition: i2c.h:294
@ RI2C_BANK_TYPEST29
Assigned Type and Subtype specific bank 29.
Definition: i2c.h:310
@ RI2C_BANK_TYPEST27
Assigned Type and Subtype specific bank 27.
Definition: i2c.h:306
@ RI2C_BANK_TYPEST23
Assigned Type and Subtype specific bank 23.
Definition: i2c.h:298
@ RI2C_BANK_TYPEST09
Assigned Type and Subtype specific bank 9.
Definition: i2c.h:270
@ RI2C_BANK_TYPEST04
Assigned Type and Subtype specific bank 4.
Definition: i2c.h:260
@ RI2C_BANK_VENDOR09
Vendor, Type and Subtype specific bank 9.
Definition: i2c.h:337
@ RI2C_BANK_VENDOR17
Vendor, Type and Subtype specific bank 17.
Definition: i2c.h:353
@ RI2C_BANK_TYPEST19
Assigned Type and Subtype specific bank 19.
Definition: i2c.h:290
@ RI2C_BANK_VENDOR06
Vendor, Type and Subtype specific bank 6.
Definition: i2c.h:331
@ RI2C_BANK_TYPEST12
Assigned Type and Subtype specific bank 12.
Definition: i2c.h:276
@ RI2C_BANK_TYPEST16
Assigned Type and Subtype specific bank 16.
Definition: i2c.h:284
@ RI2C_BANK_TYPEST10
Assigned Type and Subtype specific bank 10.
Definition: i2c.h:272
@ RI2C_BANK_TYPEST07
Assigned Type and Subtype specific bank 7.
Definition: i2c.h:266
@ RI2C_BANK_TYPEST00
Assigned Type and Subtype specific bank 0.
Definition: i2c.h:252
@ RI2C_BANK_VENDOR31
Vendor, Type and Subtype specific bank 31.
Definition: i2c.h:381
@ RI2C_BANK_VENDOR11
Vendor, Type and Subtype specific bank 11.
Definition: i2c.h:341
@ RI2C_BANK_VENDOR03
Vendor, Type and Subtype specific bank 3.
Definition: i2c.h:325
@ RI2C_BANK_VENDOR25
Vendor, Type and Subtype specific bank 25.
Definition: i2c.h:369
@ RI2C_BANK_VENDOR07
Vendor, Type and Subtype specific bank 7.
Definition: i2c.h:333
@ RI2C_BANK_VENDOR16
Vendor, Type and Subtype specific bank 16.
Definition: i2c.h:351
@ RI2C_BANK_VENDOR15
Vendor, Type and Subtype specific bank 15.
Definition: i2c.h:349
@ RI2C_BANK_TYPEST18
Assigned Type and Subtype specific bank 18.
Definition: i2c.h:288
@ RI2C_BANK_VENDOR24
Vendor, Type and Subtype specific bank 24.
Definition: i2c.h:367
@ RI2C_BANK_VENDOR14
Vendor, Type and Subtype specific bank 14.
Definition: i2c.h:347
@ RI2C_BANK_VENDOR10
Vendor, Type and Subtype specific bank 10.
Definition: i2c.h:339
@ RI2C_BANK_TYPEST20
Assigned Type and Subtype specific bank 20.
Definition: i2c.h:292
@ RI2C_BANK_VENDOR18
Vendor, Type and Subtype specific bank 18.
Definition: i2c.h:355
@ RI2C_BANK_GPAIO
General Purpose Analog Input/Output.
Definition: i2c.h:241
@ RI2C_BANK_VENDOR29
Vendor, Type and Subtype specific bank 29.
Definition: i2c.h:377
@ RI2C_BANK_TYPEST08
Assigned Type and Subtype specific bank 8.
Definition: i2c.h:268
@ RI2C_BANK_TYPEST02
Assigned Type and Subtype specific bank 2.
Definition: i2c.h:256
@ RI2C_BANK_VENDOR21
Vendor, Type and Subtype specific bank 21.
Definition: i2c.h:361
@ RI2C_BANK_VENDOR26
Vendor, Type and Subtype specific bank 26.
Definition: i2c.h:371
@ RI2C_BANK_TYPEST05
Assigned Type and Subtype specific bank 5.
Definition: i2c.h:262
@ RI2C_BANK_VENDOR04
Vendor, Type and Subtype specific bank 4.
Definition: i2c.h:327
@ RI2C_BANK_VENDOR01
Vendor, Type and Subtype specific bank 1.
Definition: i2c.h:321
@ RI2C_BANK_VENDOR00
Vendor, Type and Subtype specific bank 0.
Definition: i2c.h:319
@ RI2C_BANK_TYPEST22
Assigned Type and Subtype specific bank 22.
Definition: i2c.h:296
@ RI2C_BANK_TYPEST28
Assigned Type and Subtype specific bank 28.
Definition: i2c.h:308
@ RI2C_BANK_TYPEST14
Assigned Type and Subtype specific bank 14.
Definition: i2c.h:280
@ RI2C_BANK_VENDOR27
Vendor, Type and Subtype specific bank 27.
Definition: i2c.h:373
@ RI2C_BANK_SYSCTL
Generic control of the device.
Definition: i2c.h:237
@ RI2C_BANK_VENDOR22
Vendor, Type and Subtype specific bank 22.
Definition: i2c.h:363
@ RI2C_BANK_TYPEST25
Assigned Type and Subtype specific bank 25.
Definition: i2c.h:302
@ RI2C_BANK_TYPEST03
Assigned Type and Subtype specific bank 3.
Definition: i2c.h:258
@ RI2C_BANK_VENDOR08
Vendor, Type and Subtype specific bank 8.
Definition: i2c.h:335
@ RI2C_BANK_TYPEST13
Assigned Type and Subtype specific bank 13.
Definition: i2c.h:278
@ RI2C_BANK_VENDOR20
Vendor, Type and Subtype specific bank 20.
Definition: i2c.h:359
@ RI2C_BANK_GPDIO
General Purpose Digital Input/Output.
Definition: i2c.h:239
@ RI2C_BANK_TYPEST17
Assigned Type and Subtype specific bank 17.
Definition: i2c.h:286
@ RI2C_BANK_TYPEST31
Assigned Type and Subtype specific bank 31.
Definition: i2c.h:314
@ RI2C_BANK_VENDOR19
Vendor, Type and Subtype specific bank 19.
Definition: i2c.h:357
@ RI2C_BANK_TYPEST01
Assigned Type and Subtype specific bank 1.
Definition: i2c.h:254
uint8_t ri2c_addr_t
Type for storing I²C slave addresses.
Definition: i2c.h:81
ri2c_dev_t
Type for device types.
Definition: i2c.h:84
@ RI2C_DEV_VENDOR12
Vendor specific device type 12.
Definition: i2c.h:118
@ RI2C_DEV_VENDOR40
Vendor specific device type 40.
Definition: i2c.h:174
@ RI2C_DEV_VENDOR47
Vendor specific device type 47.
Definition: i2c.h:188
@ RI2C_DEV_VENDOR09
Vendor specific device type 9.
Definition: i2c.h:112
@ RI2C_DEV_VENDOR35
Vendor specific device type 35.
Definition: i2c.h:164
@ RI2C_DEV_VENDOR58
Vendor specific device type 58.
Definition: i2c.h:210
@ RI2C_DEV_VENDOR08
Vendor specific device type 8.
Definition: i2c.h:110
@ RI2C_DEV_VENDOR45
Vendor specific device type 45.
Definition: i2c.h:184
@ RI2C_DEV_VENDOR56
Vendor specific device type 56.
Definition: i2c.h:206
@ RI2C_DEV_VENDOR52
Vendor specific device type 52.
Definition: i2c.h:198
@ RI2C_DEV_VENDOR10
Vendor specific device type 10.
Definition: i2c.h:114
@ RI2C_DEV_VENDOR16
Vendor specific device type 16.
Definition: i2c.h:126
@ RI2C_DEV_VENDOR14
Vendor specific device type 14.
Definition: i2c.h:122
@ RI2C_DEV_VENDOR50
Vendor specific device type 50.
Definition: i2c.h:194
@ RI2C_DEV_VENDOR24
Vendor specific device type 24.
Definition: i2c.h:142
@ RI2C_DEV_VENDOR41
Vendor specific device type 41.
Definition: i2c.h:176
@ RI2C_DEV_VENDOR61
Vendor specific device type 61.
Definition: i2c.h:216
@ RI2C_DEV_VENDOR36
Vendor specific device type 36.
Definition: i2c.h:166
@ RI2C_DEV_VENDOR37
Vendor specific device type 37.
Definition: i2c.h:168
@ RI2C_DEV_VENDOR57
Vendor specific device type 57.
Definition: i2c.h:208
@ RI2C_DEV_VENDOR30
Vendor specific device type 30.
Definition: i2c.h:154
@ RI2C_DEV_VENDOR48
Vendor specific device type 48.
Definition: i2c.h:190
@ RI2C_DEV_VENDOR13
Vendor specific device type 13.
Definition: i2c.h:120
@ RI2C_DEV_VENDOR38
Vendor specific device type 38.
Definition: i2c.h:170
@ RI2C_DEV_VENDOR01
Vendor specific device type 1.
Definition: i2c.h:96
@ RI2C_DEV_VENDOR60
Vendor specific device type 60.
Definition: i2c.h:214
@ RI2C_DEV_VENDOR27
Vendor specific device type 27.
Definition: i2c.h:148
@ RI2C_DEV_VENDOR42
Vendor specific device type 42.
Definition: i2c.h:178
@ RI2C_DEV_VENDOR46
Vendor specific device type 46.
Definition: i2c.h:186
@ RI2C_DEV_VENDOR18
Vendor specific device type 18.
Definition: i2c.h:130
@ RI2C_DEV_GENERIC
Most generic device. Supports bank 0.
Definition: i2c.h:86
@ RI2C_DEV_VENDOR33
Vendor specific device type 33.
Definition: i2c.h:160
@ RI2C_DEV_VENDOR54
Vendor specific device type 54.
Definition: i2c.h:202
@ RI2C_DEV_VENDOR32
Vendor specific device type 32.
Definition: i2c.h:158
@ RI2C_DEV_VENDOR06
Vendor specific device type 6.
Definition: i2c.h:106
@ RI2C_DEV_VENDOR29
Vendor specific device type 29.
Definition: i2c.h:152
@ RI2C_DEV_VENDOR28
Vendor specific device type 28.
Definition: i2c.h:150
@ RI2C_DEV_VENDOR62
Vendor specific device type 62.
Definition: i2c.h:218
@ RI2C_DEV_VENDOR02
Vendor specific device type 2.
Definition: i2c.h:98
@ RI2C_DEV_VENDOR59
Vendor specific device type 59.
Definition: i2c.h:212
@ RI2C_DEV_VENDOR11
Vendor specific device type 11.
Definition: i2c.h:116
@ RI2C_DEV_VENDOR43
Vendor specific device type 43.
Definition: i2c.h:180
@ RI2C_DEV_VENDOR55
Vendor specific device type 55.
Definition: i2c.h:204
@ RI2C_DEV_VENDOR44
Vendor specific device type 44.
Definition: i2c.h:182
@ RI2C_DEV_VENDOR20
Vendor specific device type 20.
Definition: i2c.h:134
@ RI2C_DEV_VENDOR26
Vendor specific device type 26.
Definition: i2c.h:146
@ RI2C_DEV_VENDOR49
Vendor specific device type 49.
Definition: i2c.h:192
@ RI2C_DEV_VENDOR39
Vendor specific device type 39.
Definition: i2c.h:172
@ RI2C_DEV_VENDOR23
Vendor specific device type 23.
Definition: i2c.h:140
@ RI2C_DEV_VENDOR21
Vendor specific device type 21.
Definition: i2c.h:136
@ RI2C_DEV_VENDOR34
Vendor specific device type 34.
Definition: i2c.h:162
@ RI2C_DEV_VENDOR22
Vendor specific device type 22.
Definition: i2c.h:138
@ RI2C_DEV_VENDOR19
Vendor specific device type 19.
Definition: i2c.h:132
@ RI2C_DEV_VENDOR15
Vendor specific device type 15.
Definition: i2c.h:124
@ RI2C_DEV_VENDOR25
Vendor specific device type 25.
Definition: i2c.h:144
@ RI2C_DEV_VENDOR07
Vendor specific device type 7.
Definition: i2c.h:108
@ RI2C_DEV_VENDOR53
Vendor specific device type 53.
Definition: i2c.h:200
@ RI2C_DEV_VENDOR17
Vendor specific device type 17.
Definition: i2c.h:128
@ RI2C_DEV_VENDOR31
Vendor specific device type 31.
Definition: i2c.h:156
@ RI2C_DEV_VENDOR04
Vendor specific device type 4.
Definition: i2c.h:102
@ RI2C_DEV_VENDOR05
Vendor specific device type 5.
Definition: i2c.h:104
@ RI2C_DEV_VENDOR03
Vendor specific device type 3.
Definition: i2c.h:100
@ RI2C_DEV_VENDOR00
Vendor specific device type 0.
Definition: i2c.h:94
@ RI2C_DEV_BRIDGE
This is a bridge device. It converts between at least two diffrent communication channels....
Definition: i2c.h:90
@ RI2C_DEV_VENDOR63
Vendor specific device type 63.
Definition: i2c.h:220
@ RI2C_DEV_VENDOR51
Vendor specific device type 51.
Definition: i2c.h:196
ri2c_subtype_bridge_t
Subtype for devices of type RI2C_DEV_BRIDGE.
Definition: i2c.h:224
@ RI2C_SUBTYPE_BRIDGE_GENERIC
Generic bridge device. Can be used as prent for vendor specific bridges.
Definition: i2c.h:226
@ RI2C_SUBTYPE_BRIDGE_CONVERTER
This is a media converter. It converts between two (or more) low level protocols and physical layers.
Definition: i2c.h:228
Type to store (in packed format) static information for the device info bank (bank 0)....
Definition: i2c.h:385
uint8_t vendor
Vendor of this device. This is a assigned device vendor ID.
Definition: i2c.h:387
uint8_t revision
Vendor specific revision of the device.
Definition: i2c.h:393
ruuid_t serial
Sieral of the device.
Definition: i2c.h:403
uint8_t type
Vendor specific type of device.
Definition: i2c.h:389
uint8_t parentsubtype
Parent device's subtype ID.
Definition: i2c.h:399
uint8_t parenttype
Parent device's type ID.
Definition: i2c.h:397
uint8_t parentvendor
Parent device's vendor ID.
Definition: i2c.h:395
uint8_t subtype
Vendor specific subtype of device.
Definition: i2c.h:391
uint8_t ruuid_t[16]
Type to store packed UUID.
Definition: types.h:51