summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorJohannes Stezenbach <devnull@localhost>2003-02-11 19:25:54 +0000
committerJohannes Stezenbach <devnull@localhost>2003-02-11 19:25:54 +0000
commitb19cb6ea2a22fba0acc996580ceb9013c8bb5350 (patch)
treef113a098cf7cc23a4bc6a632534f3c5317184063 /linux/drivers/media/dvb
parentc42afdb957d5781cf1b35773060d1d9e636c6042 (diff)
downloadmediapointer-dvb-s2-b19cb6ea2a22fba0acc996580ceb9013c8bb5350.tar.gz
mediapointer-dvb-s2-b19cb6ea2a22fba0acc996580ceb9013c8bb5350.tar.bz2
- restructured build-2.4 stuff so it is no longer necessary to
copy videodev.h and videodev2.h to /usr/src/linux/include/ - merged av7110.c error message and COM_DEBUG stuff from DVB-HEAD - added a insmod.sh which uses modules from pwd, to avoid 'make install'
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/ttpci/av7110.c136
1 files changed, 96 insertions, 40 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c
index aeaef1045..44b4dbe02 100644
--- a/linux/drivers/media/dvb/ttpci/av7110.c
+++ b/linux/drivers/media/dvb/ttpci/av7110.c
@@ -30,6 +30,9 @@
#define NEW_CI 1
+/* for debugging ARM communication: */
+//#define COM_DEBUG
+
#define __KERNEL_SYSCALLS__
#include <linux/module.h>
#include <linux/init.h>
@@ -371,7 +374,7 @@ static int arm_thread(void *data)
up(&av7110->dcomlock);
if (newloops==av7110->arm_loops) {
- printk("av7110%d: ARM crashed!\n",
+ printk(KERN_ERR "av7110%d: ARM crashed!\n",
av7110->dvb_adapter->num);
arm_error(av7110);
@@ -1256,34 +1259,35 @@ void gpioirq (unsigned long data)
static int OutCommand(av7110_t *av7110, u16* buf, int length)
{
int i;
- u32 start;
+ u32 start;
+#ifdef COM_DEBUG
+ u32 stat;
+#endif
- DEB_EE(("av7110: %p\n",av7110));
+ DEB_EE(("av7110: %p\n",av7110));
if (!av7110->arm_ready) {
DEB_D(("arm not ready.\n"));
return -1;
}
-
+
start = jiffies;
while ( rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 ) )
{
ddelay(1);
if ((jiffies - start) > ARM_WAIT_FREE) {
- DEB_D(("outcommand error 1\n"));
- //arm_error(av7110);
+ printk(KERN_ERR "%s: timeout waiting for COMMAND idle\n", __FUNCTION__);
return -1;
}
}
#ifndef _NOHANDSHAKE
start = jiffies;
- while ( rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 ) )
+ while ( rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 ) )
{
ddelay(1);
if ((jiffies - start) > ARM_WAIT_SHAKE) {
- DEB_D(("outcommand error 2\n"));
- //arm_error(av7110);
+ printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
return -1;
}
}
@@ -1293,11 +1297,9 @@ static int OutCommand(av7110_t *av7110, u16* buf, int length)
while ( rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2) & OSDQFull )
{
ddelay(1);
- if ((jiffies - start) > ARM_WAIT_OSD)
- {
- DEB_D(("outcommand error 3\n"));
- //arm_error(av7110);
- return -1;
+ if ((jiffies - start) > ARM_WAIT_OSD) {
+ printk(KERN_ERR "%s: timeout waiting for !OSDQFull\n", __FUNCTION__);
+ return -1;
}
}
for (i=2; i<length; i++)
@@ -1310,6 +1312,28 @@ static int OutCommand(av7110_t *av7110, u16* buf, int length)
wdebi(av7110, DEBINOSWAP, COMMAND, (u32) buf[0], 2);
+#ifdef COM_DEBUG
+ start = jiffies;
+ while ( rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 ) )
+ {
+ ddelay(1);
+ if ((jiffies - start) > ARM_WAIT_FREE) {
+ printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__);
+ return -1;
+ }
+ }
+
+ stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
+ if (stat & GPMQOver) {
+ printk(KERN_ERR "%s: GPMQOver\n", __FUNCTION__);
+ return -1;
+ }
+ else if (stat & OSDQOver) {
+ printk(KERN_ERR "%s: OSDQOver\n", __FUNCTION__);
+ return -1;
+ }
+#endif
+
return 0;
}
@@ -1330,6 +1354,8 @@ SOutCommand(av7110_t *av7110, u16* buf, int length)
ret=OutCommand(av7110, buf, length);
up(&av7110->dcomlock);
+ if (ret)
+ printk("SOutCommand error\n");
return ret;
}
@@ -1338,7 +1364,7 @@ static int outcom(av7110_t *av7110, int type, int com, int num, ...)
{
va_list args;
u16 buf[num+2];
- int i;
+ int i, ret;
DEB_EE(("av7110: %p\n",av7110));
@@ -1352,12 +1378,15 @@ static int outcom(av7110_t *av7110, int type, int com, int num, ...)
va_end(args);
}
- return SOutCommand(av7110, buf, num+2);
+ ret = SOutCommand(av7110, buf, num+2);
+ if (ret)
+ printk("outcom error\n");
+ return ret;
}
int SendCICommand(av7110_t *av7110, u8 subcom, u8 *Params, u8 ParamLen)
{
- int i;
+ int i, ret;
u16 CommandBuffer[18] = { ((COMTYPE_COMMON_IF << 8) + subcom),
16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -1371,7 +1400,10 @@ int SendCICommand(av7110_t *av7110, u8 subcom, u8 *Params, u8 ParamLen)
CommandBuffer[(i/2)+2] |= Params[i];
}
- return SOutCommand(av7110, CommandBuffer, 18);
+ ret = SOutCommand(av7110, CommandBuffer, 18);
+ if (ret)
+ printk("SendCICommand error\n");
+ return ret;
}
@@ -1380,8 +1412,11 @@ static int CommandRequest(av7110_t *av7110, u16 *Buff, int length, u16 *buf, int
int err;
s16 i;
u32 start;
-
- DEB_EE(("av7110: %p\n",av7110));
+#ifdef COM_DEBUG
+ u32 stat;
+#endif
+
+ DEB_EE(("av7110: %p\n",av7110));
if (!av7110->arm_ready) {
DEB_D(("arm not ready.\n"));
@@ -1393,39 +1428,52 @@ static int CommandRequest(av7110_t *av7110, u16 *Buff, int length, u16 *buf, int
if ((err = OutCommand(av7110, Buff, length)) < 0) {
up(&av7110->dcomlock);
+ printk("CommandRequest error\n");
return err;
}
-
+
start = jiffies;
- while ( rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) )
+ while ( rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) )
{
#ifdef _NOHANDSHAKE
ddelay(1);
#endif
if ((jiffies - start) > ARM_WAIT_FREE) {
- DEB_D(("commandrequest error 1\n"));
+ printk("%s: timeout waiting for COMMAND to complete\n", __FUNCTION__);
up(&av7110->dcomlock);
- //arm_error(av7110);
return -1;
}
}
-
+
#ifndef _NOHANDSHAKE
start = jiffies;
while ( rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 ) ) {
ddelay(1);
if ((jiffies - start) > ARM_WAIT_SHAKE) {
- DEB_D(("commandrequest error 2\n"));
+ printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
up(&av7110->dcomlock);
- //arm_error(av7110);
return -1;
}
}
#endif
+#ifdef COM_DEBUG
+ stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
+ if (stat & GPMQOver) {
+ printk(KERN_ERR "%s: GPMQOver\n", __FUNCTION__);
+ up(&av7110->dcomlock);
+ return -1;
+ }
+ else if (stat & OSDQOver) {
+ printk(KERN_ERR "%s: OSDQOver\n", __FUNCTION__);
+ up(&av7110->dcomlock);
+ return -1;
+ }
+#endif
+
for (i=0; i<n; i++)
buf[i] = rdebi(av7110, DEBINOSWAP, COM_BUFF + 2*i, 0, 2);
-
+
up(&av7110->dcomlock);
return 0;
}
@@ -1434,7 +1482,11 @@ static int CommandRequest(av7110_t *av7110, u16 *Buff, int length, u16 *buf, int
static inline int
RequestParameter(av7110_t *av7110, u16 tag, u16* Buff, s16 length)
{
- return CommandRequest(av7110, &tag, 0, Buff, length);
+ int ret;
+ ret = CommandRequest(av7110, &tag, 0, Buff, length);
+ if (ret)
+ printk("RequestParameter error\n");
+ return ret;
}
@@ -1534,9 +1586,8 @@ static int FlushText(av7110_t *av7110)
while ( rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2 ) ) {
ddelay(1);
if ((jiffies - start) > ARM_WAIT_OSD) {
- printk("outtext error\n");
+ printk(KERN_ERR "%s: timeout waiting for BUFF1_BASE == 0\n", __FUNCTION__);
up(&av7110->dcomlock);
- //arm_error(av7110);
return -1;
}
}
@@ -1558,9 +1609,8 @@ static int WriteText(av7110_t *av7110, u8 win, u16 x, u16 y, u8* buf)
while ( rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2 ) ) {
ddelay(1);
if ((jiffies - start) > ARM_WAIT_OSD) {
- printk("outtext error\n");
+ printk(KERN_ERR "%s: timeout waiting for BUFF1_BASE == 0\n", __FUNCTION__);
up(&av7110->dcomlock);
- //arm_error(av7110);
return -1;
}
}
@@ -1569,9 +1619,8 @@ static int WriteText(av7110_t *av7110, u8 win, u16 x, u16 y, u8* buf)
while ( rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 ) ) {
ddelay(1);
if ((jiffies - start) > ARM_WAIT_SHAKE) {
- printk("outtext error\n");
+ printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
up(&av7110->dcomlock);
- //arm_error(av7110);
return -1;
}
}
@@ -1583,6 +1632,8 @@ static int WriteText(av7110_t *av7110, u8 win, u16 x, u16 y, u8* buf)
wdebi(av7110, DEBINOSWAP, BUFF1_BASE + i*2, 0, 2);
ret=OutCommand(av7110, cbuf, 5);
up(&av7110->dcomlock);
+ if (ret)
+ printk("WriteText error\n");
return ret;
}
@@ -2087,7 +2138,7 @@ bootarm(av7110_t *av7110)
/* test DEBI */
iwdebi(av7110, DEBISWAP, DPRAM_BASE, 0x76543210, 4);
if ((ret=irdebi(av7110, DEBINOSWAP, DPRAM_BASE, 0, 4))!=0x10325476) {
- printk("dvb: debi test in bootarm() failed: "
+ printk(KERN_ERR "dvb: debi test in bootarm() failed: "
"%08x != %08x\n", ret, 0x10325476);;
return -1;
}
@@ -2261,7 +2312,8 @@ SendDiSEqCMsg(av7110_t *av7110, int len, u8 *msg, int burst)
for (i=0; i<len; i++)
buf[i+4]=msg[i];
- SOutCommand(av7110, buf, 18);
+ if (SOutCommand(av7110, buf, 18))
+ printk("SendDiSEqCMsg error\n");
/*
break;
}
@@ -2809,8 +2861,10 @@ StartHWFilter(struct dvb_demux_filter *dvbdmxfilter)
buf[3] = mode;
ret=CommandRequest(av7110, buf, 20, &handle, 1);
- if (ret<0)
+ if (ret<0) {
+ printk("StartHWFilter error\n");
return ret;
+ }
av7110->handle2filter[handle]=dvbdmxfilter;
dvbdmxfilter->hw_handle=handle;
@@ -2843,6 +2897,8 @@ StopHWFilter(struct dvb_demux_filter *dvbdmxfilter)
buf[1] = 1;
buf[2] = handle;
ret=CommandRequest(av7110, buf, 3, answ, 2);
+ if (ret)
+ printk("StopHWFilter error\n");
if (answ[1] != handle) {
DEB_S(("dvb: filter %d shutdown error :%d\n", handle, answ[1]));
@@ -3375,12 +3431,12 @@ int dvb_ca_ioctl(struct inode *inode, struct file *file,
case CA_SET_DESCR:
{
ca_descr_t *descr=(ca_descr_t*) parg;
-
+
if (descr->index>=16)
return -EINVAL;
if (descr->parity>1)
return -EINVAL;
- outcom(av7110, COMTYPE_PIDFILTER, SetDescr, 5,
+ outcom(av7110, COMTYPE_PIDFILTER, SetDescr, 5,
(descr->index<<8)|descr->parity,
(descr->cw[0]<<8)|descr->cw[1],
(descr->cw[2]<<8)|descr->cw[3],