summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/ttpci/av7110_hw.c
diff options
context:
space:
mode:
authorOliver Endriss <devnull@localhost>2004-12-01 00:30:19 +0000
committerOliver Endriss <devnull@localhost>2004-12-01 00:30:19 +0000
commit561aabb441883dd7ea9324a06228caa2da1cd352 (patch)
treecf572ae3301a59eafbfa2639037d2809021a1c51 /linux/drivers/media/dvb/ttpci/av7110_hw.c
parentd9a76038b71ce19fe955339bcca215bf2cf75330 (diff)
downloadmediapointer-dvb-s2-561aabb441883dd7ea9324a06228caa2da1cd352.tar.gz
mediapointer-dvb-s2-561aabb441883dd7ea9324a06228caa2da1cd352.tar.bz2
__av7110_send_fw_cmd(): added some sanity checks suggested by Werner Fink
Diffstat (limited to 'linux/drivers/media/dvb/ttpci/av7110_hw.c')
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110_hw.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110_hw.c b/linux/drivers/media/dvb/ttpci/av7110_hw.c
index 82cf9c4ab..45de1f8ee 100644
--- a/linux/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/linux/drivers/media/dvb/ttpci/av7110_hw.c
@@ -297,9 +297,9 @@ int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
{
int i;
unsigned long start;
-#ifdef COM_DEBUG
+ char *type = NULL;
+ u16 flags[2] = {0, 0};
u32 stat;
-#endif
// dprintk(4, "%p\n", av7110);
@@ -330,14 +330,45 @@ int __av7110_send_fw_cmd(struct av7110 *av7110, u16* buf, int length)
}
#endif
- start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2) & OSDQFull) {
- msleep(1);
- if (time_after(jiffies, start + ARM_WAIT_OSD)) {
- printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for !OSDQFull\n", __FUNCTION__);
- return -1;
+ switch ((buf[0] >> 8) & 0xff) {
+ case COMTYPE_PIDFILTER:
+ case COMTYPE_ENCODER:
+ case COMTYPE_REC_PLAY:
+ case COMTYPE_MPEGDECODER:
+ type = "MSG";
+ flags[0] = GPMQOver;
+ flags[1] = GPMQFull;
+ break;
+ case COMTYPE_OSD:
+ type = "OSD";
+ flags[0] = OSDQOver;
+ flags[1] = OSDQFull;
+ break;
+ default:
+ break;
+ }
+
+ if (type != NULL) {
+ /* non-immediate COMMAND type */
+ start = jiffies;
+ for (;;) {
+ stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
+ if (stat & flags[0]) {
+ printk(KERN_ERR "%s: %s QUEUE overflow\n",
+ __FUNCTION__, type);
+ return -1;
+ }
+ if ((stat & flags[1]) == 0)
+ break;
+ if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n",
+ __FUNCTION__, type);
+ return -1;
+ }
+ msleep(1);
}
}
+
for (i = 2; i < length; i++)
wdebi(av7110, DEBINOSWAP, COMMAND + 2 * i, (u32) buf[i], 2);