Skip to content

Commit bfd8ce2

Browse files
committed
Merge branch 'master' into Arduino_1.5.5
2 parents 14987c8 + 72a7663 commit bfd8ce2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

UIPEthernet/src/utility/Enc28J60Network.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ uint16_t
276276
Enc28J60Network::setReadPtr(memhandle handle, memaddress position, uint16_t len)
277277
{
278278
memblock *packet = handle == UIP_RECEIVEBUFFERHANDLE ? &receivePkt : &blocks[handle];
279-
memaddress start = packet->begin + position;
280-
279+
memaddress start = handle == UIP_RECEIVEBUFFERHANDLE && packet->begin + position > RXSTOP_INIT ? packet->begin + position-RXSTOP_INIT+RXSTART_INIT : packet->begin + position;
280+
281281
writeRegPair(ERDPTL, start);
282282

283283
if (len > packet->size - position)
@@ -357,7 +357,8 @@ Enc28J60Network::copyPacket(memhandle dest_pkt, memaddress dest_pos, memhandle s
357357
{
358358
memblock *dest = &blocks[dest_pkt];
359359
memblock *src = src_pkt == UIP_RECEIVEBUFFERHANDLE ? &receivePkt : &blocks[src_pkt];
360-
enc28J60_mempool_block_move_callback(dest->begin+dest_pos,src->begin+src_pos,len);
360+
memaddress start = src_pkt == UIP_RECEIVEBUFFERHANDLE && src->begin + src_pos > RXSTOP_INIT ? src->begin + src_pos-RXSTOP_INIT+RXSTART_INIT : src->begin + src_pos;
361+
enc28J60_mempool_block_move_callback(dest->begin+dest_pos,start,len);
361362
// Move the RX read pointer to the start of the next received packet
362363
// This frees the memory we just read out
363364
setERXRDPT();

0 commit comments

Comments
 (0)