IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2011-06-20 22:42:48 (12 years 9 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 668d8c61cf5254602beebf0b2a1bc5be5d6c2bd3 |
Message: | tools/: added interrupt_wait support to atnet and atrf-proxy
(untested) - atrf-proxy/PROTOCOL: WAIT is now implemented and takes a timeout argument - atrf-proxy/atrf-proxy.c (cmd_more): implemented WAIT command using atrf_interrupt_wait - lib/atnet.c (atnet_interrupt_wait, atnet_driver): added interrupt_wait (using WAIT) |
Files: |
tools/atrf-proxy/PROTOCOL (2 diffs) tools/atrf-proxy/atrf-proxy.c (1 diff) tools/lib/atnet.c (2 diffs) |
Change Details
tools/atrf-proxy/PROTOCOL | ||
---|---|---|
60 | 60 | +0|1 |
61 | 61 | -message |
62 | 62 | |
63 | WAIT | |
64 | +0|1 | |
63 | WAIT timeout_ms | |
64 | +value | |
65 | 65 | -message |
66 | 66 | |
67 | 67 | |
... | ... | |
84 | 84 | device is implicitly closed when closing the TCP session. |
85 | 85 | |
86 | 86 | |
87 | Asynchrous interrupt notification (not implemented yet) | |
87 | Asynchrous interrupt notification | |
88 | 88 | --------------------------------- |
89 | 89 | |
90 | 90 | The WAIT command is not answered until an interrupt or another command is |
91 | received. WAIT returns the interrupt status, just like POLL. | |
91 | received. WAIT returns the value of the IRQ_STATUS register. If WAIT | |
92 | times out before receiving an interrupt, it returns 0. |
tools/atrf-proxy/atrf-proxy.c | ||
---|---|---|
168 | 168 | return netio_printf(netio, "-I/O error\n"); |
169 | 169 | return netio_printf(netio, "+0x%02x\n", res); |
170 | 170 | } |
171 | if (!strcasecmp(cmd, "wait")) { | |
172 | uint8_t res; | |
173 | ||
174 | if (!n) | |
175 | n = 1; | |
176 | res = atrf_interrupt_wait(dsc, n); | |
177 | if (atrf_error(dsc)) | |
178 | return netio_printf(netio, "-I/O error\n"); | |
179 | if (res < 0) | |
180 | return netio_printf(netio, "-not supported\n"); | |
181 | return netio_printf(netio, "+0x%02x\n", res); | |
182 | } | |
171 | 183 | if (!strcasecmp(cmd, "getram")) { |
172 | 184 | uint8_t res; |
173 | 185 |
tools/lib/atnet.c | ||
---|---|---|
463 | 463 | } |
464 | 464 | |
465 | 465 | |
466 | int atnet_interrupt_wait(void *handle, int timeout_ms) | |
467 | { | |
468 | struct atnet_dsc *dsc = handle; | |
469 | unsigned long value; | |
470 | char *end; | |
471 | ||
472 | if (dsc->error) | |
473 | return 0; | |
474 | if (dialog(dsc, "WAIT %d", timeout_ms) < 0) | |
475 | return 0; | |
476 | value = strtoul(dsc->reply+1, &end, 0); | |
477 | if (*end || value > 1) { | |
478 | fprintf(stderr, "invalid response \"%s\"\n", dsc->reply+1); | |
479 | dsc->error = 1; | |
480 | return 0; | |
481 | } | |
482 | return value; | |
483 | } | |
484 | ||
485 | ||
466 | 486 | /* ----- CLKM handling ----------------------------------------------------- */ |
467 | 487 | |
468 | 488 | |
... | ... | |
496 | 516 | .sram_write = atnet_sram_write, |
497 | 517 | .sram_read = atnet_sram_read, |
498 | 518 | .interrupt = atnet_interrupt, |
519 | .interrupt_wait = atnet_interrupt_wait, | |
499 | 520 | }; |