Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
w5100.h File Reference

W5100 ethernet chip I/O. More...

#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 W5100TransportPutUint64ByAddr(_dev, _byte)
 
#define W5100TransportPutInt64ByAddr(_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 W5100TransportPutInt8Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutInt8ByAddr, _n, _x)
 
#define W5100TransportPutUint8Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutUint8ByAddr, _n, _x)
 
#define W5100TransportPutCharArray(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutCharByAddr, _n, _x)
 
#define W5100TransportPutInt16Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutInt16ByAddr, _n, _x)
 
#define W5100TransportPutUint16Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutUint16ByAddr, _n, _x)
 
#define W5100TransportPutInt32Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutInt32ByAddr, _n, _x)
 
#define W5100TransportPutUint32Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutUint32ByAddr, _n, _x)
 
#define W5100TransportPutFloatArray(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutFloatByAddr, _n, _x)
 
#define W5100TransportPutInt64Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutInt64ByAddr, _n, _x)
 
#define W5100TransportPutUint64Array(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutUint64ByAddr, _n, _x)
 
#define W5100TransportPutDoubleArray(_dev, _n, _x)   W5100TransportPutArray(_dev, W5100TransportPutDoubleByAddr, _n, _x)
 
#define W5100TransportPutFixedArray(_dev, _put, _n, _x)
 
#define W5100TransportPutInt8FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutInt8ByAddr, _n, _x)
 
#define W5100TransportPutUint8FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutUint8ByAddr, _n, _x)
 
#define W5100TransportPutCharFixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutCharByAddr, _n, _x)
 
#define W5100TransportPutInt16FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutInt16ByAddr, _n, _x)
 
#define W5100TransportPutUint16FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutUint16ByAddr, _n, _x)
 
#define W5100TransportPutInt32FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutInt32ByAddr, _n, _x)
 
#define W5100TransportPutUint32FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutUint32ByAddr, _n, _x)
 
#define W5100TransportPutFloatFixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutFloatByAddr, _n, _x)
 
#define W5100TransportPutInt64FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutInt64ByAddr, _n, _x)
 
#define W5100TransportPutUint64FixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_dev, W5100TransportPutUint64ByAddr, _n, _x)
 
#define W5100TransportPutDoubleFixedArray(_dev, _n, _x)   W5100TransportPutFixedArray(_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 w5100_rx_buf [W5100_RX_BUFFER_SIZE]
 
struct w5100_periph chip0
 
struct w5100_transport w5100_tp
 

Detailed Description

W5100 ethernet chip I/O.

Definition in file w5100.h.

Macro Definition Documentation

#define GOT_CRC1   4

Definition at line 231 of file w5100.h.

Referenced by parse_w5100().

#define GOT_LENGTH   2

Definition at line 229 of file w5100.h.

Referenced by parse_w5100().

#define GOT_PAYLOAD   3

Definition at line 230 of file w5100.h.

Referenced by parse_w5100().

#define GOT_STX   1

Definition at line 228 of file w5100.h.

Referenced by parse_w5100().

#define STX   0x99

Definition at line 39 of file w5100.h.

Referenced by parse_w5100().

#define UNINIT   0

Receiving pprz messages.

Definition at line 227 of file w5100.h.

Referenced by parse_w5100(), and w5100_read_buffer().

#define W5100_BUFFER_NUM   2

Definition at line 38 of file w5100.h.

Referenced by w5100_send().

#define W5100_RX_BUFFER_SIZE   80

Definition at line 36 of file w5100.h.

Referenced by w5100_read_buffer().

#define W5100_TX_BUFFER_SIZE   80

Definition at line 37 of file w5100.h.

Referenced by w5100_transmit().

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

Definition at line 305 of file w5100.h.

#define W5100ChAvailable ( )    w5100_ch_available()

Definition at line 82 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:295
#define W5100Buffer(_dev)
Definition: w5100.h:305
if(PrimarySpektrumState.SpektrumTimer)--PrimarySpektrumState.SpektrumTimer
static void w5100_parse_payload(struct w5100_transport *t)
Definition: w5100.h:288
#define FALSE
Definition: imu_chimu.h:141

Definition at line 307 of file w5100.h.

#define W5100CheckFreeSpace (   _x)    (TRUE)

Definition at line 79 of file w5100.h.

#define W5100Getch ( )    w5100_getch()

Definition at line 83 of file w5100.h.

#define W5100Init ( )    w5100_init()

Definition at line 78 of file w5100.h.

#define W5100SendMessage ( )    w5100_send()

Definition at line 81 of file w5100.h.

#define W5100SetBaudrate (   _b)    w5100_set_baudrate(_b)

Definition at line 85 of file w5100.h.

#define W5100Transmit (   _x)    w5100_transmit(_x)

Definition at line 80 of file w5100.h.

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

Definition at line 88 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:89
#define W5100TransportSizeOf(_dev, _x)
Definition: w5100.h:87
uint8_t ck_a
unsigned char uint8_t
Definition: types.h:14
uint8_t ck_b
#define STX
Definition: w5100.h:39

Definition at line 210 of file w5100.h.

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

Definition at line 89 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:92

Definition at line 98 of file w5100.h.

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

Definition at line 109 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:89

Definition at line 103 of file w5100.h.

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

Definition at line 114 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:92

Definition at line 157 of file w5100.h.

#define W5100TransportPutCharArray (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutCharByAddr, _n, _x)

Definition at line 168 of file w5100.h.

#define W5100TransportPutCharFixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutCharByAddr, _n, _x)

Definition at line 194 of file w5100.h.

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

Definition at line 181 of file w5100.h.

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

Definition at line 133 of file w5100.h.

#define W5100TransportPutDoubleFixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutDoubleByAddr, _n, _x)

Definition at line 207 of file w5100.h.

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

Definition at line 184 of file w5100.h.

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

Definition at line 176 of file w5100.h.

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

Definition at line 154 of file w5100.h.

#define W5100TransportPutFloatFixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutFloatByAddr, _n, _x)

Definition at line 202 of file w5100.h.

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

Definition at line 170 of file w5100.h.

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

Definition at line 150 of file w5100.h.

#define W5100TransportPutInt16FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutInt16ByAddr, _n, _x)

Definition at line 196 of file w5100.h.

#define W5100TransportPutInt32Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutInt32ByAddr, _n, _x)

Definition at line 173 of file w5100.h.

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

Definition at line 152 of file w5100.h.

#define W5100TransportPutInt32FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutInt32ByAddr, _n, _x)

Definition at line 199 of file w5100.h.

#define W5100TransportPutInt64Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutInt64ByAddr, _n, _x)

Definition at line 178 of file w5100.h.

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

Definition at line 141 of file w5100.h.

#define W5100TransportPutInt64FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutInt64ByAddr, _n, _x)

Definition at line 204 of file w5100.h.

#define W5100TransportPutInt8Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutInt8ByAddr, _n, _x)

Definition at line 165 of file w5100.h.

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

Definition at line 148 of file w5100.h.

#define W5100TransportPutInt8FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutInt8ByAddr, _n, _x)

Definition at line 191 of file w5100.h.

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

Definition at line 155 of file w5100.h.

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

Definition at line 171 of file w5100.h.

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

Definition at line 151 of file w5100.h.

#define W5100TransportPutUint16FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutUint16ByAddr, _n, _x)

Definition at line 197 of file w5100.h.

#define W5100TransportPutUint32Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutUint32ByAddr, _n, _x)

Definition at line 174 of file w5100.h.

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

Definition at line 153 of file w5100.h.

#define W5100TransportPutUint32FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutUint32ByAddr, _n, _x)

Definition at line 200 of file w5100.h.

#define W5100TransportPutUint64Array (   _dev,
  _n,
  _x 
)    W5100TransportPutArray(_dev, W5100TransportPutUint64ByAddr, _n, _x)

Definition at line 179 of file w5100.h.

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

Definition at line 137 of file w5100.h.

#define W5100TransportPutUint64FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutUint64ByAddr, _n, _x)

Definition at line 205 of file w5100.h.

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

Definition at line 92 of file w5100.h.

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

Definition at line 166 of file w5100.h.

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

Definition at line 149 of file w5100.h.

#define W5100TransportPutUint8FixedArray (   _dev,
  _n,
  _x 
)    W5100TransportPutFixedArray(_dev, W5100TransportPutUint8ByAddr, _n, _x)

Definition at line 192 of file w5100.h.

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

Definition at line 90 of file w5100.h.

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

Definition at line 87 of file w5100.h.

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

Definition at line 217 of file w5100.h.

#define W5100TxRunning   chip0.tx_running

Definition at line 84 of file w5100.h.

Enumeration Type Documentation

Enumerator
W5100StatusUninit 
W5100StatusIdle 
W5100StatusReading 

Definition at line 41 of file w5100.h.

Function Documentation

bool_t w5100_ch_available ( void  )

Definition at line 337 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
uint16_t w5100_receive ( uint8_t buf,
uint16_t  len 
)

Definition at line 344 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 293 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 89 of file w5100.c.

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

Definition at line 91 of file w5100.c.

Referenced by w5100_read_buffer().

struct w5100_transport w5100_tp

Definition at line 109 of file w5100.c.