libnfc 1.4.2
Defines | Functions
uart_posix.c File Reference

POSIX UART driver. More...

#include <sys/select.h>
#include <sys/param.h>
#include <termios.h>

Go to the source code of this file.

Defines

#define UART_BAUDRATE_T0_BYTE_DURATION(X)   ((1000000 * 10)/ X)

Functions

int uart_receive (serial_port sp, byte_t *pbtRx, size_t *pszRx)
 Receive data from UART and copy data to pbtRx.
int uart_send (serial_port sp, const byte_t *pbtTx, const size_t szTx)
 Send pbtTx content to UART.

Detailed Description

POSIX UART driver.

Definition in file uart_posix.c.


Define Documentation

#define UART_BAUDRATE_T0_BYTE_DURATION (   X)    ((1000000 * 10)/ X)
Note:
This define convert a Baud rate in a per-byte duration (in µs) Bauds are "symbols per second", so each symbol is bit here. We want to convert Bd to bytes/s in first time, 1 serial-transmitted byte is (in 8N1):
  • 1 start bit,
  • 8 data bits,
  • 1 stop bit.

In 8N1 mode, byte-rate = baud-rate / 10

Definition at line 99 of file uart_posix.c.


Function Documentation

int uart_receive ( serial_port  sp,
byte_t *  pbtRx,
size_t *  pszRx 
)

Receive data from UART and copy data to pbtRx.

Returns:
0 on success, otherwise driver error code

Definition at line 212 of file uart_posix.c.

int uart_send ( serial_port  sp,
const byte_t *  pbtTx,
const size_t  szTx 
)

Send pbtTx content to UART.

Returns:
0 on success, otherwise a driver error is returned

Definition at line 279 of file uart_posix.c.