Date:2010-09-10 01:22:45 (9 years 6 days 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
126126        buf[BUILD_OFFSET-1] = ' ';
127127        for (size = 0; build_date[size]; size++)
128128            buf[BUILD_OFFSET+size] = build_date[size];
129        size += BUILD_OFFSET-i+1;
129        size += BUILD_OFFSET-i;
130130        SDCC_FORCE_EVAL(uint8_t, setup->bRequest);
131131        if (size > setup->wLength)
132132            return 0;
...... 
143143        reset_rf();
144144        return 1;
145145
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
146154    case ATSPI_TO_DEV(ATSPI_REG_WRITE):
147155        debug("ATSPI_REG_WRITE\n");
148156        nSS = 0;
atrf/fw/include/atspi/ep0.h
2121 * ->host ATSPI_BUILD - - #bytes
2222 * host-> ATSPI_RESET - - 0
2323 *
24 * host-> ATSPI_RF_RESET - -
24 * host-> ATSPI_RF_RESET - - 0
25 * ->host ATSPI_POLL_INT - - 1
2526 *
2627 * host-> ATSPI_REG_WRITE value addr 0
2728 * ->host ATSPI_REG_READ - addr 1
...... 
6364    ATSPI_BUILD,
6465    ATSPI_RESET,
6566    ATSPI_RF_RESET = 0x10,
67    ATSPI_POLL_INT,
6668    ATSPI_REG_WRITE = 0x20,
6769    ATSPI_REG_READ,
6870    ATSPI_BUF_WRITE,
tools/lib/atusb.c
187187}
188188
189189
190/* ----- RF interrupt ------------------------------------------------------ */
191
192
193static 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
190213/* ----- driver interface -------------------------------------------------- */
191214
192215
...... 
202225    .reg_read = atusb_reg_read,
203226    .buf_write = atusb_buf_write,
204227    .buf_read = atusb_buf_read,
228    .interrupt = atusd_interrupt,
205229};
tools/lib/atusd.c
300300}
301301
302302
303/* ----- RF interrupt ------------------------------------------------------ */
304
305
303306static int atusd_interrupt(void *handle)
304307{
305308        struct atusd_dsc *dsc = handle;

Archive Download the corresponding diff file



interactive