Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pprz_transport.h File Reference

Extra datalink using PPRZ protocol. More...

#include <inttypes.h>
#include "std.h"
#include "subsystems/datalink/datalink.h"
#include "subsystems/datalink/transport.h"
+ Include dependency graph for pprz_transport.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pprz_transport
 

Macros

#define STX   0x99
 
#define PprzTransportSizeOf(_dev, _payload)   (_payload+4)
 4 = STX + len + ck_a + ck_b More...
 
#define PprzTransportCheckFreeSpace(_dev, _x)   TransportLink(_dev, CheckFreeSpace(_x))
 
#define PprzTransportPut1Byte(_dev, _x)   TransportLink(_dev, Transmit(_x))
 
#define PprzTransportSendMessage(_dev)   TransportLink(_dev, SendMessage())
 
#define PprzTransportHeader(_dev, payload_len)
 
#define PprzTransportTrailer(_dev)
 
#define PprzTransportPutUint8(_dev, _byte)
 
#define PprzTransportPutNamedUint8(_dev, _name, _byte)   PprzTransportPutUint8(_dev, _byte)
 
#define PprzTransportPut1ByteByAddr(_dev, _byte)
 
#define PprzTransportPut2ByteByAddr(_dev, _byte)
 
#define PprzTransportPut4ByteByAddr(_dev, _byte)
 
#define PprzTransportPutDoubleByAddr(_dev, _byte)
 
#define PprzTransportPutInt8ByAddr(_dev, _x)   PprzTransportPut1ByteByAddr(_dev, _x)
 
#define PprzTransportPutUint8ByAddr(_dev, _x)   PprzTransportPut1ByteByAddr(_dev, (const uint8_t*)_x)
 
#define PprzTransportPutInt16ByAddr(_dev, _x)   PprzTransportPut2ByteByAddr(_dev, (const uint8_t*)_x)
 
#define PprzTransportPutUint16ByAddr(_dev, _x)   PprzTransportPut2ByteByAddr(_dev, (const uint8_t*)_x)
 
#define PprzTransportPutInt32ByAddr(_dev, _x)   PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_x)
 
#define PprzTransportPutUint32ByAddr(_dev, _x)   PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_x)
 
#define PprzTransportPutFloatByAddr(_dev, _x)   PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_x)
 
#define PprzTransportPutArray(_dev, _put, _n, _x)
 
#define PprzTransportPutFloatArray(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutFloatByAddr, _n, _x)
 
#define PprzTransportPutDoubleArray(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutDoubleByAddr, _n, _x)
 
#define PprzTransportPutInt16Array(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutInt16ByAddr, _n, _x)
 
#define PprzTransportPutUint16Array(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutUint16ByAddr, _n, _x)
 
#define PprzTransportPutInt32Array(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutInt32ByAddr, _n, _x)
 
#define PprzTransportPutUint32Array(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutUint32ByAddr, _n, _x)
 
#define PprzTransportPutUint8Array(_dev, _n, _x)   PprzTransportPutArray(_dev, PprzTransportPutUint8ByAddr, _n, _x)
 
#define UNINIT   0
 Receiving pprz messages. More...
 
#define GOT_STX   1
 
#define GOT_LENGTH   2
 
#define GOT_PAYLOAD   3
 
#define GOT_CRC1   4
 
#define PprzBuffer(_dev)   TransportLink(_dev,ChAvailable())
 
#define ReadPprzBuffer(_dev, _trans)   { while (TransportLink(_dev,ChAvailable())&&!(_trans.trans.msg_received)) parse_pprz(&(_trans),TransportLink(_dev,Getch())); }
 
#define PprzCheckAndParse(_dev, _trans)
 

Functions

static void parse_pprz (struct pprz_transport *t, uint8_t c)
 
static void pprz_parse_payload (struct pprz_transport *t)
 

Variables

uint8_t ck_a
 
uint8_t ck_b
 
struct pprz_transport pprz_tp
 

Detailed Description

Extra datalink using PPRZ protocol.

Building and parsing Paparazzi frames.

Pprz frame:

|STX|length|... payload=(length-4) bytes ...|Checksum A|Checksum B|

where checksum is computed over length and payload: ck_A = ck_B = length for each byte b in payload ck_A += b; ck_b += ck_A

