Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
w5100.h File Reference
#include "subsystems/datalink/datalink.h"
#include "generated/airframe.h"
#include "subsystems/datalink/transport.h"
+ Include dependency graph for w5100.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  w5100_periph
 
struct  w5100_transport
 

Macros

#define W5100_RX_BUFFER_SIZE   80
 
#define W5100_TX_BUFFER_SIZE   80
 
#define W5100_BUFFER_NUM   2
 
#define STX   0x99
 
#define W5100Init()   w5100_init()
 
#define W5100CheckFreeSpace(_x)   (TRUE)
 
#define W5100Transmit(_x)   w5100_transmit(_x)
 
#define W5100SendMessage()   w5100_send()
 
#define W5100ChAvailable()   w5100_ch_available()
 
#define W5100Getch()   w5100_getch()
 
#define W5100TxRunning   chip0.tx_running
 
#define W5100SetBaudrate(_b)   w5100_set_baudrate(_b)
 
#define W5100TransportSizeOf(_dev, _x)   (_x+4)
 
#define W5100TransportCheckFreeSpace(_dev, x)   TransportLink(_dev, CheckFreeSpace(x))
 
#define W5100TransportPut1Byte(_dev, x)   TransportLink(_dev, Transmit(x))
 
#define W5100TransportSendMessage(_dev)   TransportLink(_dev, SendMessage())
 
#define W5100TransportPutUint8(_dev, _byte)
 
#define W5100TransportPut1ByteByAddr(_dev, _byte)
 
#define W5100TransportPut2Bytes(_dev, _x)
 
#define W5100TransportPut2ByteByAddr(_dev, _byte)
 
#define W5100TransportPut4ByteByAddr(_dev, _byte)
 
#define W5100TransportPutDoubleByAddr(_dev, _byte)
 
#define W5100TransportPutInt8ByAddr(_dev, _x)   W5100TransportPut1ByteByAddr(_dev, _x)
 
#define W5100TransportPutUint8ByAddr(_dev, _x)   W5100TransportPut1ByteByAddr(_dev, (const uint8_t*)_x)
 
#define W5100TransportPutInt16ByAddr(_dev, _x)   W5100TransportPut2ByteByAddr(_dev, (const uint8_t*)_x)
 
#define W5100TransportPutUint16ByAddr(_dev, _x)   W5100TransportPut2ByteByAddr(_dev, (const uint8_t*)_x)
 
#define W5100TransportPutInt32ByAddr(_dev, _x)   W5100TransportPut4ByteByAddr(_dev, (const uint8_t*)_x)
 
#define W5100TransportPutUint32ByAddr(_dev, _x)   W5100TransportPut4ByteByAddr(_dev, (const uint8_t*)_x)
 
#define W5100TransportPutFloatByAddr(_dev, _x)   W5100TransportPut4ByteByAddr(_dev, (const uint8_t*)_x)
 
#define W5100TransportPutNamedUint8(_dev, _name, _byte)   W5100TransportPutUint8(_dev, _byte)
 
#define W5100TransportPutArray(_dev, _put, _n, _x)
 
#define W5100TransportPutInt16Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutInt16ByAddr, _n, _x)
 
#define W5100TransportPutUint16Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutUint16ByAddr, _n, _x)
 
#define W5100TransportPutUint8Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutUint8ByAddr, _n, _x)
 
#define W5100TransportPutFloatArray(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutFloatByAddr, _n, _x)
 
#define W5100TransportPutDoubleArray(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutDoubleByAddr, _n, _x)
 
#define W5100TransportHeader(_dev, payload_len)
 
#define W5100TransportTrailer(_dev)
 
#define UNINIT   0
 Receiving pprz messages. More...
 
#define GOT_STX   1
 
#define GOT_LENGTH   2
 
#define GOT_PAYLOAD   3
 
#define GOT_CRC1   4
 
#define W5100Buffer(_dev)   TransportLink(_dev,ChAvailable())
 
#define W5100CheckAndParse(_dev, _trans)
 

Enumerations

enum  W5100Status { W5100StatusUninit, W5100StatusIdle, W5100StatusReading }
 

Functions

void w5100_init (void)
 
void w5100_transmit (uint8_t data)
 
uint16_t w5100_receive (uint8_t *buf, uint16_t len)
 
void w5100_send (void)
 
uint16_t w5100_rx_size (uint8_t _s)
 
bool_t w5100_ch_available (void)
 
static void parse_w5100 (struct w5100_transport *t, uint8_t c)
 
static void w5100_parse_payload (struct w5100_transport *t)
 
