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 <linux/mutex.h>
#include <asm/etraxi2c.h>
#include <asm/io.h>
#include <asm/delay.h>
#include "i2c.h"

Go to the source code of this file.


#define D(x)
#define I2C_MAJOR   123 /* LOCAL/EXPERIMENTAL */
#define CLOCK_LOW_TIME   8
#define CLOCK_HIGH_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()
#define i2c_disable()
#define i2c_dir_out()   crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_out)
#define i2c_dir_in()   crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_in)
#define i2c_clk(x)   crisv32_io_set(&cris_i2c_clk, x)
#define i2c_data(x)   crisv32_io_set(&cris_i2c_data, x)
#define i2c_getbit()   crisv32_io_rd(&cris_i2c_data)
#define i2c_delay(usecs)   udelay(usecs)


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_write (unsigned char theSlave, void *data, size_t nbytes)
int i2c_read (unsigned char theSlave, void *data, size_t nbytes)
int i2c_writereg (unsigned char theSlave, unsigned char theReg, unsigned char theValue)
unsigned char i2c_readreg (unsigned char theSlave, unsigned char theReg)
 module_init (i2c_register)

Macro Definition Documentation

#define CLOCK_HIGH_TIME   8

Definition at line 53 of file i2c.c.

#define CLOCK_LOW_TIME   8

Definition at line 52 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 ! ! Nov 30 1998 Torbjorn Eliasson Initial version. ! Bjorn Wesen Elinux kernel version. ! Jan 14 2000 Johan Adolfsson Fixed PB shadow register stuff - ! don't use PB_I2C if DS1302 uses same bits, ! use PB. | June 23 2003 Pieter Grimmerink Added 'i2c_sendnack'. i2c_readreg now | generates nack on last received byte, | instead of ack. | i2c_getack changed data level while clock | was high, causing DS75 to see a stop condition ! ! ------------------------------------------------------------------------— ! ! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN ! !

Definition at line 46 of file i2c.c.

#define ENABLE_INPUT   0x00

Definition at line 57 of file i2c.c.

#define ENABLE_OUTPUT   0x01

Definition at line 56 of file i2c.c.

#define i2c_clk (   x)    crisv32_io_set(&cris_i2c_clk, x)

Definition at line 73 of file i2c.c.

#define I2C_CLOCK_HIGH   1

Definition at line 58 of file i2c.c.

#define I2C_CLOCK_LOW   0

Definition at line 59 of file i2c.c.

#define i2c_data (   x)    crisv32_io_set(&cris_i2c_data, x)

Definition at line 74 of file i2c.c.

#define I2C_DATA_HIGH   1

Definition at line 60 of file i2c.c.

#define I2C_DATA_LOW   0

Definition at line 61 of file i2c.c.

#define i2c_delay (   usecs)    udelay(usecs)

Definition at line 80 of file i2c.c.

#define i2c_dir_in ( )    crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_in)

Definition at line 69 of file i2c.c.

#define i2c_dir_out ( )    crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_out)

Definition at line 68 of file i2c.c.

#define i2c_disable ( )

Definition at line 64 of file i2c.c.

#define i2c_enable ( )

Definition at line 63 of file i2c.c.

#define i2c_getbit ( )    crisv32_io_rd(&cris_i2c_data)

Definition at line 78 of file i2c.c.

#define I2C_MAJOR   123 /* LOCAL/EXPERIMENTAL */

Definition at line 48 of file i2c.c.


Definition at line 54 of file i2c.c.


Definition at line 55 of file i2c.c.

Function Documentation

int i2c_getack ( void  )

Definition at line 236 of file i2c.c.

unsigned char i2c_inbyte ( void  )

Definition at line 179 of file i2c.c.

void i2c_outbyte ( unsigned char  x)

Definition at line 147 of file i2c.c.

int i2c_read ( unsigned char  theSlave,
void data,
size_t  nbytes 

Definition at line 447 of file i2c.c.

unsigned char i2c_readreg ( unsigned char  theSlave,
unsigned char  theReg 

Definition at line 567 of file i2c.c.

void i2c_sendack ( void  )

Definition at line 324 of file i2c.c.

void i2c_sendnack ( void  )

Definition at line 360 of file i2c.c.

void i2c_start ( void  )

Definition at line 95 of file i2c.c.

void i2c_stop ( void  )

Definition at line 120 of file i2c.c.

int i2c_write ( unsigned char  theSlave,
void data,
size_t  nbytes 

Definition at line 391 of file i2c.c.

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

Definition at line 506 of file i2c.c.

module_init ( i2c_register  )