|
@@ -31,14 +31,6 @@ struct debugifc_mask_item {
|
|
|
unsigned long msk;
|
|
|
};
|
|
|
|
|
|
-static struct debugifc_mask_item mask_items[] = {
|
|
|
- {"ENC_FIRMWARE",(1<<PVR2_SUBSYS_B_ENC_FIRMWARE)},
|
|
|
- {"ENC_CFG",(1<<PVR2_SUBSYS_B_ENC_CFG)},
|
|
|
- {"DIG_RUN",(1<<PVR2_SUBSYS_B_DIGITIZER_RUN)},
|
|
|
- {"USB_RUN",(1<<PVR2_SUBSYS_B_USBSTREAM_RUN)},
|
|
|
- {"ENC_RUN",(1<<PVR2_SUBSYS_B_ENC_RUN)},
|
|
|
-};
|
|
|
-
|
|
|
|
|
|
static unsigned int debugifc_count_whitespace(const char *buf,
|
|
|
unsigned int count)
|
|
@@ -148,134 +140,14 @@ static int debugifc_match_keyword(const char *buf,unsigned int count,
|
|
|
}
|
|
|
|
|
|
|
|
|
-static unsigned long debugifc_find_mask(const char *buf,unsigned int count)
|
|
|
-{
|
|
|
- struct debugifc_mask_item *mip;
|
|
|
- unsigned int idx;
|
|
|
- for (idx = 0; idx < ARRAY_SIZE(mask_items); idx++) {
|
|
|
- mip = mask_items + idx;
|
|
|
- if (debugifc_match_keyword(buf,count,mip->name)) {
|
|
|
- return mip->msk;
|
|
|
- }
|
|
|
- }
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-static int debugifc_print_mask(char *buf,unsigned int sz,
|
|
|
- unsigned long msk,unsigned long val)
|
|
|
-{
|
|
|
- struct debugifc_mask_item *mip;
|
|
|
- unsigned int idx;
|
|
|
- int bcnt = 0;
|
|
|
- int ccnt;
|
|
|
- for (idx = 0; idx < ARRAY_SIZE(mask_items); idx++) {
|
|
|
- mip = mask_items + idx;
|
|
|
- if (!(mip->msk & msk)) continue;
|
|
|
- ccnt = scnprintf(buf,sz,"%s%c%s",
|
|
|
- (bcnt ? " " : ""),
|
|
|
- ((mip->msk & val) ? '+' : '-'),
|
|
|
- mip->name);
|
|
|
- sz -= ccnt;
|
|
|
- buf += ccnt;
|
|
|
- bcnt += ccnt;
|
|
|
- }
|
|
|
- return bcnt;
|
|
|
-}
|
|
|
-
|
|
|
-static unsigned int debugifc_parse_subsys_mask(const char *buf,
|
|
|
- unsigned int count,
|
|
|
- unsigned long *mskPtr,
|
|
|
- unsigned long *valPtr)
|
|
|
-{
|
|
|
- const char *wptr;
|
|
|
- unsigned int consume_cnt = 0;
|
|
|
- unsigned int scnt;
|
|
|
- unsigned int wlen;
|
|
|
- int mode;
|
|
|
- unsigned long m1,msk,val;
|
|
|
-
|
|
|
- msk = 0;
|
|
|
- val = 0;
|
|
|
-
|
|
|
- while (count) {
|
|
|
- scnt = debugifc_isolate_word(buf,count,&wptr,&wlen);
|
|
|
- if (!scnt) break;
|
|
|
- consume_cnt += scnt; count -= scnt; buf += scnt;
|
|
|
- if (!wptr) break;
|
|
|
-
|
|
|
- mode = 0;
|
|
|
- if (wlen) switch (wptr[0]) {
|
|
|
- case '+':
|
|
|
- wptr++;
|
|
|
- wlen--;
|
|
|
- break;
|
|
|
- case '-':
|
|
|
- mode = 1;
|
|
|
- wptr++;
|
|
|
- wlen--;
|
|
|
- break;
|
|
|
- }
|
|
|
- if (!wlen) continue;
|
|
|
- m1 = debugifc_find_mask(wptr,wlen);
|
|
|
- if (!m1) break;
|
|
|
- msk |= m1;
|
|
|
- if (!mode) val |= m1;
|
|
|
- }
|
|
|
- *mskPtr = msk;
|
|
|
- *valPtr = val;
|
|
|
- return consume_cnt;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
int pvr2_debugifc_print_info(struct pvr2_hdw *hdw,char *buf,unsigned int acnt)
|
|
|
{
|
|
|
int bcnt = 0;
|
|
|
int ccnt;
|
|
|
- struct pvr2_hdw_debug_info dbg;
|
|
|
-
|
|
|
- pvr2_hdw_get_debug_info(hdw,&dbg);
|
|
|
-
|
|
|
- ccnt = scnprintf(buf,acnt,"big lock %s; ctl lock %s",
|
|
|
- (dbg.big_lock_held ? "held" : "free"),
|
|
|
- (dbg.ctl_lock_held ? "held" : "free"));
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- if (dbg.ctl_lock_held) {
|
|
|
- ccnt = scnprintf(buf,acnt,"; cmd_state=%d cmd_code=%d"
|
|
|
- " cmd_wlen=%d cmd_rlen=%d"
|
|
|
- " wpend=%d rpend=%d tmout=%d rstatus=%d"
|
|
|
- " wstatus=%d",
|
|
|
- dbg.cmd_debug_state,dbg.cmd_code,
|
|
|
- dbg.cmd_debug_write_len,
|
|
|
- dbg.cmd_debug_read_len,
|
|
|
- dbg.cmd_debug_write_pend,
|
|
|
- dbg.cmd_debug_read_pend,
|
|
|
- dbg.cmd_debug_timeout,
|
|
|
- dbg.cmd_debug_rstatus,
|
|
|
- dbg.cmd_debug_wstatus);
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- }
|
|
|
- ccnt = scnprintf(buf,acnt,"\n");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(
|
|
|
- buf,acnt,"driver flags: %s %s %s\n",
|
|
|
- (dbg.flag_init_ok ? "initialized" : "uninitialized"),
|
|
|
- (dbg.flag_ok ? "ok" : "fail"),
|
|
|
- (dbg.flag_disconnected ? "disconnected" : "connected"));
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"Subsystems enabled / configured: ");
|
|
|
+ ccnt = scnprintf(buf,acnt,"Driver state info:\n");
|
|
|
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = debugifc_print_mask(buf,acnt,dbg.subsys_flags,dbg.subsys_flags);
|
|
|
+ ccnt = pvr2_hdw_state_report(hdw,buf,acnt);
|
|
|
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"\n");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"Subsystems disabled / unconfigured: ");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = debugifc_print_mask(buf,acnt,~dbg.subsys_flags,dbg.subsys_flags);
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"\n");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
-
|
|
|
ccnt = scnprintf(buf,acnt,"Attached I2C modules:\n");
|
|
|
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
ccnt = pvr2_i2c_report(hdw,buf,acnt);
|
|
@@ -290,7 +162,6 @@ int pvr2_debugifc_print_status(struct pvr2_hdw *hdw,
|
|
|
{
|
|
|
int bcnt = 0;
|
|
|
int ccnt;
|
|
|
- unsigned long msk;
|
|
|
int ret;
|
|
|
u32 gpio_dir,gpio_in,gpio_out;
|
|
|
|
|
@@ -311,28 +182,6 @@ int pvr2_debugifc_print_status(struct pvr2_hdw *hdw,
|
|
|
pvr2_hdw_get_streaming(hdw) ? "on" : "off");
|
|
|
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
|
|
|
- msk = pvr2_hdw_subsys_get(hdw);
|
|
|
- ccnt = scnprintf(buf,acnt,"Subsystems enabled / configured: ");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = debugifc_print_mask(buf,acnt,msk,msk);
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"\n");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"Subsystems disabled / unconfigured: ");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = debugifc_print_mask(buf,acnt,~msk,msk);
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"\n");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
-
|
|
|
- msk = pvr2_hdw_subsys_stream_get(hdw);
|
|
|
- ccnt = scnprintf(buf,acnt,"Subsystems stopped on stream shutdown: ");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = debugifc_print_mask(buf,acnt,msk,msk);
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
- ccnt = scnprintf(buf,acnt,"\n");
|
|
|
- bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
|
|
-
|
|
|
return bcnt;
|
|
|
}
|
|
|
|
|
@@ -369,28 +218,10 @@ static int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf,
|
|
|
return pvr2_upload_firmware2(hdw);
|
|
|
} else if (debugifc_match_keyword(wptr,wlen,"decoder")) {
|
|
|
return pvr2_hdw_cmd_decoder_reset(hdw);
|
|
|
+ } else if (debugifc_match_keyword(wptr,wlen,"worker")) {
|
|
|
+ return pvr2_hdw_untrip(hdw);
|
|
|
}
|
|
|
return -EINVAL;
|
|
|
- } else if (debugifc_match_keyword(wptr,wlen,"subsys_flags")) {
|
|
|
- unsigned long msk = 0;
|
|
|
- unsigned long val = 0;
|
|
|
- if (debugifc_parse_subsys_mask(buf,count,&msk,&val) != count) {
|
|
|
- pvr2_trace(PVR2_TRACE_DEBUGIFC,
|
|
|
- "debugifc parse error on subsys mask");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- pvr2_hdw_subsys_bit_chg(hdw,msk,val);
|
|
|
- return 0;
|
|
|
- } else if (debugifc_match_keyword(wptr,wlen,"stream_flags")) {
|
|
|
- unsigned long msk = 0;
|
|
|
- unsigned long val = 0;
|
|
|
- if (debugifc_parse_subsys_mask(buf,count,&msk,&val) != count) {
|
|
|
- pvr2_trace(PVR2_TRACE_DEBUGIFC,
|
|
|
- "debugifc parse error on stream mask");
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- pvr2_hdw_subsys_stream_bit_chg(hdw,msk,val);
|
|
|
- return 0;
|
|
|
} else if (debugifc_match_keyword(wptr,wlen,"cpufw")) {
|
|
|
scnt = debugifc_isolate_word(buf,count,&wptr,&wlen);
|
|
|
if (!scnt) return -EINVAL;
|