static void w5100_read_buffer (struct w5100_transport *t)
 

Variables

uint8_t rx_buf [W5100_RX_BUFFER_SIZE]
 
struct w5100_periph chip0
 
struct w5100_transport w5100_tp
 

Macro Definition Documentation

#define GOT_CRC1   4

Definition at line 175 of file w5100.h.

Referenced by parse_w5100().

#define GOT_LENGTH   2

Definition at line 173 of file w5100.h.

Referenced by parse_w5100().

#define GOT_PAYLOAD   3

Definition at line 174 of file w5100.h.

Referenced by parse_w5100().

#define GOT_STX   1

Definition at line 172 of file w5100.h.

Referenced by parse_w5100().

#define STX   0x99

Definition at line 36 of file w5100.h.

Referenced by parse_w5100().

#define UNINIT   0

Receiving pprz messages.

Definition at line 171 of file w5100.h.

Referenced by parse_w5100(), and w5100_read_buffer().

#define W5100_BUFFER_NUM   2

Definition at line 35 of file w5100.h.

Referenced by w5100_send().

#define W5100_RX_BUFFER_SIZE   80

Definition at line 33 of file w5100.h.

Referenced by w5100_read_buffer().

#define W5100_TX_BUFFER_SIZE   80

Definition at line 34 of file w5100.h.

Referenced by w5100_transmit().

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

Definition at line 249 of file w5100.h.

#define W5100ChAvailable ( )    w5100_ch_available()

Definition at line 79 of file w5100.h.

#define W5100CheckAndParse (   _dev,
  _trans 
)
Value:
{ \
if (W5100Buffer(_dev)) { \
w5100_read_buffer( &(_trans) ); \
if (_trans.trans.msg_received) { \
w5100_parse_payload(&(_trans)); \
_trans.trans.msg_received = FALSE; \
} \
} \
}
static void w5100_read_buffer(struct w5100_transport *t)
Definition: w5100.h:239
#define W5100Buffer(_dev)
Definition: w5100.h:249
if(PrimarySpektrumState.SpektrumTimer)--PrimarySpektrumState.SpektrumTimer
static void w5100_parse_payload(struct w5100_transport *t)
Definition: w5100.h:232
#define FALSE
Definition: imu_chimu.h:141

Definition at line 251 of file w5100.h.

#define W5100CheckFreeSpace (   _x)    (TRUE)

Definition at line 76 of file w5100.h.

#define W5100Getch ( )    w5100_getch()

Definition at line 80 of file w5100.h.

#define W5100Init ( )    w5100_init()

Definition at line 75 of file w5100.h.

#define W5100SendMessage ( )    w5100_send()

Definition at line 78 of file w5100.h.

#define W5100SetBaudrate (   _b)    w5100_set_baudrate(_b)

Definition at line 82 of file w5100.h.

#define W5100Transmit (   _x)    w5100_transmit(_x)

Definition at line 77 of file w5100.h.

#define W5100TransportCheckFreeSpace (   _dev,
 
)    TransportLink(_dev, CheckFreeSpace(x))

Definition at line 85 of file w5100.h.

#define W5100TransportHeader (   _dev,
  payload_len 
)
Value:
{ \
uint8_t msg_len = W5100TransportSizeOf(_dev, payload_len); \
W5100TransportPut1Byte(_dev, msg_len); \
ck_a = msg_len; ck_b = msg_len; \
}
#define W5100TransportPut1Byte(_dev, x)
Definition: w5100.h:86
#define W5100TransportSizeOf(_dev, _x)
Definition: w5100.h:84
uint8_t ck_a
unsigned char uint8_t
Definition: types.h:14
uint8_t ck_b
#define STX
Definition: w5100.h:36

Definition at line 154 of file w5100.h.

#define W5100TransportPut1Byte (   _dev,
 
)    TransportLink(_dev, Transmit(x))

Definition at line 86 of file w5100.h.

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

Definition at line 95 of file w5100.h.

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

Definition at line 106 of file w5100.h.

#define W5100TransportPut2Bytes (   _dev,
  _x 
)
Value:
{ \
uint16_t x16 = _x; \
W5100TransportPut1Byte(_dev, x16>>8); \
W5100TransportPut1Byte(_dev, x16 & 0xff); \
}
unsigned short uint16_t
Definition: types.h:16
#define W5100TransportPut1Byte(_dev, x)
Definition: w5100.h:86

Definition at line 100 of file w5100.h.

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

Definition at line 111 of file w5100.h.

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

Definition at line 138 of file w5100.h.

