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

📄 tid_def.h

📁 mpc8xx driver(led), based on tqm8
💻 H
字号:
/*********************************************************************** * * (C) Copyright 2000 * Jean-Jacques Germond, Fr閐閞ic Soulier, Christian Batt; Alcatel * C/O jjg@sxb.bsf.alcatel.fr * * All rights reserved. * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU *Library* General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This code is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * *Library* General Public License for more details. * * You should have received a copy of the GNU *Library* General Public * License along with this program (see file COPYING.LIB); if not, * write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. * ***********************************************************************//* * * The "TRIVIAL INTERRUPT DRIVER" (tid) project main include file * by Jean-Jacques Germond (jjg). * * Several parts of these source siles are derived from * Alessandro Rubini (AR) "LINUX DEVICE DRIVERS" excellent book. * and "scull" examples at ftp://ora.com/pub/examples/linux/drivers * */#ifndef TRIVIAL_INTERRUPT_DEF#define TRIVIAL_INTERRUPT_DEF#define TID_MAX_CHARS    1000     /* The max number of chars in the device */#define TID_MAJOR         121#ifdef __KERNEL__/* Definitions that are not exported to UNIX processes */#include <linux/kernel.h>	/* We're doing kernel work	*/#include <linux/module.h>	/* Specifically, a module	*/#include <linux/mm.h>#include <linux/fs.h>#include <linux/types.h>#define	DEBUG#ifdef	DEBUG# define debugk(fmt,args...)	printk(fmt ,##args)#else# define debugk(fmt,args...)#endifextern void *kmalloc(size_t, int);extern void kfree(const void *);extern void kfree_s(const void *, size_t);#define NUM(dev)    (MINOR(dev)) /* low  nibble *//*  A TID device */typedef struct {  loff_t   nbChars;       /* The number of chars in the buffer */  long     uniqueId;      /* Unique instance identifier */  loff_t   maxChars;      /* The max # of chars in the device */      /* These guys are just for display via /proc */  long     nbIntrEver;    /* The never zeroed out number of interrupts */  long     nbBhActiv;     /* The # of activation of the bh handler */  long     nbWakeUp;      /* The # of wakeups of UNIX processes    */  long     lastWakeup;    /* The last wakeup code */      /* Pointer to hardware specific data (if needed) */  void    *hw;} Tid_Dev;/* Note:  The unique instance identifier is suposed to address the * problem of the tid device being erased while other unix processes * are waiting on this device.  To be frank, this problem is NOT * properly handled yet (we shoud wakeup such waiting processes when * erasing the device, etc, etc, ...) and we wont fix/test that because * "tid" our first "trivial interrupt driver" and we want to keep it * as simple as we like.  We imagine that real drivers must be awfully * complex to deal with such cases. */extern Tid_Dev tid_dev_struct;  /* The device descripor structure */extern int  tid_proc_register(void);extern void tid_proc_unregister(void);extern int   tid_rippleInit(void);extern char* tid_ripple(loff_t offset);extern int   tid_caughtSignal(void);extern int   tid_connect_timer(Tid_Dev* dev, unsigned long period);extern void  tid_disconnect_timer(Tid_Dev* dev);extern int   tid_wait(loff_t fpos);/* The portability layer to the virtual timer */extern int tid_useSimulatedTimer(void);extern void tid_it_handler(void* dev_id);extern void tid_init_timer (Tid_Dev* dev, unsigned long period);extern void tid_cancel_timer (Tid_Dev* dev);extern int  tid_getIntrNbr(void);   /* The interrupt number */extern void tid_ackTimerInterrupt(void *dev_id);extern void tid_setPeriod (Tid_Dev* dev, ulong interval); /* Set period and start */extern void tid_simu_timer_interrupt(int nbIntr);#endif	/* __KERNEL__ */#endif	/* TRIVIAL_INTERRUPT_DEF */

⌨️ 快捷键说明

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