URL
https://opencores.org/ocsvn/mlite/mlite/trunk
Subversion Repositories mlite
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 164 to Rev 165
- ↔ Reverse comparison
Rev 164 → Rev 165
/trunk/kernel/tcpip.c
49,6 → 49,10
#define UartPrintf printf |
#define UartPrintfCritical printf |
#define Led(A) |
#else |
#undef printf |
#define printf UartPrintfPoll |
//#define printf UartPrintfNull |
#endif |
|
//ETHER FIELD OFFSET LENGTH VALUE |
489,6 → 493,8
count = FrameFreeCount - FRAME_COUNT_WINDOW; |
if(count < 1) |
count = 1; |
if(count > 4) |
count = 4; |
count *= 512; |
packet[TCP_WINDOW_SIZE] = (uint8)(count >> 8); |
packet[TCP_WINDOW_SIZE+1] = (uint8)count; |
822,6 → 828,11
TCPSendPacket(socket, frameOut, TCP_DATA); |
} |
|
//Determine window |
socket->seqWindow = (packet[TCP_WINDOW_SIZE] << 8) | packet[TCP_WINDOW_SIZE+1]; |
if(socket->seqWindow < 8) |
socket->seqWindow = 8; |
|
//Notify application |
if(socket->funcPtr) |
socket->funcPtr(socket); |
1207,16 → 1218,26
{ |
IPFrame *frameOut; |
uint8 *packetOut; |
uint32 bytes, count=0; |
uint32 bytes, count=0, tries; |
int offset; |
OS_Thread_t *self; |
|
//printf("IPWrite(0x%x, %d)", Socket, Length); |
self = OS_ThreadSelf(); |
while(Length) |
{ |
if(Socket->frameSend == NULL) |
tries = 0; |
while(Socket->frameSend == NULL) |
{ |
Socket->frameSend = IPFrameGet(FRAME_COUNT_SEND); |
Socket->sendOffset = 0; |
if(Socket->frameSend == NULL) |
{ |
if(self == IPThread || ++tries > 200) |
break; |
else |
OS_ThreadSleep(1); |
} |
} |
frameOut = Socket->frameSend; |
offset = Socket->sendOffset; |
1233,6 → 1254,11
memcpy(packetOut+TCP_DATA+offset, Buf, bytes); |
if(Socket->sendOffset >= 512) |
IPWriteFlush(Socket); |
//if(Socket->seq - Socket->seqReceived > Socket->seqWindow) |
//{ |
// printf("W"); |
// OS_ThreadSleep(10); |
//} |
} |
else //UDP |
{ |
1249,24 → 1275,6
} |
|
|
void IPWritePend(IPSocket *Socket, uint8 *Buf, uint32 Length) |
{ |
int bytes; |
OS_Thread_t *self; |
|
self = OS_ThreadSelf(); |
assert(self != IPThread); |
while(Length) |
{ |
bytes = IPWrite(Socket, Buf, Length); |
Buf += bytes; |
Length -= bytes; |
if(Length) |
OS_ThreadSleep(1); |
} |
} |
|
|
uint32 IPRead(IPSocket *Socket, uint8 *Buf, uint32 Length) |
{ |
IPFrame *frame, *frame2; |