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

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

?? st16c554sio.c

?? vxworks下的16c554驅動
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* ST16C554Sio.c - ST16C554 serial driver *//*modification history--------------------01a,30dec04,xf  written (using ST16C554Serial.c + the VxMon polled driver).*//*DESCRIPTIONThis is the driver for the ST16C554 UART Chip used on the PC 386.It uses the SCCs in asynchronous mode only.USAGEAn ST16C554_CHAN structure is used to describe the chip.The BSP's sysHwInit() routine typically calls sysSerialHwInit()which initializes all the register values in the ST16C554_CHAN structure(except the SIO_DRV_FUNCS) before calling ST16C554HrdInit().The BSP's sysHwInit2() routine typically calls sysSerialHwInit2() whichconnects the chips interrupt handler (ST16C554Int) via intConnect().IOCTL FUNCTIONSThis driver responds to all the same ioctl() codes as a normal serial driver;for more information, see the comments in sioLib.h.  As initialized, theavailable baud rates are 110, 300, 600, 1200, 2400, 4800, 9600, 19200, and38400.This driver handles setting of hardware options such as parity(odd, even) andnumber of data bits(5, 6, 7, 8). Hardware flow control is provided with thehandshakes RTS/CTS. The function HUPCL(hang up on last close) is available.INCLUDE FILES: drv/sio/ST16C554Sio.h*/#include "vxWorks.h"#include "iv.h"#include "intLib.h"#include "errnoLib.h"#include "drv/sio/ST16C554Sio.h"/* defines *//* This value is used to specify the maximum number of times ST16C554Int() * routine will read the 8250 Interrupt Identification Register before * returning.  This value should optimally be derived from the BRDR. */#define ST16C554_IIR_READ_MAX          40#ifndef ST16C554_DEFAULT_BAUD#   define  ST16C554_DEFAULT_BAUD      9600#endif#ifndef SIO_HUP#   define SIO_OPEN     0x100A#   define SIO_HUP      0x100B#endif/********************************************************************//*****************************test define****************************/#define SIO_INIT_IER      0x100C/* locals *//* baudTable is a table of the available baud rates, and the values to write * to the UART's baud rate divisor {high, low} register. the formula is * 1843200(source) / (16 * baudrate) */static BAUD baudTable [] =    {    {50, 2304}, {75, 1536}, {110, 1047}, {134, 857}, {150, 768},    {300, 384}, {600, 192}, {1200, 96}, {2000, 58}, {2400, 48},    {3600,32}, {4800, 24}, {7200,16}, {9600, 12}, {19200, 6}, {38400, 3},    {57600, 2}, {115200, 1}    };static SIO_DRV_FUNCS ST16C554SioDrvFuncs;/* forward declarations */LOCAL   void    ST16C554InitChannel (ST16C554_CHAN *);LOCAL   int     ST16C554Ioctl(ST16C554_CHAN *, int, int);LOCAL   int     ST16C554Startup(ST16C554_CHAN *pChan);LOCAL   int     ST16C554PRxChar (ST16C554_CHAN *pChan, char *ch);LOCAL   int     ST16C554PTxChar(ST16C554_CHAN *pChan, char ch);LOCAL   STATUS  ST16C554OptsSet (ST16C554_CHAN *, UINT);LOCAL   STATUS  ST16C554ModeSet (ST16C554_CHAN *, UINT);LOCAL   STATUS  ST16C554BaudSet (ST16C554_CHAN *, UINT);/******************************************************************************** ST16C554CallbackInstall - install ISR callbacks to get put chars.** This routine installs the callback functions for the driver** RETURNS: OK on success or ENOSYS on unsupported callback type.*/ static int ST16C554CallbackInstall    (    SIO_CHAN *  pSioChan,    int         callbackType,    STATUS      (*callback)(),    void *      callbackArg    )    {    ST16C554_CHAN * pChan = (ST16C554_CHAN *)pSioChan;    switch (callbackType)        {        case SIO_CALLBACK_GET_TX_CHAR:            pChan->getTxChar    = callback;            pChan->getTxArg     = callbackArg;            return (OK);        case SIO_CALLBACK_PUT_RCV_CHAR:            pChan->putRcvChar   = callback;            pChan->putRcvArg    = callbackArg;            return (OK);        default:            return (ENOSYS);        }    }/******************************************************************************** ST16C554HrdInit - initialize the chip** This routine is called to reset the chip in a quiescent state.* RETURNS: N/A*/void ST16C554HrdInit    (    ST16C554_CHAN *  pChan         /* pointer to device */    )    {    if (ST16C554SioDrvFuncs.ioctl == NULL)        {        ST16C554SioDrvFuncs.ioctl          = (int (*)())ST16C554Ioctl;        ST16C554SioDrvFuncs.txStartup      = (int (*)())ST16C554Startup;        ST16C554SioDrvFuncs.callbackInstall = ST16C554CallbackInstall;        ST16C554SioDrvFuncs.pollInput      = (int (*)())ST16C554PRxChar;        ST16C554SioDrvFuncs.pollOutput     = (int (*)(SIO_CHAN *,char))ST16C554PTxChar;        }    pChan->pDrvFuncs = &ST16C554SioDrvFuncs;    ST16C554InitChannel(pChan);    /* reset the channel */    }/********************************************************************************* ST16C554InitChannel  - initialize a single channel*/static void ST16C554InitChannel    (    ST16C554_CHAN *  pChan         /* pointer to device */    )    {    int oldLevel;    oldLevel = intLock ();    /* set channel baud rate */    (void) ST16C554BaudSet(pChan, ST16C554_DEFAULT_BAUD);    /* 8 data bits, 1 stop bit, no parity */    (*pChan->outByte) (pChan->lcr, (ST16C554_LCR_CS8 | ST16C554_LCR_1_STB | ST16C554_LCR_PDIS));    (*pChan->outByte) (pChan->mdc, (ST16C554_MCR_RTS | ST16C554_MCR_DTR | \                                        ST16C554_MCR_OUT2));    (*pChan->inByte) (pChan->data);     /* clear the port */    /* disable interrupts  */    (*pChan->outByte) (pChan->ier, 0x0);    pChan->options = (CLOCAL | CREAD | CS8);/*defined in siolib.h*/    intUnlock (oldLevel);    }/********************************************************************************* ST16C554Hup - hang up the modem control lines ** Resets the RTS and DTR signals.** RETURNS: OK*/LOCAL STATUS ST16C554Hup    (    ST16C554_CHAN * pChan          /* pointer to channel */    )    {    FAST int     oldlevel;      /* current interrupt level mask */    oldlevel = intLock ();    (*pChan->outByte) (pChan->mdc, ST16C554_MCR_OUT2);    intUnlock (oldlevel);    return (OK);    }    /********************************************************************************* ST16C554Open - Set the modem control lines ** Set the modem control lines(RTS, DTR) TRUE if not already set.  * It also clears the receiver. ** RETURNS: OK*/LOCAL STATUS ST16C554Open    (    ST16C554_CHAN * pChan          /* pointer to channel */    )    {    FAST int     oldlevel;      /* current interrupt level mask */    char mask;    /* read modem control register */    mask = ((*pChan->inByte) (pChan->mdc)) & (ST16C554_MCR_RTS | ST16C554_MCR_DTR);    if (mask != (ST16C554_MCR_RTS | ST16C554_MCR_DTR))         {        /* RTS and DTR not set yet */        oldlevel = intLock ();        /* set RTS and DTR TRUE */        (*pChan->outByte) (pChan->mdc, (ST16C554_MCR_RTS | ST16C554_MCR_DTR | \                                        ST16C554_MCR_OUT2));        intUnlock (oldlevel);        }    printf("\nOpen driver Success!");    return (OK);    }/******************************************************************************** ST16C554BaudSet - change baud rate for channel** This routine sets the baud rate for the UART. The interrupts are disabled* during chip access.** RETURNS: OK to indicate success, otherwise ERROR is returned*/LOCAL STATUS  ST16C554BaudSet    (    ST16C554_CHAN *   pChan,       /* pointer to channel */    UINT           baud         /* requested baud rate */    )    {    int         oldlevel;    STATUS      status;    FAST        int     ix;    UINT8       lcr;    /* disable interrupts during chip access */    oldlevel = intLock ();    status = ERROR;    for (ix = 0; ix < NELEMENTS (baudTable); ix++)        {        if (baudTable [ix].rate == baud)        /* lookup baud rate value */            {            lcr = (*pChan->inByte) (pChan->lcr);            printf("\nLCR=%d\n",lcr);               /*(*pChan->outByte) (pChan->lcr, ((char)(lcr)));            (*pChan->outByte) (pChan->brdh, MSB (baudTable[ix].preset));            (*pChan->outByte) (pChan->brdl, LSB (baudTable[ix].preset));            (*pChan->outByte) (pChan->lcr, lcr);*/            (*pChan->outByte) (pChan->lcr, ((char)(lcr))|0x80);            (*pChan->outByte) (pChan->brdh, 0x00);            (*pChan->outByte) (pChan->brdl, 0x0C);            (*pChan->outByte) (pChan->lcr, lcr);            status = OK;            break;            }        }    intUnlock(oldlevel);    printf("\n baudset driver Success!");    return (status);    }/********************************************************************************* ST16C554ModeSet - change channel mode setting** This driver supports both polled and interrupt modes and is capable of* switching between modes dynamically. ** If interrupt mode is desired this routine enables the channels receiver and * transmitter interrupts. If the modem control option is TRUE, the Tx interrupt* is disabled if the CTS signal is FALSE. It is enabled otherwise. ** If polled mode is desired the device interrupts are disabled. ** RETURNS:* Returns a status of OK if the mode was set else ERROR.*/LOCAL STATUS ST16C554ModeSet    (    ST16C554_CHAN * pChan,         /* pointer to channel */    UINT        newMode         /* mode requested */    )    {    FAST int     oldlevel;      /* current interrupt level mask */    char ier, mask;    if ((newMode != SIO_MODE_POLL) && (newMode != SIO_MODE_INT))        return (ERROR);    oldlevel = intLock();               if (newMode == SIO_MODE_POLL)        ier = 0x00;    else          {        if (pChan->options & CLOCAL)             ier = ST16C554_IER_RXRDY;        else              {            mask = ((*pChan->inByte) (pChan->msr)) & ST16C554_MSR_CTS;            /* if the CTS is asserted enable Tx interrupt */            if (mask & ST16C554_MSR_CTS)                ier = (ST16C554_IER_TBE | ST16C554_IER_MSI);            else                ier = (ST16C554_IER_MSI);            }           }    (*pChan->outByte) (pChan->ier, ier);                pChan->channelMode = newMode;                intUnlock(oldlevel);    return (OK);    }/********************************************************************************* ST16C554OptsSet - set the serial options** Set the channel operating mode to that specified.  All sioLib options* are supported: CLOCAL, HUPCL, CREAD, CSIZE, PARENB, and PARODD.** RETURNS:* Returns OK to indicate success, otherwise ERROR is returned*/LOCAL STATUS ST16C554OptsSet    (    ST16C554_CHAN * pChan,         /* pointer to channel */    UINT options                /* new hardware options */    )    {    FAST int     oldlevel;              /* current interrupt level mask */    char lcr = 0;     char mcr = ST16C554_MCR_OUT2;    char ier;    char mask;    ier = (*pChan->inByte) (pChan->ier);    if (pChan == NULL || options & 0xffffff00)        return ERROR;    switch (options & CSIZE)        {        case CS5:            lcr = ST16C554_LCR_CS5; break;        case CS6:            lcr = ST16C554_LCR_CS6; break;        case CS7:            lcr = ST16C554_LCR_CS7; break;        default:        case CS8:            lcr = ST16C554_LCR_CS8; break;        }    if (options & STOPB)        lcr |= ST16C554_LCR_2_STB;    else        lcr |= ST16C554_LCR_1_STB;        switch (options & (PARENB | PARODD))        {        case PARENB|PARODD:            lcr |= ST16C554_LCR_PEN; break;        case PARENB:            lcr |= (ST16C554_LCR_PEN | ST16C554_LCR_EPS); break;        default:        case 0:            lcr |= ST16C554_LCR_PDIS; break;        }    (*pChan->outByte) (pChan->ier, 0x00);    if (!(options & CLOCAL))        {        /* !clocal enables hardware flow control(DTR/DSR) */        mcr |= (ST16C554_MCR_DTR | ST16C554_MCR_RTS);        ier |= ST16C554_IER_MSI;    /* enable modem status interrupt */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线国偷精品产拍免费yy| 欧美一卡2卡3卡4卡| 久久色中文字幕| 麻豆精品在线播放| 精品88久久久久88久久久| 日韩在线观看一区二区| 欧美日韩国产经典色站一区二区三区| 国产精品久久久久aaaa樱花| 99精品欧美一区二区三区综合在线| 国产日韩欧美一区二区三区综合| 国产精品亚洲人在线观看| 国产精品免费视频网站| 欧美日韩视频不卡| 日韩高清中文字幕一区| 精品88久久久久88久久久| 成a人片国产精品| 一区二区三区中文字幕电影| 欧美精品123区| 国产91色综合久久免费分享| 亚洲精品久久久久久国产精华液| 在线不卡欧美精品一区二区三区| 韩国精品主播一区二区在线观看 | 欧美成人一区二区| 99久久精品免费观看| 日本一区中文字幕| 亚洲人成在线播放网站岛国| 欧美日本国产视频| 国产jizzjizz一区二区| 午夜一区二区三区视频| 亚洲国产电影在线观看| 91精品国产一区二区三区 | 国产成人综合亚洲网站| 亚洲成人综合视频| 国产欧美日韩综合| 久久一夜天堂av一区二区三区| 在线精品视频免费播放| 国产成人精品一区二区三区四区| 日本成人在线视频网站| 日本亚洲天堂网| 亚洲精品国产精品乱码不99| 欧美国产国产综合| 国产亚洲精品aa| 欧美国产一区二区| 一级做a爱片久久| 亚洲国产婷婷综合在线精品| 日韩码欧中文字| 国产欧美综合色| 欧美韩国一区二区| 成人欧美一区二区三区小说| 国产一区在线精品| 久久久久亚洲蜜桃| 亚洲欧洲日韩在线| 美女视频黄频大全不卡视频在线播放 | 秋霞影院一区二区| 人人狠狠综合久久亚洲| 悠悠色在线精品| 一区二区三区在线视频免费| 国产精品丝袜黑色高跟| 国产日韩精品一区| 国产精品久久一卡二卡| 亚洲欧美国产毛片在线| 秋霞国产午夜精品免费视频| 久草这里只有精品视频| 国产成人自拍网| 色狠狠av一区二区三区| 欧美一卡2卡三卡4卡5免费| 精品国产三级a在线观看| 一区二区三区高清| 国产伦精品一区二区三区视频青涩 | av激情成人网| 日韩一区二区三区av| 中文子幕无线码一区tr| 亚洲综合丝袜美腿| 免费高清视频精品| 一本大道久久精品懂色aⅴ| 911精品国产一区二区在线| 欧美激情中文字幕一区二区| 美女一区二区久久| 成人三级在线视频| 国产亚洲成aⅴ人片在线观看 | 在线不卡欧美精品一区二区三区| 久久久久久久久久久电影| 亚洲成人av在线电影| 99久久精品国产导航| 欧美大片一区二区| 免费人成在线不卡| 欧美日韩精品一区二区三区蜜桃 | 久久99最新地址| 久久久99精品免费观看| 久久精品国产在热久久| 日韩欧美中文字幕一区| 久久99精品国产.久久久久久| 69堂精品视频| 精品无人码麻豆乱码1区2区| 日韩一级大片在线观看| 日韩电影在线一区二区三区| 欧美一区二区三区色| 亚洲h动漫在线| 欧美一区二区大片| 国产精品亚洲人在线观看| 国产精品伦一区| 91在线国产福利| 亚洲午夜一区二区| 欧美成人精品3d动漫h| 黑人精品欧美一区二区蜜桃| 国产欧美日韩在线看| 色一情一伦一子一伦一区| 午夜精品久久久久久久久久久| 日韩欧美国产小视频| 激情欧美日韩一区二区| 国产精品美女一区二区三区 | 久久久www成人免费毛片麻豆| 国产69精品一区二区亚洲孕妇| 中文字幕一区二区三区在线观看 | 精品国产乱码久久久久久1区2区 | 国产乱子轮精品视频| 亚洲欧美在线观看| 在线电影国产精品| 成人精品国产福利| 亚洲h在线观看| 欧美日韩一区二区三区在线看 | 日韩成人精品在线观看| **网站欧美大片在线观看| 日韩一级片网址| 在线观看一区二区精品视频| 国产一区二区三区电影在线观看| 亚洲自拍与偷拍| 中文字幕综合网| 久久久不卡网国产精品二区| 3atv在线一区二区三区| 欧美最新大片在线看| 不卡电影免费在线播放一区| 久久av中文字幕片| 日本视频一区二区| 亚洲动漫第一页| 亚洲影院久久精品| 亚洲一区二区综合| 亚洲视频免费在线| 最新国产の精品合集bt伙计| 久久精品网站免费观看| 久久精品人人做人人爽97| 精品福利一二区| 欧美国产一区在线| 国产精品久久久一区麻豆最新章节| 久久久另类综合| 亚洲欧洲日韩av| 一区二区三区四区国产精品| 亚洲人午夜精品天堂一二香蕉| 综合久久久久久| 首页综合国产亚洲丝袜| 国产精品一区二区免费不卡| 日本不卡免费在线视频| 久久福利视频一区二区| 国产成人亚洲精品青草天美| 91视视频在线观看入口直接观看www | 午夜精品福利久久久| 另类小说综合欧美亚洲| 国产精品99久久久久久宅男| 成人国产电影网| 欧美性猛片aaaaaaa做受| 日韩三级电影网址| 国产精品成人免费在线| 亚洲电影第三页| 国产精品资源在线看| 色国产精品一区在线观看| 日韩一二三区视频| 国产精品美女一区二区在线观看| 一区二区高清免费观看影视大全 | 中文字幕欧美一| 九九九精品视频| 91福利视频在线| 中文字幕视频一区二区三区久| 天堂va蜜桃一区二区三区| av中文一区二区三区| 欧美大片日本大片免费观看| 一区二区视频在线| 成人avav影音| 国产日韩欧美激情| 精品一区二区三区蜜桃| 欧美日韩午夜影院| 中文字幕一区二区三区视频| 国产成人精品影视| 精品美女一区二区| 日韩国产在线一| 777久久久精品| 欧美aaaaa成人免费观看视频| 欧美图片一区二区三区| 夜夜嗨av一区二区三区中文字幕| 国产精品白丝av| 久久久久99精品国产片| 国产91综合网| 国产精品国产精品国产专区不蜜| 国产精品影视在线观看| 国产色产综合色产在线视频| 国产资源精品在线观看| 国产三级一区二区| 国产精品1024久久| 亚洲啪啪综合av一区二区三区| 高清beeg欧美| 亚洲精品一卡二卡|