1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 14:40:17 +02:00

atusb/fw/: added optional debug log with request ATUSB_READ_LOG

This commit is contained in:
Werner Almesberger 2011-07-05 18:52:56 -03:00
parent e610a9ec20
commit 39e3d4e61a
2 changed files with 33 additions and 0 deletions

View File

@ -56,6 +56,20 @@ static void do_buf_write(void *user)
#define BUILD_OFFSET 7 /* '#' plus "65535" plus ' ' */
#ifdef DEBUG_LOG
#define LOG_SIZE 16
static struct {
uint16_t n;
struct setup_request setup;
} log_buf[LOG_SIZE];
static int log_pos = 0;
#endif /* DEBUG_LOG */
static int my_setup(const struct setup_request *setup)
{
uint16_t req = setup->bmRequestType | setup->bRequest << 8;
@ -63,6 +77,17 @@ static int my_setup(const struct setup_request *setup)
uint8_t i;
uint64_t tmp64;
#ifdef DEBUG_LOG
uint8_t pos;
pos = log_pos & (LOG_SIZE-1);
log_buf[pos].n = log_pos;
log_buf[pos].setup = *setup;
log_pos++;
#endif /* DEBUG_LOG */
switch (req) {
case ATUSB_FROM_DEV(ATUSB_ID):
debug("ATUSB_ID\n");
@ -129,6 +154,12 @@ static int my_setup(const struct setup_request *setup)
gpio_cleanup();
return 1;
#ifdef DEBUG_LOG
case ATUSB_FROM_DEV(ATUSB_READ_LOG):
usb_send(&eps[0], log_buf, sizeof(log_buf), NULL, NULL);
return 1;
#endif
case ATUSB_TO_DEV(ATUSB_SLP_TR):
debug("ATUSB_SLP_TR\n");
slp_tr();

View File

@ -28,6 +28,7 @@
* ->host ATUSB_GPIO dir+data mask+p# 3
* host-> ATUSB_SLP_TR - - 0
* host-> ATUSB_GPIO_CLEANUP - - 0
* ->host ATUSB_READ_LOG - - #bytes
*
* host-> ATUSB_REG_WRITE value addr 0
* ->host ATUSB_REG_READ - addr 1
@ -82,6 +83,7 @@ enum atspi_requests {
ATUSB_GPIO,
ATUSB_SLP_TR,
ATUSB_GPIO_CLEANUP,
ATUSB_READ_LOG,
ATUSB_REG_WRITE = 0x20, /* transceiver group */
ATUSB_REG_READ,
ATUSB_BUF_WRITE,