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

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

?? serknr.c

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

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

                    802-655-7879


    written by:     Jeff Finkelstein

    Modification History:
    4/8/91      jf  - created
    4/9/91      jf  - added COMPORT1 and COMPORT2 strings for DOS
    4/13/91     jf  - added system command for Com configuration
    4/15/91     jf  - simplified get_serial_record
    4/23/91     jf  - removed IO.h for KNR systems
                jf  - removed O_BINARY
    4/30/91     jf  - removed references to DOS.. SERKNR.c is no longer
                      DOS compatible..DOS is NOT capabable of reasonable
                      serial communication control!!!
    11/3/92     jf  - baudspeedbits now initialized to B9600 for UNIX
    12/22/92    jf  - updated for SGI compatibility..note that
                      get_serial_record has been modified to return
                      the most recent (newest) record from the BIRD
    12/29/92    jf  - moved all #ifdefs and #defines to column 1 for
                      compiler compatibility
    1/8/93      jf  - added DEBUG_VIEWSERIAL ifdefs to allow serial
                      characters received to appear on the console
                jf  - added DEBUG_SKIPSERIAL ifdefs to skip opening
                      and read/writes to the serial port if TRUE
    1/12/93     jf  - open now use O_NDELAY for all systems to disregard
                      the state of the Carrier Detect signal
    1/31/93     jf  - send_serial_cmd modified to be able to send out
                      rs232 to fbb commands to addr 30

           <<<< Copyright 1990 Ascension Technology Corporation >>>>
*****************************************************************************
****************************************************************************/
#include <stdio.h>          /* general I/O */
#include <string.h>         /* for string commands */
#include "asctech.h"        /* Ascension Technology Definitions */
#include "compiler.h"       /* Compiler Definitions */
#include "menu.h"           /* for user interaction */
#include "serial.h"         /* Serial Definitions */

/*
    Local Prototypes
*/
#ifdef KNR
int get_record();
#else
int get_record(short charsneeded, char * rxbufinptr, short checkphasebit);
#endif

/*
    Descriptors for the COM ports
    =============================

    sys_com_config gets built at run time in configserial via strcpy and
    strcat C library calls... the user MUST modify this code when compiling
    on a UNIX platform using the proper /dev/tty driver
*/

#ifdef DOS
    char * sys_com_port[2] ={"com1","com2"};
#define OPENPARAMS O_RDWR
#endif

    /*
        UNIX Platforms
    */
#ifdef UNIX
#ifdef UNIX_SGTTY
    struct sgttyb oldcom_sgttyb;    /* save the old com config */
    struct sgttyb com_sgttyb;       /* for the new com config */
#endif

#ifdef UNIX_TERMIO
    struct termio oldcom_termio;    /* save the old com config */
    struct termio com_termio;       /* for the new com config */
#endif

    /*
        COHERENT - PCAT/Compatible 386/486 Platform
        --------

        COHERENT defines the Com Ports as: /dev/com1*,/dev/com2*
        Where, the l denotes interrupt mode, w/o Modem control
        Use /dev/com*l for interrupts w/o Modem control
             /dev/com*r for interrupts w/  Modem control
             /dev/com*pl for polled mode w/o Modem control
             /dev/com*pr for polled mode w/  Modem control
    */
#ifdef COHERENT
    char * sys_com_port[2] ={"/dev/com1l","/dev/com2l"};
#define OPENPARAMS O_RDWR
#endif

   /*
        IBM AIX - For the Risc 6000 Platform (using the Berkley terminal
        -------   interface)
   */
#ifdef AIX
    char * sys_com_port[2] ={"/dev/tty0","/dev/tty1"};
#define OPENPARAMS O_RDWR | O_NDELAY

#endif

   /*
        SUN SUNOS - For the SUN platform (using the TERMIO interface)
        ---------
   */
#ifdef SUNOS
    char * sys_com_port[2] ={"/dev/ttyha","/dev/ttyhb"};
#define OPENPARAMS O_RDWR | O_NDELAY
#endif

   /*
        DEC ULTRIX - For the DEC Platforms (using the Berkley terminal
        ----------   interface)
   */
#ifdef ULTRIX
    char * sys_com_port[2] ={"/dev/tty00","/dev/tty01"};
#define OPENPARAMS O_RDWR | O_NDELAY
#endif

   /*
        SGI IRIX - For the Silicon Graphics Platforms (using
        --------   the TERMIO interface)
   */
#ifdef IRIX
    char * sys_com_port[2] ={"/dev/ttyd1","/dev/ttyd2"};
#define OPENPARAMS O_RDWR
#endif

