亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
3d成人h动漫网站入口| 免费在线看一区| www.综合网.com| 国产精品欧美极品| 国产精品1区二区.| 亚洲国产精品成人综合色在线婷婷| 国产一区美女在线| 久久色成人在线| 成人黄色777网| 亚洲男人的天堂在线aⅴ视频| 色综合久久久久久久久| 亚洲中国最大av网站| 欧美日韩精品二区第二页| 男女性色大片免费观看一区二区 | 成人在线视频一区| 最新不卡av在线| 欧美日韩午夜精品| 激情图区综合网| 中文字幕一区二区三区不卡在线| 91亚洲精品一区二区乱码| 亚洲国产视频a| 欧美成人精品高清在线播放| 国产成人在线观看| 亚洲国产欧美日韩另类综合| 亚洲精品中文在线观看| 欧美亚洲综合网| 久久精品久久99精品久久| 国产精品视频免费看| 欧美影院一区二区三区| 精品在线亚洲视频| 亚洲欧美日韩综合aⅴ视频| 欧美一级生活片| 成人黄色在线网站| 日韩av中文字幕一区二区| 中国色在线观看另类| 欧美电影在线免费观看| 国产999精品久久久久久绿帽| 一区二区三区四区在线| 久久影院午夜论| 欧美色综合影院| 国产99久久久精品| 日韩综合一区二区| 亚洲视频资源在线| 久久色成人在线| 欧美日韩高清一区二区不卡| 成人福利视频在线看| 日本不卡免费在线视频| 亚洲三级免费观看| 久久久综合激的五月天| 91精品蜜臀在线一区尤物| 91一区二区在线| 国产精品77777| 日韩1区2区3区| 亚洲精品亚洲人成人网在线播放| 2022国产精品视频| 日韩欧美一区二区在线视频| 色狠狠色狠狠综合| 国产99久久久国产精品潘金| 日韩高清在线不卡| 亚洲成在人线在线播放| 综合久久久久综合| 国产精品久久久久久福利一牛影视 | 91精品视频网| 欧美日韩一级二级三级| 91影视在线播放| www.成人在线| 国产.欧美.日韩| 久久国产精品99精品国产| 日韩中文字幕91| 亚洲狠狠爱一区二区三区| 亚洲欧美区自拍先锋| 自拍偷拍欧美激情| 中文字幕一区二区三区不卡在线| 欧美激情一区二区三区蜜桃视频 | 国产亚洲婷婷免费| 午夜精品成人在线| 亚洲国产sm捆绑调教视频 | 一区二区三区在线播放| 中文字幕亚洲精品在线观看| 91精品国产一区二区三区蜜臀| 国产 欧美在线| 亚洲综合视频在线| 久久久久国产成人精品亚洲午夜| 成人av动漫网站| 精品亚洲免费视频| 伊人婷婷欧美激情| 中文字幕欧美日本乱码一线二线| 欧洲精品在线观看| www.66久久| 韩国精品久久久| 日韩精品一二三| 亚洲永久精品大片| 成人免费小视频| 国产精品福利影院| 亚洲国产电影在线观看| 制服视频三区第一页精品| 欧美性色欧美a在线播放| 91视频在线观看| 9久草视频在线视频精品| 国产精品系列在线观看| 成人精品免费视频| 黄色资源网久久资源365| 精品亚洲成a人在线观看| 国模大尺度一区二区三区| 蜜桃在线一区二区三区| 日韩电影在线一区二区| 国产精品1024| 国产精品一卡二卡在线观看| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 国产一区美女在线| 一区二区三区丝袜| 国产成人精品亚洲午夜麻豆| 国产高清一区日本| 大陆成人av片| 91久久奴性调教| 欧美大片在线观看一区| 国产精品毛片久久久久久| 午夜激情久久久| 国产91露脸合集magnet| 国产欧美日韩综合| 国产精品久久久久久久浪潮网站 | 亚洲国产美女搞黄色| 亚洲电影中文字幕在线观看| 亚洲国产综合91精品麻豆| 六月婷婷色综合| 在线亚洲一区二区| 久久久国产精品午夜一区ai换脸| 中文字幕欧美三区| 久久精品噜噜噜成人av农村| 福利电影一区二区三区| 9191久久久久久久久久久| 国产精品丝袜一区| 精品一区精品二区高清| 欧美主播一区二区三区| 国产精品久久久久久福利一牛影视| 五月婷婷色综合| 色婷婷久久久久swag精品| 久久日韩粉嫩一区二区三区 | 国产精品久久久久永久免费观看| 亚洲成人av免费| 欧美一区二区黄| 日韩国产欧美在线视频| 欧美蜜桃一区二区三区| 国产精品久线在线观看| av福利精品导航| 国产精品卡一卡二卡三| 国产成人在线视频免费播放| 欧美少妇xxx| 国产日韩综合av| 日韩激情中文字幕| 亚洲女厕所小便bbb| 亚洲欧美一区二区三区久本道91| 国产精品伦一区二区三级视频| 色综合天天综合网天天看片| 久久精品男人天堂av| 成人做爰69片免费看网站| 日韩精品资源二区在线| 亚洲大片精品永久免费| 91九色最新地址| 亚洲欧洲成人精品av97| 成人午夜电影小说| 国产日韩精品一区二区三区在线| 麻豆国产一区二区| 日韩一区二区三区av| 欧美一区二区三区视频在线| 久久精品国产**网站演员| 精品盗摄一区二区三区| 国产精品91xxx| 性久久久久久久| 国产清纯白嫩初高生在线观看91| 国产成人aaaa| 一区二区三区久久久| 欧美一区二区播放| 成人午夜av在线| 另类小说视频一区二区| 亚洲欧洲国产日韩| 欧美日本韩国一区二区三区视频 | 91精品国产综合久久福利| 久久精品免费看| 亚洲成人免费电影| 亚洲欧洲美洲综合色网| 在线播放中文字幕一区| eeuss影院一区二区三区| 日韩电影免费在线观看网站| 国产欧美中文在线| 精品久久国产97色综合| 欧美日韩在线播| 91福利在线导航| 91视频国产资源| 成人精品高清在线| 国内成人精品2018免费看| 亚洲一区免费视频| 日韩理论片网站| 国产精品久久精品日日| 久久久三级国产网站| 精品久久久久久亚洲综合网| 亚洲视频图片小说| 久久久久久久综合色一本| 综合激情成人伊人|