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

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

?? serknr.c

?? 一個C語言寫的讀入位置跟蹤器數據的源程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
        ioctl(comhandle,TCSETA,&oldcom_termio);    /* restore config */
#endif
        close(comhandle);    /* close the handle */
        comhandle = -1;        /* make the comhandle 'look' closed */
    }
#endif /* DEBUG_SKIPSERIAL */
}

/*
    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()
{
#ifdef UNIX
    short charsrdy;
    char temprxbuf[255]; /* should never be more than 255 chars in buffer ?? */
#endif

    phaseerror_count = 0;               /* clear the phase counter */

#ifdef UNIX
    /*
       Flush Pending Buffers
    */
    ioctl(comhandle,TCFLSH,TIOCFLUSH);  /* flush pending I/O chars */

    /*
       Determine if there are chars in the Buffer
    */
    if (ioctl(comhandle,TIONREAD,&charsrdy))
    {
       printf("\n\r** ERROR ** IOCTL returned an error\n\r");
       return;
    }

    /*
       Get the number of chars ready out of the read buffer
    */
    if (charsrdy)
    {
        if (get_record(charsrdy,temprxbuf,FALSE) != charsrdy)
            printf("\n\r** ERROR ** could not clear the RX buffer\n\r");
    }
#endif

}

/*
    get_serial_record   - Get a record from the serial IO Buffer

    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

    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.

                        NOTE that this routine returns the MOST RECENT
                        record from the Buffer...if more than one record
                        is present, old records are discarded.
*/
int get_serial_record(rxbuf, recsize, outputmode)
unsigned char * rxbuf;
short recsize;
short outputmode;
{
    short charsread;

#ifdef DEBUG_SKIPSERIAL

    /*
       Fill in the Record with the Data Read
    */
    for (charsread = 0; charsread < recsize; charsread++)
    {
        rxbuf[charsread] = charsread;
    }

    /*
        Set the Phasing Bit
    */
    rxbuf[0] |= 0x80;

    return(recsize);
#else

    char * rxbufinptr;
    short tempcharsneeded;
    int   charsrdy = 0;
    short numrecordsrdy;
    int   totalcharsrdy;


    /*
       STREAM mode is NOT allowed if using DOS
       ..DOS does not support interrupt driven serial I/O
    */
#ifdef DOS
    if (outputmode == STREAM)
    {
        printf("\n\r** ERROR ** STREAM mode is not supported by DOS\n\r");
        return(RXERRORS);
    }
#endif

    /*
        Setup some variables
    */
    totalcharsrdy = 0;

    /*
       Get the Number of Chars Ready

       Note that this approach reads the MOST RECENT record received by the
       host computer by manually emptying the operating system's serial
       character buffer until the last valid record
    */
#ifdef UNIX
    if (ioctl(comhandle,TIONREAD,&charsrdy))
    {
       printf("\n\r** ERROR ** IOCTL returned an error\n\r");
       return(RXERRORS);
    }
#endif

    /*
        Add the current amount of chars ready to the total
    */
    totalcharsrdy += charsrdy;

    /*
       Now take care of 3 cases...
       1) charsrdy = recsize
       2) charsrdy > recsize
       3) charsrdy < recsize
    */
    if (totalcharsrdy >= recsize)
    {

        /*
           Determine the number of records available

           If the number is greater than 1 then throw away old records
        */
        if (recsize)
            numrecordsrdy = totalcharsrdy/recsize;
        else
        {
            printf("\n\r** ERROR ** illegal parameter in call to get_serial_record\n\r");
            return(RXERRORS);
        }

        /*
            Read the most recent complete Block from the Port
        */
        while (numrecordsrdy--)
        {
            if (get_record(recsize,(char *) rxbuf,TRUE) == RXERRORS)
                return(RXERRORS);
        }
    }
    else
    {
        return(get_record(recsize,(char *) rxbuf,TRUE));
    }

    /*
        Everything is OK, so return the recsize
    */
    return(recsize);

#endif /* DEBUG_SKIPSERIAL */
}

