LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
d_iic.c File Reference
#include <asm/types.h>
#include "../../lms2012/source/lms2012.h"
#include "../../lms2012/source/am1808.h"
#include "d_iic.h"
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/circ_buf.h>
#include <linux/hrtimer.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/debugfs.h>
#include <linux/ioport.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
#include <linux/delay.h>

Go to the source code of this file.

Data Structures

struct  IICPORT
 

Macros

#define HW_ID_SUPPORT
 
#define MODULE_NAME   "iic_module"
 
#define DEVICE1_NAME   IIC_DEVICE
 
#define __USE_POSIX
 
#define NO_OF_IIC_PORTS   INPUTS
 
#define PUDisable   iowrite32(ioread32(da8xx_syscfg1_base + 0x0C) & ~0xFFFFFFFF,da8xx_syscfg1_base + 0x0C)
 
#define IIC_TIMER_RESOLUTION   20
 
#define SHM_LENGTH   (sizeof(IicDefault))
 
#define NPAGES   ((SHM_LENGTH + PAGE_SIZE - 1) / PAGE_SIZE)
 

Enumerations

enum  IIC_STATE {
  IIC_IDLE, IIC_INIT, IIC_RESTART, IIC_ENABLE,
  IIC_NXT_TEMP_START, IIC_NXT_TEMP_WRITE, IIC_NXT_TEMP_READ, IIC_MANUFACTURER_START,
  IIC_MANUFACTURER_WRITE, IIC_MANUFACTURER_READ, IIC_TYPE_START, IIC_TYPE_WRITE,
  IIC_TYPE_READ, IIC_SETUP_WAIT, IIC_SETUP_START, IIC_SETUP_WRITE,
  IIC_SETUP_READ, IIC_WAITING, IIC_WRITING, IIC_READING,
  IIC_REPEAT, IIC_ERROR, IIC_EXIT, IIC_STATES
}
 

Functions

 MODULE_LICENSE ("GPL")
 
 MODULE_AUTHOR ("The LEGO Group")
 
 MODULE_DESCRIPTION (MODULE_NAME)
 
 MODULE_SUPPORTED_DEVICE (DEVICE1_NAME)
 
 module_init (ModuleInit)
 
 module_exit (ModuleExit)
 
void SetGpio (int Pin)
 
void InitGpio (void)
 
void iic_fiq_start_transfer (unsigned int time, bool fiq_nirq)
 
 module_param (HwId, charp, 0)
 

Variables

INPIN IicPortPin [NO_OF_IIC_PORTS][IIC_PORT_PINS]
 
int Hw = 0
 
INPINpIicPortPin []
 
IICPORT IicPortDefault
 
UBYTE IicConfigured [INPUTS]
 
IICPORT IicPort [INPUTS]
 
struct IIC_control_t IicCtrl
 
char IicStateText [IIC_STATES][50]
 
DATA8 IicPortType [INPUTS]
 
IICSTR IicStrings [INPUTS]
 

Macro Definition Documentation

#define __USE_POSIX

Definition at line 88 of file d_iic.c.

#define DEVICE1_NAME   IIC_DEVICE

Definition at line 83 of file d_iic.c.

#define HW_ID_SUPPORT

Definition at line 62 of file d_iic.c.

#define IIC_TIMER_RESOLUTION   20

Definition at line 673 of file d_iic.c.

#define MODULE_NAME   "iic_module"

Definition at line 82 of file d_iic.c.

#define NO_OF_IIC_PORTS   INPUTS

Definition at line 127 of file d_iic.c.

#define NPAGES   ((SHM_LENGTH + PAGE_SIZE - 1) / PAGE_SIZE)

Definition at line 1381 of file d_iic.c.

#define PUDisable   iowrite32(ioread32(da8xx_syscfg1_base + 0x0C) & ~0xFFFFFFFF,da8xx_syscfg1_base + 0x0C)

Definition at line 240 of file d_iic.c.

#define SHM_LENGTH   (sizeof(IicDefault))

Definition at line 1380 of file d_iic.c.

Enumeration Type Documentation

enum IIC_STATE
Enumerator
IIC_IDLE 
IIC_INIT 
IIC_RESTART 
IIC_ENABLE 
IIC_NXT_TEMP_START 
IIC_NXT_TEMP_WRITE 
IIC_NXT_TEMP_READ 
IIC_MANUFACTURER_START 
IIC_MANUFACTURER_WRITE 
IIC_MANUFACTURER_READ 
IIC_TYPE_START 
IIC_TYPE_WRITE 
IIC_TYPE_READ 
IIC_SETUP_WAIT 
IIC_SETUP_START 
IIC_SETUP_WRITE 
IIC_SETUP_READ 
IIC_WAITING 
IIC_WRITING 
IIC_READING 
IIC_REPEAT 
IIC_ERROR 
IIC_EXIT 
IIC_STATES 

Definition at line 612 of file d_iic.c.

Function Documentation

void iic_fiq_start_transfer ( unsigned int  time,
bool  fiq_nirq 
)
void InitGpio ( void  )

Definition at line 288 of file d_iic.c.

MODULE_AUTHOR ( "The LEGO Group"  )
MODULE_DESCRIPTION ( MODULE_NAME  )
module_exit ( ModuleExit  )
module_init ( ModuleInit  )
MODULE_LICENSE ( "GPL"  )
module_param ( HwId  ,
charp  ,
 
)
MODULE_SUPPORTED_DEVICE ( DEVICE1_NAME  )
void SetGpio ( int  Pin)

Definition at line 254 of file d_iic.c.

Variable Documentation

int Hw = 0

Definition at line 149 of file d_iic.c.

UBYTE IicConfigured[INPUTS]

Definition at line 450 of file d_iic.c.

struct IIC_control_t IicCtrl
IICPORT IicPort[INPUTS]

Definition at line 451 of file d_iic.c.

IICPORT IicPortDefault
Initial value:
=
{
0,
0,
0,
0,
0,
-1,
0,
0,
0,
0,
1,
3,
"",
0,
0,
0,
0,
0,
}

Definition at line 388 of file d_iic.c.

DATA8 IicPortType[INPUTS]

Definition at line 669 of file d_iic.c.

char IicStateText[IIC_STATES][50]
Initial value:
=
{
"IDLE\n",
"INIT",
"RESTART",
"ENABLE",
"IIC_NXT_TEMP_START",
"IIC_NXT_TEMP_WRITE",
"IIC_NXT_TEMP_READ",
"MANUFACTURER_START",
"MANUFACTURER_WRITE",
"MANUFACTURER_READ",
"TYPE_START",
"TYPE_WRITE",
"TYPE_READ",
"SETUP_WAIT",
"SETUP_START",
"SETUP_WRITE",
"SETUP_READ",
"WAITING",
"WRITING",
"READING",
"REPEAT",
"ERROR",
"EXIT"
}

Definition at line 641 of file d_iic.c.

IICSTR IicStrings[INPUTS]

Definition at line 670 of file d_iic.c.

INPIN* pIicPortPin[]
Initial value:
=
{
[FINAL] = (INPIN*)&FINAL_IicPortPin[0],
[FINALB] = (INPIN*)&FINALB_IicPortPin[0],
[EP2] = (INPIN*)&EP2_IicPortPin[0],
}
Definition: am1808.h:222
#define EP2
Schematics revision D.
Definition: lms2012.h:99
#define FINAL
Final prototype.
Definition: lms2012.h:101
#define FINALB
Schematics revision B and C.
Definition: lms2012.h:100

Definition at line 242 of file d_iic.c.