PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Serial communication for the PX4IO module. More...
#include <stdint.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <string.h>
#include <nuttx/arch.h>
#include <arch/board/board.h>
#include <chip.h>
#include <up_internal.h>
#include <up_arch.h>
#include <stm32.h>
#include <perf/perf_counter.h>
#include "px4io.h"
Go to the source code of this file.
Macros | |
#define | REG(_x) (*(volatile uint32_t *)(PX4FMU_SERIAL_BASE + _x)) |
#define | rSR REG(STM32_USART_SR_OFFSET) |
#define | rDR REG(STM32_USART_DR_OFFSET) |
#define | rBRR REG(STM32_USART_BRR_OFFSET) |
#define | rCR1 REG(STM32_USART_CR1_OFFSET) |
#define | rCR2 REG(STM32_USART_CR2_OFFSET) |
#define | rCR3 REG(STM32_USART_CR3_OFFSET) |
#define | rGTPR REG(STM32_USART_GTPR_OFFSET) |
Functions | |
static void | rx_handle_packet (void) |
static void | rx_dma_callback (DMA_HANDLE handle, uint8_t status, void *arg) |
static int | serial_interrupt (int irq, void *context, FAR void *arg) |
static void | dma_reset (void) |
void | interface_init (void) |
FMU communications. More... | |
Variables | |
static perf_counter_t | pc_txns |
static perf_counter_t | pc_errors |
static perf_counter_t | pc_ore |
static perf_counter_t | pc_fe |
static perf_counter_t | pc_ne |
static perf_counter_t | pc_idle |
static perf_counter_t | pc_badidle |
static perf_counter_t | pc_regerr |
static perf_counter_t | pc_crcerr |
static DMA_HANDLE | tx_dma |
static DMA_HANDLE | rx_dma |
static struct IOPacket | dma_packet |
#define rBRR REG(STM32_USART_BRR_OFFSET) |
Definition at line 83 of file serial.c.
Referenced by interface_init().
#define rCR1 REG(STM32_USART_CR1_OFFSET) |
Definition at line 84 of file serial.c.
Referenced by interface_init(), and serial_interrupt().
#define rCR2 REG(STM32_USART_CR2_OFFSET) |
Definition at line 85 of file serial.c.
Referenced by interface_init().
#define rCR3 REG(STM32_USART_CR3_OFFSET) |
Definition at line 86 of file serial.c.
Referenced by dma_reset(), interface_init(), and rx_dma_callback().
#define rDR REG(STM32_USART_DR_OFFSET) |
Definition at line 82 of file serial.c.
Referenced by dma_reset(), interface_init(), rx_dma_callback(), and serial_interrupt().
#define REG | ( | _x | ) | (*(volatile uint32_t *)(PX4FMU_SERIAL_BASE + _x)) |
#define rSR REG(STM32_USART_SR_OFFSET) |
Definition at line 81 of file serial.c.
Referenced by dma_reset(), interface_init(), and serial_interrupt().
|
static |
Definition at line 332 of file serial.c.
References dma_packet, rCR3, rDR, rSR, rx_dma, rx_dma_callback(), and tx_dma.
Referenced by interface_init(), rx_dma_callback(), and serial_interrupt().
void interface_init | ( | void | ) |
FMU communications.
Definition at line 90 of file serial.c.
References debug, dma_reset(), PC_COUNT, PC_ELAPSED, perf_alloc, rBRR, rCR1, rCR2, rCR3, rDR, rSR, rx_dma, serial_interrupt(), and tx_dma.
Referenced by user_start().
|
static |
Definition at line 222 of file serial.c.
References IOPacket::crc, crc_packet(), dma_packet, dma_reset(), perf_begin(), perf_end(), PKT_SIZE, rCR3, rDR, rx_handle_packet(), and tx_dma.
Referenced by dma_reset(), and serial_interrupt().
|
static |
Definition at line 156 of file serial.c.
References IOPacket::count_code, IOPacket::crc, crc_packet(), dma_packet, IOPacket::offset, IOPacket::page, perf_count(), PKT_CODE, PKT_CODE_CORRUPT, PKT_CODE_ERROR, PKT_CODE_READ, PKT_CODE_SUCCESS, PKT_CODE_WRITE, PKT_COUNT, PKT_MAX_REGS, registers_get(), registers_set(), and IOPacket::regs.
Referenced by rx_dma_callback().
|
static |
Definition at line 258 of file serial.c.
References dma_packet, dma_reset(), perf_count(), PKT_SIZE, rCR1, rDR, rSR, rx_dma, and rx_dma_callback().
Referenced by interface_init().
|
static |
Definition at line 77 of file serial.c.
Referenced by dma_reset(), rx_dma_callback(), rx_handle_packet(), and serial_interrupt().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 72 of file serial.c.
Referenced by dma_reset(), interface_init(), and serial_interrupt().
|
static |
Definition at line 71 of file serial.c.
Referenced by dma_reset(), interface_init(), and rx_dma_callback().