#endif

    /*
        Declare/Init the Variables
    */
    short comport = COM1;                   /* holds the comport # */

    /*
       Baud Rates for 6DFOBs
    */
    long baud = 9600L;                      /* holds the current baud rate */
    long baudratetable[] = {115200L,
                            57600L,
                            38400L,
                            19200L,
                            9600L,
                            4800L,
                            2400L};         /* holds the baud rate selections */

    /*
       Setup a Table for the Baud Rate Bit Definition used when
       setting up the Baud Rates via a call to IOCTL
    */
#ifdef UNIX

    short baudspeedbits = B9600;            /* holds the current bit definition */
    short baudspeedbittable[] = {BAUDRATE_115200,  /* CPU SPECIFIC */
                                 BAUDRATE_57600,   /* CPU SPECIFIC */
                                 BAUDRATE_38400,   /* CPU SPECIFIC */
                                 B19200,
                                 B9600,
                                 B4800,
                                 B2400};    /* holds the bitspeed definition */
#endif

    /*
       Use the Definitions from the BIOS INT14 function 0
    */
#ifdef DOS
    short baudspeedbits = 7;            /* holds the current bit definition */
    short baudspeedbittable[] = {-1,
                                 -1,
                                 -1,
                                 -1,
                                 7,
                                 6,
                                 5};    /* holds the bitspeed definition */
#endif

    int comhandle = -1;                     /* holds the comport handle */
    short serialconfigsaved = FALSE;        /* flag indicates serial port saved */
    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:
*/
int configserialport()
{
#ifdef DEBUG_SKIPSERIAL
       return(TRUE);
#else

#ifdef DOS
#ifdef RTSINCABLE
        int com_base;
#endif

      /*
         Use BIOS INT 14 to setup the Serial Ports Baud Rate and Config
      */
#define SETSERIALINT 0x14       /* INT 14h */
      union REGS regs;                /* Use C's register emulation */

      regs.h.ah = 0;                          /* set up for function 0 */
      regs.h.al = (baudspeedbits << 5) | 3;   /* MS 3 bits of AL = BAUD
                                                 LS 2 bits = 8 bit char */
      regs.x.dx = comport;                    /* DX = comport # */
      int86(SETSERIALINT,&regs,&regs);        /* Do INT */

      /*
         NOTE: Enable the RTSINCABLE code if the RS232 cable connected
               to the Host PC contains a connection for RTS...

               RTS holds the Bird in RESET/STANDY and therefore the
               DOS write times outs
      */

#ifdef RTSINCABLE
        /*
            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);
        }

        /*
            Assert DTR...just in case the cable uses the DTR signal
            Deassert RTS...else the system will reset
            Dessert OUT2...needed to disable interrupts on PC compatible
                serial I/O cards
        */
        OUTPORTB(com_base + MODEMCONT, DTRON);
#endif


      return(TRUE);
#endif

#ifdef UNIX_SGTTY
      struct sgttyb tempcom_sgttyb;

      /*
          Get the Current Com Port Configuration
      */
      if (ioctl(comhandle,TIOCGETP,&tempcom_sgttyb) >= 0)
      {
          /*
              Set the New Baud Rate...input and output
          */
          tempcom_sgttyb.sg_ispeed = baudspeedbits;
          tempcom_sgttyb.sg_ospeed = baudspeedbits;
          if (ioctl(comhandle,TIOCSETP,&tempcom_sgttyb) >= 0)
              return(TRUE);
      }
      printf("\n\r** ERROR ** could not set the COM port Baud Rate\n\r");
      return(FALSE);

#endif

#ifdef UNIX_TERMIO
      struct termio tempcom_termio;

      /*
          Get the Current Com Port Configuration
      */
      if (ioctl(comhandle,TCGETA,&tempcom_termio) >= 0)
      {
          /*
              Set the New Baud Rate... don't smash the current CFLAG settings
          */
          tempcom_termio.c_cflag |= baudspeedbits;
          if (ioctl(comhandle,TCSETA,&tempcom_termio) >= 0)
              return(TRUE);
      }
      printf("\n\r** ERROR ** could not set the COM port Baud Rate\n\r");
      return(FALSE);

#endif
#endif /* DEBUG_SKIPSERIAL */
}

/*
    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()
{
#ifdef DEBUG_SKIPSERIAL
    return(TRUE);
#else

#ifdef UNIX
    int zeroint = 0;
#endif

    /*
        if already opened, return FALSE
    */
    if (comhandle != -1)
        return(FALSE);

    /*
        Open the Comport for RD and WR and get a handle
    */
    if ((comhandle = open(sys_com_port[comport], OPENPARAMS)) == -1)
    {
        printf("\n\r** ERROR ** could not open the COM port\n\r");
        return(FALSE);
    }

