uart.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifndef __NFC_BUS_UART_H__
00027 #define __NFC_BUS_UART_H__
00028
00029 #include <stdio.h>
00030 #include <string.h>
00031 #include <stdlib.h>
00032
00033
00034 #include <nfc/nfc-types.h>
00035
00036
00037 #ifndef _WIN32
00038 #include <termios.h>
00039 #include <sys/ioctl.h>
00040 #include <unistd.h>
00041 #include <fcntl.h>
00042 #include <sys/types.h>
00043 #include <sys/stat.h>
00044 #include <limits.h>
00045 #include <sys/time.h>
00046 #else
00047 #include <windows.h>
00048 #endif
00049
00050
00051 typedef void* serial_port;
00052 #define INVALID_SERIAL_PORT (void*)(~1)
00053 #define CLAIMED_SERIAL_PORT (void*)(~2)
00054
00055 serial_port uart_open(const char* pcPortName);
00056 void uart_close(const serial_port sp);
00057
00058 void uart_set_speed(serial_port sp, const uint32_t uiPortSpeed);
00059 uint32_t uart_get_speed(const serial_port sp);
00060
00061 bool uart_receive(const serial_port sp, byte_t* pbtRx, size_t* pszRxLen);
00062 bool uart_send(const serial_port sp, const byte_t* pbtTx, const size_t szTxLen);
00063
00064 #endif // __NFC_BUS_UART_H__
00065
00066