Date:2011-06-21 00:03:03 (9 years 1 month ago)
Author:Werner Almesberger
Commit:55354c7f915d667b729ad5aaa410ccc1c78582e6
Message: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
Files: tools/lib/atben.c (3 diffs)

Change Details

tools/lib/atben.c
1919#include <sys/mman.h>
2020
2121#include "at86rf230.h"
22#include "timeout.h"
2223#include "driver.h"
2324
2425
...... 
383384}
384385
385386
387int atben_interrupt_wait(void *handle, int timeout_ms)
388{
389    struct timeout to;
390    int timedout;
391
392    timeout_start(&to, timeout_ms);
393    while (1) {
394        timedout = timeout_reached(&to);
395        if (atben_interrupt(handle))
396            return atben_reg_read(handle, REG_IRQ_STATUS);
397        if (timedout)
398            return 0;
399        usleep(1000);
400    }
401
402    return 0;
403}
404
405
386406/* ----- Driver-specific hacks --------------------------------------------- */
387407
388408
...... 
412432    .sram_write = atben_sram_write,
413433    .sram_read = atben_sram_read,
414434    .interrupt = atben_interrupt,
435    .interrupt_wait = atben_interrupt_wait,
415436};

Archive Download the corresponding diff file



interactive