⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 at24c01a.h

📁 开发环境为uClinux2.4.x+s3c44b0。此程序以字节方式对IIC器件进行读写。通过硬件测试
💻 H
字号:


/*=====================================================
*
*  	File Name: 
*	---------
*	AT24C01A.h  
*
*
*   Author:
*   -------
*   zhang dahai
*
*   Email:
*   ------
*   olivercheung@126.com
*
*   QQ & MSN;
*   ---------
*   334654529, olivercheung2005@yahoo.com.cn
*
*	Modification History:
*	-----------------
*	2006-8-23, zhang dahai, created(8-23).
*
*
=====================================================*/

#ifndef	 _AT24C01A_H_
#define	 _AT24C01A_H_

/*===================================================*/
/*                                         gereneral                                                           */
/*===================================================*/

/*=================device number=========================*/

#define 	IIC_NAME 		"at24c01a"	/*device name of tl16c750*/
#define 	IIC_MAJOR 		126			/*the major device number of tl16c750*/

#define 	IIC_SLAVE_ADDR			0xa0		/*IIC slave address*/

#define	IIC_READ				0x01
#define	IIC_WRITE				0x00

//#define I_ISPR	 	*(volatile unsigned *)0x1e00020//#define I_ISPC     	*(volatile unsigned *)0x1e00024
#define BIT_IIC       (0x1<<5)
/* ===============for debugging usage=======================*/

#define   DEBUG						/*used while debugging*/

/*====================file opterations====================*/

static ssize_t 	at24c01a_read(struct file *filp, char *buf, size_t count, loff_t *l);
static ssize_t 	at24c01a_write(struct file *filp, const char *buf, size_t count, loff_t *l);
//static int 		at24c01a_ioctl (struct inode *inode, struct file *file, unsigned int cmd,  unsigned long arg);
static int 		at24c01a_open(struct inode *inode, struct file *filp);
static int 		at24c01a_release(struct inode *inode, struct file *filp);
static void 	at24c01a_handler(int irq, void *dev_idkp, struct pt_regs *regs);
int __init 		at24c01a_init(void);
void __exit 	at24c01a_cleanup(void);	

static struct file_operations at24c01a_fops =
{
	read:	at24c01a_read,	
	write:   	at24c01a_write,
//	ioctl:       at24c01a_ioctl,
	open:	at24c01a_open,
	release:	at24c01a_release
}; 			/*  the file operations structure.*/

#endif

⌨️ 快捷键说明

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