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

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

?? serdpcpl.c

?? 一個C語言寫的讀入位置跟蹤器數據的源程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/****************************************************************************
*****************************************************************************
    serdpcpl.c      - Serial Routines - DOS PC Compatible

    written for:    Ascension Technology Corporation
                    PO Box 527
                    Burlington, Vermont  05402

                    802-655-7879


    written by:     Jeff Finkelstein

    Modification History:

    10/18/90        jf  - released
    11/12/90        jf  - add getdosticks() to allow Polled mode operation
                          at 19200 even on a pretty slow machine
    4/16/91         jf  - renamed file to serdpcpl.c
    6/18/91         jf  - added FOB baudrates
    12/5/93         jf  - fixed bug in getserialrecord to assure that a
                          character with an error does not get into the
                          rxbuffer
    12/23/92        jf  - added baudratebit definitions to allow
                          for compatibility with UNIX
    1/31/93         jf  - send_serial_cmd modified to be able to send out
                          rs232 to fbb commands to addr 30
    10/21/93        jf  - remove getdosticks() and replaced with GETTICKS

           <<<< Copyright 1990 Ascension Technology Corporation >>>>
*****************************************************************************
****************************************************************************/
#include <stdio.h>          /* general I/O */
#include <time.h>           /* clock functions */
#include <dos.h>            /* int86 call */
#include "asctech.h"
#include "compiler.h"
#include "menu.h"
#include "pctimer.h"
#include "serial.h"

/*
    Prototype for DOS Systems Only
*/
void interrupt far serialisr(void);

/*
    Global Variables
*/
	short com_base = COM1BASE;           /* holds the base address of the 8250 */
	short comport = COM1;                   /* holds the comport # */

    char * sys_com_port[2] ={"com1","com2"};


/*
    The FOB Bird uses a different set of Baud Rates as compared
    to the standard Bird
*/
    long baud = 9600L;                     /* holds the default baud rate */
    long baudratetable[] = {115200L,
                            57600L,
                            38400L,
                            19200L,
                            9600L,
                            4800L,          /* holds the baud rate selections */
                            2400L};         /* for the FOB Bird               */
    /*
       Used for compatibility with UNIX versions
    */
    short baudspeedbits = 7;            /* holds the current bit definition */
    short baudspeedbittable[] = {11,
                                 10,
                                 9,
                                 8,
                                 7,
                                 6,
                                 5};    /* holds the bitspeed definition */

    short serialconfigsaved = FALSE;            /* flag indicates serial port saved */

/*
    UART variable Storage
*/
    unsigned char olddivisorlow;            /* holds the old divisor low value */
    unsigned char olddivisorhigh;           /* holds the old divisor high value */
    unsigned char oldlinecont;              /* holds the old line control value */
    unsigned char oldinterenable;           /* holds the old interrupt enable value */
    unsigned char oldmodemcont;             /* holds the old modem control value */

	short phaseerror_count = 0;      /* holds the phase errors */
	short rxerrors = 0;              /* holds the rx line errors */

/*
    Define RS232 to FBB Global Address
*/
    short rs232tofbbaddr = 0;


