Date:2010-11-11 06:29:07 (8 years 10 months ago)
Author:Werner Almesberger
Commit:5d63a009c8d41c63fcbf03569ed99588bd5b48df
Message:libatspi: new function atspi_test_mode to enter test mode

- include/atspi.h, lib/atspi.c: new function atspi_test_mode to enter test
mode
- lib/driver.h (struct atspi_driver): add backend function test_mode
- lib/atusb.c (atusb_test_mode), lib/atusb.c (atusb_driver): enter test
mode
- lib/atusd.c (atusd_driver): test mode is not supported
Files: tools/include/atspi.h (1 diff)
tools/lib/atspi.c (1 diff)
tools/lib/atusb.c (2 diffs)
tools/lib/atusd.c (1 diff)
tools/lib/driver.h (1 diff)

Change Details

tools/include/atspi.h
2929
3030void atspi_reset(struct atspi_dsc *dsc);
3131void atspi_reset_rf(struct atspi_dsc *dsc);
32int atspi_test_mode(struct atspi_dsc *dsc);
3233
3334void atspi_reg_write(struct atspi_dsc *dsc, uint8_t reg, uint8_t value);
3435uint8_t atspi_reg_read(struct atspi_dsc *dsc, uint8_t reg);
tools/lib/atspi.c
9999}
100100
101101
102int atspi_test_mode(struct atspi_dsc *dsc)
103{
104    if (!dsc->driver->test_mode)
105        return 0;
106    dsc->driver->test_mode(dsc->handle);
107    return 1;
108}
109
110
102111void atspi_reg_write(struct atspi_dsc *dsc, uint8_t reg, uint8_t value)
103112{
104113    dsc->driver->reg_write(dsc->handle, reg, value);
tools/lib/atusb.c
108108}
109109
110110
111static void atusb_test_mode(void *dsc)
112{
113    usb_dev_handle *dev = dsc;
114    int res;
115
116    if (error)
117        return;
118
119    res =
120        usb_control_msg(dev, TO_DEV, ATSPI_TEST, 0, 0, NULL, 0, 1000);
121    if (res < 0) {
122        fprintf(stderr, "ATSPI_TEST: %d\n", res);
123        error = 1;
124    }
125}
126
127
111128/* ----- register access --------------------------------------------------- */
112129
113130
...... 
221238    .clear_error = atusb_clear_error,
222239    .reset = atusb_reset,
223240    .reset_rf = atusb_reset_rf,
241    .test_mode = atusb_test_mode,
224242    .reg_write = atusb_reg_write,
225243    .reg_read = atusb_reg_read,
226244    .buf_write = atusb_buf_write,
tools/lib/atusd.c
320320    .close = atusd_close,
321321    .reset = NULL,
322322    .reset_rf = atusd_reset_rf,
323    .test_mode = NULL,
323324    .reg_write = atusd_reg_write,
324325    .reg_read = atusd_reg_read,
325326    .buf_write = atusd_buf_write,
tools/lib/driver.h
2525    int (*clear_error)(void *dsc);
2626    void (*reset)(void *dsc);
2727    void (*reset_rf)(void *dsc);
28    void (*test_mode)(void *dsc);
2829    void (*reg_write)(void *dsc, uint8_t reg, uint8_t value);
2930    uint8_t (*reg_read)(void *dsc, uint8_t reg);
3031    void (*buf_write)(void *dsc, const void *buf, int size);

Archive Download the corresponding diff file



interactive