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
33 #define I2C_OFFSET_STATUS0 0x01
35 #define I2C_OFFSET_BANKSELECT 0x02
37 #define I2C_OFFSET_DEVERROR 0x03
39 #define I2C_OFFSET_BANKDATA 0x04
41 
43 #define RI2C_INTERFACE_VERSION 0x00
44 
46 #define RI2C_STATUS0_NONE 0x00
47 #define RI2C_STATUS0_DEVICE_READY 0x01
49 #define RI2C_STATUS0_SELFCHECK_PASSED 0x02
51 #define RI2C_STATUS0_SELFCHECK_ERROR 0x04
53 #define RI2C_STATUS0_UPDATES_PENDING 0x08
55 
57 #define RI2C_STATUS1_NONE 0x00
58 #define RI2C_STATUS2_NONE 0x00
60 
62 #define RI2C_CAPS0_BRIDGE_NONE 0x00
63 #define RI2C_CAPS0_BRIDGE_NETWORK 0x01
65 #define RI2C_CAPS0_BRIDGE_ETHERNET 0x02
67 #define RI2C_CAPS0_BRIDGE_I2C 0x04
69 #define RI2C_CAPS0_BRIDGE_SPI 0x08
71 #define RI2C_CAPS0_BRIDGE_DMX512 0x10
73 #define RI2C_CAPS0_BRIDGE_MIDI 0x20
75 #define RI2C_CAPS0_BRIDGE_WAVEFORM 0x40
77 #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
221 } ri2c_dev_t;
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
382 } ri2c_bank_t;
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