IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2010-09-10 01:22:45 (10 years 4 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | b6a80ba3ddc63b4f1072a8e20db07e08fcac2738 |
Message: | Added interrupt polling support for atusb. - atrf/fw/include/atspi/ep0.h enum atspi_requests), atrf/fw/atspi/ep0.c (my_setup): new command ATSPI_POLL_INT to poll IRQ_RF - atrf/fw/atspi/ep0.c (my_setup): ATSPI_BUILD sent one byte too many - tools/lib/atusb.c (atusd_interrupt, atusb_driver): implemented interrupt polling - tools/lib/atusd.c: added section title for the RF interrupt function |
Files: |
atrf/fw/atspi/ep0.c (2 diffs) atrf/fw/include/atspi/ep0.h (2 diffs) tools/lib/atusb.c (2 diffs) tools/lib/atusd.c (1 diff) |
Change Details
atrf/fw/atspi/ep0.c | ||
---|---|---|
126 | 126 | buf[BUILD_OFFSET-1] = ' '; |
127 | 127 | for (size = 0; build_date[size]; size++) |
128 | 128 | buf[BUILD_OFFSET+size] = build_date[size]; |
129 | size += BUILD_OFFSET-i+1; | |
129 | size += BUILD_OFFSET-i; | |
130 | 130 | SDCC_FORCE_EVAL(uint8_t, setup->bRequest); |
131 | 131 | if (size > setup->wLength) |
132 | 132 | return 0; |
... | ... | |
143 | 143 | reset_rf(); |
144 | 144 | return 1; |
145 | 145 | |
146 | case ATSPI_FROM_DEV(ATSPI_POLL_INT): | |
147 | debug("ATSPI_POLL_INT\n"); | |
148 | if (setup->wLength < 1) | |
149 | return 0; | |
150 | *buf = IRQ_RF; | |
151 | usb_send(&ep0, buf, 1, NULL, NULL); | |
152 | return 1; | |
153 | ||
146 | 154 | case ATSPI_TO_DEV(ATSPI_REG_WRITE): |
147 | 155 | debug("ATSPI_REG_WRITE\n"); |
148 | 156 | nSS = 0; |
atrf/fw/include/atspi/ep0.h | ||
---|---|---|
21 | 21 | * ->host ATSPI_BUILD - - #bytes |
22 | 22 | * host-> ATSPI_RESET - - 0 |
23 | 23 | * |
24 | * host-> ATSPI_RF_RESET - - | |
24 | * host-> ATSPI_RF_RESET - - 0 | |
25 | * ->host ATSPI_POLL_INT - - 1 | |
25 | 26 | * |
26 | 27 | * host-> ATSPI_REG_WRITE value addr 0 |
27 | 28 | * ->host ATSPI_REG_READ - addr 1 |
... | ... | |
63 | 64 | ATSPI_BUILD, |
64 | 65 | ATSPI_RESET, |
65 | 66 | ATSPI_RF_RESET = 0x10, |
67 | ATSPI_POLL_INT, | |
66 | 68 | ATSPI_REG_WRITE = 0x20, |
67 | 69 | ATSPI_REG_READ, |
68 | 70 | ATSPI_BUF_WRITE, |
tools/lib/atusb.c | ||
---|---|---|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
190 | /* ----- RF interrupt ------------------------------------------------------ */ | |
191 | ||
192 | ||
193 | static int atusd_interrupt(void *dsc) | |
194 | { | |
195 | usb_dev_handle *dev = dsc; | |
196 | uint8_t buf; | |
197 | int res; | |
198 | ||
199 | if (error) | |
200 | return -1; | |
201 | ||
202 | res = usb_control_msg(dev, FROM_DEV, ATSPI_POLL_INT, 0, 0, | |
203 | (void *) &buf, 1, 1000); | |
204 | if (res < 0) { | |
205 | fprintf(stderr, "ATSPI_POLL_INT: %d\n", res); | |
206 | error = 1; | |
207 | } | |
208 | ||
209 | return buf; | |
210 | } | |
211 | ||
212 | ||
190 | 213 | /* ----- driver interface -------------------------------------------------- */ |
191 | 214 | |
192 | 215 | |
... | ... | |
202 | 225 | .reg_read = atusb_reg_read, |
203 | 226 | .buf_write = atusb_buf_write, |
204 | 227 | .buf_read = atusb_buf_read, |
228 | .interrupt = atusd_interrupt, | |
205 | 229 | }; |
tools/lib/atusd.c | ||
---|---|---|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
303 | /* ----- RF interrupt ------------------------------------------------------ */ | |
304 | ||
305 | ||
303 | 306 | static int atusd_interrupt(void *handle) |
304 | 307 | { |
305 | 308 | struct atusd_dsc *dsc = handle; |