Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
lisa_spistream.h File Reference
#include <string.h>
+ Include dependency graph for lisa_spistream.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  spistream_state_t
 
struct  spistream_message_range_t
 
struct  spistream_buffers_t
 
struct  spistream_config_t
 

Macros

#define SPISTREAM_MAX_MESSAGE_LENGTH   720
 
#define SPISTREAM_MAX_RX_MESSAGE_LENGTH   SPISTREAM_MAX_MESSAGE_LENGTH
 
#define SPISTREAM_RX_BUFFER_SIZE   SPISTREAM_MAX_RX_MESSAGE_LENGTH
 
#define SPISTREAM_MAX_TX_MESSAGE_LENGTH   SPISTREAM_MAX_MESSAGE_LENGTH
 
#define SPISTREAM_MAX_TX_PARALLEL_TRANSACTIONS   4
 
#define SPISTREAM_TX_MAX_BUFFER_PACKAGES
 
#define SPISTREAM_INVALID_MESSAGE_ID   0
 

Typedefs

typedef void(* spistream_message_rx_handler_t )(uint8_t msg_id, uint8_t *data, uint16_t num_bytes)
 
typedef void(* spistream_message_tx_handler_t )(uint8_t msg_id)
 

Enumerations

enum  spistream_flag { SPISTREAM_NO_WAIT =0, SPISTREAM_WAIT_FOR_READ }
 

Functions

static void spistream_init (spistream_message_rx_handler_t message_rx_handler, spistream_message_tx_handler_t message_tx_handler)
 
static void spistream_read_pkg (struct AutopilotMessagePTStream *pkg_in)
 Read a single package into internal RX buffer. More...
 
static void spistream_write_pkg (struct AutopilotMessagePTStream *pkg_out)
 Fill given SPI package with next package from TX buffer. More...
 
static uint8_t spistream_send_msg (uint8_t *data, uint16_t num_bytes, enum spistream_flag wait_for_read)
 Used from userland: Send num_bytes bytes from buffer over spistream. More...
 
static uint8_t spistream_enqueue_msg (uint8_t *data, uint16_t num_bytes, enum spistream_flag wait_for_read)
 Enqueue given message in TX buffer. More...
 
static void spistream_dequeue_msg (uint8_t message_id)
 

Variables

static struct spistream_state_t spistream_state
 
static struct spistream_buffers_t spistream_buffers
 
static struct spistream_config_t spistream
 

Macro Definition Documentation

#define SPISTREAM_INVALID_MESSAGE_ID   0

Definition at line 30 of file lisa_spistream.h.

Referenced by spistream_enqueue_msg(), spistream_read_pkg(), and spistream_write_pkg().

#define SPISTREAM_MAX_MESSAGE_LENGTH   720

Definition at line 7 of file lisa_spistream.h.

Referenced by __attribute__(), and uart_transfer_event().

#define SPISTREAM_MAX_RX_MESSAGE_LENGTH   SPISTREAM_MAX_MESSAGE_LENGTH

Definition at line 11 of file lisa_spistream.h.

#define SPISTREAM_MAX_TX_MESSAGE_LENGTH   SPISTREAM_MAX_MESSAGE_LENGTH

Definition at line 18 of file lisa_spistream.h.

#define SPISTREAM_MAX_TX_PARALLEL_TRANSACTIONS   4

Definition at line 21 of file lisa_spistream.h.

#define SPISTREAM_RX_BUFFER_SIZE   SPISTREAM_MAX_RX_MESSAGE_LENGTH

Definition at line 14 of file lisa_spistream.h.

#define SPISTREAM_TX_MAX_BUFFER_PACKAGES
Value:
( \
SPISTREAM_PACKAGE_SIZE) * \
#define SPISTREAM_MAX_TX_MESSAGE_LENGTH
#define SPISTREAM_MAX_TX_PARALLEL_TRANSACTIONS

Definition at line 24 of file lisa_spistream.h.

Referenced by spistream_enqueue_msg(), and spistream_write_pkg().

