add lots of debugging stuff

This commit is contained in:
Christian Daniel 2012-06-05 20:48:09 +02:00
parent 41eb541606
commit b93708ed1d
10 changed files with 66 additions and 1 deletions

View File

@ -30,5 +30,6 @@ extern unsigned char fastsource_interfaces[3];
void fastsource_init(void);
void fastsource_start(void);
void fastsource_dump(void);
void usb_submit_req_ctx(struct req_ctx *rctx);

View File

@ -50,4 +50,6 @@ extern uint8_t req_ctx_num(struct req_ctx *ctx);
void req_ctx_enqueue(struct llist_head *list, struct req_ctx *rctx);
struct req_ctx *req_ctx_dequeue(struct llist_head *list);
void req_ctx_dump();
#endif /* _REQ_CTX_H */

View File

@ -215,4 +215,6 @@ int e4k_set_lna_gain(struct e4k_state *e4k, int32_t gain);
int e4k_enable_manual_gain(struct e4k_state *e4k, uint8_t manual);
int e4k_set_enh_gain(struct e4k_state *e4k, int32_t gain);
int e4k_dump(struct e4k_state *e4k);
#endif /* _E4K_TUNER_H */

View File

@ -335,6 +335,12 @@ static int cmd_tuner_iqofs(struct cmd_state *cs, enum cmd_op op,
return e4k_manual_dc_offset(&e4k, iofs, irange, qofs, qrange);
}
static int cmd_tuner_dump(struct cmd_state *cs, enum cmd_op op,
const char *cmd, int argc, char ** argv)
{
return e4k_dump(&e4k);
}
static int cmd_dfu(struct cmd_state *cs, enum cmd_op op,
const char *cmd, int argc, char ** argv)
{
@ -345,6 +351,8 @@ static int cmd_dfu(struct cmd_state *cs, enum cmd_op op,
static struct cmd cmds[] = {
{ "tuner.init", CMD_OP_EXEC, cmd_tuner_init,
"Initialize the tuner" },
{ "tuner.dump", CMD_OP_EXEC, cmd_tuner_dump,
"Dump E4k registers" },
{ "tuner.freq", CMD_OP_SET|CMD_OP_GET, cmd_rf_freq,
"Tune to the specified frequency" },
{ "tuner.gain", CMD_OP_SET, cmd_tuner_gain,

View File

@ -588,3 +588,13 @@ void USBDDriverCallbacks_InterfaceSettingChanged(unsigned char interface,
else
LED_Set(USBD_LEDOTHER);
}
void fastsource_dump(void)
{
struct req_ctx *rctx, *rctx2;
printf("usb pending:");
llist_for_each_entry_safe(rctx, rctx2, &usb_state.queue, list)
printf(" %02d", req_ctx_num(rctx));
printf("\n\r");
}

View File

@ -277,7 +277,16 @@ static int cmd_ssc_stats(struct cmd_state *cs, enum cmd_op op,
static int cmd_ssc_dump(struct cmd_state *cs, enum cmd_op op,
const char *cmd, int argc, char **argv)
{
struct req_ctx *rctx, *rctx2;
dma_dump_regs();
req_ctx_dump();
printf("ssc pending:");
llist_for_each_entry_safe(rctx, rctx2, &ssc_state.pending_rctx, list)
printf(" %02d", req_ctx_num(rctx));
printf("\n\r");
fastsource_dump();
}
static struct cmd cmds[] = {

View File

@ -129,3 +129,15 @@ void req_ctx_enqueue(struct llist_head *list, struct req_ctx *rctx)
llist_add_tail(&rctx->list, list);
local_irq_restore(flags);
}
void req_ctx_dump()
{
int i;
local_irq_save(flags);
printf("ctx status: ");
for(i = 0; i < NUM_REQ_CTX; i++)
printf(" %02x", req_ctx[i].state);
local_irq_restore(flags);
printf("\n\r");
}

View File

@ -969,3 +969,16 @@ int e4k_init(struct e4k_state *e4k)
return 0;
}
int e4k_dump(struct e4k_state *e4k)
{
int i;
for(i = 0; i < 64; i++)
printf("0x%02x: 0x%02x 0x%02x: 0x%02x 0x%02x: 0x%02x 0x%02x: 0x%02x\n\r",
i, e4k_reg_read(e4k, i),
i + 64, e4k_reg_read(e4k, i + 64),
i + 128, e4k_reg_read(e4k, i + 128),
i + 192, e4k_reg_read(e4k, i + 192)
);
}

View File

@ -145,4 +145,11 @@ void fastsource_start(void)
USBD_Write(EP_NR, test_data, sizeof(test_data), wr_compl_cb, NULL);
}
void fastsource_dump(void)
{
printf("usb pending: ");
printf("ssc pending:");
llist_for_each_entry_safe(rctx, rctx2, &ssc_state.pending_rctx, list)
printf(" %d", req_ctx_num(rctx));
printf("\r\n");
}

View File

@ -16,3 +16,4 @@
void fastsource_init(void);
void fastsource_start(void);
void fastsource_req_hdlr(const USBGenericRequest *request);
void fastsource_dump(void);