1/*
2 * Copyright (c) 2012, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, CAB F.78, Universitaetstr 6, CH-8092 Zurich.
8 */
9#ifndef __TI_I2C_H__
10#define __TI_I2C_H__
11
12#include <barrelfish/types.h>
13#include <errors/errno.h>
14
15// there are 4 GP i2c controllers on the pandaboard
16#define I2C_COUNT 4
17
18enum i2c_flags {
19    I2C_RD     = 0x1,
20    I2C_WR     = 0x2,
21    I2C_NOSTOP = 0x4,
22};
23
24struct i2c_msg {
25    // should not exceed 10 bits
26    uint16_t slave;
27    enum i2c_flags flags;
28    uint16_t length;
29    uint8_t *buf;
30};
31
32struct twl6030_driver_state;
33void ti_i2c_init(struct twl6030_driver_state* st, int i);
34errval_t ti_i2c_transfer(int i, struct i2c_msg *msgs, size_t msgcount);
35lpaddr_t i2c_get_pbase(size_t dev);
36
37#endif // __TI_I2C_H__
38