libnetworking: Use rtems_clock_get_uptime_seconds

This reduces the start-up time of the network stack.

With a 1ms tick the ticks since boot value overflows after approximately
50 days.  This problem is avoided with the
rtems_clock_get_uptime_seconds() function.
This commit is contained in:
Sebastian Huber
2012-11-21 16:29:41 +01:00
parent 94eb1bb342
commit 3fbcadfbf7
3 changed files with 6 additions and 17 deletions
@@ -139,7 +139,11 @@ void rtems_bsdnet_semaphore_release (void);
void rtems_bsdnet_schednetisr (int n);
int rtems_bsdnet_parse_driver_name (const struct rtems_bsdnet_ifconfig *config, char **namep);
unsigned long rtems_bsdnet_seconds_since_boot (void);
static inline unsigned long rtems_bsdnet_seconds_since_boot(void)
{
return (unsigned long) rtems_clock_get_uptime_seconds() + 1UL;
}
unsigned long rtems_bsdnet_random (void);
rtems_id rtems_bsdnet_newproc (
-15
View File
@@ -335,12 +335,6 @@ rtems_bsdnet_initialize (void)
rtems_bsdnet_microseconds_per_tick =
1000000 / rtems_bsdnet_ticks_per_second;
/*
* Ensure that `seconds' is greater than 0
*/
while (rtems_bsdnet_seconds_since_boot() == 0)
rtems_task_wake_after(1);
/*
* Set up BSD-style sockets
*/
@@ -714,15 +708,6 @@ rtems_status_code rtems_bsdnet_event_receive (
return sc;
}
unsigned long
rtems_bsdnet_seconds_since_boot (void)
{
rtems_interval now;
now = rtems_clock_get_ticks_since_boot();
return now / rtems_bsdnet_ticks_per_second;
}
/*
* Fake random number generator
*/
+1 -1
View File
@@ -44,7 +44,7 @@
#define INDEX_HTML "HTTP/1.1 200 OK\r\n" \
"Date: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n" \
"Last-Modified: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\r\n" \
"Etag: \"21dae501.a2\"\r\n" \
"Etag: \"21dae500.a2\"\r\n" \
"Content-Type: text/html\r\n" \
"Content-Length: 162\r\n" \
"Connection: close\r\n" \