iic.h

来自「linux下三星4510的BSP驱动程序!已经试验成功」· C头文件 代码 · 共 70 行

H
70
字号
/*************************************************************************/
/*                                                                       */
/* FILE NAME                                      VERSION                */
/*                                                                       */
/*      iic.h                      KS32C5000, KS32C50100   : version 1.0 */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      I2C control function library header file.                        */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         NAME            DATE                    REMARKS               */
/*                                                                       */
/*        hbahn         01-25-1998      Created initial version 1.0      */
/*        in4maker      05-04-1999      updated                          */
/*************************************************************************/
#ifndef _IIC_H_
#define _IIC_H_

/*=====================================================================*/
/*                                                                     */
/*                       IIC EEPROM ADDRESS MAP                        */
/*                                                                     */
/*      Case of Using 64Kbit(=8K bytes) IIC Serial EEPROM,             */
/*      The address range is 0x0 to 0x1fff                             */
/*                                                                     */
/*=====================================================================*/
#define PAGE_SIZE	8
#define IIC_DEV_0	0xa0    // IIC device's slave address
#define S_WRITE		0x00    // Write IIC data for slave
#define S_READ		0x01    // Read IIC data for slave

#define BF 		0x01	// Buffer flag
#define IEN		0x02    // Interrupt enable
#define LRB		0x04    // Last bit received/ACK not received
#define IIC_ACK		0x08    // Ack enable/Generate an ACK signal at 9th SCL
#define NOACK		0x00    
#define START		0x10
#define STOP		0x20
#define RESTART		0x30
#define BUSY		0x40
#define IICRESET	0x80
#define IICCON		(*(volatile unsigned *)0x03FFF000) //IIC bus control status register
#define IICBUF		(*(volatile unsigned *)0x03FFF004) //IIC bus shift buffer register
#define IICPS		(*(volatile unsigned *)0x03FFF008) //IIC bus prescaler register
  

int IicRead(int addr,int size,int *buf);
int IicWrite(int addr, int size, int *pdata);
int IicInit(void);
int DrvIicRead(int addr, int size, int *pdata);
int DrvIicWrite(int addr, int size, int *pdata);
void Iic_Test(void);
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?