Typedef Documentation

typedef void(* spistream_message_rx_handler_t)(uint8_t msg_id, uint8_t *data, uint16_t num_bytes)

Definition at line 55 of file lisa_spistream.h.

typedef void(* spistream_message_tx_handler_t)(uint8_t msg_id)

Definition at line 56 of file lisa_spistream.h.

Enumeration Type Documentation

Enumerator
SPISTREAM_NO_WAIT 
SPISTREAM_WAIT_FOR_READ 

Definition at line 64 of file lisa_spistream.h.

Function Documentation

static void spistream_dequeue_msg ( uint8_t  message_id)
inlinestatic

Definition at line 252 of file lisa_spistream.h.

static uint8_t spistream_enqueue_msg ( uint8_t data,
uint16_t  num_bytes,
enum spistream_flag  wait_for_read 
)
inlinestatic

Enqueue given message in TX buffer.

This function is directly wrapped by spistream_send_message at the moment.

Definition at line 171 of file lisa_spistream.h.

References spistream_buffers, SPISTREAM_INVALID_MESSAGE_ID, SPISTREAM_NO_WAIT, spistream_state, SPISTREAM_TX_MAX_BUFFER_PACKAGES, spistream_buffers_t::tx, spistream_buffers_t::tx_insert, spistream_state_t::tx_message_cnt, and spistream_buffers_t::tx_num_packages.

Referenced by spistream_send_msg().

+ Here is the caller graph for this function:

static void spistream_init ( spistream_message_rx_handler_t  message_rx_handler,
spistream_message_tx_handler_t  message_tx_handler 
)
inlinestatic
static void spistream_read_pkg ( struct AutopilotMessagePTStream *  pkg_in)
inlinestatic

Read a single package into internal RX buffer.

Converts data from package domain to byte array. After receiving a full message, the registered spistream.message_rx_handler function is called. Called on every SPI event.

Definition at line 99 of file lisa_spistream.h.

References spistream_config_t::message_rx_handler, spistream_buffers_t::rx, spistream_buffers_t::rx_num_packages, spistream_state_t::rx_package_cntd, spistream, spistream_buffers, SPISTREAM_INVALID_MESSAGE_ID, and spistream_state.

Referenced by on_overo_link_msg_received().

+ Here is the caller graph for this function:

static uint8_t spistream_send_msg ( uint8_t data,
uint16_t  num_bytes,
enum spistream_flag  wait_for_read 
)
inlinestatic

Used from userland: Send num_bytes bytes from buffer over spistream.

Flags are:

  • SPISTREAM_WAIT_FOR_READ: Reject packages when TX buffer is full and return 0, otherwise enqueue message and return 1.
  • SPISTREAM_NO_WAIT: Overwrite data if TX buffer is full, enqueue message and always return 1.

Definition at line 263 of file lisa_spistream.h.

References spistream_enqueue_msg().

Referenced by on_spistream_msg_received(), and uart_transfer_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void spistream_write_pkg ( struct AutopilotMessagePTStream *  pkg_out)
inlinestatic

Fill given SPI package with next package from TX buffer.

Called on every SPI event.

Definition at line 143 of file lisa_spistream.h.

References spistream_config_t::message_tx_handler, spistream, spistream_buffers, SPISTREAM_INVALID_MESSAGE_ID, SPISTREAM_TX_MAX_BUFFER_PACKAGES, spistream_buffers_t::tx, spistream_buffers_t::tx_num_packages, and spistream_buffers_t::tx_read.

Referenced by on_overo_link_msg_received().

+ Here is the caller graph for this function:

Variable Documentation

struct spistream_config_t spistream
static

Definition at line 78 of file lisa_spistream.h.

Referenced by spistream_init(), spistream_read_pkg(), and spistream_write_pkg().

struct spistream_buffers_t spistream_buffers
static
struct spistream_state_t spistream_state
static

Definition at line 76 of file lisa_spistream.h.

Referenced by spistream_enqueue_msg(), spistream_init(), and spistream_read_pkg().