LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
d_iic.h
Go to the documentation of this file.
1 /*
2  * LEGO® MINDSTORMS EV3
3  *
4  * Copyright (C) 2010-2013 The LEGO Group
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #ifndef __D_IIC_H
23 #define __D_IIC_H
24 
25 
26 
27 // Defines and Structures for internal and user space usage --------------------------------------------
28 
47 };
48 
49 
51  __u8 addr;
52  __u8 data[32];
56  __u8 bit;
57  __u8 byte;
58  __u8 data_byte;
61  __u8 nacked;
62  __u8 port;
64 };
65 
66 #define IIC_MAGIC 'i' // defines the magic number
67 #define IIC_PORT_CONFIG_IOC _IOW(IIC_MAGIC,0, int) // defines our ioctl call.
68 #define IIC_READ_WRITE_IOC _IOWR(IIC_MAGIC,1, struct IIC_data_package) // defines our ioctl call.
69 
70 
71 // Defines and structures for internal usage --------------------------------------------------
72 
73 #define IIC_INPUTS 4
74 
75 struct IIC_control_t {
76  // For communication to FIQ and timer functions
80 };
81 
83 {
88 };
89 
90 #define PINInput(port,pin) { (*IicPortPin[port][pin].pGpio).dir |= IicPortPin[port][pin].Mask; }
91 #define PINOutput(port,pin) { (*IicPortPin[port][pin].pGpio).dir &= ~IicPortPin[port][pin].Mask; }
92 #define PINRead(port,pin) (((*IicPortPin[port][pin].pGpio).in_data & IicPortPin[port][pin].Mask)?1:0)
93 #define PINHigh(port,pin) { (*IicPortPin[port][pin].pGpio).set_data = IicPortPin[port][pin].Mask; }
94 #define PINLow(port,pin) { (*IicPortPin[port][pin].pGpio).clr_data = IicPortPin[port][pin].Mask; }
95 
96 #endif
__u8 read_start_send
Definition: d_iic.h:60
__u8 data[32]
Definition: d_iic.h:52
__u8 port_enabled
Definition: d_iic.h:78
__u8 data_byte
Definition: d_iic.h:58
__u8 transfers_active
Definition: d_iic.h:79
struct IIC_data_package data_package[IIC_INPUTS]
Definition: d_iic.h:77
__u8 write_length
Definition: d_iic.h:54
__u8 read_length
Definition: d_iic.h:53
#define IIC_INPUTS
Definition: d_iic.h:73
__u8 wait_cycles
Definition: d_iic.h:63
IicPortPins
Definition: d_iic.h:82
__u8 clock_state
Definition: d_iic.h:55
__u8 nacked
Definition: d_iic.h:61
__u8 transfer_state
Definition: d_iic.h:59
TransferState
Definition: d_iic.h:29