[BACK]Return to device.h CVS log [TXT][DIR] Up to [local] / funnyos / sys

File: [local] / funnyos / sys / device.h (download)

Revision 1.9, Fri Dec 21 17:38:56 2007 UTC (16 years, 4 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +2 -2 lines

bump DVNAMELEN to 10 allowing device like 'spisdmmc' to attach

/*
 * $Id: device.h,v 1.9 2007/12/21 17:38:56 nbrk Exp $
 */
#ifndef _SYS_DEVICE_H
#define _SYS_DEVICE_H
#include <sys/types.h>

#define DVNAMELEN 10

struct device {
//	char 			dv_name[DVNAMELEN];		/* device name up to 7 chars */
	char 			*dv_name;
	uint8_t 		dv_minor;				/* instance number starting from 0 */
	int 			dv_active;				/* is this device active? */

	void 			*dv_devdata;			/* device data in driver */
	void 			*dv_aux;				/* varios data exposed by device */

	struct device 	*dv_parent;				/* parent device; set in attach time */
};


struct driver {
	uint32_t 		dr_ddsize;				/* size of xxx_dd (devdata) */
	int 			(*dr_attach)(struct device *self, uint32_t loc, uint8_t flags); /* attach subroutine */
	int 			(*dr_detach)(struct device *self); /* detach subroutine */
	void 			(*dr_interrupt)(struct device *self); /* intr handler */
};


struct driverinfo {
	/*
	 * Associate actual driver with device name.
	 */
	char 			*di_dname; 		/* device name */
	struct driver	*di_driverp; 	/* pointer to driver */
	int8_t 			di_ninstances; 	/* number of already created devices; for dv_minor */
};


struct attachinfo {
	/*
	 * Attach hint. Describes where to attach particular device.
	 * "child" at "parent" 0 loc 0x16000000 intrno 4 flags 0x00
	 */
	char 			*ai_cname; 		/* child device name */
	char 			*ai_pname; 		/* parent device name */
	uint8_t 		ai_pminor; 		/* parent minor */
	uint32_t 		ai_locator;		/* location on parent (0 - default) */
	int8_t 			ai_intrno; 		/* interrupt line (XXX on IRQ Controller) */
	uint8_t 		ai_flags; 		/* flags passed to dr_attach() */
};


#endif /* _SYS_DEVICE_H */