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

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

?? lptdrv.c

?? IXP425的BSP代碼
?? C
字號:
/* lptDrv.c - parallel chip device driver for the IBM-PC LPT *//* Copyright 1984-2001 Wind River Systems, Inc. *//*modification history--------------------01m,01apr01,rcs  used LPT_DATA_RES, LPT_STAT_RES, and LPT_CTRL_RES macros                 exclusively and set the default spacing to 1 SPR# 6593701l,23mar01,sru  register spacing now provided in LPT_RESOURCE SPR# 6593701k,15mar01,dat  SPR 28847/65275, disable interrupt after each character01j,21nov00,jkf  SPR#62266 T3 doc update01i,26oct00,jkf  SPR 35546, removed unused IMPORT sysIntLevel().01h,04jan00,dat  SPR 29875, using SEM_ID in structures.01g,06oct98,jmp  doc: cleanup.01f,03jun98,hdn  removed spurious interrupt handling from lptIntr().01e,18oct96,hdn  re-written.01d,14jun95,hdn  removed function declarations defined in sysLib.h.01c,24jan95,jdi  doc cleanup.01b,20nov94,kdl  fixed typo in man page.01a,13oct94,hdn  written.*//*DESCRIPTIONThis is the basic driver for the LPT used on the IBM-PC.  If the component INCLUDE_LPT is enabled, the driver initializes the LPT port on the PC.USER-CALLABLE ROUTINESMost of the routines in this driver are accessible only through the I/Osystem.  However, two routines must be called directly:  lptDrv() toinitialize the driver, and lptDevCreate() to create devices.There are one other callable routines:  lptShow() to show statistics.The argument to lptShow() is a channel number, 0 to 2.Before the driver can be used, it must be initialized by calling lptDrv().This routine should be called exactly once, before any reads, writes, orcalls to lptDevCreate().  Normally, it is called from usrRoot() inusrConfig.c.  The first argument to lptDrv() is a number of channels,0 to 2.  The second argument is a pointer to the resource table.Definitions of members of the resource table structure are:.CS    int  ioBase;         /@ IO base address @/    int  intVector;      /@ interrupt vector @/    int  intLevel;       /@ interrupt level @/    BOOL autofeed;       /@ TRUE if enable autofeed @/    int  busyWait;       /@ loop count for BUSY wait @/    int  strobeWait;     /@ loop count for STROBE wait @/    int  retryCnt;       /@ retry count @/    int  timeout;        /@ timeout second for syncSem @/.CEIOCTL FUNCTIONSThis driver responds to two functions: LPT_SETCONTROL and LPT_GETSTATUS.The argument for LPT_SETCONTROL is a value of the control register.The argument for LPT_GETSTATUS is a integer pointer where a value of thestatus register is stored.SEE ALSO:.pG "I/O System"*/#include "vxWorks.h"#include "taskLib.h"#include "blkIo.h"#include "ioLib.h"#include "iosLib.h"#include "memLib.h"#include "stdlib.h"#include "errnoLib.h"#include "stdio.h"#include "string.h"#include "intLib.h"#include "iv.h"#include "wdLib.h"#include "sysLib.h"#include "sys/fcntlcom.h"#include "drv/parallel/lptDrv.h"/* imports */IMPORT UINT sysStrayIntCount;/* globals */LPT_DEV lptDev [N_LPT_CHANNELS];/* locals */LOCAL int	lptDrvNum;	/* driver number assigned to this driver *//* forward declarations */LOCAL	int	lptOpen		(LPT_DEV *pDev, char *name, int mode);LOCAL	int	lptRead		(LPT_DEV *pDev, char *pBuf, int size);LOCAL	int	lptWrite	(LPT_DEV *pDev, char *pBuf, int size);LOCAL	STATUS	lptIoctl	(LPT_DEV *pDev, int function, int arg);LOCAL	void	lptIntr		(LPT_DEV *pDev);LOCAL	void	lptInit		(LPT_DEV *pDev);/********************************************************************************* lptDrv - initialize the LPT driver** This routine initializes the LPT driver, sets up interrupt vectors,* and performs hardware initialization of the LPT ports.** This routine should be called exactly once, before any reads, writes,* or calls to lptDevCreate().  Normally, it is called by usrRoot()* in usrConfig.c.** RETURNS: OK, or ERROR if the driver cannot be installed.** SEE ALSO: lptDevCreate()*/STATUS lptDrv     (    int channels,		/* LPT channels */    LPT_RESOURCE *pResource	/* LPT resources */    )    {    int ix;    LPT_DEV *pDev;    /* check if driver already installed */    if (lptDrvNum > 0)	return (OK);        if (channels > N_LPT_CHANNELS)	return (ERROR);    for (ix=0; ix < channels; ix++, pResource++)	{	pDev = &lptDev[ix];	pDev->created		= FALSE;	pDev->autofeed		= pResource->autofeed;	pDev->inservice		= FALSE;        if (pResource->regDelta == 0) 	   pResource->regDelta = 1;         pDev->data		= LPT_DATA_RES (pResource);        pDev->stat		= LPT_STAT_RES (pResource);        pDev->ctrl		= LPT_CTRL_RES (pResource);	pDev->intCnt		= 0;	pDev->retryCnt		= pResource->retryCnt;	pDev->busyWait		= pResource->busyWait;	pDev->strobeWait	= pResource->strobeWait;	pDev->timeout		= pResource->timeout;	pDev->intLevel		= pResource->intLevel;    	pDev->syncSem = semBCreate (SEM_Q_FIFO, SEM_EMPTY);    	pDev->muteSem = semMCreate (SEM_Q_PRIORITY | SEM_DELETE_SAFE |				  SEM_INVERSION_SAFE);    	(void) intConnect ((VOIDFUNCPTR *)INUM_TO_IVEC (pResource->intVector),		           (VOIDFUNCPTR)lptIntr, (int)pDev);    	sysIntEnablePIC (pDev->intLevel);	/* unmask the interrupt */	lptInit (&lptDev[ix]);	}    lptDrvNum = iosDrvInstall (lptOpen, (FUNCPTR) NULL, lptOpen,			       (FUNCPTR) NULL, lptRead, lptWrite, lptIoctl);    return (lptDrvNum == ERROR ? ERROR : OK);    }/********************************************************************************* lptDevCreate - create a device for an LPT port** This routine creates a device for a specified LPT port.  Each port* to be used should have exactly one device associated with it by calling* this routine.** For instance, to create the device `/lpt/0', the proper call would be:* .CS*     lptDevCreate ("/lpt/0", 0);* .CE** RETURNS: OK, or ERROR if the driver is not installed, the channel is* invalid, or the device already exists.** SEE ALSO: lptDrv()*/STATUS lptDevCreate    (    char *name,		/* name to use for this device */    int channel		/* physical channel for this device (0 - 2) */    )    {    if (channel >= N_LPT_CHANNELS)	return (ERROR);    if (lptDrvNum <= 0)	{	errnoSet (S_ioLib_NO_DRIVER);	return (ERROR);	}    /* if this device already exists, don't create it */    if (lptDev[channel].created)	return (ERROR);    /* mark the device as created, and add the device to the I/O system */    lptDev[channel].created = TRUE;    return (iosDevAdd (&lptDev[channel].devHdr, name, lptDrvNum));    }/********************************************************************************* lptOpen - open file to LPT** ARGSUSED1*/LOCAL int lptOpen    (    LPT_DEV *pDev,    char    *name,    int     mode    )    {    return ((int) pDev);    }/********************************************************************************* lptRead - read from the port.** Read from the port.** RETURNS: ERROR.*/LOCAL int lptRead    (    LPT_DEV *pDev,    char    *pBuf,    int     size    )    {    return (ERROR);	/* XXX would be supported in next release */    }/********************************************************************************* lptWrite - write to the port.** Write to the port.** RETURNS: The number of bytes written, or ERROR if the command didn't succeed.*/LOCAL int lptWrite    (    LPT_DEV *pDev,    char    *pBuf,    int     size    )    {    int byteCnt = 0;    BOOL giveup = FALSE;    int retry;    int wait;    if (size == 0)	return (size);        semTake (pDev->muteSem, WAIT_FOREVER);    retry = 0;    while ((sysInByte (pDev->stat) & S_MASK) != 	   (S_SELECT | S_NODERR | S_NOBUSY))	{	if (retry++ > pDev->retryCnt)	    {	    if (giveup)		{	        errnoSet (S_ioLib_DEVICE_ERROR);	        semGive (pDev->muteSem);	        return (ERROR);		}	    else		{		lptInit (pDev);		giveup = TRUE;		}	    }        wait = 0;	while (wait != pDev->busyWait)	    wait++;	}        retry = 0;    do {        wait  = 0;	sysOutByte (pDev->data, *pBuf);	while (wait != pDev->strobeWait)	    wait++;	sysOutByte (pDev->ctrl, sysInByte (pDev->ctrl) | C_STROBE | C_ENABLE);	while (wait)	    wait--;	sysOutByte (pDev->ctrl, sysInByte (pDev->ctrl) & ~C_STROBE);	if (semTake (pDev->syncSem, pDev->timeout * sysClkRateGet ()) == ERROR)	    {	    if (retry++ > pDev->retryCnt)		{		errnoSet (S_ioLib_DEVICE_ERROR);		semGive (pDev->muteSem);		return (ERROR);		}	    }	else	    {	    pBuf++;	    byteCnt++;	    }	} while (byteCnt < size);    semGive (pDev->muteSem);    return (size);    }/********************************************************************************* lptIoctl - special device control** This routine handles LPT_SETCONTROL and LPT_GETSTATUS requests.** RETURNS: OK or ERROR if invalid request.*/LOCAL STATUS lptIoctl    (    LPT_DEV *pDev,	/* device to control */    int function,	/* request code */    int arg		/* some argument */    )    {    int status = OK;    semTake (pDev->muteSem, WAIT_FOREVER);    switch (function)	{	case LPT_SETCONTROL:    	    sysOutByte (pDev->ctrl, arg);	    break;	case LPT_GETSTATUS:    	    *(int *)arg = sysInByte (pDev->stat);	    break;	default:	    (void) errnoSet (S_ioLib_UNKNOWN_REQUEST);	    status = ERROR;	    break;	}    semGive (pDev->muteSem);    return (status);    }/********************************************************************************* lptIntr - handle an interrupt** This routine gets called to handle interrupts.* If there is another character to be transmitted, it sends it.  If* not, or if a device has never been created for this channel, just* return.** Disables interrupts after each character.  This protects the system* against continuous interrupts when printer is not connected, or interrupt* controller is not programmed correctly (level versus edge detect).*/LOCAL void lptIntr    (    LPT_DEV *pDev    )    {    pDev->inservice = TRUE;    pDev->intCnt++;    semGive (pDev->syncSem);    pDev->inservice = FALSE;    sysOutByte (pDev->ctrl, sysInByte (pDev->ctrl) & ~C_ENABLE);      }/********************************************************************************* lptInit - initialize the specified LPT port** initialize the specified LPT port.*/LOCAL void lptInit    (    LPT_DEV *pDev    )    {    sysOutByte (pDev->ctrl, 0);			/* init */    taskDelay (sysClkRateGet () >> 3);		/* hold min 50 mili sec */    if (pDev->autofeed)        sysOutByte (pDev->ctrl, C_NOINIT | C_SELECT | C_AUTOFEED);    else        sysOutByte (pDev->ctrl, C_NOINIT | C_SELECT);    }/********************************************************************************* lptShow - show LPT statistics** This routine shows statistics for a specified LPT port.** RETURNS: N/A*/void lptShow    (    UINT channel	/* channel (0 - 2) */    )    {    LPT_DEV *pDev = &lptDev[channel];    if (channel > N_LPT_CHANNELS)	return;    printf ("controlReg        = 0x%x\n", sysInByte (pDev->ctrl));    printf ("statusReg         = 0x%x\n", sysInByte (pDev->stat));    printf ("created           = %s\n",   pDev->created ? "TRUE" : "FALSE");    printf ("autofeed          = %s\n",   pDev->autofeed ? "TRUE" : "FALSE");    printf ("inservice         = %s\n",   pDev->inservice ? "TRUE" : "FALSE");    printf ("normalInt         = %d\n",   pDev->intCnt);    printf ("defaultInt        = %d\n",   sysStrayIntCount);    printf ("retryCnt          = %d\n",   pDev->retryCnt);    printf ("busyWait   (loop) = %d\n",   pDev->busyWait);    printf ("strobeWait (loop) = %d\n",   pDev->strobeWait);    printf ("timeout    (sec)  = %d\n",   pDev->timeout);    printf ("intLevel   (IRQ)  = %d\n",   pDev->intLevel);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人a免费在线看| 日本美女视频一区二区| 精品国产乱码久久久久久老虎| 91成人免费在线| 欧美三级日韩三级| 欧美高清精品3d| 日韩精品一区国产麻豆| 久久这里只有精品首页| 久久精品日韩一区二区三区| 国产精品久久久久久久久久久免费看 | 成人黄色小视频| 色综合久久88色综合天天6| 欧美一区二区三区的| 国产乱国产乱300精品| 国产亚洲成av人在线观看导航| 99久久精品国产毛片| 成人午夜激情视频| 国产亚洲人成网站| 国产性做久久久久久| 中文字幕亚洲欧美在线不卡| 午夜精品久久久| 懂色av一区二区三区免费观看| 色婷婷国产精品综合在线观看| 欧美日韩精品一区二区天天拍小说 | 国产精品国产三级国产三级人妇| 中文字幕在线观看一区二区| 日韩中文字幕一区二区三区| 国产一区在线视频| 欧美日韩在线电影| 中文子幕无线码一区tr| 五月婷婷欧美视频| 91亚洲精品一区二区乱码| 欧美电影免费观看高清完整版| 亚洲成人自拍一区| 午夜电影一区二区| 成人黄色片在线观看| 日韩一区二区电影在线| 亚洲精品va在线观看| 成人国产精品免费观看视频| 日韩女优电影在线观看| 五月激情综合色| 欧美日本一区二区在线观看| 一区二区三区中文字幕| 91麻豆文化传媒在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 日韩电影免费在线观看网站| 欧美精品日韩综合在线| 一区二区三区免费网站| 欧美午夜理伦三级在线观看| 亚洲欧美日韩综合aⅴ视频| 波多野结衣的一区二区三区| 国产精品久久久久久久久免费樱桃 | 色8久久人人97超碰香蕉987| 亚洲免费在线看| 91精品福利在线一区二区三区 | www国产成人免费观看视频 深夜成人网| 亚洲综合在线免费观看| 欧美午夜电影在线播放| 欧美一区二区三区影视| 久久成人久久鬼色| 亚洲欧美另类综合偷拍| 欧美精品久久久久久久多人混战| 亚洲一级二级三级| 国产色产综合色产在线视频| 日本丶国产丶欧美色综合| 麻豆成人综合网| 亚洲小说春色综合另类电影| 欧美国产日韩一二三区| 51精品秘密在线观看| www.欧美精品一二区| 国内成人免费视频| 免费看精品久久片| 亚洲电影一级片| 亚洲一卡二卡三卡四卡五卡| 国产精品久久久久久久久晋中| 精品国产免费一区二区三区香蕉| 欧美午夜片在线看| 色成人在线视频| 91视频免费观看| 91麻豆国产福利在线观看| www.亚洲精品| 95精品视频在线| 91在线视频免费91| 日本高清成人免费播放| 日韩午夜小视频| 丁香啪啪综合成人亚洲小说| 久久久午夜精品理论片中文字幕| 麻豆免费精品视频| 久久精品网站免费观看| 国产盗摄视频一区二区三区| 亚洲电影视频在线| 久久久久久综合| 日韩精品一区二区三区蜜臀| 97久久精品人人做人人爽50路| thepron国产精品| 不卡的电影网站| 91视频精品在这里| 欧美日韩在线综合| 精品日韩一区二区| 国产亚洲成aⅴ人片在线观看| 亚洲精品在线网站| 国产视频911| 中文字幕中文在线不卡住| 亚洲一区二区三区在线| 日韩av在线播放中文字幕| 国产电影一区二区三区| 91精品中文字幕一区二区三区| 精品国产精品网麻豆系列| 国产精品天天摸av网| 18成人在线观看| 婷婷六月综合亚洲| 国产99精品国产| 欧美日韩在线综合| 日韩毛片一二三区| 狠狠狠色丁香婷婷综合激情| 99精品久久久久久| 日韩一级二级三级精品视频| 中文字幕一区二区三区四区| 热久久一区二区| 欧美日韩午夜影院| 亚洲欧美日本韩国| 国产老妇另类xxxxx| 91精品欧美久久久久久动漫| 亚洲天堂中文字幕| 国产激情精品久久久第一区二区| 欧美日韩一区二区三区视频| 一区二区三区在线观看国产| 91麻豆.com| 亚洲免费在线视频| 91在线观看污| 中文字幕中文字幕中文字幕亚洲无线| 精品综合久久久久久8888| 欧美日韩国产系列| 亚洲午夜久久久久久久久久久| 欧美影视一区二区三区| 香蕉成人啪国产精品视频综合网| 91久久精品网| 肉丝袜脚交视频一区二区| 99精品偷自拍| 日韩成人伦理电影在线观看| 欧美日韩国产首页| 精品中文字幕一区二区小辣椒| 欧美zozo另类异族| 国产在线精品一区二区夜色| 精品日韩欧美一区二区| 国产精品羞羞答答xxdd| 亚洲私人影院在线观看| 3atv一区二区三区| 成人福利在线看| 亚洲综合偷拍欧美一区色| 欧美日本一区二区| 高清在线成人网| 亚洲成av人片在线观看无码| 欧美精品一区二区三区蜜桃 | 国产馆精品极品| 天天色天天爱天天射综合| 精品久久久久久亚洲综合网| 成人h动漫精品一区二区| 亚洲精品日产精品乱码不卡| 久久综合一区二区| 欧美日韩中文国产| 日本久久精品电影| 国产一区二区精品久久99| 亚洲精品国产精华液| 日韩欧美你懂的| 欧洲国产伦久久久久久久| 粉嫩av亚洲一区二区图片| 国产一区二区在线视频| 亚洲成人综合在线| 亚洲欧美日韩国产中文在线| 国产午夜精品理论片a级大结局 | 亚洲综合区在线| 亚洲一区二区中文在线| 亚洲欧美aⅴ...| 亚洲欧美一区二区三区极速播放 | 亚洲成人av中文| 香蕉av福利精品导航| 亚洲久本草在线中文字幕| 国产精品午夜电影| 国产午夜精品一区二区三区四区| 欧美成人性福生活免费看| 精品剧情在线观看| 国产欧美一区二区精品性色| 亚洲国产精品二十页| 国产欧美精品一区aⅴ影院 | 亚洲第一综合色| 首页欧美精品中文字幕| 美女脱光内衣内裤视频久久网站| 亚洲综合小说图片| 国产综合久久久久久久久久久久| 国产成人日日夜夜| 99视频超级精品| 97久久精品人人爽人人爽蜜臀| 91浏览器在线视频| 精品剧情在线观看| 亚洲女人的天堂| 久久99最新地址| 99国产精品视频免费观看| 色婷婷av久久久久久久| 91精品国产综合久久久久久|