/*
    get_record          - Get a record from the serial port

    Prototype in:       serknr.c

    Parameters Passed:

                        short charsneeded   - number of chars needed
                        char * rxbufinptr   - place to store the chars
                        short checkphasebit - check phase on/off

    Return Value:       If successful, returns recsize
                        else, RXERRORS if Rx errors were detected while
                        receiving data

    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.
*/
int get_record(charsneeded, rxbufinptr, checkphasebit)
short charsneeded;
char * rxbufinptr;
short checkphasebit;
{
    short tempcharsneeded;
    char * temprxbufinptr = rxbufinptr;
    short charsread;

    /*
        Now Try to Read the required amount of characters...

        Note that we do NOT assume that the read will block until
        required number of characters are available because the
        read can return with less than the number of characters
        needed
    */
    tempcharsneeded = charsneeded;
    while(tempcharsneeded)
    {

        charsread = read(comhandle,temprxbufinptr,tempcharsneeded);
        if (charsread <= 0)  /* check to make sure we got a least 1 */
        {
            printf("\n\r** ERROR ** serial receive timeout \n\r");
            return(RXERRORS);
        }

        /*
            Keep track of the number of characters read
        */
        if (charsread != -1)
        {
            temprxbufinptr += charsread;
            tempcharsneeded -= charsread;
        }

        /*
            Verify that the first character has the Phasing Bit Set
            and all the remaining characters do NOT have the Phasing Bit
            Set ..only if enabled
        */
        if (checkphasebit && !(*rxbufinptr & 0x80))
        {
            printf ("\n\r** ERROR ** phasing bit error\n\r");
            return(RXERRORS);
        }
    }

    return(charsneeded);
}


/*
    send_serial_cmd     -    Send Serial Command to the Bird port

    Prototype in:       serial.h

    Parameters Passed:  cmd         -   string to send to the serial port
                        cmdsize     -   size of the cmd string (cmd is NOT
                                        NULL terminated, since the data can
                                        be NULL)
    Return Value:       number of characters transmitted

    Remarks:            Routine will send a string of characters to the serial
                        port.  The string is pointed to by cmd and all
                        characters will be sent upto but NOT including
                        the NULL
*/
int send_serial_cmd(cmd,cmdsize)
unsigned char * cmd;
short cmdsize;
{
    char cmdbytessent;

#ifdef DEBUG_SKIPSERIAL
#ifdef DEBUG_VIEWSERIAL

    printf ("\n\rCOMMAND SENT: ");
    for (cmdbytessent = 0; cmdbytessent < cmdsize; cmdbytessent++)
        printf(" 0x%X",*cmd++);
    printf ("\n\r");
#endif /* DEBUG_VIEWSERIAL */

    return(cmdbytessent);
#else  /* DEBUG_SKIPSERIAL */

    unsigned char rs232tofbbcmd;

    /*
        Send the RS232 to FBB Prefice Character if non-zero
    */
    if (rs232tofbbaddr > 0)
    {
        if (rs232tofbbaddr <= 15)
            /* pass through command 0-15 */
            rs232tofbbcmd = (unsigned char)(0xF0 | rs232tofbbaddr);
        else
            /* pass through command 16-31 */
            rs232tofbbcmd = (unsigned char)(0xE0 | rs232tofbbaddr-16);

#ifdef DEBUG_VIEWSERIAL
        printf ("\n\rRS232TOFBB COMMAND: 0x%X\n\r",rs232tofbbcmd);
#endif
        write(comhandle,&rs232tofbbcmd,1);
    }

#ifdef DEBUG_VIEWSERIAL
    printf ("\n\rCOMMAND SENT: ");
    for(cmdbytessent = 0;cmdbytessent < cmdsize; cmdbytessent++)
        printf (" 0x%X",cmd[cmdbytessent]);
    printf("\n\r");
#endif

    cmdbytessent = write(comhandle,cmd,cmdsize);

#ifdef UNIX
    ioctl(comhandle,TCFLSH,TIOCFLUSH);  /* flush pending I/O chars */
#endif

    return(cmdbytessent);

#endif /* DEBUG_SKIPSERIAL */
}

/*
    get_serial_char -   Get 1 Character from the serial port if one is available

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       returns the

    Remarks:            returns the receive character if successful,
                        RXERRORS if receive errors
*/
int get_serial_char()
{
#ifdef DEBUG_SKIPSERIAL
    static chr = 0;
#ifdef DEBUG_VIEWSERIAL
    printf("\n\rCHAR RECEIVED: 0x%X\n\r",chr);
#endif
    return(chr++);
#else
    unsigned char chr;

    if ((read(comhandle, &chr,1)) != -1)
    {
#ifdef DEBUG_VIEWSERIAL
        printf("\n\rCHAR RECEIVED: 0x%X\n\r",chr);
#endif
        return(chr);
    }
    else
        return(RXERRORS);

#endif /* DEBUG_SKIPSERIAL */
}

