Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
i2c.c File Reference
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <asm/etraxi2c.h>
#include <arch/svinto.h>
#include <asm/io.h>
#include <asm/delay.h>
#include <arch/io_interface_mux.h>
#include "i2c.h"

Go to the source code of this file.

Macros

#define D(x)
 
#define I2C_MAJOR   123 /* LOCAL/EXPERIMENTAL */
 
#define CLOCK_LOW_TIME   8
 
#define CLOCK_HIGH_TIME   8
 
#define START_CONDITION_HOLD_TIME   8
 
#define STOP_CONDITION_HOLD_TIME   8
 
#define ENABLE_OUTPUT   0x01
 
#define ENABLE_INPUT   0x00
 
#define I2C_CLOCK_HIGH   1
 
#define I2C_CLOCK_LOW   0
 
#define I2C_DATA_HIGH   1
 
#define I2C_DATA_LOW   0
 
#define i2c_enable()   *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_en))
 
#define i2c_disable()   *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_en))
 
#define i2c_dir_out()
 
#define i2c_dir_in()
 
#define i2c_clk(x)
 
#define i2c_data(x)
 
#define i2c_getbit()   (*R_PORT_PB_READ & 0x1)
 
#define i2c_delay(usecs)   udelay(usecs)
 

Functions

void i2c_start (void)
 
void i2c_stop (void)
 
void i2c_outbyte (unsigned char x)
 
unsigned char i2c_inbyte (void)
 
int i2c_getack (void)
 
void i2c_sendack (void)
 
void i2c_sendnack (void)
 
int i2c_writereg (unsigned char theSlave, unsigned char theReg, unsigned char theValue)
 
unsigned char i2c_readreg (unsigned char theSlave, unsigned char theReg)
 
int __init i2c_init (void)
 
 module_init (i2c_register)
 

Macro Definition Documentation

#define CLOCK_HIGH_TIME   8

Definition at line 40 of file i2c.c.

#define CLOCK_LOW_TIME   8

Definition at line 39 of file i2c.c.

#define D (   x)

! ! FILE NAME : i2c.c ! ! DESCRIPTION: implements an interface for IIC/I2C, both directly from other ! kernel modules (i2c_writereg/readreg) and from userspace using ! ioctl()'s ! ! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN ! !

Definition at line 34 of file i2c.c.

#define ENABLE_INPUT   0x00

Definition at line 44 of file i2c.c.

#define ENABLE_OUTPUT   0x01

Definition at line 43 of file i2c.c.

#define i2c_clk (   x)
Value:
*R_PORT_PB_I2C = (port_pb_i2c_shadow = (port_pb_i2c_shadow & \
~IO_MASK(R_PORT_PB_I2C, i2c_clk)) | IO_FIELD(R_PORT_PB_I2C, i2c_clk, (x))); \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 1, x);

Definition at line 99 of file i2c.c.

#define I2C_CLOCK_HIGH   1

Definition at line 45 of file i2c.c.

#define I2C_CLOCK_LOW   0

Definition at line 46 of file i2c.c.

#define i2c_data (   x)
Value:
*R_PORT_PB_I2C = (port_pb_i2c_shadow = (port_pb_i2c_shadow & \
~IO_MASK(R_PORT_PB_I2C, i2c_d)) | IO_FIELD(R_PORT_PB_I2C, i2c_d, (x))); \
REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 0, x);

Definition at line 104 of file i2c.c.

#define I2C_DATA_HIGH   1

Definition at line 47 of file i2c.c.

#define I2C_DATA_LOW   0

Definition at line 48 of file i2c.c.

#define i2c_delay (   usecs)    udelay(usecs)

Definition at line 116 of file i2c.c.

#define i2c_dir_in ( )
Value:
*R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \
REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 0);

Definition at line 93 of file i2c.c.

#define i2c_dir_out ( )
Value:
*R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_oe_)); \
REG_SHADOW_SET(R_PORT_PB_DIR, port_pb_dir_shadow, 0, 1);

Definition at line 90 of file i2c.c.

#define i2c_disable ( )    *R_PORT_PB_I2C = (port_pb_i2c_shadow &= ~IO_MASK(R_PORT_PB_I2C, i2c_en))

Definition at line 86 of file i2c.c.

#define i2c_enable ( )    *R_PORT_PB_I2C = (port_pb_i2c_shadow |= IO_MASK(R_PORT_PB_I2C, i2c_en))

Definition at line 85 of file i2c.c.

#define i2c_getbit ( )    (*R_PORT_PB_READ & 0x1)

Definition at line 111 of file i2c.c.

#define I2C_MAJOR   123 /* LOCAL/EXPERIMENTAL */

Definition at line 36 of file i2c.c.

#define START_CONDITION_HOLD_TIME   8

Definition at line 41 of file i2c.c.

#define STOP_CONDITION_HOLD_TIME   8

Definition at line 42 of file i2c.c.

Function Documentation

int i2c_getack ( void  )

Definition at line 267 of file i2c.c.

unsigned char i2c_inbyte ( void  )

Definition at line 210 of file i2c.c.

int __init i2c_init ( void  )

Definition at line 623 of file i2c.c.

void i2c_outbyte ( unsigned char  x)

Definition at line 178 of file i2c.c.

unsigned char i2c_readreg ( unsigned char  theSlave,
unsigned char  theReg 
)

Definition at line 487 of file i2c.c.

void i2c_sendack ( void  )

Definition at line 350 of file i2c.c.

void i2c_sendnack ( void  )

Definition at line 386 of file i2c.c.

void i2c_start ( void  )

Definition at line 126 of file i2c.c.

void i2c_stop ( void  )

Definition at line 151 of file i2c.c.

int i2c_writereg ( unsigned char  theSlave,
unsigned char  theReg,
unsigned char  theValue 
)

Definition at line 417 of file i2c.c.

module_init ( i2c_register  )