/*
    configserialport    -   Configure the Serial Port connected to the BIRD

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       TRUE if successfull, else FALSE

    Remarks:
                        Unfortunately, the PC ROM BIOS does NOT support baud
                        rates upto 19200. Therefore, this routine must talk
                        directly to the hardware to configure the serial port
                        ...this is not a problem in a PC environment since the
                        I/O map is fixed for COM1 and COM2.

                                *** NOTE ***

    The 8250 UART cannot withstand back to back writes (OUTs).  The
    compiler does not generate contiguous 'out dx,al' instructions
    and therefore there are delays between the OUTPUTs.  If written in
    assembly language, the typical BIOS type delay is a 'jmp' to the next
    instruction. For example...
                                out dx,al       ; output to serial port
                                jmp $+2         ; jump to the PC + 2
                                out dx,al       ; output to serial port
                        or
                                out dx,al       ; output to serial port
                                clc             ; clear carry
                                jnc $+2         ; jump to the PC + 2
                                out dx,al       ; output to serial port


*/
int configserialport(void)
{
    unsigned divisor;

    /*
        Verify the comport and set the Base Address
    */
    switch (comport)
    {
        case COM1:
            com_base = COM1BASE;                /* set the new I/O addr */
            break;
        case COM2:
            com_base = COM2BASE;                /* set the new I/O addr */
            break;
        default:
            printf("\n** ERROR ** invalid COM port\n");
            return(FALSE);
    }

    /*
        disable the interrupts
    */
    OUTPORTB(com_base + INTERENABLE, 0);

    /*
        assume that there are NO CHARACTERS CURRENTLY in the Tx Buffer
        and change the baud rate
    */
    OUTPORTB(com_base + LINECONT, DLAB);

    /*
        Set the least significant byte and then the most significant
        byte of the baud rate divisor
    */
    divisor = 115200L/baud;
    OUTPORTB(com_base, (divisor & 0xff));
    OUTPORTB(com_base + 1, ((divisor & 0xff00) >> 8));

    /*
        Set the Stop Bits = 1, Word Length = 8 and Parity = None
    */
    OUTPORTB(com_base + LINECONT, STOP_WORDLEN_PARITY);

    /*
        Clear the Rx Buffer
    */
    clear_rx();

    /*
        Assert DTR...just in case the cable uses the DTR signal
    */
    OUTPORTB(com_base + MODEMCONT,1);

    return(TRUE);
}

/*
    saveserialconfig    -   save serial port configuration

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       void

    Remarks:            saves the current configuration of the serial port

*/
int saveserialconfig()
{
    /*
        Save the Current Com Port Configuration Regs including:
            Divisor, Interrupt Enable, Line Control, Modem Control
    */
    oldlinecont = INPORTB(com_base + LINECONT);         /* save the old line control value */
    OUTPORTB(com_base + LINECONT, DLAB);                /* set DLAB to get the divisor */
    olddivisorlow = INPORTB(com_base);                  /* save the divisor low */
    olddivisorhigh = INPORTB(com_base + 1);             /* save the divisor high */
    OUTPORTB(com_base + LINECONT,oldlinecont & 0x7f);   /* reset DLAB to get the divisor */
    oldinterenable = INPORTB(com_base + INTERENABLE);   /* save the interrupt enable reg */
    oldmodemcont = INPORTB(com_base + MODEMCONT);       /* save the interrupt enable reg */

    return(TRUE);
}

/*
    restoreserialconfig -   Restore the original serial port configuration

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       void

    Remarks:            restores the configuration of the serial port
*/
void restoreserialconfig()
{
    /*
        Do not Restore if not previously stored
    */
    if (!serialconfigsaved)
        return;

    /*
        Restore the Com Port Configuration Regs including:
            Divisor, Interrupt Enable, Line Control, Modem Control
    */
    OUTPORTB(com_base + LINECONT, DLAB);                /* set DLAB to get the divisor */
    OUTPORTB(com_base,olddivisorlow);                   /* restore the divisor low */
    OUTPORTB(com_base + 1,olddivisorhigh);              /* restore the divisor high */
    OUTPORTB(com_base + LINECONT,oldlinecont);          /* reset DLAB to get the divisor */
    OUTPORTB(com_base + INTERENABLE,oldinterenable);    /* restore the interrupt enable reg */
    OUTPORTB(com_base + MODEMCONT,oldmodemcont);        /* restore the interrupt enable reg */
}


/*
    clearrx             -   Read the characters out of the Rx buffer if available

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       void

    Remarks:            clears the rx buffer and rx errors if any

*/
void clear_rx()
{
    phaseerror_count = 0;                       /* clear the phase counter */

    while (get_serial_char() != NODATAAVAIL);   /* get chars */
    INPORTB(com_base + LINESTATUS);             /* clear errors */
}