Definition in file pprz_transport.h.

Macro Definition Documentation

#define GOT_CRC1   4

Definition at line 144 of file pprz_transport.h.

Referenced by parse_pprz().

#define GOT_LENGTH   2

Definition at line 142 of file pprz_transport.h.

Referenced by parse_pprz().

#define GOT_PAYLOAD   3

Definition at line 143 of file pprz_transport.h.

Referenced by parse_pprz().

#define GOT_STX   1

Definition at line 141 of file pprz_transport.h.

Referenced by parse_pprz().

#define PprzBuffer (   _dev)    TransportLink(_dev,ChAvailable())

Definition at line 209 of file pprz_transport.h.

Referenced by main_event_task().

#define PprzCheckAndParse (   _dev,
  _trans 
)
Value:
{ \
if (PprzBuffer(_dev)) { \
ReadPprzBuffer(_dev,_trans); \
if (_trans.trans.msg_received) { \
pprz_parse_payload(&(_trans)); \
_trans.trans.msg_received = FALSE; \
} \
} \
}
#define ReadPprzBuffer(_dev, _trans)
#define FALSE
Definition: imu_chimu.h:141
#define PprzBuffer(_dev)
static void pprz_parse_payload(struct pprz_transport *t)

Definition at line 211 of file pprz_transport.h.

#define PprzTransportCheckFreeSpace (   _dev,
  _x 
)    TransportLink(_dev, CheckFreeSpace(_x))

Definition at line 56 of file pprz_transport.h.

#define PprzTransportHeader (   _dev,
  payload_len 
)
Value:
{ \
uint8_t msg_len = PprzTransportSizeOf(_dev, payload_len); \
PprzTransportPut1Byte(_dev, msg_len); \
ck_a = msg_len; ck_b = msg_len; \
}
#define PprzTransportSizeOf(_dev, _payload)
4 = STX + len + ck_a + ck_b
#define PprzTransportPut1Byte(_dev, _x)
uint8_t ck_a
unsigned char uint8_t
Definition: types.h:14
#define STX
uint8_t ck_b

Definition at line 60 of file pprz_transport.h.

#define PprzTransportPut1Byte (   _dev,
  _x 
)    TransportLink(_dev, Transmit(_x))

Definition at line 57 of file pprz_transport.h.

#define PprzTransportPut1ByteByAddr (   _dev,
  _byte 
)
Value:
{ \
uint8_t _x = *(_byte); \
}
#define PprzTransportPutUint8(_dev, _byte)
unsigned char uint8_t
Definition: types.h:14

Definition at line 81 of file pprz_transport.h.

#define PprzTransportPut2ByteByAddr (   _dev,
  _byte 
)
Value:
{ \
PprzTransportPut1ByteByAddr(_dev, (const uint8_t*)_byte+1); \
}
#define PprzTransportPut1ByteByAddr(_dev, _byte)
unsigned char uint8_t
Definition: types.h:14

Definition at line 86 of file pprz_transport.h.

#define PprzTransportPut4ByteByAddr (   _dev,
  _byte 
)
Value:
{ \
PprzTransportPut2ByteByAddr(_dev, (const uint8_t*)_byte+2); \
}
#define PprzTransportPut2ByteByAddr(_dev, _byte)
unsigned char uint8_t
Definition: types.h:14

Definition at line 91 of file pprz_transport.h.

#define PprzTransportPutArray (   _dev,
  _put,
  _n,
  _x 
)
Value:
{ \
for(_i = 0; _i < _n; _i++) { \
_put(_dev, &_x[_i]); \
} \
}
#define PprzTransportPutUint8(_dev, _byte)
unsigned char uint8_t
Definition: types.h:14

Definition at line 117 of file pprz_transport.h.

#define PprzTransportPutDoubleArray (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutDoubleByAddr, _n, _x)

Definition at line 126 of file pprz_transport.h.

#define PprzTransportPutDoubleByAddr (   _dev,
  _byte 
)
Value:
{ \
PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_byte); \
PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_byte+4); \
}
#define PprzTransportPut4ByteByAddr(_dev, _byte)
unsigned char uint8_t
Definition: types.h:14

Definition at line 102 of file pprz_transport.h.

