Wiznet / ioLibrary_Driver

ioLibrary_Driver can be used for the application design of WIZnet TCP/IP chips as W5500, W5300, W5200, W5100 W5100S.
MIT License
612 stars 333 forks source link

"W5300.c, wiz_recv_data function" #126

Open jewoolee opened 2 years ago

jewoolee commented 2 years ago

Hi everyone

I think should be change the wiz_recv_data in w5300.c

because, If they use 16 bit process, recv buffer was big problems.

Please look at the bold font.

If "wizdata[i] = (uint8_t)(rd >> 8)" data was 0x0101, when use 16bit process, assign is value 0x0101. It was very big mistake.

WiznetIOdriver use default 8bit process, i think this change was not problem.

void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint32_t len) { uint16_t rd = 0; uint32_t i = 0; if(len == 0) return; for(i = 0; i < len; i++) { if((i & 0x01)==0) { rd = getSn_RX_FIFOR(sn); wizdata[i] = (uint8_t)(rd >> 8); } else wizdata[i] = (uint8_t)rd; // For checking the memory access violation } sock_remained_byte[sn] = (uint8_t)rd & 0x00FFu; // back up the remaind fifo byte. // If you use 16 bit process, perhaps, It should be recv buffer error // I think it should be inclue the mask LSB. }