#ifdef UNIX_SGTTY

    /*
        Save the Current Com Port Configuration
    */
    if (ioctl(comhandle,TIOCGETP,&oldcom_sgttyb) >= 0)
    {
      /*
         Set the New configuration to RAW mode
      */
      com_sgttyb.sg_flags = RAW;
      if (ioctl(comhandle,TIOCSETP,&com_sgttyb) >= 0)
      {
#ifdef ULTRIX
          /*
              Setup the TTY to NOT need the MODEM control Signal
          */
          if (ioctl(comhandle,TIOCNMODEM,zeroint) >= 0)
          {
              /*
                   Setup for ignoring Carrier
              */
              if (ioctl(comhandle,TIOCNCAR,zeroint) >= 0)
                  return(TRUE);
          }
#else
          return(TRUE);
#endif
        }
     }

    /*
        Put up the Error and return
    */
    printf("** ERROR ** could not configure the COM port to RAW mode");
    hitkeycontinue();

    return(FALSE);
#endif

#ifdef UNIX_TERMIO

    /*
        Save the Current Com Port Configuration
    */
    if (ioctl(comhandle,TCGETA,&oldcom_termio) >= 0)
    {
        /*
           Setupt the new port configuration...NON-CANONICAL INPUT MODE
           .. as defined in termio.h
        */
        com_termio.c_iflag = XOFF;
        com_termio.c_cflag = CS8 | CLOCAL | CREAD;
        com_termio.c_lflag = 0;
        com_termio.c_cc[VMIN] = 0;     /* setup to return after 2 seconds */
        com_termio.c_cc[VTIME] = 20;   /* ..if no characters are received */
                                       /* TIME units are assumed to be 0.1 secs */

        if (ioctl(comhandle,TCSETA,&com_termio) >= 0)
        {
           return(TRUE);
        }
     }

    /*
        Put up the Error and return
    */
    printf("** ERROR ** could not configure the COM port to RAW mode");
    hitkeycontinue();

    return(FALSE);
#endif

#ifdef DOS
    return(TRUE);
#endif

#endif /* DEBUG_SKIPSERIAL */

}