#define PprzTransportPutFloatArray (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutFloatByAddr, _n, _x)

Definition at line 125 of file pprz_transport.h.

#define PprzTransportPutFloatByAddr (   _dev,
  _x 
)    PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 115 of file pprz_transport.h.

#define PprzTransportPutInt16Array (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutInt16ByAddr, _n, _x)

Definition at line 128 of file pprz_transport.h.

#define PprzTransportPutInt16ByAddr (   _dev,
  _x 
)    PprzTransportPut2ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 111 of file pprz_transport.h.

#define PprzTransportPutInt32Array (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutInt32ByAddr, _n, _x)

Definition at line 131 of file pprz_transport.h.

#define PprzTransportPutInt32ByAddr (   _dev,
  _x 
)    PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 113 of file pprz_transport.h.

#define PprzTransportPutInt8ByAddr (   _dev,
  _x 
)    PprzTransportPut1ByteByAddr(_dev, _x)

Definition at line 109 of file pprz_transport.h.

#define PprzTransportPutNamedUint8 (   _dev,
  _name,
  _byte 
)    PprzTransportPutUint8(_dev, _byte)

Definition at line 79 of file pprz_transport.h.

#define PprzTransportPutUint16Array (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutUint16ByAddr, _n, _x)

Definition at line 129 of file pprz_transport.h.

#define PprzTransportPutUint16ByAddr (   _dev,
  _x 
)    PprzTransportPut2ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 112 of file pprz_transport.h.

#define PprzTransportPutUint32Array (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutUint32ByAddr, _n, _x)

Definition at line 132 of file pprz_transport.h.

#define PprzTransportPutUint32ByAddr (   _dev,
  _x 
)    PprzTransportPut4ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 114 of file pprz_transport.h.

#define PprzTransportPutUint8 (   _dev,
  _byte 
)
Value:
{ \
ck_a += _byte; \
PprzTransportPut1Byte(_dev, _byte); \
}
#define PprzTransportPut1Byte(_dev, _x)
uint8_t ck_a
uint8_t ck_b

Definition at line 73 of file pprz_transport.h.

#define PprzTransportPutUint8Array (   _dev,
  _n,
  _x 
)    PprzTransportPutArray(_dev, PprzTransportPutUint8ByAddr, _n, _x)

Definition at line 134 of file pprz_transport.h.

#define PprzTransportPutUint8ByAddr (   _dev,
  _x 
)    PprzTransportPut1ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 110 of file pprz_transport.h.

#define PprzTransportSendMessage (   _dev)    TransportLink(_dev, SendMessage())

Definition at line 58 of file pprz_transport.h.

#define PprzTransportSizeOf (   _dev,
  _payload 
)    (_payload+4)

4 = STX + len + ck_a + ck_b

Definition at line 54 of file pprz_transport.h.

#define PprzTransportTrailer (   _dev)
Value:
{ \
}
#define PprzTransportPut1Byte(_dev, _x)
uint8_t ck_a
uint8_t ck_b
#define PprzTransportSendMessage(_dev)

Definition at line 67 of file pprz_transport.h.

#define ReadPprzBuffer (   _dev,
  _trans 
)    { while (TransportLink(_dev,ChAvailable())&&!(_trans.trans.msg_received)) parse_pprz(&(_trans),TransportLink(_dev,Getch())); }

Definition at line 210 of file pprz_transport.h.

Referenced by main_event_task().

#define STX   0x99

Definition at line 51 of file pprz_transport.h.

Referenced by parse_pprz().

#define UNINIT   0

Receiving pprz messages.

Definition at line 140 of file pprz_transport.h.

Referenced by parse_pprz().

Function Documentation

static void pprz_parse_payload ( struct pprz_transport t)
inlinestatic

Definition at line 201 of file pprz_transport.h.

References dl_msg_available, transport::payload, transport::payload_len, pprz_transport::trans, and TRUE.

Referenced by main_event_task().

+ Here is the caller graph for this function:

Variable Documentation

uint8_t ck_a

Definition at line 9 of file audio_telemetry_hw.c.

uint8_t ck_b

Definition at line 9 of file audio_telemetry_hw.c.

struct pprz_transport pprz_tp

Definition at line 31 of file pprz_transport.c.