uart.h

Go to the documentation of this file.
00001 /*-
00002  * Public platform independent Near Field Communication (NFC) library
00003  * 
00004  * Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty
00005  * 
00006  * This program is free software: you can redistribute it and/or modify it
00007  * under the terms of the GNU Lesser General Public License as published by the
00008  * Free Software Foundation, either version 3 of the License, or (at your
00009  * option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00014  * more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>
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 // Handle platform specific includes
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 // Define shortcut to types to make code more readable
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 

Generated on 8 May 2010 for libnfc by  doxygen 1.6.1