#define W5100TransportPutDoubleArray (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutDoubleByAddr, _n, _x)

Definition at line 151 of file w5100.h.

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

Definition at line 122 of file w5100.h.

#define W5100TransportPutFloatArray (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutFloatByAddr, _n, _x)

Definition at line 150 of file w5100.h.

#define W5100TransportPutFloatByAddr (   _dev,
  _x 
)    W5100TransportPut4ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 135 of file w5100.h.

#define W5100TransportPutInt16Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutInt16ByAddr, _n, _x)

Definition at line 146 of file w5100.h.

#define W5100TransportPutInt16ByAddr (   _dev,
  _x 
)    W5100TransportPut2ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 131 of file w5100.h.

#define W5100TransportPutInt32ByAddr (   _dev,
  _x 
)    W5100TransportPut4ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 133 of file w5100.h.

#define W5100TransportPutInt8ByAddr (   _dev,
  _x 
)    W5100TransportPut1ByteByAddr(_dev, _x)

Definition at line 129 of file w5100.h.

#define W5100TransportPutNamedUint8 (   _dev,
  _name,
  _byte 
)    W5100TransportPutUint8(_dev, _byte)

Definition at line 136 of file w5100.h.

#define W5100TransportPutUint16Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutUint16ByAddr, _n, _x)

Definition at line 148 of file w5100.h.

#define W5100TransportPutUint16ByAddr (   _dev,
  _x 
)    W5100TransportPut2ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 132 of file w5100.h.

#define W5100TransportPutUint32ByAddr (   _dev,
  _x 
)    W5100TransportPut4ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 134 of file w5100.h.

#define W5100TransportPutUint8 (   _dev,
  _byte 
)
Value:
{ \
ck_a += _byte; \
W5100TransportPut1Byte(_dev, _byte); \
}
#define W5100TransportPut1Byte(_dev, x)
Definition: w5100.h:86
uint8_t ck_a
uint8_t ck_b

Definition at line 89 of file w5100.h.

#define W5100TransportPutUint8Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutUint8ByAddr, _n, _x)

Definition at line 149 of file w5100.h.

#define W5100TransportPutUint8ByAddr (   _dev,
  _x 
)    W5100TransportPut1ByteByAddr(_dev, (const uint8_t*)_x)

Definition at line 130 of file w5100.h.

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

Definition at line 87 of file w5100.h.

#define W5100TransportSizeOf (   _dev,
  _x 
)    (_x+4)

Definition at line 84 of file w5100.h.

#define W5100TransportTrailer (   _dev)
Value:
{ \
}
#define W5100TransportPut1Byte(_dev, x)
Definition: w5100.h:86
#define W5100TransportSendMessage(_dev)
Definition: w5100.h:87
uint8_t ck_a
uint8_t ck_b

Definition at line 161 of file w5100.h.

#define W5100TxRunning   chip0.tx_running

Definition at line 81 of file w5100.h.

Enumeration Type Documentation

Enumerator
W5100StatusUninit 
W5100StatusIdle 
W5100StatusReading 

Definition at line 38 of file w5100.h.

Function Documentation

bool_t w5100_ch_available ( void  )

Definition at line 324 of file w5100.c.

References CMD_SOCKET, FALSE, TRUE, and w5100_rx_size().

Referenced by w5100_read_buffer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void w5100_parse_payload ( struct w5100_transport t)
inlinestatic
static void w5100_read_buffer ( struct w5100_transport t)
inlinestatic

Definition at line 239 of file w5100.h.

References c, transport::msg_received, parse_w5100(), rx_buf, w5100_transport::status, w5100_transport::trans, UNINIT, w5100_ch_available(), w5100_receive(), and W5100_RX_BUFFER_SIZE.

+ Here is the call graph for this function:

uint16_t w5100_receive ( uint8_t buf,
uint16_t  len 
)

Definition at line 331 of file w5100.c.

References CMD_SOCKET, SOCK_CR, SOCK_RECV, SOCK_RXRD, w5100_read_data(), w5100_sock_get16(), and w5100_sock_set().

Referenced by w5100_read_buffer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16_t w5100_rx_size ( uint8_t  _s)

Definition at line 280 of file w5100.c.

References SOCK_RSR, val, and w5100_sock_get16().

Referenced by w5100_ch_available().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

struct w5100_periph chip0

Definition at line 75 of file w5100.c.

Referenced by w5100_init(), w5100_send(), and w5100_transmit().

Definition at line 77 of file w5100.c.

Referenced by w5100_read_buffer().

struct w5100_transport w5100_tp

Definition at line 95 of file w5100.c.