comparison packages/redboot/current/src/net/udp.c @ 1169:83f799d5b41a

Improve stand-alone networking speeds.
author gthomas
date Tue, 19 Aug 2003 17:23:01 +0000
parents 4ebdd3788c30
children 31dd38f564ec
comparison
equal deleted inserted replaced
1168:a8252a1c38ea 1169:83f799d5b41a
7 //========================================================================== 7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN#### 8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. 11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 // Copyright (C) 2002 Gary Thomas 12 // Copyright (C) 2002, 2003 Gary Thomas
13 // 13 //
14 // eCos is free software; you can redistribute it and/or modify it under 14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free 15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version. 16 // Software Foundation; either version 2 or (at your option) any later version.
17 // 17 //
253 recvfrom_len = len; 253 recvfrom_len = len;
254 recvfrom_server = server; 254 recvfrom_server = server;
255 total_ms = (timo->tv_sec * 1000) + (timo->tv_usec / 1000); 255 total_ms = (timo->tv_sec * 1000) + (timo->tv_usec / 1000);
256 start = MS_TICKS(); 256 start = MS_TICKS();
257 res = -1; 257 res = -1;
258 while ((MS_TICKS_DELAY() - start) < total_ms) { 258 do {
259 __enet_poll(); // Handle the hardware 259 __enet_poll(); // Handle the hardware
260 if (!recvfrom_buf) { 260 if (!recvfrom_buf) {
261 // Data have arrived 261 // Data have arrived
262 res = recvfrom_len; 262 res = recvfrom_len;
263 break; 263 break;
264 } 264 }
265 } 265 } while ((MS_TICKS_DELAY() - start) < total_ms);
266 __udp_remove_listener(my_port); 266 __udp_remove_listener(my_port);
267 return res; 267 return res;
268 } 268 }