⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.h

📁 GPS导航定位程序
💻 H
字号:
/****************************************************************************
* This include file contains definitions of various constants and macros used 
* by the serial communications routines in GPS Builder-2.
****************************************************************************/

/* Serial Port Definitions. */

extern volatile SERIALPORT;
extern volatile char *nextserialin, *nextserialout;

/* Serial Macros. */

#define serialstat() (inp(LINESTATUS))

/* Serial Port Addresses. */

/* 8250 UART base port address:  COM1 = 3f8, COM2 = 2f8 */

#define BASE        (0x3f8-((SERIALPORT-1)<<8))
#define TXDATA       BASE                                /* transmit data. */
#define RXDATA       BASE                                 /* receive data. */
#define DIVLSB       BASE                        /* baud rate divisor lsb. */
#define DIVMSB      (BASE+1)                     /* baud rate divisor msb. */
#define INTENABLE   (BASE+1)                          /* interrupt enable. */
#define INTIDENT    (BASE+2)                         /* interrupt ident'n. */
#define LINECTL     (BASE+3)                              /* line control. */
#define MODEMCTL    (BASE+4)                             /* modem control. */
#define LINESTATUS  (BASE+5)                               /* line status. */
#define MODEMSTATUS (BASE+6)                              /* modem status. */

/* Serial Interrupt Values. */

#define IRQ     (4-(SERIALPORT-1))                     /* 0-7 = IRQ0-IRQ7. */
#define SERIALINT  (12-(SERIALPORT-1))                /* Interrupt vector. */
#define SERIALIRQ  (~(1 << IRQ))
#define PIC01   0x21             /* 8259 Programmable Interrupt Controller.*/
#define PIC00   0x20             /*  "      "              "        "      */
#define EOI     0x20                          /* End of Interrupt command. */

/* Line Status Register Values. */

#define XMIT_DATA_READY    0x20

/* Modem Control Register Values. */

#define DTR   1
#define RTS   2
#define OUT2  8

/* Interrupt Enable Register Signals. */

#define DATAREADY 1

/* Serial Input Interrupt Buffer Size. */

#define SERIALBUFFERSIZE 1024

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -