You are welcome.
I assume you are asking about how long to make it. It took more or less five days, but it's not all the library only the ones mentioned.
By the way i forgot to mention there are two possible bugs in the normal Arduino code base.
void W5100Class::recv_data_processing(SOCKET s, uint8_t *data, uint16_t len, uint8_t peek)
{
uint16_t ptr;
ptr = readSnRX_RD(s);
read_data(s, (uint8_t *)ptr, data, len);
if (!peek)
{
ptr += len;
writeSnRX_RD(s, ptr);
}
}
void W5100Class::read_data(SOCKET s, volatile uint8_t *src, volatile uint8_t *dst, uint16_t len)
{
uint16_t size;
uint16_t src_mask;
uint16_t src_ptr;
src_mask = (uint16_t)src & RMASK;
src_ptr = RBASE[s] + src_mask;
if( (src_mask + len) > RSIZE )
{
size = RSIZE - src_mask;
read(src_ptr, (uint8_t *)dst, size);
dst += size;
read(RBASE[s], (uint8_t *) dst, len - size);
}
else
read(src_ptr, (uint8_t *) dst, len);
}
The problems starts with casting of an uint16_t to (uint8_t *), which absolutely doesn't make sense since the pointer is an internal W5100 pointer and not AVR accessible. That casting causes no problem in avr because luckily pointers are uint16_t but that is bad programing practices to assume that. Also once the new chips come into place that assumption may fail badly and be hard to debug.
Another point is the use of the volatile keyword which is completely meaningless and can cause the compiler to not do its best in optimizing the code. It is meaningless because no data is read in an interrupt and there are no threads in AVR.
The following casts to (uint8_t *) are also useless since dst is already of that type.
The code style is also not really good throughout the library with the socket function argument being called _s, socket, sock or s. I would be glad to correct some of the style if there were any guidelines