Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
uart_arch.c File Reference
#include <BOARD_CONFIG>
#include "mcu_periph/uart.h"
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "serial_port.h"
#include "rt_priority.h"
#include <pthread.h>
#include <sys/select.h>
+ Include dependency graph for uart_arch.c:

Go to the source code of this file.

Macros

#define UART_THREAD_PRIO   11
 
#define TRACE(fmt, args...)
 

Functions

static void uart_receive_handler (struct uart_periph *periph)
 
static void * uart_thread (void *data)
 
void uart_arch_init (void)
 
static void uart_periph_open (struct uart_periph *periph, uint32_t baud)
 
void uart_periph_set_baudrate (struct uart_periph *periph, uint32_t baud)
 Set baudrate. More...
 
void uart_periph_set_bits_stop_parity (struct uart_periph *periph, uint8_t bits, uint8_t stop, uint8_t parity)
 Set parity and stop bits. More...
 
void uart_put_byte (struct uart_periph *periph, long fd, uint8_t data)
 Uart transmit implementation. More...
 
uint8_t uart_getch (struct uart_periph *p)
 
int uart_char_available (struct uart_periph *p)
 Check UART for available chars in receive buffer. More...
 

Variables

static pthread_mutex_t uart_mutex = PTHREAD_MUTEX_INITIALIZER
 

Macro Definition Documentation

#define TRACE (   fmt,
  args... 
)

Definition at line 52 of file uart_arch.c.

Referenced by uart_periph_open(), uart_put_byte(), and uart_receive_handler().

#define UART_THREAD_PRIO   11

Definition at line 44 of file uart_arch.c.

Referenced by uart_thread().

Function Documentation

void uart_arch_init ( void  )

Definition at line 54 of file uart_arch.c.

References uart_thread().

+ Here is the call graph for this function:

int uart_char_available ( struct uart_periph p)

Check UART for available chars in receive buffer.

Returns
number of chars in the buffer

Definition at line 323 of file uart_arch.c.

References uart_periph::rx_extract_idx, uart_periph::rx_insert_idx, and UART_RX_BUFFER_SIZE.

uint8_t uart_getch ( struct uart_periph p)
static void uart_periph_open ( struct uart_periph periph,
uint32_t  baud 
)
static

Definition at line 219 of file uart_arch.c.

References uart_periph::baudrate, uart_periph::dev, uart_periph::reg_addr, serial_port_close(), serial_port_free(), serial_port_new(), serial_port_open_raw(), and TRACE.

Referenced by uart_periph_set_baudrate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void uart_periph_set_baudrate ( struct uart_periph periph,
uint32_t  baud 
)

Set baudrate.

Definition at line 246 of file uart_arch.c.

References uart_periph::baudrate, uart_periph::reg_addr, serial_port_set_baudrate(), and uart_periph_open().

+ Here is the call graph for this function:

void uart_periph_set_bits_stop_parity ( struct uart_periph periph,
uint8_t  bits,
uint8_t  stop,
uint8_t  parity 
)

Set parity and stop bits.

Definition at line 262 of file uart_arch.c.

References uart_periph::reg_addr, and serial_port_set_bits_stop_parity().

+ Here is the call graph for this function:

void uart_put_byte ( struct uart_periph periph,
long  fd,
uint8_t  data 
)

Uart transmit implementation.

Definition at line 272 of file uart_arch.c.

References SerialPort::fd, uart_periph::reg_addr, and TRACE.

static void uart_receive_handler ( struct uart_periph periph)
static

Definition at line 290 of file uart_arch.c.

References fd, SerialPort::fd, TRACE, and UART_RX_BUFFER_SIZE.

Referenced by uart_thread().

+ Here is the caller graph for this function:

static void * uart_thread ( void *  data)
static

Definition at line 68 of file uart_arch.c.

References fd, get_rt_prio(), uart_receive_handler(), and UART_THREAD_PRIO.

Referenced by uart_arch_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

pthread_mutex_t uart_mutex = PTHREAD_MUTEX_INITIALIZER
static

Definition at line 49 of file uart_arch.c.