亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
大陆成人av片| 精品伊人久久久久7777人| 久久久蜜桃精品| 日韩欧美区一区二| 日韩欧美不卡在线观看视频| 欧美一区二区三区免费视频 | 欧美在线高清视频| 成人免费视频视频| 99久久精品国产网站| 色综合天天视频在线观看| 色哟哟一区二区在线观看| 欧美中文字幕不卡| 91精品国产综合久久久蜜臀图片| 欧美肥大bbwbbw高潮| 日韩一区二区在线观看视频播放| 欧美一区二区高清| 国产亚洲成aⅴ人片在线观看| 久久综合久色欧美综合狠狠| 国产精品电影一区二区三区| 亚洲激情综合网| 日韩中文字幕区一区有砖一区 | 亚洲国产视频网站| 日韩精品一二三四| 国产精品一区二区黑丝| 91一区二区在线观看| 精品污污网站免费看| 精品对白一区国产伦| 亚洲视频资源在线| 日韩不卡一区二区| 成人精品国产一区二区4080| 欧美中文字幕亚洲一区二区va在线 | 精品一区二区精品| eeuss鲁片一区二区三区 | 成人av免费网站| 欧美日韩精品一区二区三区 | 91免费版pro下载短视频| 精品视频1区2区| 久久―日本道色综合久久| 亚洲欧美成人一区二区三区| 日韩av一级片| 91免费观看国产| 国产日韩欧美在线一区| 石原莉奈一区二区三区在线观看| 国产精品综合久久| 欧美老女人在线| 亚洲视频一区在线| 精品一区二区三区久久久| 欧美影院午夜播放| 亚洲国产成人一区二区三区| 免费在线成人网| 一本大道av一区二区在线播放| 337p粉嫩大胆噜噜噜噜噜91av | 久久国产综合精品| 欧美最猛黑人xxxxx猛交| 亚洲国产精品二十页| 日韩av电影免费观看高清完整版在线观看 | 欧美一区二区三区免费| 亚洲精品少妇30p| 成人av免费网站| 欧美激情一区三区| 国产一区二区在线影院| 日韩欧美一区二区免费| 香蕉乱码成人久久天堂爱免费| 99精品国产99久久久久久白柏| 久久久久久久综合| 国产在线播放一区三区四| 日韩欧美国产一区在线观看| 天天色天天操综合| 欧美麻豆精品久久久久久| 亚洲va在线va天堂| 欧美自拍丝袜亚洲| 亚洲人成网站色在线观看| 成人99免费视频| 亚洲欧美一区二区视频| 99re视频精品| 亚洲精品乱码久久久久久黑人 | 一区二区三区电影在线播| 97久久精品人人爽人人爽蜜臀 | 欧美曰成人黄网| 亚洲午夜精品网| 欧美日韩免费视频| 日韩一区精品字幕| 欧美电影免费提供在线观看| 精品影院一区二区久久久| 久久久精品免费观看| 丁香六月久久综合狠狠色| 国产精品女同一区二区三区| 91在线高清观看| 天堂影院一区二区| 2021国产精品久久精品| 成人午夜伦理影院| 亚洲国产成人在线| 欧洲精品一区二区| 九九国产精品视频| 国产精品国产三级国产aⅴ中文| 波多野结衣91| 天天操天天干天天综合网| 欧美va在线播放| 成人免费视频国产在线观看| 国产精品18久久久久久久久久久久| 日韩免费性生活视频播放| 国内精品不卡在线| 亚洲三级免费电影| 日韩一二三四区| 国产成人在线网站| 亚洲综合男人的天堂| 精品国内片67194| 91农村精品一区二区在线| 蜜桃精品视频在线观看| 国产精品欧美一区二区三区| 91精品麻豆日日躁夜夜躁| 国产精品夜夜爽| 午夜精品久久久久久| 国产女同性恋一区二区| 欧美精品一级二级| 成人亚洲一区二区一| 五月天精品一区二区三区| 国产精品三级在线观看| 欧美一区二区三区在线观看| 91色视频在线| 国产一区二区不卡在线| 亚洲一级二级在线| 国产精品伦理一区二区| 日韩欧美国产一区二区在线播放| 91理论电影在线观看| 国产一区二区三区蝌蚪| 午夜精品在线看| 最新久久zyz资源站| 日韩一区二区三| 欧美色精品在线视频| 成人午夜视频福利| 美女视频黄频大全不卡视频在线播放| 亚洲天堂精品视频| 欧美激情综合五月色丁香| 欧美tickling挠脚心丨vk| 欧美精品色综合| 欧美色老头old∨ideo| 91老师片黄在线观看| www.亚洲激情.com| 国产不卡在线视频| 国产精品一二三四五| 国产自产视频一区二区三区| 日韩高清一区在线| 一区二区三区在线高清| 亚洲免费看黄网站| 亚洲精品日产精品乱码不卡| 国产欧美一区二区在线| 国产婷婷色一区二区三区四区| 欧美成人bangbros| 欧美成人三级电影在线| 日韩无一区二区| 日韩视频在线一区二区| 日韩一区二区三区免费看 | 美女国产一区二区三区| 秋霞电影网一区二区| 七七婷婷婷婷精品国产| 免费美女久久99| 国产在线视视频有精品| 国产福利一区二区| 国产成人精品一区二| 不卡视频一二三| 91久久久免费一区二区| 在线观看欧美精品| 欧美老肥妇做.爰bbww| 91精品国产入口| 精品乱码亚洲一区二区不卡| 久久久久久久久岛国免费| 欧美国产激情二区三区| 综合av第一页| 亚洲二区在线视频| 麻豆精品一区二区av白丝在线| 国内欧美视频一区二区 | 色综合视频一区二区三区高清| 色综合久久久久综合体桃花网| 精品视频资源站| 久久综合久久久久88| 亚洲视频中文字幕| 日韩极品在线观看| 国产91高潮流白浆在线麻豆| 色婷婷久久综合| 欧美一级理论片| 中文字幕免费不卡| 五月天激情综合| 国产成人8x视频一区二区 | 免费在线观看视频一区| 国产99精品国产| 欧美男人的天堂一二区| 国产视频不卡一区| 午夜免费久久看| 懂色av中文一区二区三区| 欧美色手机在线观看| 久久久久久**毛片大全| 亚洲一二三专区| 风间由美一区二区av101 | 国产视频一区不卡| 天堂精品中文字幕在线| 不卡大黄网站免费看| 欧美成人在线直播| 亚洲永久免费视频| 成人午夜精品在线|