- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
- /***********************************************
- name: uart.h
- create by skier 2005.06.04
- for LPG2104 UART driver
- *********************************************/
- #ifndef UART_H
- #define UART_H
- /*
- * if DEBUG_MODEM_DATA defined
- *Byte receive from Modem or Send to Modem will
- * print to user Com
- */
- //#define DEBUG_MODEM_DATA
- #define UART0_IN_DATA (((U0LSR | 0x00) & 0x01) == 0x01)
- #define UART0_DATA U0RBR
- #define UART1_IN_DATA (((U1LSR | 0x00) & 0x01) == 0x01)
- #define UART1_DATA U1RBR
- #define UART1_RATE 115200
- #define U1LCR_VALUE ((Fcclk/4) /16)/UART1_RATE
- #define UART0_RATE 115200
- #define U0LCR_VALUE ((Fcclk/4) /16)/UART0_RATE
- /*
- * MAX byte of UART0 interrupt buffered.
- *UART0 in this is used to print DEBUG information ,
- *UART0 is also used to connect to user application
- *equipment. such as POS.
- */
- #define MAX_UART0_BUFFER 512
- /*
- * MAX byte of UART1 interrupt buffered.
- * UART1 in this is used to connect to a GPRS Modem.
- * such as HUAWEI GTM900B, MC35I etc.
- */
- #define MAX_UART1_BUFFER 1024
- /*
- * MAX byte will be read one time by main() function.
- * for reduce RAM we define it to 512
- */
- #define MAX_READ_LEN 1024
- #define UART_NO_DATA -1
- #define DATA_READ_OK 0
- #define SEND_AT(str) sendString_2_modem(str)
- #define GET_AT(p) Uart1_getByte(p)
- #define GET_USER_DATA(p) Uart0_getByte(p)
- #define DEBUG 0
- #if DEBUG
- #define DEBUG_FUNCTION(str) debug_sys_time();
- sendString_2_user(str);
- #define DEBUG_EVENT(str) {
- debug_sys_time();
- sendString_2_user(str);
- }
- #define DEBUG_ERR(str) {
- debug_sys_time();
- sendString_2_user("ERR:");
- sendString_2_user(str);
- }
- #else
- #define DEBUG_FUNCTION(str)
- #define DEBUG_EVENT(str)
- #define DEBUG_ERR(str)
- #endif
- #define DEBUG_CHAR(char) //sendByte_2_user(char)
- #define DEBUG_CHARNECESSARY(ch) sendByte_2_user(ch)
- #define DEBUG_NECESSARY(s) sendString_2_user(s)
- #ifndef UART_C
- extern void UART0_Ini(void);
- extern void UART1_Ini(void);
- extern void sendByte_2_user(u8_t data);
- extern void sendByte_2_modem(u8_t data);
- extern void sendString_2_user(char *str);
- extern void sendString_2_modem(char *str);
- extern char UART0_ReceiveChar(void);
- extern u32_t get_user_data(u8_t *ch);
- extern u32_t get_modem_data(u8_t *ch);
- extern u16_t get_modem_datalen(void);
- extern u16_t get_user_datalen(void);
- extern u32_t writeDate_2_modem(void *device, u8_t *data, u32_t len);
- extern u32_t writeDate_2_user(u8_t *data, u32_t len);
- extern void sio_read_abort(void *);
- //extern INT16 Uart1_getByte(u8_t *ch);
- #else
- void UART0_Ini(void);
- void UART1_Ini(void);
- void sendByte_2_user(u8_t data);
- void sendByte_2_modem(u8_t data);
- void sendString_2_user(char *str);
- void sendString_2_modem(char *str);
- char UART0_ReceiveChar(void);
- INT16 Uart0_getByte(u8_t *ch);
- INT16 Uart1_getByte(u8_t *ch);
- u32_t get_modem_data(u8_t *buf);
- u32_t get_user_data(u8_t *buf);
- u16_t get_modem_datalen(void);
- u16_t get_user_datalen(void);
- u32_t writeDate_2_modem(void *device, u8_t *data, u32_t len);
- u32_t writeDate_2_user(u8_t *data, u32_t len);
- void sio_read_abort(void *);
- #endif
- #endif