mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-02-17 00:14:43 +02:00
tools/lib/atben.c: added support for interrupt_wait (polled)
- atben.c (atben_interrupt_wait): loop until either the timeout has been reached or an interrupt has occurred - atben.c (atben_driver): added atben_interrupt_wait
This commit is contained in:
parent
4d4cec6a67
commit
55354c7f91
@ -19,6 +19,7 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include "at86rf230.h"
|
#include "at86rf230.h"
|
||||||
|
#include "timeout.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
|
||||||
|
|
||||||
@ -383,6 +384,25 @@ static int atben_interrupt(void *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int atben_interrupt_wait(void *handle, int timeout_ms)
|
||||||
|
{
|
||||||
|
struct timeout to;
|
||||||
|
int timedout;
|
||||||
|
|
||||||
|
timeout_start(&to, timeout_ms);
|
||||||
|
while (1) {
|
||||||
|
timedout = timeout_reached(&to);
|
||||||
|
if (atben_interrupt(handle))
|
||||||
|
return atben_reg_read(handle, REG_IRQ_STATUS);
|
||||||
|
if (timedout)
|
||||||
|
return 0;
|
||||||
|
usleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----- Driver-specific hacks --------------------------------------------- */
|
/* ----- Driver-specific hacks --------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
@ -412,4 +432,5 @@ struct atrf_driver atben_driver = {
|
|||||||
.sram_write = atben_sram_write,
|
.sram_write = atben_sram_write,
|
||||||
.sram_read = atben_sram_read,
|
.sram_read = atben_sram_read,
|
||||||
.interrupt = atben_interrupt,
|
.interrupt = atben_interrupt,
|
||||||
|
.interrupt_wait = atben_interrupt_wait,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user