Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
W5100 ethernet chip I/O. More...
#include "mcu_periph/sys_time.h"
#include "subsystems/datalink/w5100.h"
#include "mcu_periph/spi.h"
#include "mcu_periph/gpio.h"
Go to the source code of this file.
Macros | |
#define | TXBUF_BASE 0x4000 |
#define | RXBUF_BASE 0x6000 |
#define | SOCKETS 4 |
#define | CMD_SOCKET 1 |
#define | TELEM_SOCKET 0 |
#define | SOCK_OPEN 0x01 |
#define | SOCK_CLOSE 0x10 |
#define | SOCK_SEND 0x20 |
#define | SOCK_RECV 0x40 |
#define | SNMR_UDP 0x02 |
#define | SNMR_MULTI 0x80 |
#define | SNIR_SEND_OK 0x10 |
#define | SNIR_TIMEOUT 0x08 |
#define | CH_BASE 0x0400 |
#define | CH_SIZE 0x0100 |
#define | SMASK 0x07FF |
#define | RMASK 0x07FF |
#define | REG_MR 0x0000 |
#define | REG_RX_MEM 0x001A |
#define | REG_TX_MEM 0x001B |
#define | REG_GAR 0x0001 |
#define | REG_SUBR 0x0005 |
#define | REG_SHAR 0x0009 |
#define | REG_SIPR 0x000F |
#define | SOCK_MR 0x0000 |
#define | SOCK_CR 0x0001 |
#define | SOCK_IR 0x0002 |
#define | SOCK_PORT 0x0004 |
#define | SOCK_DHAR 0x0006 |
#define | SOCK_DIPR 0x000C |
#define | SOCK_DPORT 0x0010 |
#define | SOCK_TX_WR 0x0024 |
#define | SOCK_RSR 0x0026 |
#define | SOCK_RXRD 0x0028 |
#define | W5100_SPI_DEV spi1 |
#define | W5100_SLAVE_IDX SPI_SLAVE1 |
#define | W5100_DRDY_GPIO GPIOB |
#define | W5100_DRDY_GPIO_PIN GPIO1 |
Variables | |
struct w5100_periph | chip0 |
uint8_t | ck_a |
uint8_t | ck_b |
uint8_t | w5100_rx_buf [W5100_RX_BUFFER_SIZE] |
static uint8_t | mac [] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED } |
static uint8_t | ip [] = { W5100_IP } |
static uint8_t | dest [] = { W5100_MULTICAST_IP } |
static uint8_t | subnet [] = { W5100_SUBNET } |
static uint16_t | dport = W5100_MULTICAST_PORT |
static const uint8_t | RST = 7 |
uint16_t | SBASE [SOCKETS] |
uint16_t | RBASE [SOCKETS] |
static const uint16_t | SSIZE = 2048 |
static const uint16_t | RSIZE = 2048 |
struct spi_transaction | w5100_spi |
W5100 ethernet chip I/O.
Definition in file w5100.c.
#define CH_BASE 0x0400 |
Definition at line 48 of file w5100.c.
Referenced by configure_socket(), w5100_sock_get(), and w5100_sock_set().
#define CH_SIZE 0x0100 |
Definition at line 49 of file w5100.c.
Referenced by configure_socket(), w5100_sock_get(), and w5100_sock_set().
#define CMD_SOCKET 1 |
Definition at line 37 of file w5100.c.
Referenced by w5100_ch_available(), w5100_init(), w5100_read_data(), and w5100_receive().
#define REG_GAR 0x0001 |
Definition at line 57 of file w5100.c.
Referenced by w5100_init().
#define REG_MR 0x0000 |
Definition at line 53 of file w5100.c.
Referenced by w5100_init().
#define REG_RX_MEM 0x001A |
Definition at line 54 of file w5100.c.
Referenced by w5100_init().
#define REG_SHAR 0x0009 |
Definition at line 59 of file w5100.c.
Referenced by w5100_init().
#define REG_SIPR 0x000F |
Definition at line 60 of file w5100.c.
Referenced by w5100_init().
#define REG_SUBR 0x0005 |
Definition at line 58 of file w5100.c.
Referenced by w5100_init().
#define REG_TX_MEM 0x001B |
Definition at line 55 of file w5100.c.
Referenced by w5100_init().
#define RMASK 0x07FF |
Definition at line 51 of file w5100.c.
Referenced by w5100_read_data().
#define RXBUF_BASE 0x6000 |
Definition at line 34 of file w5100.c.
Referenced by w5100_init().
#define SMASK 0x07FF |
Definition at line 50 of file w5100.c.
Referenced by w5100_send().
#define SNMR_MULTI 0x80 |
Definition at line 45 of file w5100.c.
Referenced by w5100_init().
#define SNMR_UDP 0x02 |
Definition at line 44 of file w5100.c.
Referenced by configure_socket().
#define SOCK_CLOSE 0x10 |
Definition at line 41 of file w5100.c.
Referenced by w5100_close_socket().
#define SOCK_CR 0x0001 |
Definition at line 63 of file w5100.c.
Referenced by configure_socket(), w5100_close_socket(), w5100_receive(), and w5100_send().
#define SOCK_DHAR 0x0006 |
Definition at line 66 of file w5100.c.
Referenced by configure_socket().
#define SOCK_DIPR 0x000C |
Definition at line 67 of file w5100.c.
Referenced by configure_socket().
#define SOCK_DPORT 0x0010 |
Definition at line 68 of file w5100.c.
Referenced by configure_socket().
#define SOCK_IR 0x0002 |
Definition at line 64 of file w5100.c.
Referenced by w5100_close_socket().
#define SOCK_MR 0x0000 |
Definition at line 62 of file w5100.c.
Referenced by configure_socket().
#define SOCK_OPEN 0x01 |
Definition at line 40 of file w5100.c.
Referenced by configure_socket().
#define SOCK_PORT 0x0004 |
Definition at line 65 of file w5100.c.
Referenced by configure_socket().
#define SOCK_RECV 0x40 |
Definition at line 43 of file w5100.c.
Referenced by w5100_receive().
#define SOCK_RSR 0x0026 |
Definition at line 70 of file w5100.c.
Referenced by w5100_rx_size().
#define SOCK_RXRD 0x0028 |
Definition at line 71 of file w5100.c.
Referenced by w5100_receive().
#define SOCK_SEND 0x20 |
Definition at line 42 of file w5100.c.
Referenced by w5100_send().
#define SOCK_TX_WR 0x0024 |
Definition at line 69 of file w5100.c.
Referenced by w5100_send().
#define SOCKETS 4 |
Definition at line 35 of file w5100.c.
Referenced by w5100_init().
#define TELEM_SOCKET 0 |
Definition at line 38 of file w5100.c.
Referenced by w5100_init(), and w5100_send().
#define TXBUF_BASE 0x4000 |
Definition at line 33 of file w5100.c.
Referenced by w5100_init().
#define W5100_DRDY_GPIO GPIOB |
Definition at line 82 of file w5100.c.
Referenced by w5100_init().
#define W5100_DRDY_GPIO_PIN GPIO1 |
Definition at line 86 of file w5100.c.
Referenced by w5100_init().
#define W5100_SLAVE_IDX SPI_SLAVE1 |
Definition at line 78 of file w5100.c.
Referenced by w5100_init().
#define W5100_SPI_DEV spi1 |
Definition at line 74 of file w5100.c.
Referenced by w5100_get(), and w5100_set().
|
static |
Definition at line 348 of file w5100.c.
References CH_BASE, CH_SIZE, SNMR_UDP, SOCK_CR, SOCK_DHAR, SOCK_DIPR, SOCK_DPORT, SOCK_MR, SOCK_OPEN, SOCK_PORT, w5100_close_socket(), w5100_set_buffer(), and w5100_sock_set().
Referenced by w5100_init().
|
static |
Definition at line 176 of file w5100.c.
References w5100_ch_available().
Referenced by w5100_init().
|
static |
Definition at line 177 of file w5100.c.
References w5100_receive().
Referenced by w5100_init().
|
static |
Definition at line 175 of file w5100.c.
References w5100_send().
Referenced by w5100_init().
|
static |
Definition at line 173 of file w5100.c.
References w5100_transmit().
Referenced by w5100_init().
|
static |
Definition at line 174 of file w5100.c.
References w5100_transmit_buffer().
Referenced by w5100_init().
|
static |
Definition at line 172 of file w5100.c.
Referenced by w5100_init().
bool w5100_ch_available | ( | void | ) |
Definition at line 374 of file w5100.c.
References CMD_SOCKET, and w5100_rx_size().
Referenced by dev_char_available(), and w5100_read_buffer().
|
static |
Definition at line 340 of file w5100.c.
References SOCK_CLOSE, SOCK_CR, SOCK_IR, and w5100_sock_set().
Referenced by configure_socket().
Definition at line 129 of file w5100.c.
References spi_transaction::input_buf, spi_transaction::output_buf, spi_submit(), SPITransSuccess, spi_transaction::status, w5100_spi, and W5100_SPI_DEV.
Referenced by w5100_read(), and w5100_sock_get().
void w5100_init | ( | void | ) |
Definition at line 184 of file w5100.c.
References spi_transaction::bitorder, spi_transaction::cdiv, chip0, CMD_SOCKET, configure_socket(), spi_transaction::cpha, spi_transaction::cpol, w5100_periph::curbuf, dest, dev_char_available(), dev_getch(), dev_send(), dev_transmit(), dev_transmit_buffer(), w5100_periph::device, dport, spi_transaction::dss, gpio_clear(), gpio_set(), gpio_setup_output(), spi_transaction::input_buf, spi_transaction::input_length, ip, mac, spi_transaction::output_buf, spi_transaction::output_length, RBASE, REG_GAR, REG_MR, REG_RX_MEM, REG_SHAR, REG_SIPR, REG_SUBR, REG_TX_MEM, RSIZE, RST, RXBUF_BASE, SBASE, spi_transaction::select, spi_transaction::slave_idx, SNMR_MULTI, SOCKETS, SPICphaEdge1, SPICpolIdleLow, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SSIZE, w5100_periph::status, subnet, sys_time_usleep(), TELEM_SOCKET, true_function(), TXBUF_BASE, W5100_DRDY_GPIO, W5100_DRDY_GPIO_PIN, w5100_set(), w5100_set_buffer(), W5100_SLAVE_IDX, w5100_spi, W5100StatusUninit, w5100_periph::work_rx, and w5100_periph::work_tx.
Referenced by downlink_init().
Definition at line 428 of file w5100.c.
References w5100_get().
Referenced by w5100_read_data().
|
static |
Definition at line 408 of file w5100.c.
References CMD_SOCKET, RBASE, RMASK, RSIZE, and w5100_read().
Referenced by w5100_receive().
Definition at line 382 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 dev_getch(), and w5100_read_buffer().
Definition at line 327 of file w5100.c.
References SOCK_RSR, val, and w5100_sock_get16().
Referenced by w5100_ch_available().
void w5100_send | ( | void | ) |
Definition at line 285 of file w5100.c.
References chip0, w5100_periph::curbuf, offset, SBASE, SMASK, SOCK_CR, SOCK_SEND, SOCK_TX_WR, SSIZE, TELEM_SOCKET, w5100_periph::tx_buf, w5100_periph::tx_extract_idx, w5100_periph::tx_insert_idx, W5100_BUFFER_NUM, w5100_set_buffer(), w5100_sock_get(), w5100_sock_get16(), and w5100_sock_set().
Referenced by dev_send().
Definition at line 116 of file w5100.c.
References spi_transaction::output_buf, spi_submit(), SPITransSuccess, spi_transaction::status, w5100_spi, and W5100_SPI_DEV.
Referenced by w5100_init(), w5100_set_buffer(), and w5100_sock_set().
Definition at line 143 of file w5100.c.
References w5100_set().
Referenced by configure_socket(), w5100_init(), and w5100_send().
Definition at line 156 of file w5100.c.
References CH_BASE, CH_SIZE, and w5100_get().
Referenced by w5100_send(), and w5100_sock_get16().
Definition at line 161 of file w5100.c.
References w5100_sock_get().
Referenced by w5100_receive(), w5100_rx_size(), and w5100_send().
Definition at line 151 of file w5100.c.
References CH_BASE, CH_SIZE, and w5100_set().
Referenced by configure_socket(), w5100_close_socket(), w5100_receive(), and w5100_send().
void w5100_transmit | ( | uint8_t | data | ) |
Definition at line 262 of file w5100.c.
References chip0, w5100_periph::curbuf, w5100_periph::tx_buf, w5100_periph::tx_extract_idx, w5100_periph::tx_insert_idx, and W5100_TX_BUFFER_SIZE.
Referenced by dev_transmit(), and w5100_transmit_buffer().
Definition at line 277 of file w5100.c.
References w5100_transmit().
Referenced by dev_transmit_buffer().
struct w5100_periph chip0 |
Definition at line 89 of file w5100.c.
Referenced by w5100_init(), w5100_send(), and w5100_transmit().
|
static |
Definition at line 98 of file w5100.c.
Referenced by image_to_grayscale(), image_yuv422_colorfilt(), image_yuv422_downsample(), pflash_program_array(), and w5100_init().
|
static |
Definition at line 100 of file w5100.c.
Referenced by w5100_init().
|
static |
Definition at line 97 of file w5100.c.
Referenced by w5100_init().
|
static |
Definition at line 94 of file w5100.c.
Referenced by w5100_init().
Definition at line 105 of file w5100.c.
Referenced by w5100_init(), and w5100_read_data().
|
static |
Definition at line 107 of file w5100.c.
Referenced by w5100_init(), and w5100_read_data().
|
static |
Definition at line 102 of file w5100.c.
Referenced by w5100_init().
Definition at line 104 of file w5100.c.
Referenced by w5100_init(), and w5100_send().
|
static |
Definition at line 106 of file w5100.c.
Referenced by w5100_init(), and w5100_send().
|
static |
Definition at line 99 of file w5100.c.
Referenced by w5100_init().
uint8_t w5100_rx_buf[W5100_RX_BUFFER_SIZE] |
Definition at line 91 of file w5100.c.
Referenced by w5100_read_buffer().
struct spi_transaction w5100_spi |
Definition at line 109 of file w5100.c.
Referenced by w5100_get(), w5100_init(), and w5100_set().