/*
    get_serial_record   - Get a record from the serial port

    Prototype in:       serial.h

    Parameters Passed:  rxbuf       -   pointer to a buffer to store the
                                        received characters
                        recsize     -   number of characters to receive
                        outputmode  -   POINT, CONTINUOUS or STREAM

    Return Value:       If successful, returns recsize
                        else, RXERRORS if Rx errors were detected while
                        receiving data, or RXPHASEERRORS if in POINT or
                        CONTINUOUS mode and a phase error is detected.

    Remarks:            A record of data has the MSB of the first
                        character set to a 1.  The routine verifies that
                        the first character received is in PHASE.  If
                        in STREAM mode, the routine resynches and tries
                        to capture the data into the rxbuf.  If in POINT
                        or CONTINUOUS mode, then the routine returns
                        indicating a RXPHASEERROR.

*/
int get_serial_record(rxbuf, recsize, outputmode)
unsigned char * rxbuf;
short recsize;
short outputmode;
{
	short rxcount;
	short rxchar;
	short resynch;
    char * rxbufptr;

    resynch = TRUE;

    do
    {
        if  (resynch)
        {
            rxcount = 0;                /* initialize char counter */
            rxbufptr = rxbuf;           /* setup buffer pointer */
            resynch = FALSE;
        }

        /*
            Get first character and if error and NOT in STREAM mode..return
        */
        if (rxcount == 0)
        {
            if ((rxchar = waitforchar()) < 0)
            {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区精品欧美日韩一区二区三区 | 日日噜噜夜夜狠狠视频欧美人| 午夜久久电影网| 国产69精品久久久久毛片| 欧美日韩在线免费视频| 中文欧美字幕免费| 日本系列欧美系列| 91蝌蚪porny| 国产精品日韩成人| 国产乱码精品一区二区三区av| 在线观看av不卡| 国产精品免费丝袜| 国产成人精品亚洲午夜麻豆| 欧美一区二区啪啪| 亚洲一区二区欧美| 色噜噜狠狠成人中文综合| 国产精品色噜噜| 国产精品123| 国产日韩精品一区| 国产成人亚洲精品狼色在线| 日韩一级视频免费观看在线| 午夜精品福利久久久| 在线免费观看日本欧美| 亚洲裸体xxx| 93久久精品日日躁夜夜躁欧美| 国产蜜臀av在线一区二区三区| 日本不卡免费在线视频| 91极品视觉盛宴| 精品无人区卡一卡二卡三乱码免费卡 | 国产一区二区在线看| 欧美日韩国产精选| 亚洲国产一区二区三区| 色综合天天狠狠| 亚洲欧洲av一区二区三区久久| 国产精品系列在线播放| 久久久高清一区二区三区| 国产精品一区二区免费不卡 | 国产精品久久毛片av大全日韩| 国产麻豆精品视频| 久久久99精品免费观看不卡| 国产精品正在播放| 自拍偷拍亚洲综合| 欧洲国产伦久久久久久久| 亚洲综合网站在线观看| 欧美另类z0zxhd电影| 日韩av中文字幕一区二区| 欧美xxxx在线观看| 国产高清在线精品| 自拍偷拍亚洲综合| 7777精品伊人久久久大香线蕉| 日韩av网站在线观看| 337p粉嫩大胆色噜噜噜噜亚洲 | 亚洲一本大道在线| 欧美久久一区二区| 国产成人免费9x9x人网站视频| 综合色中文字幕| 91精品国产综合久久国产大片| 久久99久久99| 亚洲女人****多毛耸耸8| 7777精品伊人久久久大香线蕉最新版 | 国产jizzjizz一区二区| 自拍av一区二区三区| 欧美日韩在线精品一区二区三区激情| 久久精品国产久精国产| 国产性色一区二区| 欧美亚州韩日在线看免费版国语版| 性感美女极品91精品| 26uuu色噜噜精品一区二区| 成人黄色电影在线| 爽好久久久欧美精品| 久久蜜桃av一区二区天堂| 一道本成人在线| 激情六月婷婷久久| 亚洲成人一二三| 欧美国产日本视频| 日韩欧美一区二区免费| 99久久精品99国产精品| 美女脱光内衣内裤视频久久影院| 中文字幕一区二区三区精华液 | 国产精品国产a| 欧美成人激情免费网| 在线视频国内自拍亚洲视频| 韩国在线一区二区| 日本在线不卡视频| 亚洲欧美一区二区三区孕妇| 欧美videos大乳护士334| 色94色欧美sute亚洲线路一久| 国产一区二区毛片| 另类中文字幕网| 亚洲福利电影网| 亚洲蜜臀av乱码久久精品| 国产午夜精品久久久久久久| 在线综合+亚洲+欧美中文字幕| 99精品欧美一区二区三区小说| 国产一区二区伦理片| 久久国产精品99精品国产| 香蕉成人啪国产精品视频综合网| 国产精品国产a级| 国产精品网友自拍| 精品国产乱码久久久久久老虎 | 欧美最新大片在线看 | 国产黄色91视频| 激情小说亚洲一区| 美国精品在线观看| 日本不卡免费在线视频| 日韩电影一区二区三区四区| 亚洲午夜激情网页| 亚洲一区二区三区中文字幕| 国产精品进线69影院| 国产精品进线69影院| 国产精品美女久久久久久久网站| 国产喷白浆一区二区三区| 久久久久国产免费免费| 国产欧美综合在线观看第十页| 久久久精品一品道一区| 久久婷婷久久一区二区三区| 久久婷婷综合激情| 国产精品久久三区| 亚洲综合久久久| 欧美a一区二区| 久久精品99久久久| 国内精品在线播放| 国产精品一区三区| jlzzjlzz亚洲日本少妇| 成人午夜免费视频| 日本高清不卡aⅴ免费网站| 欧美视频中文一区二区三区在线观看| 欧美亚洲综合在线| 欧美一级在线免费| 久久久国产一区二区三区四区小说| 久久久久国产精品人| 亚洲视频网在线直播| 一区二区三区欧美| 日本欧美肥老太交大片| 九色综合狠狠综合久久| 成人污视频在线观看| 91麻豆福利精品推荐| 欧美日韩久久久一区| 欧美r级电影在线观看| 久久精品欧美日韩| 亚洲欧美日韩在线| 日韩精品五月天| 国产二区国产一区在线观看| 91同城在线观看| 日韩一区二区高清| 国产精品午夜电影| 亚洲123区在线观看| 精彩视频一区二区三区| 91麻豆免费视频| 精品国精品自拍自在线| 亚洲色图.com| 韩国欧美国产1区| 欧洲精品一区二区| 国产精品麻豆一区二区| 丝袜亚洲精品中文字幕一区| 国产精品正在播放| 欧美精品在线一区二区三区| 欧美激情一区三区| 日本欧美在线看| 91理论电影在线观看| 日韩小视频在线观看专区| 91精品黄色片免费大全| 国产高清精品网站| 亚洲精品va在线观看| 国产欧美一区二区三区鸳鸯浴 | 久久久久久久久99精品| 亚洲啪啪综合av一区二区三区| 日韩精彩视频在线观看| 国产成人高清视频| 日韩精品一区二区三区视频| 一区二区三区国产| 91麻豆精东视频| 亚洲欧洲制服丝袜| 91在线视频18| 精品免费一区二区三区| 奇米四色…亚洲| 日韩精品一区二| 国产乱理伦片在线观看夜一区 | 日日夜夜精品视频天天综合网| 91同城在线观看| 亚洲一区二区三区中文字幕| 色天天综合色天天久久| 亚洲激情网站免费观看| 欧美视频在线不卡| 日韩va亚洲va欧美va久久| 亚洲精品一区二区三区蜜桃下载 | 成年人国产精品| 成人一区二区三区视频| 日本免费在线视频不卡一不卡二| 欧美区视频在线观看| 欧美三级韩国三级日本三斤| 国产精品不卡一区二区三区| 黄色资源网久久资源365| 日韩一区二区免费电影| 天堂精品中文字幕在线| 欧美一区在线视频| 免费看黄色91| 亚洲最大成人网4388xx| 国产欧美一区二区三区沐欲| 91美女视频网站|