/*
    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()
{
#ifdef DEBUG_SKIPSERIAL
    return;
#else
    /*
        Restore the Com Port Configuration.. if already opened
    */
    if (comhandle != -1)
    {
#ifdef UNIX_SGTTY
        ioctl(comhandle,TIOCSETP,&oldcom_sgttyb);    /* restore config */
#endif

#ifdef UNIX_TERMIO

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线成人小视频| 99久久免费精品| www.视频一区| 欧日韩精品视频| 日韩欧美一二三区| 最新不卡av在线| 日韩av高清在线观看| 国产成人福利片| 欧美日韩一区二区欧美激情| 久久久亚洲欧洲日产国码αv| 亚洲人亚洲人成电影网站色| 麻豆国产一区二区| 在线亚洲免费视频| 久久嫩草精品久久久精品| 亚洲永久免费视频| 国产永久精品大片wwwapp| 欧美最猛黑人xxxxx猛交| www日韩大片| 午夜亚洲福利老司机| 国产精品亚洲一区二区三区在线| 欧美吞精做爰啪啪高潮| 久久精品在线观看| 日本最新不卡在线| 一本到一区二区三区| 久久久久久亚洲综合影院红桃| 亚洲自拍欧美精品| 成人黄色电影在线| 欧美sm美女调教| 亚洲观看高清完整版在线观看| 国产激情偷乱视频一区二区三区 | 亚洲一二三四在线观看| 国产精品66部| 欧美美女激情18p| 国产精品二区一区二区aⅴ污介绍| 麻豆精品在线看| 欧美日韩aaa| 亚洲人成亚洲人成在线观看图片| 国产在线精品免费| 日韩一级免费观看| 亚洲成人福利片| 99免费精品视频| 久久欧美一区二区| 精品一区二区国语对白| 亚洲成人av电影在线| 国产不卡视频一区| 精品国产91亚洲一区二区三区婷婷| 亚洲国产视频在线| 91福利资源站| 中文字幕字幕中文在线中不卡视频| 精品亚洲成a人在线观看| 6080国产精品一区二区| 一级特黄大欧美久久久| 99久久精品国产麻豆演员表| 国产亚洲欧美日韩俺去了| 久久激五月天综合精品| 欧美一级一区二区| 日韩av中文字幕一区二区三区| 欧美日韩日日夜夜| 午夜精品久久久久久久久| 欧美唯美清纯偷拍| 亚洲国产你懂的| 91成人在线观看喷潮| 亚洲你懂的在线视频| eeuss鲁片一区二区三区| 欧美国产日本韩| 国产成a人亚洲精品| 国产欧美一区二区三区鸳鸯浴| 国产一区二区久久| 国产拍欧美日韩视频二区| 国精产品一区一区三区mba桃花 | 国产精品影视在线观看| 久久综合资源网| 国产一区999| 久久美女艺术照精彩视频福利播放 | 99久久久久久| 亚洲精品老司机| 91传媒视频在线播放| 亚洲二区视频在线| 欧美日本韩国一区| 免费国产亚洲视频| 久久久亚洲高清| 国产a精品视频| 中文字幕中文字幕中文字幕亚洲无线| 成人免费视频app| 亚洲免费大片在线观看| 欧美三级中文字幕在线观看| 五月天网站亚洲| 精品国产人成亚洲区| 懂色av一区二区夜夜嗨| 亚洲欧洲www| 欧美性生活一区| 男女性色大片免费观看一区二区| 欧美成人r级一区二区三区| 国产一区二区女| 成人免费在线视频| 欧美色综合久久| 九色综合狠狠综合久久| 亚洲国产精品激情在线观看| 97久久超碰国产精品电影| 亚洲一区二区三区爽爽爽爽爽| 91精品国产综合久久精品| 国产在线麻豆精品观看| 亚洲欧洲无码一区二区三区| 欧美午夜免费电影| 久久精品国产免费看久久精品| 日本一区二区成人| 欧美探花视频资源| 精品在线一区二区三区| 最新成人av在线| 日韩区在线观看| 成人app网站| 婷婷激情综合网| 国产三级欧美三级| 欧美视频第二页| 国产一区视频导航| 亚洲免费在线播放| 精品国产伦一区二区三区观看方式 | 日韩区在线观看| 99久久久精品| 美腿丝袜一区二区三区| 亚洲视频免费看| 精品日韩在线观看| 日本电影欧美片| 九九视频精品免费| 亚洲免费观看在线视频| 欧美va亚洲va香蕉在线| 在线视频你懂得一区| 国产一区二区三区免费在线观看| 亚洲精品午夜久久久| 欧美精品一区二区三区高清aⅴ| 色欧美片视频在线观看在线视频| 韩国v欧美v日本v亚洲v| 性做久久久久久| 国产精品丝袜黑色高跟| 日韩一卡二卡三卡四卡| 91日韩在线专区| 国产美女娇喘av呻吟久久| 亚洲午夜精品在线| 亚洲欧美在线视频观看| 日韩你懂的在线观看| 欧美性感一区二区三区| 成人蜜臀av电影| 精品一区二区av| 日日夜夜免费精品| 亚洲最快最全在线视频| 国产免费久久精品| 精品久久久久久久久久久院品网| 在线观看区一区二| 99久久伊人精品| 国产剧情一区二区三区| 日韩不卡一区二区| 亚洲午夜一区二区三区| 中文字幕日韩av资源站| 久久久五月婷婷| 欧美成人猛片aaaaaaa| 91精品午夜视频| 91福利在线观看| 91丨porny丨国产入口| 粉嫩蜜臀av国产精品网站| 狠狠色综合播放一区二区| 日韩激情av在线| 亚洲va韩国va欧美va| 亚洲欧美偷拍卡通变态| 亚洲日本一区二区三区| 国产精品视频一区二区三区不卡| 久久天堂av综合合色蜜桃网| 日韩免费看网站| 日韩精品一区二区三区四区| 3d动漫精品啪啪| 在线播放国产精品二区一二区四区| 在线视频你懂得一区二区三区| 91麻豆文化传媒在线观看| 成人黄色在线网站| 成人av资源下载| 成人午夜看片网址| jizz一区二区| 91视频国产观看| 91久久精品一区二区二区| 91黄色激情网站| 欧美亚洲动漫精品| 欧美日韩国产色站一区二区三区| 欧美日韩在线三区| 欧美日韩电影在线播放| 欧美精选一区二区| 91精品国产手机| 精品久久人人做人人爽| 久久综合99re88久久爱| 久久久久九九视频| 国产精品全国免费观看高清| 中文字幕日本不卡| 一区二区免费在线| 日本成人在线一区| 国产在线观看一区二区| 成人久久18免费网站麻豆| 99精品久久只有精品| 色婷婷亚洲精品| 欧美日韩国产乱码电影| 欧美成人精品高清在线播放| 国产区在线观看成人精品| 国产精品久久久久久久久搜平片 |