Date:2011-07-05 23:52:56 (8 years 2 months ago)
Author:Werner Almesberger
Commit:39e3d4e61acccf40e021bdb7af73492e6c10b4c6
Message:atusb/fw/: added optional debug log with request ATUSB_READ_LOG

Files: atusb/fw/ep0.c (3 diffs)
atusb/fw/include/atusb/ep0.h (2 diffs)

Change Details

atusb/fw/ep0.c
5656#define BUILD_OFFSET 7 /* '#' plus "65535" plus ' ' */
5757
5858
59#ifdef DEBUG_LOG
60
61#define LOG_SIZE 16
62
63static struct {
64    uint16_t n;
65    struct setup_request setup;
66} log_buf[LOG_SIZE];
67
68static int log_pos = 0;
69
70#endif /* DEBUG_LOG */
71
72
5973static int my_setup(const struct setup_request *setup)
6074{
6175    uint16_t req = setup->bmRequestType | setup->bRequest << 8;
...... 
6377    uint8_t i;
6478    uint64_t tmp64;
6579
80#ifdef DEBUG_LOG
81
82    uint8_t pos;
83
84    pos = log_pos & (LOG_SIZE-1);
85    log_buf[pos].n = log_pos;
86    log_buf[pos].setup = *setup;
87    log_pos++;
88
89#endif /* DEBUG_LOG */
90
6691    switch (req) {
6792    case ATUSB_FROM_DEV(ATUSB_ID):
6893        debug("ATUSB_ID\n");
...... 
129154        gpio_cleanup();
130155        return 1;
131156
157#ifdef DEBUG_LOG
158    case ATUSB_FROM_DEV(ATUSB_READ_LOG):
159        usb_send(&eps[0], log_buf, sizeof(log_buf), NULL, NULL);
160        return 1;
161#endif
162
132163    case ATUSB_TO_DEV(ATUSB_SLP_TR):
133164        debug("ATUSB_SLP_TR\n");
134165        slp_tr();
atusb/fw/include/atusb/ep0.h
2828 * ->host ATUSB_GPIO dir+data mask+p# 3
2929 * host-> ATUSB_SLP_TR - - 0
3030 * host-> ATUSB_GPIO_CLEANUP - - 0
31 * ->host ATUSB_READ_LOG - - #bytes
3132 *
3233 * host-> ATUSB_REG_WRITE value addr 0
3334 * ->host ATUSB_REG_READ - addr 1
...... 
8283    ATUSB_GPIO,
8384    ATUSB_SLP_TR,
8485    ATUSB_GPIO_CLEANUP,
86    ATUSB_READ_LOG,
8587    ATUSB_REG_WRITE = 0x20, /* transceiver group */
8688    ATUSB_REG_READ,
8789    ATUSB_BUF_WRITE,

Archive Download the corresponding diff file



interactive