/*
    send_serial_char    -   Send one serial char to the serial port

    Prototype in:       serial.h

    Parameters Passed:  chr     -   character to send to the serial port

    Return Value:       returns TRUE if successful, or TXNOTEMPTY if
                        cannot send because the holding register is not
                        empty

    Remarks:
*/
int send_serial_char(chr)
short chr;
{
#ifdef DEBUG_SKIPSERIAL
#ifdef DEBUG_VIEWSERIAL
    printf("\n\rCHAR SENT: 0x%X\n\r",chr);
#endif

    return(TRUE);
#else

#ifdef UNIX
    int zeroint=0;
#endif

    if ((write(comhandle,(char *) &chr,1)) == 1)
    {
#ifdef UNIX
        ioctl(comhandle,TCFLSH,TIOCFLUSH);  /* flush pending I/O chars */
#endif

#ifdef DEBUG_VIEWSERIAL
        printf("\n\rCHAR SENT: 0x%X\n\r",chr);
#endif
        return(TRUE);
    }
    else
        return(TXNOTEMPTY);

#endif /* DEBUG_SKIPSERIAL */
}


/*
    waitforchar         -   Wait for a Character from the Serial Port

    Prototype in:       serial.h

    Parameters Passed:  void

    Return Value:       returns the receive character if successful,
                        RXERRORS if recieve errors,
                        RXTIMEOUT if a time out occurs before a
                        character is ready

    Remarks:            Routine waits for the TIMEOUTINTICKS period
                        for a character

*/
int waitforchar()
{
    short rxchar;

    /*
        Wait until a character is available
        ....leave loop if errors or character available
    */
    while ((rxchar = get_serial_char()) == NODATAAVAIL);

    /*
        return if RX errors
    */
    if (rxchar < 0)
        return(RXERRORS);

    /*
        Everything is OK...return the character
    */
    return(rxchar);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美狂野另类xxxxoooo| 久久婷婷成人综合色| 91精品国产麻豆| 91麻豆精品久久久久蜜臀| 欧美中文字幕一区二区三区| 日韩欧美视频一区| 亚洲欧美怡红院| 日本不卡在线视频| 从欧美一区二区三区| 欧美撒尿777hd撒尿| 2019国产精品| 亚洲成人一区在线| 成人av在线播放网站| 在线成人免费视频| 久久久久久久久岛国免费| 亚洲欧美一区二区三区极速播放| 免费成人在线网站| 色综合天天综合网天天看片| 精品国产1区二区| 亚洲国产人成综合网站| 成人性色生活片免费看爆迷你毛片| 色八戒一区二区三区| 亚洲色图都市小说| 欧美色综合网站| 日韩电影免费一区| 日韩欧美一卡二卡| 欧美精品一区二区三区高清aⅴ| 在线精品观看国产| 日韩欧美www| 亚洲国产精品久久艾草纯爱| 成人午夜在线播放| 精品成人一区二区三区四区| 午夜在线电影亚洲一区| 成人动漫一区二区| 亚洲国产精品v| 国产一区二区0| 精品日韩在线观看| 中文字幕在线观看不卡视频| 国产成人aaa| 久久精品一二三| 国产在线精品一区在线观看麻豆| 91在线视频免费91| 欧美精品一区二区三区四区| 中文字幕精品在线不卡| 黄页网站大全一区二区| 欧美一卡二卡三卡| 青青草精品视频| 在线中文字幕一区| 亚洲黄一区二区三区| 91在线丨porny丨国产| 亚洲色欲色欲www在线观看| 成人av电影观看| 中文字幕在线观看一区二区| 91免费观看在线| 亚洲香肠在线观看| 欧美日韩免费在线视频| 自拍偷拍国产亚洲| 欧美日韩三级一区| 视频在线观看国产精品| 91啪亚洲精品| 亚洲欧美激情插| 欧美久久免费观看| 欧美aⅴ一区二区三区视频| 欧美电影免费观看高清完整版| 一区二区三区久久| 7777精品久久久大香线蕉| 青青草国产精品亚洲专区无| 日韩一区二区影院| 国产成人免费视频网站高清观看视频| 亚洲国产精品黑人久久久| av成人动漫在线观看| 亚洲愉拍自拍另类高清精品| 欧美日韩一级片在线观看| 亚洲一区在线观看免费| 日韩美女一区二区三区四区| 成人看片黄a免费看在线| 亚洲啪啪综合av一区二区三区| 欧美日韩一区二区电影| 国精产品一区一区三区mba桃花 | 欧美无砖专区一中文字| 日韩精品电影一区亚洲| 久久久噜噜噜久噜久久综合| 91福利资源站| 一区二区成人在线| 久久综合久久综合亚洲| 91看片淫黄大片一级| 韩国欧美国产1区| 午夜精品123| 亚洲自拍都市欧美小说| 国产欧美一区二区精品性色超碰| 欧美福利电影网| 在线观看国产精品网站| 成人毛片在线观看| 国产成人av电影在线观看| 久久不见久久见免费视频7| 亚洲国产成人av网| 一区2区3区在线看| 亚洲精品乱码久久久久| 中文字幕视频一区| 欧美国产一区视频在线观看| 99久久精品免费看国产| 国产午夜亚洲精品理论片色戒 | 亚洲国产成人av好男人在线观看| 欧美一区二区三区人| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 国产999精品久久| 国产成人av福利| 丁香六月综合激情| 岛国精品在线观看| 国产a精品视频| 国产成人自拍高清视频在线免费播放| 另类小说视频一区二区| 美女网站在线免费欧美精品| 琪琪久久久久日韩精品| 日本aⅴ免费视频一区二区三区 | 中文字幕一区二区三区色视频| www国产亚洲精品久久麻豆| 亚洲精品在线观看网站| 69堂国产成人免费视频| 日韩视频在线永久播放| 日韩欧美自拍偷拍| 欧美成人激情免费网| 久久综合色8888| 国产精品午夜免费| 1000精品久久久久久久久| 日韩一区在线看| 亚洲精品亚洲人成人网在线播放| 亚洲自拍偷拍av| 欧美a一区二区| 国产福利91精品一区二区三区| 国产福利精品导航| 色域天天综合网| 欧美乱妇一区二区三区不卡视频| 91精品一区二区三区在线观看| 日韩欧美视频一区| 国产欧美精品一区| 一区二区三区在线观看欧美| 天堂一区二区在线| 极品美女销魂一区二区三区| av中文字幕亚洲| 欧美视频精品在线观看| 欧美一区二区日韩一区二区| 亚洲国产经典视频| 亚洲成av人片一区二区梦乃| 国产一区二区三区免费看| 91在线精品一区二区| 欧美精品日韩精品| 国产亚洲精品aa午夜观看| 亚洲一区二区在线免费看| 激情久久久久久久久久久久久久久久| 国产成人精品免费在线| 欧美色视频在线观看| 久久久精品日韩欧美| 一区2区3区在线看| 国产精品亚洲第一| 欧美日韩国产另类一区| 久久久精品天堂| 日日夜夜精品免费视频| 99久久久久久| 久久综合九色综合欧美就去吻| 一区二区三区免费在线观看| 国产精品一线二线三线| 欧美日韩在线观看一区二区 | 91麻豆精品国产| 亚洲天堂福利av| 国产精品亚洲一区二区三区在线| 一本到一区二区三区| 国产午夜一区二区三区| 蜜桃av一区二区三区| 91久久精品一区二区三| 国产亚洲精品bt天堂精选| 亚洲成av人片一区二区| 99久精品国产| 国产日韩欧美高清在线| 激情综合色综合久久| 欧美特级限制片免费在线观看| 欧美国产精品中文字幕| 极品销魂美女一区二区三区| 在线成人av网站| 亚洲一区二区av在线| 99久久精品国产麻豆演员表| 日韩精品一区二| 免费高清在线一区| 欧美精品日韩精品| 亚洲 欧美综合在线网络| 色系网站成人免费| 国产精品久久精品日日| 粉嫩高潮美女一区二区三区 | 国产成人免费av在线| 777精品伊人久久久久大香线蕉| 亚洲国产另类av| 在线不卡一区二区| 亚洲电影视频在线| 欧美三级韩国三级日本三斤| 一区二区三区四区中文字幕| 色婷婷精品久久二区二区蜜臀av | 日本高清不卡视频| 一区二区三区在线不卡| 欧美综合色免费| 亚洲综合在线电影|