ESP8266
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
W5100Class Class Reference

Public Member Functions

void init ()
 
void read_data (SOCKET s, volatile uint16_t src, volatile uint8_t *dst, uint16_t len)
 This function is being used for copy the data form Receive buffer of the chip to application buffer. More...
 
void send_data_processing (SOCKET s, const uint8_t *data, uint16_t len)
 This function is being called by send() and sendto() function also. More...
 
void send_data_processing_offset (SOCKET s, uint16_t data_offset, const uint8_t *data, uint16_t len)
 A copy of send_data_processing that uses the provided ptr for the write offset. Only needed for the "streaming" UDP API, where a single UDP packet is built up over a number of calls to send_data_processing_ptr, because TX_WR doesn't seem to get updated correctly in those scenarios. More...
 
void recv_data_processing (SOCKET s, uint8_t *data, uint16_t len, uint8_t peek=0)
 This function is being called by recv() also. More...
 
void setGatewayIp (uint8_t *_addr)
 
void getGatewayIp (uint8_t *_addr)
 
void setSubnetMask (uint8_t *_addr)
 
void getSubnetMask (uint8_t *_addr)
 
void setMACAddress (uint8_t *addr)
 
void getMACAddress (uint8_t *addr)
 
void setIPAddress (uint8_t *addr)
 
void getIPAddress (uint8_t *addr)
 
void setRetransmissionTime (uint16_t timeout)
 
void setRetransmissionCount (uint8_t _retry)
 
void execCmdSn (SOCKET s, SockCMD _cmd)
 
uint16_t getTXFreeSize (SOCKET s)
 
uint16_t getRXReceivedSize (SOCKET s)
 

Static Public Member Functions

static void writeMR (uint8_t _data)
 
static uint8_t readMR ()
 
static uint16_t writeGAR (uint8_t *_buff)
 
static uint16_t readGAR (uint8_t *_buff)
 
static uint16_t writeSUBR (uint8_t *_buff)
 
static uint16_t readSUBR (uint8_t *_buff)
 
static uint16_t writeSHAR (uint8_t *_buff)
 
static uint16_t readSHAR (uint8_t *_buff)
 
static uint16_t writeSIPR (uint8_t *_buff)
 
static uint16_t readSIPR (uint8_t *_buff)
 
static void writeIR (uint8_t _data)
 
static uint8_t readIR ()
 
static void writeIMR (uint8_t _data)
 
static uint8_t readIMR ()
 
static void writeRTR (uint16_t _data)
 
static uint16_t readRTR ()
 
static void writeRCR (uint8_t _data)
 
static uint8_t readRCR ()
 
static void writeRMSR (uint8_t _data)
 
static uint8_t readRMSR ()
 
static void writeTMSR (uint8_t _data)
 
static uint8_t readTMSR ()
 
static void writePATR (uint8_t _data)
 
static uint8_t readPATR ()
 
static void writePTIMER (uint8_t _data)
 
static uint8_t readPTIMER ()
 
static void writePMAGIC (uint8_t _data)
 
static uint8_t readPMAGIC ()
 
static uint16_t writeUIPR (uint8_t *_buff)
 
static uint16_t readUIPR (uint8_t *_buff)
 
static void writeUPORT (uint16_t _data)
 
static uint16_t readUPORT ()
 
static void writeSnMR (SOCKET _s, uint8_t _data)
 
static uint8_t readSnMR (SOCKET _s)
 
static void writeSnCR (SOCKET _s, uint8_t _data)
 
static uint8_t readSnCR (SOCKET _s)
 
static void writeSnIR (SOCKET _s, uint8_t _data)
 
static uint8_t readSnIR (SOCKET _s)
 
static void writeSnSR (SOCKET _s, uint8_t _data)
 
static uint8_t readSnSR (SOCKET _s)
 
static void writeSnPORT (SOCKET _s, uint16_t _data)
 
static uint16_t readSnPORT (SOCKET _s)
 
static uint16_t writeSnDHAR (SOCKET _s, uint8_t *_buff)
 
static uint16_t readSnDHAR (SOCKET _s, uint8_t *_buff)
 
static uint16_t writeSnDIPR (SOCKET _s, uint8_t *_buff)
 
static uint16_t readSnDIPR (SOCKET _s, uint8_t *_buff)
 
static void writeSnDPORT (SOCKET _s, uint16_t _data)
 
static uint16_t readSnDPORT (SOCKET _s)
 
static void writeSnMSSR (SOCKET _s, uint16_t _data)
 
static uint16_t readSnMSSR (SOCKET _s)
 
static void writeSnPROTO (SOCKET _s, uint8_t _data)
 
static uint8_t readSnPROTO (SOCKET _s)
 
static void writeSnTOS (SOCKET _s, uint8_t _data)
 
static uint8_t readSnTOS (SOCKET _s)
 
static void writeSnTTL (SOCKET _s, uint8_t _data)
 
static uint8_t readSnTTL (SOCKET _s)
 
static void writeSnTX_FSR (SOCKET _s, uint16_t _data)
 
static uint16_t readSnTX_FSR (SOCKET _s)
 
static void writeSnTX_RD (SOCKET _s, uint16_t _data)
 
static uint16_t readSnTX_RD (SOCKET _s)
 
static void writeSnTX_WR (SOCKET _s, uint16_t _data)
 
static uint16_t readSnTX_WR (SOCKET _s)
 
static void writeSnRX_RSR (SOCKET _s, uint16_t _data)
 
static uint16_t readSnRX_RSR (SOCKET _s)
 
static void writeSnRX_RD (SOCKET _s, uint16_t _data)
 
static uint16_t readSnRX_RD (SOCKET _s)
 
static void writeSnRX_WR (SOCKET _s, uint16_t _data)
 
static uint16_t readSnRX_WR (SOCKET _s)
 

Static Public Attributes

static const uint16_t SSIZE = 2048
 

Static Private Member Functions

static uint8_t write (uint16_t _addr, uint8_t _data)
 
static uint16_t write (uint16_t addr, const uint8_t *buf, uint16_t len)
 
static uint8_t read (uint16_t addr)
 
static uint16_t read (uint16_t addr, uint8_t *buf, uint16_t len)
 
static uint8_t readSn (SOCKET _s, uint16_t _addr)
 
static uint8_t writeSn (SOCKET _s, uint16_t _addr, uint8_t _data)
 
static uint16_t readSn (SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t len)
 
static uint16_t writeSn (SOCKET _s, uint16_t _addr, uint8_t *_buf, uint16_t len)
 
static void initSS ()
 
static void setSS ()
 
static void resetSS ()
 

Private Attributes

uint16_t SBASE [SOCKETS]
 
uint16_t RBASE [SOCKETS]
 

Static Private Attributes

static const uint16_t CH_BASE = 0x0400
 
static const uint16_t CH_SIZE = 0x0100
 
static const uint8_t RST = 7
 
static const int SOCKETS = 4
 
static const uint16_t SMASK = 0x07FF
 
static const uint16_t RMASK = 0x07FF
 
static const uint16_t RSIZE = 2048
 

Member Function Documentation

void W5100Class::execCmdSn ( SOCKET  s,
SockCMD  _cmd 
)
void W5100Class::getGatewayIp ( uint8_t *  _addr)
void W5100Class::getIPAddress ( uint8_t *  addr)
void W5100Class::getMACAddress ( uint8_t *  addr)
uint16_t W5100Class::getRXReceivedSize ( SOCKET  s)
void W5100Class::getSubnetMask ( uint8_t *  _addr)
uint16_t W5100Class::getTXFreeSize ( SOCKET  s)
void W5100Class::init ( void  )
static void W5100Class::initSS ( )
staticprivate
uint8_t W5100Class::read ( uint16_t  addr)
staticprivate
uint16_t W5100Class::read ( uint16_t  addr,
uint8_t *  buf,
uint16_t  len 
)
staticprivate
void W5100Class::read_data ( SOCKET  s,
volatile uint16_t  src,
volatile uint8_t *  dst,
uint16_t  len 
)

This function is being used for copy the data form Receive buffer of the chip to application buffer.

It calculate the actual physical address where one has to read the data from Receive buffer. Here also take care of the condition while it exceed the Rx memory uper-bound of socket.

static uint16_t W5100Class::readGAR ( uint8_t *  _buff)
static
static uint8_t W5100Class::readIMR ( )
static
static uint8_t W5100Class::readIR ( )
static
static uint8_t W5100Class::readMR ( )
static
static uint8_t W5100Class::readPATR ( )
static
static uint8_t W5100Class::readPMAGIC ( )
static
static uint8_t W5100Class::readPTIMER ( )
static
static uint8_t W5100Class::readRCR ( )
static
static uint8_t W5100Class::readRMSR ( )
static
static uint16_t W5100Class::readRTR ( )
static
static uint16_t W5100Class::readSHAR ( uint8_t *  _buff)
static
static uint16_t W5100Class::readSIPR ( uint8_t *  _buff)
static
uint8_t W5100Class::readSn ( SOCKET  _s,
uint16_t  _addr 
)
staticprivate
uint16_t W5100Class::readSn ( SOCKET  _s,
uint16_t  _addr,
uint8_t *  _buf,
uint16_t  len 
)
staticprivate
static uint8_t W5100Class::readSnCR ( SOCKET  _s)
static
static uint16_t W5100Class::readSnDHAR ( SOCKET  _s,
uint8_t *  _buff 
)
static
static uint16_t W5100Class::readSnDIPR ( SOCKET  _s,
uint8_t *  _buff 
)
static
static uint16_t W5100Class::readSnDPORT ( SOCKET  _s)
static
static uint8_t W5100Class::readSnIR ( SOCKET  _s)
static
static uint8_t W5100Class::readSnMR ( SOCKET  _s)
static
static uint16_t W5100Class::readSnMSSR ( SOCKET  _s)
static
static uint16_t W5100Class::readSnPORT ( SOCKET  _s)
static
static uint8_t W5100Class::readSnPROTO ( SOCKET  _s)
static
static uint16_t W5100Class::readSnRX_RD ( SOCKET  _s)
static
static uint16_t W5100Class::readSnRX_RSR ( SOCKET  _s)
static
static uint16_t W5100Class::readSnRX_WR ( SOCKET  _s)
static
static uint8_t W5100Class::readSnSR ( SOCKET  _s)
static
static uint8_t W5100Class::readSnTOS ( SOCKET  _s)
static
static uint8_t W5100Class::readSnTTL ( SOCKET  _s)
static
static uint16_t W5100Class::readSnTX_FSR ( SOCKET  _s)
static
static uint16_t W5100Class::readSnTX_RD ( SOCKET  _s)
static
static uint16_t W5100Class::readSnTX_WR ( SOCKET  _s)
static
static uint16_t W5100Class::readSUBR ( uint8_t *  _buff)
static
static uint8_t W5100Class::readTMSR ( )
static
static uint16_t W5100Class::readUIPR ( uint8_t *  _buff)
static
static uint16_t W5100Class::readUPORT ( )
static
void W5100Class::recv_data_processing ( SOCKET  s,
uint8_t *  data,
uint16_t  len,
uint8_t  peek = 0 
)

This function is being called by recv() also.

This function read the Rx read pointer register and after copy the data from receive buffer update the Rx write pointer register. User should read upper byte first and lower byte later to get proper value.

static void W5100Class::resetSS ( )
staticprivate
void W5100Class::send_data_processing ( SOCKET  s,
const uint8_t *  data,
uint16_t  len 
)

This function is being called by send() and sendto() function also.

This function read the Tx write pointer register and after copy the data in buffer update the Tx write pointer register. User should read upper byte first and lower byte later to get proper value.

void W5100Class::send_data_processing_offset ( SOCKET  s,
uint16_t  data_offset,
const uint8_t *  data,
uint16_t  len 
)

A copy of send_data_processing that uses the provided ptr for the write offset. Only needed for the "streaming" UDP API, where a single UDP packet is built up over a number of calls to send_data_processing_ptr, because TX_WR doesn't seem to get updated correctly in those scenarios.

Parameters
ptrvalue to use in place of TX_WR. If 0, then the value is read in from TX_WR
Returns
New value for ptr, to be used in the next call
void W5100Class::setGatewayIp ( uint8_t *  _addr)
void W5100Class::setIPAddress ( uint8_t *  addr)
void W5100Class::setMACAddress ( uint8_t *  addr)
void W5100Class::setRetransmissionCount ( uint8_t  _retry)
void W5100Class::setRetransmissionTime ( uint16_t  timeout)
static void W5100Class::setSS ( )
staticprivate
void W5100Class::setSubnetMask ( uint8_t *  _addr)
uint8_t W5100Class::write ( uint16_t  _addr,
uint8_t  _data 
)
staticprivate
uint16_t W5100Class::write ( uint16_t  addr,
const uint8_t *  buf,
uint16_t  len 
)
staticprivate
static uint16_t W5100Class::writeGAR ( uint8_t *  _buff)
static
static void W5100Class::writeIMR ( uint8_t  _data)
static
static void W5100Class::writeIR ( uint8_t  _data)
static
static void W5100Class::writeMR ( uint8_t  _data)
static
static void W5100Class::writePATR ( uint8_t  _data)
static
static void W5100Class::writePMAGIC ( uint8_t  _data)
static
static void W5100Class::writePTIMER ( uint8_t  _data)
static
static void W5100Class::writeRCR ( uint8_t  _data)
static
static void W5100Class::writeRMSR ( uint8_t  _data)
static
static void W5100Class::writeRTR ( uint16_t  _data)
static
static uint16_t W5100Class::writeSHAR ( uint8_t *  _buff)
static
static uint16_t W5100Class::writeSIPR ( uint8_t *  _buff)
static
uint8_t W5100Class::writeSn ( SOCKET  _s,
uint16_t  _addr,
uint8_t  _data 
)
staticprivate
uint16_t W5100Class::writeSn ( SOCKET  _s,
uint16_t  _addr,
uint8_t *  _buf,
uint16_t  len 
)
staticprivate
static void W5100Class::writeSnCR ( SOCKET  _s,
uint8_t  _data 
)
static
static uint16_t W5100Class::writeSnDHAR ( SOCKET  _s,
uint8_t *  _buff 
)
static
static uint16_t W5100Class::writeSnDIPR ( SOCKET  _s,
uint8_t *  _buff 
)
static
static void W5100Class::writeSnDPORT ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnIR ( SOCKET  _s,
uint8_t  _data 
)
static
static void W5100Class::writeSnMR ( SOCKET  _s,
uint8_t  _data 
)
static
static void W5100Class::writeSnMSSR ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnPORT ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnPROTO ( SOCKET  _s,
uint8_t  _data 
)
static
static void W5100Class::writeSnRX_RD ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnRX_RSR ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnRX_WR ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnSR ( SOCKET  _s,
uint8_t  _data 
)
static
static void W5100Class::writeSnTOS ( SOCKET  _s,
uint8_t  _data 
)
static
static void W5100Class::writeSnTTL ( SOCKET  _s,
uint8_t  _data 
)
static
static void W5100Class::writeSnTX_FSR ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnTX_RD ( SOCKET  _s,
uint16_t  _data 
)
static
static void W5100Class::writeSnTX_WR ( SOCKET  _s,
uint16_t  _data 
)
static
static uint16_t W5100Class::writeSUBR ( uint8_t *  _buff)
static
static void W5100Class::writeTMSR ( uint8_t  _data)
static
static uint16_t W5100Class::writeUIPR ( uint8_t *  _buff)
static
static void W5100Class::writeUPORT ( uint16_t  _data)
static

Member Data Documentation

const uint16_t W5100Class::CH_BASE = 0x0400
staticprivate
const uint16_t W5100Class::CH_SIZE = 0x0100
staticprivate
uint16_t W5100Class::RBASE[SOCKETS]
private
const uint16_t W5100Class::RMASK = 0x07FF
staticprivate
const uint16_t W5100Class::RSIZE = 2048
staticprivate
const uint8_t W5100Class::RST = 7
staticprivate
uint16_t W5100Class::SBASE[SOCKETS]
private
const uint16_t W5100Class::SMASK = 0x07FF
staticprivate
const int W5100Class::SOCKETS = 4
staticprivate
const uint16_t W5100Class::SSIZE = 2048
static