platform/minimal-net: Implement better idle behavior.
The minimal-net target, as currently written, wakes up the CPU every millisecond to check for packets, and will only react in real-time to input from stdin. If you are running this on a laptop battery, your battery will quickly drain. This change allows the CPU to idle when there is literally nothing to do while still being responsive to input from stein and/or incoming packets. This fix should significantly improve performance while significantly improving power usage. Win-win. Also added `_xassert()` implementation so that the contiki- provided `assert()` macro will work properly when used on this platform.
This commit is contained in:
parent
0a88373add
commit
092b6f3baa
5 changed files with 71 additions and 9 deletions
|
@ -85,6 +85,13 @@ static unsigned long lasttime;
|
|||
static void do_send(void);
|
||||
uint8_t tapdev_send(uip_lladdr_t *lladdr);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
tapdev_fd(void)
|
||||
{
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
uint16_t
|
||||
tapdev_poll(void)
|
||||
|
@ -161,6 +168,7 @@ tapdev_init(void)
|
|||
/* gdk_input_add(fd, GDK_INPUT_READ,
|
||||
read_callback, NULL);*/
|
||||
|
||||
atexit(&tapdev_exit);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue