亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? short.c

?? LINUX設備驅動2源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * short.c -- Simple Hardware Operations and Raw Tests * short.c -- also a brief example of interrupt handling ("short int") * * untested (by now) the hardware r/w * * Tested with 2.0.18 (intel & alpha -- but no irq available for me) * This module won't work on the sparc, where there's no concept of I/O space *  *********/#ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif#ifdef __sparc__#  error "This module can't compile on the Sparc platform"#else#include <linux/module.h>#include <linux/sched.h>#include <linux/kernel.h> /* printk() */#include <linux/fs.h>     /* everything... */#include <linux/errno.h>  /* error codes */#include <linux/malloc.h>#include <linux/mm.h>#include <linux/ioport.h>#include <linux/interrupt.h>#include <linux/tqueue.h>#include <asm/io.h>#include <asm/segment.h>#include "sysdep-2.1.h"int short_major = 0;#ifdef __alpha__int short_base = 0x3bc; /* Hmm.... FIXME */#elseint short_base = 0x378; /* intel: default to lp0 */#endifint short_irq = -1;unsigned long short_buffer = 0;unsigned long volatile short_head;volatile unsigned long short_tail;struct wait_queue *short_queue;static int probe = 0; /* select at load time how to probe irq line */static int bh = 0; /* select at load time whether a bottom-half is used */static int share = 0; /* select at load time whether install a shared irq *//* * The devices with low minor numbers write/read burst of data to/from * specific I/O ports (by default the parallel ones). *  * The device with 128 as minor number returns ascii strings telling * when interrupts have been received. Writing to the device toggles * 00/FF on the parallel data lines. If there is a loopback wire, this * generates interrupts.   */int short_open (struct inode *inode, struct file *filp){    extern struct file_operations short_i_fops;    MOD_INC_USE_COUNT;    if (MINOR(inode->i_rdev) & 0x80) {        filp->f_op = &short_i_fops; /* the interrupt-driven node */    }    return 0;}release_t short_release (struct inode *inode, struct file *filp){    MOD_DEC_USE_COUNT;    release_return(0);}/* first, the port-oriented device */enum short_modes {SHORT_DEFAULT=0, SHORT_PAUSE, SHORT_STRING};read_write_t short_read (struct inode *inode, struct file *filp,                char *buf, count_t count){    int retval = count;    unsigned port = short_base + (MINOR(inode->i_rdev)&0x0f);    int mode = (MINOR(inode->i_rdev)&0x70) >> 4;    unsigned char *kbuf=kmalloc(count, GFP_KERNEL), *ptr;        if (!kbuf) return -ENOMEM;    ptr=kbuf;    switch(mode) {      case SHORT_STRING:#ifndef __alpha__ /* Alpha doesn'e export insb: fall through */        insb(port, ptr, count);        break;#endif      case SHORT_DEFAULT:        while (count--)            *(ptr++) = inb(port);        break;      case SHORT_PAUSE:        while (count--)            *(ptr++) = inb_p(port);        break;      default: /* no more modes defined by now */        retval = -EINVAL;        break;    }    if (retval > 0)        copy_to_user(buf, kbuf, retval);    kfree(kbuf);    return retval;}read_write_t short_write (struct inode *inode, struct file *filp,                const char *buf, count_t count){    int retval = count;    unsigned port = short_base + (MINOR(inode->i_rdev)&0x0f);    int mode = (MINOR(inode->i_rdev)&0x70) >> 4;    unsigned char *kbuf=kmalloc(count, GFP_KERNEL), *ptr;    if (!kbuf) return -ENOMEM;    copy_from_user(kbuf, buf, count);    ptr=kbuf;    switch(mode) {      case SHORT_PAUSE:        while (count--)            outb_p(*(ptr++), port);        break;      case SHORT_STRING:#ifndef __alpha__ /* Alpha doesn't export insb: fall through  */        outsb(port, ptr, count);        break;#endif      case SHORT_DEFAULT:        while (count--)            outb(*(ptr++), port);        break;      default: /* no more modes defined by now */        retval = -EINVAL;        break;    }    kfree(kbuf);    return retval;}#ifdef __USE_OLD_SELECT__int short_poll (struct inode *inode, struct file *filp,                  int mode, select_table *table){    return mode==SEL_EX ? 0 : 1; /* readable, writable, not-exceptionable */}#elseunsigned int short_poll (struct file *filp, poll_table *table){    return POLLIN | POLLRDNORM | POLLOUT | POLLWRNORM;}#endifstruct file_operations short_fops = {    NULL,          /* short_lseek */    short_read,    short_write,    NULL,          /* short_readdir */    short_poll,    NULL,          /* short_ioctl */    NULL,          /* short_mmap */    short_open,    short_release,    NULL,          /* short_fsync */    NULL,          /* short_fasync */                   /* nothing more, fill with NULLs */};/* then,  the interrupt-related device */read_write_t short_i_read (struct inode *inode, struct file *filp,                char *buf, count_t count){    int count0;    while (short_head == short_tail) {        interruptible_sleep_on(&short_queue);        if (current->signal & ~current->blocked) /* a signal arrived */          return -ERESTARTSYS; /* tell the fs layer to handle it */        /* else, loop */    }    /* count0 is the number of readable data bytes */    count0 = short_head - short_tail;    if (count0 < 0) /* wrapped */        count0 = short_buffer + PAGE_SIZE - short_tail;    if (count0 < count) count = count0;    copy_to_user(buf, (char *)short_tail, count);    short_tail += count;    if (short_tail == short_buffer + PAGE_SIZE)        short_tail = short_buffer;    return count;}read_write_t short_i_write (struct inode *inode, struct file *filp,                const char *buf, count_t count){    int written = 0, odd = filp->f_pos & 1;    unsigned port = short_base; /* output to the parallel data latch */    while (written < count)        outb(0xff * ((++written + odd) & 1), port);    filp->f_pos += count;    return written;}struct file_operations short_i_fops = {    NULL,          /* short_i_lseek */    short_i_read,    short_i_write,    NULL,          /* short_i_readdir */    NULL,          /* short_i_select */    NULL,          /* short_i_ioctl */    NULL,          /* short_i_mmap */    short_open,    short_release,    NULL,          /* short_i_fsync */    NULL,          /* short_i_fasync */                   /* nothing more, fill with NULLs */};/* * The interrupt handler has a different prototype whether it * is compiled with kernels older or newer than 1.3.70 */#if LINUX_VERSION_CODE < VERSION_CODE(1,3,70)void short_interrupt(int irq, struct pt_regs *regs)#elsevoid short_interrupt(int irq, void *dev_id, struct pt_regs *regs)#endif{    struct timeval tv;    do_gettimeofday(&tv);    /* Write a 16 byte record. Assume PAGE_SIZE is a multiple of 16 */    short_head += sprintf((char *)short_head,"%08u.%06u\n",                          (int)(tv.tv_sec % 100000000), (int)(tv.tv_usec));    if (short_head == short_buffer + PAGE_SIZE)        short_head = short_buffer; /* wrap */    wake_up_interruptible(&short_queue); /* awake any reading process */}/* * The following two functions are equivalent to the previous one, * but split in top and bottom half. First, a few needed variables */#define NR_TIMEVAL 512 /* length of the array of time values */struct timeval tv_data[NR_TIMEVAL]; /* too lazy to allocate it */volatile struct timeval *tv_head=tv_data;struct timeval *tv_tail=tv_data;static struct tq_struct short_task; /* 0 by now, filled by init_module code */int short_bh_count = 0;void short_bottom_half(void *unused){    int savecount = short_bh_count;    short_bh_count = 0; /* we have already been removed from the queue */    /*     * The bottom half reads the tv array, filled by the top half,     * and prints it to the circular text buffer, which is then consumed     * by reading processes     */    /* First write the number of interrupts that occurred before this bh */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91超碰这里只有精品国产| 久久综合九色综合欧美就去吻| 欧美剧情片在线观看| 久久久久高清精品| 五月天一区二区三区| 国产激情视频一区二区在线观看| 色吧成人激情小说| 久久精品一区蜜桃臀影院| 亚洲不卡在线观看| 99视频超级精品| 久久久久久9999| 日韩精品一区第一页| 99久久精品情趣| 国产日韩综合av| 蜜臀av在线播放一区二区三区| 色哟哟在线观看一区二区三区| 久久精品人人做| 久久成人18免费观看| 欧美性xxxxxx少妇| 亚洲天堂精品在线观看| 成人免费高清视频在线观看| 精品国产免费人成在线观看| 日本中文字幕一区二区有限公司| 欧美性受xxxx黑人xyx性爽| 欧美高清一级片在线观看| 国内精品久久久久影院色 | 91精品国产欧美一区二区成人| 国产精品久久久久久久久动漫| 精品一区二区在线观看| 制服丝袜日韩国产| 婷婷国产在线综合| 欧美日本在线播放| 丝袜诱惑制服诱惑色一区在线观看| 91福利在线观看| 亚洲靠逼com| 欧美视频一区二区在线观看| 亚洲国产日韩精品| 欧美精品在线观看播放| 日韩精品国产精品| 日韩欧美123| 国产精品99久久久久久有的能看| 久久影院午夜片一区| 国产成人h网站| 中文字幕一区视频| 日本久久电影网| 亚洲成人第一页| 日韩欧美成人一区二区| 国产美女娇喘av呻吟久久| 久久精品男人天堂av| 风间由美中文字幕在线看视频国产欧美| 精品成人a区在线观看| 国产麻豆精品久久一二三| 中文字幕乱码日本亚洲一区二区| 99精品黄色片免费大全| 亚洲国产成人av| 亚洲精品一区二区精华| 波多野结衣中文字幕一区二区三区| 亚洲欧洲av在线| 欧美人体做爰大胆视频| 国产在线精品一区二区| 亚洲欧洲美洲综合色网| 欧美久久一二三四区| 黄色小说综合网站| 亚洲欧美一区二区三区极速播放 | 亚洲va欧美va天堂v国产综合| 精品视频一区 二区 三区| 久久精品国产亚洲a| 国产精品久久午夜夜伦鲁鲁| 欧美视频在线一区| 国产激情一区二区三区四区| 亚洲一线二线三线视频| 精品福利一二区| 欧洲一区二区三区在线| 韩国成人在线视频| 亚洲高清视频的网址| 国产日韩综合av| 91精品国产欧美一区二区成人| 国产v综合v亚洲欧| 三级影片在线观看欧美日韩一区二区 | 成人免费毛片app| 五月婷婷久久丁香| 国产精品久久久久一区| 精品日韩一区二区| 欧美性猛交xxxxxx富婆| 成人免费电影视频| 狠狠色综合日日| 五月婷婷欧美视频| 亚洲女性喷水在线观看一区| 久久影院视频免费| 91精品国产aⅴ一区二区| 99久久久精品免费观看国产蜜| 久久99热国产| 日韩av一二三| 午夜精品免费在线| 亚洲精品欧美二区三区中文字幕| 精品国产凹凸成av人导航| 欧美三级视频在线| 色综合中文综合网| 中文字幕+乱码+中文字幕一区| 欧美精品 国产精品| 欧美在线免费观看视频| 99精品一区二区三区| 成人毛片在线观看| 国产一区二区三区免费| 美女www一区二区| 天涯成人国产亚洲精品一区av| 亚洲视频一区二区在线观看| 国产精品天干天干在线综合| 久久男人中文字幕资源站| 日韩欧美中文一区二区| 3d动漫精品啪啪1区2区免费| 欧美日韩一区三区四区| 在线中文字幕一区二区| 欧美色窝79yyyycom| 欧美综合在线视频| 在线视频观看一区| 欧美日韩一区视频| 9191国产精品| 日韩一级片在线观看| 精品乱码亚洲一区二区不卡| 欧美va在线播放| 精品久久久久久无| 久久亚洲精华国产精华液| 国产日韩欧美a| 亚洲国产精品精华液2区45| 国产精品美女久久久久av爽李琼| 国产精品污网站| 亚洲欧美日韩国产成人精品影院| 亚洲日本韩国一区| 水野朝阳av一区二区三区| 蜜桃精品视频在线观看| 精品亚洲aⅴ乱码一区二区三区| 狠狠色伊人亚洲综合成人| 丁香天五香天堂综合| 91精品1区2区| 欧美大度的电影原声| 欧美激情中文字幕一区二区| 亚洲精品欧美在线| 日本美女视频一区二区| 韩国女主播成人在线| 懂色av中文一区二区三区| 91视频国产观看| 欧美一区二区三区的| 欧美国产日韩亚洲一区| 亚洲已满18点击进入久久| 美国精品在线观看| av网站免费线看精品| 欧美夫妻性生活| 国产午夜精品在线观看| 亚洲尤物在线视频观看| 精品一二三四区| 91麻豆文化传媒在线观看| 欧美一区二区三区免费在线看| 国产日产精品1区| 亚洲一区免费视频| 国产乱一区二区| 欧美亚洲国产一区在线观看网站| 日韩精品一区二区三区四区视频| 欧美高清在线视频| 男女男精品网站| 色综合一区二区| 日本一区二区三区电影| 婷婷开心激情综合| 99精品视频在线免费观看| 精品毛片乱码1区2区3区| 亚洲小少妇裸体bbw| 国产成人精品aa毛片| 这里只有精品视频在线观看| 中文字幕在线一区免费| 蜜桃av一区二区在线观看 | av日韩在线网站| 日韩午夜激情av| 亚洲一区在线观看免费 | 欧美日本在线视频| 国产精品久久久久久久久晋中 | 亚洲欧美综合网| 精品亚洲porn| 日韩午夜小视频| 三级影片在线观看欧美日韩一区二区 | 日韩一区二区三区在线观看| 中文字幕一区在线观看视频| 国产一区在线不卡| 日韩写真欧美这视频| 亚洲成av人**亚洲成av**| www.av亚洲| 国产喷白浆一区二区三区| 精品一区二区三区在线播放| 欧美日韩国产精选| 一区二区三区日本| 99久久综合国产精品| 国产天堂亚洲国产碰碰| 国产呦精品一区二区三区网站| 91精品国产aⅴ一区二区| 亚洲国产三级在线| 欧美日韩中文字幕一区二区| 亚洲黄一区二区三区| 色哟哟国产精品| 亚洲人午夜精品天堂一二香蕉| www.欧美日韩| 亚洲日本在线a|