OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [char/] [mbus.h] - Rev 1765

Compare with Previous | Blame | View Log

/************************************************************************/
/*                                                                      */
/*  mbus.h -   definitions for the mbus driver		                */
/*                                                                      */
/*                                                                      */
/*  (C) Copyright 1999, Martin Floeer (mfloeer@axcent.de)               */      /*                                                                      */
/*                                                                      */
/************************************************************************/
 
 
 
#ifndef	__MBUS_H__
#define	__MBUS_H__
 
#include <linux/ioctl.h>
 
 
 
#ifndef MBUS_MAJOR
#define MBUS_MAJOR 127 		/*static definition of major nr.*/
#endif
 
#ifndef MBUS_NR_DEVS
#define MBUS_NR_DEVS 1
#endif
 
#define count_t int
#define read_write_t int
 
 
#define	MBUS_TRANSMIT 0x1
#define	MBUS_RECEIVE 0x0
 
#define	MBUS_MASTER 0x1
#define	MBUS_SLAVE 0x0
 
 
 
volatile int		MBUS_STATE;		/*  1 = mbus busy */
						/*  0 = mbus idle no errror */
						/* -1 = mbus idle at last transfer arbitration lost */
						/* -2 = mbus idle at last transfer no acknowledge receive */
#define	MBUS_STATE_BUSY					1
#define	MBUS_STATE_IDLE					0
#define	MBUS_STATE_ARBITRATION_LOST		-1
#define	MBUS_STATE_NO_ACKNOWLEDGE		-2
 
volatile unsigned char			MBUS_MODE;			/* true = tranceive : false = receive */
volatile unsigned char				MBUS_DEST_ADDRESS_BUFFER;	/* Buffer for the slave_address */
volatile unsigned char			*MBUS_DATA;				/* Pointer to data */
volatile int				MBUS_DATA_COUNT;		/* counter for data bytes */
volatile int				MBUS_DATA_NUMBER;	
 
void mbus_start(unsigned char address,unsigned char clock,char IRQ_LEVEL);
/*
slave_address: slave address
dest_address: dest address
*/
extern void mbus_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 
extern void mbus_putchar(unsigned char slave_address, unsigned char dest_address, char *data);
 
extern void mbus_getchar(unsigned char slave_address, unsigned char dest_address, char *data);
 
extern void mbus_putchars(unsigned char slave_address, unsigned char dest_address, char *data, int number);                                                 
 
 
typedef struct Mbus_Dev 
{
	struct Mbus_Dev *next;
	char *name;
	unsigned int usage;
} Mbus_Dev;
 
extern int mbus_major;
extern int mbus_nr_devs;	
 
extern struct file_operations mbus_fops;
 
read_write_t mbus_read(struct inode *inode, struct file *filp, char *buf,
count_t count);
read_write_t mbus_write(struct inode *inode, struct file *filp, char *buf,
count_t count);
 
#define MBUS_BUSY mbus_busy_event()
extern unsigned char mbus_busy_event(void);
 
 
#endif /* __MBUS_H__ */
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.