Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
transport.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2014 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
26 #ifndef TRANSPORT_H
27 #define TRANSPORT_H
28 
29 #include <inttypes.h>
30 #include "mcu_periph/link_device.h"
31 #include "std.h"
32 
33 #ifndef TRANSPORT_PAYLOAD_LEN
34 #define TRANSPORT_PAYLOAD_LEN 256
35 #endif
36 
39 struct transport_rx {
41  volatile uint8_t payload_len;
42  volatile bool_t msg_received;
44 };
45 
62 };
63 
69 };
70 
76 typedef uint8_t (*size_of_t)(void *, uint8_t);
77 typedef int (*check_available_space_t)(void *, struct link_device *, uint8_t);
78 typedef void (*put_bytes_t)(void *, struct link_device *, enum TransportDataType, enum TransportDataFormat, uint8_t,
79  const void *);
80 typedef void (*put_named_byte_t)(void *, struct link_device *, enum TransportDataType, enum TransportDataFormat,
81  uint8_t, const char *);
82 typedef void (*start_message_t)(void *, struct link_device *, uint8_t);
83 typedef void (*end_message_t)(void *, struct link_device *);
84 typedef void (*overrun_t)(void *, struct link_device *);
85 typedef void (*count_bytes_t)(void *, struct link_device *, uint8_t);
86 
89 struct transport_tx {
98  void *impl;
99 };
100 
101 #endif /* TRANSPORT_H */
102 
volatile bool_t msg_received
message received flag
Definition: transport.h:42
TransportDataFormat
Data format (scalar or array)
Definition: transport.h:66
end_message_t end_message
transport trailer
Definition: transport.h:95
Generic reception transport header.
Definition: transport.h:39
Generic transmission transport header.
Definition: transport.h:89
uint8_t payload[TRANSPORT_PAYLOAD_LEN]
payload buffer
Definition: transport.h:40
uint8_t(* size_of_t)(void *, uint8_t)
Function pointers definition.
Definition: transport.h:76
void(* end_message_t)(void *, struct link_device *)
Definition: transport.h:83
size_of_t size_of
get size of payload with transport header and trailer
Definition: transport.h:90
volatile uint8_t payload_len
payload buffer length
Definition: transport.h:41
overrun_t overrun
overrun
Definition: transport.h:96
void(* overrun_t)(void *, struct link_device *)
Definition: transport.h:84
TransportDataType
Data type.
Definition: transport.h:48
count_bytes_t count_bytes
count bytes to send
Definition: transport.h:97
void(* start_message_t)(void *, struct link_device *, uint8_t)
Definition: transport.h:82
void(* put_named_byte_t)(void *, struct link_device *, enum TransportDataType, enum TransportDataFormat, uint8_t, const char *)
Definition: transport.h:80
start_message_t start_message
transport header
Definition: transport.h:94
put_named_byte_t put_named_byte
send a single byte or its name
Definition: transport.h:93
int(* check_available_space_t)(void *, struct link_device *, uint8_t)
Definition: transport.h:77
void(* put_bytes_t)(void *, struct link_device *, enum TransportDataType, enum TransportDataFormat, uint8_t, const void *)
Definition: transport.h:78
unsigned char uint8_t
Definition: types.h:14
void * impl
pointer to parent implementation
Definition: transport.h:98
check_available_space_t check_available_space
check if transmit buffer is not full
Definition: transport.h:91
put_bytes_t put_bytes
send bytes
Definition: transport.h:92
void(* count_bytes_t)(void *, struct link_device *, uint8_t)
Definition: transport.h:85
uint8_t error
overrun and error flags
Definition: transport.h:43
uint8_t ovrn
Definition: transport.h:43
#define TRANSPORT_PAYLOAD_LEN
Definition: transport.h:34