summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2002-12-23 15:22:04 +0000
committerMichael Hunold <devnull@localhost>2002-12-23 15:22:04 +0000
commit0a77956ce8816e957f40b1b5437c6b3e2fd62e34 (patch)
tree3f9c298dde182706b080cc8508cd49647ac9d39a /linux
parent18668795699dd3d92b5bb1565103918fa0e4e2e6 (diff)
downloadmediapointer-dvb-s2-0a77956ce8816e957f40b1b5437c6b3e2fd62e34.tar.gz
mediapointer-dvb-s2-0a77956ce8816e957f40b1b5437c6b3e2fd62e34.tar.bz2
Changed the debug messages to use a similar system like saa7146, it's
possible to create a complete call trace now. (You can #if 0 this out, if you are concerned about runtime drawbacks...)
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/av7110/av7110.c300
1 files changed, 234 insertions, 66 deletions
diff --git a/linux/drivers/media/dvb/av7110/av7110.c b/linux/drivers/media/dvb/av7110/av7110.c
index d6cb1ebe7..a2f8448aa 100644
--- a/linux/drivers/media/dvb/av7110/av7110.c
+++ b/linux/drivers/media/dvb/av7110/av7110.c
@@ -73,12 +73,10 @@
#include "dvb_i2c.h"
#include "dvb_frontend.h"
-// #include "compat.h"
#include "av7110.h"
#include "av7110_ipack.h"
-
static int AV_StartPlay(av7110_t *av7110, int av);
static void restart_feeds(av7110_t *av7110);
static int bootarm(av7110_t *av7110);
@@ -91,7 +89,19 @@ void pes_to_ts(u8 const *buf, long int length, u16 pid, p2t_t *p);
void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter, struct dvb_demux_feed *feed);
static int av7110_debug = 0;
-#define dprintk if (av7110_debug) printk
+#if 1
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
+ #define KBUILD_MODNAME av7110
+#endif
+#define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__)
+#define DEB_S(x) if (0!=(av7110_debug&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */
+#define DEB_D(x) if (0!=(av7110_debug&0x02)) { DEBUG_PROLOG; printk x; } /* more detailed debug messages */
+#define DEB_EE(x) if (0!=(av7110_debug&0x04)) { DEBUG_PROLOG; printk x; } /* print enter and exit of functions */
+#else
+#define DEB_S(x)
+#define DEB_D(x)
+#define DEB_EE(x)
+#endif
static int vidmode=CVBS_RGB_OUT;
static int pids_off;
@@ -118,7 +128,7 @@ inline static void
setgpio(av7110_t *av7110, int port, u32 data)
{
struct saa7146_dev *dev = av7110->dev;
- u32 val;
+ u32 val = 0;
val=saa7146_read(dev,GPIO_CTRL);
val&=~(0xff << (8*(port)));
@@ -169,6 +179,8 @@ static int debiwrite(av7110_t *av7110, u32 config,
struct saa7146_dev *dev = av7110->dev;
u32 cmd;
+// DEB_EE(("av7110: %p\n",av7110));
+
if (count <= 0 || count > 32764)
return -1;
if (wait_for_debi_done(av7110) < 0)
@@ -188,6 +200,8 @@ static u32 debiread(av7110_t *av7110, u32 config, int addr, int count)
struct saa7146_dev *dev = av7110->dev;
u32 result = 0;
+// DEB_EE(("av7110: %p\n",av7110));
+
if (count > 32764 || count <= 0)
return 0;
if (wait_for_debi_done(av7110) < 0)
@@ -267,6 +281,8 @@ ARM_ResetMailBox(av7110_t *av7110)
{
unsigned long flags;
+ DEB_EE(("av7110: %p\n",av7110));
+
spin_lock_irqsave(&av7110->debilock, flags);
debiread(av7110, DEBINOSWAP, IRQ_RX, 2);
//printk("dvb: IRQ_RX=%d\n", debiread(av7110, DEBINOSWAP, IRQ_RX, 2));
@@ -277,18 +293,24 @@ ARM_ResetMailBox(av7110_t *av7110)
static inline void
ARM_ClearMailBox(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
iwdebi(av7110, DEBINOSWAP, IRQ_RX, 0, 2);
}
static inline void
ARM_ClearIrq(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
irdebi(av7110, DEBINOSWAP, IRQ_RX, 0, 2);
}
static void
reset_arm(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
setgpio(av7110, RESET_LINE, GPIO_OUTLO);
/* Disable DEBI and GPIO irq */
@@ -316,6 +338,8 @@ reset_arm(av7110_t *av7110)
static void
recover_arm(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (current->files)
bootarm(av7110);
else {
@@ -329,6 +353,8 @@ recover_arm(av7110_t *av7110)
static void
arm_error(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
av7110->arm_errors++;
av7110->arm_ready=0;
recover_arm(av7110);
@@ -337,8 +363,10 @@ arm_error(av7110_t *av7110)
static int arm_thread(void *data)
{
av7110_t *av7110 = data;
- u16 newloops;
-
+ u16 newloops = 0;
+
+ DEB_EE(("av7110: %p\n",av7110));
+
lock_kernel();
#if 0
daemonize();
@@ -388,6 +416,8 @@ record_cb(dvb_filter_pes2ts_t *p2t, u8 *buf, size_t len)
{
struct dvb_demux_feed *dvbdmxfeed=(struct dvb_demux_feed *) p2t->priv;
+ DEB_EE(("dvb_filter_pes2ts_t:%p\n",p2t));
+
if (!(dvbdmxfeed->ts_type & TS_PACKET))
return 0;
if (buf[3]==0xe0) // video PES do not have a length in TS
@@ -403,6 +433,8 @@ static int
dvb_filter_pes2ts_cb(void *priv, unsigned char *data)
{
struct dvb_demux_feed *dvbdmxfeed=(struct dvb_demux_feed *) priv;
+
+ DEB_EE(("dvb_demux_feed:%p\n",dvbdmxfeed));
dvbdmxfeed->cb.ts(data, 188, 0, 0,
&dvbdmxfeed->feed.ts,
@@ -416,6 +448,8 @@ AV_StartRecord(av7110_t *av7110, int av,
{
struct dvb_demux *dvbdmx=dvbdmxfeed->demux;
+ DEB_EE(("av7110: %p, dvb_demux_feed:%p\n",av7110,dvbdmxfeed));
+
if (av7110->playing||(av7110->rec_mode&av))
return -EBUSY;
outcom(av7110, COMTYPE_REC_PLAY, __Stop, 0);
@@ -457,6 +491,8 @@ AV_StartRecord(av7110_t *av7110, int av,
static int
AV_StartPlay(av7110_t *av7110, int av)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->rec_mode)
return -EBUSY;
if (av7110->playing&av)
@@ -489,7 +525,9 @@ AV_StartPlay(av7110_t *av7110, int av)
static void
AV_Stop(av7110_t *av7110, int av)
{
- if (!(av7110->playing&av) && !(av7110->rec_mode&av))
+ DEB_EE(("av7110: %p\n",av7110));
+
+ if (!(av7110->playing&av) && !(av7110->rec_mode&av))
return;
outcom(av7110, COMTYPE_REC_PLAY, __Stop, 0);
@@ -601,8 +639,7 @@ ring_buffer_write(ring_buffer_t *rbuf,
(ring_buffer_free(rbuf)>2048)))
return count-todo;
}
- dprintk ("function: %s pread=%08x pwrite=%08x\n", __FUNCTION__,
- rbuf->pread, rbuf->pwrite);
+ DEB_S(("pread=%08x, pwrite=%08x\n",rbuf->pread, rbuf->pwrite));
//mdelay(2);
free = rbuf->pread - rbuf->pwrite;
split=rbuf->size;
@@ -651,7 +688,7 @@ ring_buffer_put(ring_buffer_t *db, u8 *buf, int len)
} else
split=0;
if (len>=fsize) {
- dprintk("buffer overflow\n");
+ DEB_S(("buffer overflow, len:%d, size:%d\n",len,size));
return;
}
if (split>=len)
@@ -674,6 +711,8 @@ ring_buffer_put(ring_buffer_t *db, u8 *buf, int len)
static int
TTBStop(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (--av7110->feeding)
return av7110->feeding;
saa7146_write(av7110->dev, MC1, MASK_20); // DMA3 off
@@ -697,6 +736,8 @@ TTBStart(av7110_t *av7110)
{
struct saa7146_dev *dev=av7110->dev;
+ DEB_EE(("av7110: %p\n",av7110));
+
//printk ("function : %s\n", __FUNCTION__);
if (av7110->feeding)
return ++av7110->feeding;
@@ -748,6 +789,8 @@ void av7110_setup_irc_config (av7110_t *av7110, u32 ir_config)
{
static av7110_t *last;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (!av7110)
av7110 = last;
else
@@ -760,13 +803,13 @@ static void (*irc_handler)(u32);
void av7110_register_irc_handler(void (*func)(u32))
{
- //dprintk("registering %08x\n",func);
+ //DEB_EE(("registering %08x\n",func));
irc_handler = func;
}
void av7110_unregister_irc_handler(void (*func)(u32))
{
- //dprintk("unregistering %08x\n",func);
+ //DEB_EE(("unregistering %08x\n",func));
irc_handler = NULL;
}
@@ -780,7 +823,7 @@ DECLARE_TASKLET(irtask,run_handlers,0);
void IR_handle(av7110_t *av7110, u32 ircom)
{
- dprintk("av7110: ircommand = %08x\n", ircom);
+ DEB_S(("av7110: ircommand = %08x\n", ircom));
irtask.data = (unsigned long) ircom;
tasklet_schedule(&irtask);
}
@@ -793,6 +836,8 @@ void CI_handle(av7110_t *av7110, u8 *data, u16 len)
{
//CI_out(av7110, data, len);
+ DEB_EE(("av7110: %p\n",av7110));
+
if (len<3)
return;
switch (data[0]) {
@@ -827,6 +872,8 @@ DvbDmxFilterCallback(u8 * buffer1, size_t buffer1_len,
dmx_success_t success,
av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (!dvbdmxfilter->feed->demux->dmx.frontend)
return 0;
if (dvbdmxfilter->feed->demux->dmx.frontend->source==DMX_MEMORY_FE)
@@ -890,7 +937,9 @@ static void fidbirq(struct saa7146_dev* saa, void *data)
av7110_t *av7110=(av7110_t *) data;
u8 *mem;
- mem=(av7110->tsf ? TS_HEIGHT*TS_WIDTH/2 :0)+(u8 *)av7110->grabbing;
+ DEB_EE(("av7110: %p\n",av7110));
+
+ mem=(av7110->tsf ? TS_HEIGHT*TS_WIDTH/2 :0)+(u8 *)av7110->grabbing;
// FIXME: think of something better without busy waiting
if (av7110->tsf)
@@ -916,6 +965,8 @@ void fidbirq (unsigned long data)
int num;
u32 dmapos;
+ DEB_EE(("av7110: %p\n",av7110));
+
dmapos=saa7146_read(av7110->dev, PCI_VDP3);
dmapos-=(dmapos%188);
@@ -994,8 +1045,8 @@ void debiirq (unsigned long data)
int type=av7110->debitype;
int handle=(type>>8)&0x1f;
-// printk("debiirq()\n");
-
+ DEB_EE(("av7110: %p\n",av7110));
+
print_time("debi");
IER_DISABLE(av7110->dev, MASK_19);
// saa7146_write(av7110->dev, IER,
@@ -1124,7 +1175,8 @@ pes_play(void *dest, ring_buffer_t *buf, int dlen)
u32 sync;
u16 blen;
- dprintk ("function : %s\n", __FUNCTION__);
+ DEB_EE(("ring_buffer_t: %p\n",buf));
+
if (!dlen) {
wake_up(&buf->queue);
return -1;
@@ -1170,8 +1222,7 @@ pes_play(void *dest, ring_buffer_t *buf, int dlen)
buf->data + buf->pread, len);
buf->pread = (buf->pread +len)%buf->size;
- dprintk ("function: %s pread=%08x pwrite=%08x\n", __FUNCTION__,
- buf->pread, buf->pwrite);
+ DEB_S(("pread=%08x, pwrite=%08x\n",buf->pread, buf->pwrite));
wake_up(&buf->queue);
return blen;
}
@@ -1183,11 +1234,12 @@ void gpioirq (unsigned long data)
u32 rxbuf, txbuf;
int len;
-// printk("GPIO0 irq\n");
+ DEB_EE(("av7110: %p\n",av7110));
- if (av7110->debitype !=-1)
- printk("GPIO0 irq oops\n");
-
+ if (av7110->debitype !=-1) {
+ DEB_D(("GPIO0 irq oops, av7110: %p\n",av7110));
+ }
+
spin_lock(&av7110->debilock);
ARM_ClearIrq(av7110);
@@ -1204,10 +1256,10 @@ void gpioirq (unsigned long data)
txbuf=irdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);
len=(av7110->debilen+3)&(~3);
- dprintk("GPIO0 irq %d %d\n", av7110->debitype, av7110->debilen);
+ DEB_D(("GPIO0 irq %d %d\n", av7110->debitype, av7110->debilen));
print_time("gpio");
- dprintk("GPIO0 irq %02x\n", av7110->debitype&0xff);
+ DEB_D(("GPIO0 irq %02x\n", av7110->debitype&0xff));
switch (av7110->debitype&0xff) {
case DATA_TS_PLAY:
@@ -1286,7 +1338,7 @@ void gpioirq (unsigned long data)
iwdebi(av7110, DEBINOSWAP, TX_BUFF, 0, 2);
break;
}
- dprintk("GPIO0 PES_PLAY len=%04x\n", len);
+ DEB_D(("GPIO0 PES_PLAY len=%04x\n", len));
iwdebi(av7110, DEBINOSWAP, TX_LEN, len, 2);
iwdebi(av7110, DEBINOSWAP, IRQ_STATE_EXT, len, 2);
wait_for_debi_done(av7110);
@@ -1370,7 +1422,7 @@ void gpioirq (unsigned long data)
ARM_ClearMailBox(av7110);
av7110->debitype=-1;
spin_unlock(&av7110->debilock);
- dprintk("GPIO0 irq exit 0\n");
+ DEB_D(("GPIO0 irq exit 0\n"));
}
@@ -1384,15 +1436,19 @@ static int OutCommand(av7110_t *av7110, u16* buf, int length)
int i;
u32 start;
- if (!av7110->arm_ready)
- return -1;
+ 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) {
- printk("outcommand error 1\n");
+ DEB_D(("outcommand error 1\n"));
//arm_error(av7110);
return -1;
}
@@ -1404,7 +1460,7 @@ static int OutCommand(av7110_t *av7110, u16* buf, int length)
{
ddelay(1);
if ((jiffies - start) > ARM_WAIT_SHAKE) {
- printk("outcommand error 2\n");
+ DEB_D(("outcommand error 2\n"));
//arm_error(av7110);
return -1;
}
@@ -1417,7 +1473,7 @@ static int OutCommand(av7110_t *av7110, u16* buf, int length)
ddelay(1);
if ((jiffies - start) > ARM_WAIT_OSD)
{
- printk("outcommand error 3\n");
+ DEB_D(("outcommand error 3\n"));
//arm_error(av7110);
return -1;
}
@@ -1440,9 +1496,13 @@ SOutCommand(av7110_t *av7110, u16* buf, int length)
{
int ret;
- if (!av7110->arm_ready)
- return -1;
+ DEB_EE(("av7110: %p\n",av7110));
+ if (!av7110->arm_ready) {
+ DEB_D(("arm not ready.\n"));
+ return -1;
+ }
+
if (down_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
@@ -1458,6 +1518,8 @@ static int outcom(av7110_t *av7110, int type, int com, int num, ...)
u16 buf[num+2];
int i;
+ DEB_EE(("av7110: %p\n",av7110));
+
buf[0]=(( type << 8 ) | com);
buf[1]=num;
@@ -1477,6 +1539,8 @@ int SendCICommand(av7110_t *av7110, u8 subcom, u8 *Params, u8 ParamLen)
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 };
+ DEB_EE(("av7110: %p\n",av7110));
+
for(i=0; (i<ParamLen)&&(i<32); i++)
{
if(i%2 == 0)
@@ -1495,8 +1559,12 @@ static int CommandRequest(av7110_t *av7110, u16 *Buff, int length, u16 *buf, int
s16 i;
u32 start;
- if (!av7110->arm_ready)
- return -1;
+ DEB_EE(("av7110: %p\n",av7110));
+
+ if (!av7110->arm_ready) {
+ DEB_D(("arm not ready.\n"));
+ return -1;
+ }
if (down_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
@@ -1513,7 +1581,7 @@ static int CommandRequest(av7110_t *av7110, u16 *Buff, int length, u16 *buf, int
ddelay(1);
#endif
if ((jiffies - start) > ARM_WAIT_FREE) {
- printk("commandrequest error 1\n");
+ DEB_D(("commandrequest error 1\n"));
up(&av7110->dcomlock);
//arm_error(av7110);
return -1;
@@ -1525,7 +1593,7 @@ static int CommandRequest(av7110_t *av7110, u16 *Buff, int length, u16 *buf, int
while ( rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 ) ) {
ddelay(1);
if ((jiffies - start) > ARM_WAIT_SHAKE) {
- printk("commandrequest error 2\n");
+ DEB_D(("commandrequest error 2\n"));
up(&av7110->dcomlock);
//arm_error(av7110);
return -1;
@@ -1556,6 +1624,8 @@ RequestParameter(av7110_t *av7110, u16 tag, u16* Buff, s16 length)
inline static int
SendDAC(av7110_t *av7110, u8 addr, u8 data)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
return outcom(av7110, COMTYPE_AUDIODAC, AudioDAC, 2, addr, data);
}
@@ -1564,6 +1634,8 @@ SetVolume(av7110_t *av7110, int volleft, int volright)
{
int err;
+ DEB_EE(("av7110: %p\n",av7110));
+
switch (av7110->adac_type) {
case DVB_ADAC_TI:
volleft=(volleft*256)/946;
@@ -1757,6 +1829,8 @@ LoadBitmap(av7110_t *av7110, u16 format, u16 dx, u16 dy, int inc, u8* data)
u8 c;
DECLARE_WAITQUEUE(wait, current);
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->bmp_state==BMP_LOADING) {
add_wait_queue(&av7110->bmpq, &wait);
while (1) {
@@ -1811,7 +1885,9 @@ BlitBitmap(av7110_t *av7110, u16 win, u16 x, u16 y, u16 trans)
{
DECLARE_WAITQUEUE(wait, current);
- if (av7110->bmp_state==BMP_NONE)
+ DEB_EE(("av7110: %p\n",av7110));
+
+ if (av7110->bmp_state==BMP_NONE)
return -1;
if (av7110->bmp_state==BMP_LOADING) {
add_wait_queue(&av7110->bmpq, &wait);
@@ -1833,6 +1909,8 @@ BlitBitmap(av7110_t *av7110, u16 win, u16 x, u16 y, u16 trans)
static inline int
ReleaseBitmap(av7110_t *av7110)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->bmp_state!=BMP_LOADED)
return -1;
av7110->bmp_state=BMP_NONE;
@@ -2015,6 +2093,8 @@ dvb_osd_ioctl(struct inode *inode, struct file *file,
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (cmd==OSD_SEND_CMD)
return OSD_DrawCommand(av7110, (osd_cmd_t *)parg);
@@ -2049,6 +2129,8 @@ firmversion(av7110_t *av7110)
u16 tag = ((COMTYPE_REQUEST << 8) + ReqVersion);
+ DEB_EE(("av7110: %p\n",av7110));
+
RequestParameter(av7110, tag, buf, 16);
av7110->arm_fw=(buf[0] << 16) + buf[1];
@@ -2069,6 +2151,8 @@ waitdebi(av7110_t *av7110, int adr, int state)
{
int k;
+ DEB_EE(("av7110: %p\n",av7110));
+
for (k=0; k<100; k++, udelay(500)) {
if (irdebi(av7110, DEBINOSWAP, adr, 0, 2) == state)
return 0;
@@ -2084,6 +2168,8 @@ load_dram(av7110_t *av7110, u32 *data, int len)
int blocks, rest;
u32 base, bootblock=BOOT_BLOCK;
+ DEB_EE(("av7110: %p\n",av7110));
+
blocks=len/BOOT_MAX_SIZE;
rest=len % BOOT_MAX_SIZE;
base=DRAM_START_CODE;
@@ -2091,7 +2177,7 @@ load_dram(av7110_t *av7110, u32 *data, int len)
for (i=0; i<blocks; i++) {
if (waitdebi(av7110, BOOT_STATE, BOOTSTATE_BUFFER_EMPTY) < 0)
return -1;
- dprintk("Writing DRAM block %d\n",i);
+ DEB_D(("Writing DRAM block %d\n",i));
iwdebi(av7110, DEBISWAB, bootblock,
i*(BOOT_MAX_SIZE)+(u32)data,
BOOT_MAX_SIZE);
@@ -2157,7 +2243,7 @@ bootarm(av7110_t *av7110)
u32 ret;
int i;
- printk("bootarm: %p => %p\n",av7110,av7110 != 0 ? av7110->dev : 0);
+ DEB_EE(("av7110: %p\n",av7110));
setgpio(av7110, RESET_LINE, GPIO_OUTLO);
@@ -2184,10 +2270,10 @@ bootarm(av7110_t *av7110)
}
for (i=0; i<8192; i+=4)
iwdebi(av7110, DEBISWAP, DPRAM_BASE+i, 0x00, 4);
- dprintk("bootarm: debi test OK\n");;
+ DEB_D(("bootarm: debi test OK\n"));
/* boot */
- dprintk("bootarm: load boot code\n");
+ DEB_D(("bootarm: load boot code\n"));
setgpio(av7110, ARM_IRQ_LINE, GPIO_IRQLO);
//setgpio(av7110, DEBI_DONE_LINE, GPIO_INPUT);
@@ -2201,7 +2287,7 @@ bootarm(av7110_t *av7110)
current->state=TASK_INTERRUPTIBLE;
schedule_timeout(HZ);
- dprintk("bootarm: load dram code\n");
+ DEB_D(("bootarm: load dram code\n"));
if (load_dram(av7110, (u32 *)Root, sizeof(Root))<0)
return -1;
@@ -2209,7 +2295,7 @@ bootarm(av7110_t *av7110)
setgpio(av7110, RESET_LINE, GPIO_OUTLO);
mdelay(1);
- dprintk("bootarm: load dpram code\n");
+ DEB_D(("bootarm: load dpram code\n"));
iwdebi(av7110, DEBISWAB, DPRAM_BASE, (u32) Dpram, sizeof(Dpram));
@@ -2234,6 +2320,8 @@ static inline int
SetPIDs(av7110_t *av7110, u16 vpid, u16 apid, u16 ttpid,
u16 subpid, u16 pcrpid)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (vpid == 0x1fff || apid == 0x1fff ||
ttpid == 0x1fff || subpid == 0x1fff || pcrpid == 0x1fff)
vpid = apid = ttpid = subpid = pcrpid = 0;
@@ -2246,6 +2334,8 @@ static void
ChangePIDs(av7110_t *av7110, u16 vpid, u16 apid, u16 ttpid,
u16 subpid, u16 pcrpid)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
if (down_interruptible(&av7110->pid_mutex))
return;
@@ -2266,6 +2356,8 @@ ChangePIDs(av7110_t *av7110, u16 vpid, u16 apid, u16 ttpid,
static void
SetMode(av7110_t *av7110, int mode)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
outcom(av7110, COMTYPE_ENCODER, LoadVidCode, 1, mode);
if (!av7110->playing) {
@@ -2280,12 +2372,14 @@ SetMode(av7110_t *av7110, int mode)
inline static void
TestMode(av7110_t *av7110, int mode)
{
+ DEB_EE(("av7110: %p\n",av7110));
outcom(av7110, COMTYPE_ENCODER, SetTestMode, 1, mode);
}
inline static void
VidMode(av7110_t *av7110, int mode)
{
+ DEB_EE(("av7110: %p\n",av7110));
outcom(av7110, COMTYPE_ENCODER, SetVidMode, 1, mode);
}
@@ -2293,6 +2387,7 @@ VidMode(av7110_t *av7110, int mode)
static int inline
vidcom(av7110_t *av7110, u32 com, u32 arg)
{
+ DEB_EE(("av7110: %p\n",av7110));
return outcom(av7110, 0x80, 0x02, 4,
(com>>16), (com&0xffff),
(arg>>16), (arg&0xffff));
@@ -2301,17 +2396,19 @@ vidcom(av7110_t *av7110, u32 com, u32 arg)
static int inline
audcom(av7110_t *av7110, u32 com)
{
- return outcom(av7110, 0x80, 0x03, 4,
+ DEB_EE(("av7110: %p\n",av7110));
+ return outcom(av7110, 0x80, 0x03, 4,
(com>>16), (com&0xffff));
}
inline static void
Set22K(av7110_t *av7110, int state)
{
- if (av7110->card_type->type==DVB_CARD_TT_SIEMENS)
- outcom(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0);
- if (av7110->card_type->type==DVB_CARD_TT_BUDGET)
- setgpio(av7110, 3, (state ? GPIO_OUTHI : GPIO_OUTLO));
+ DEB_EE(("av7110: %p\n",av7110));
+ if (av7110->card_type->type==DVB_CARD_TT_SIEMENS)
+ outcom(av7110, COMTYPE_AUDIODAC, (state ? ON22K : OFF22K), 0);
+ if (av7110->card_type->type==DVB_CARD_TT_BUDGET)
+ setgpio(av7110, 3, (state ? GPIO_OUTHI : GPIO_OUTLO));
}
@@ -2323,6 +2420,8 @@ Set22K(av7110_t *av7110, int state)
inline static void
DiseqcSendBit(av7110_t *av7110, int data)
{
+ DEB_EE(("av7110: %p\n",av7110));
+
setgpio(av7110, 3, GPIO_OUTHI);
udelay(data ? 500 : 1000);
setgpio(av7110, 3, GPIO_OUTLO);
@@ -2334,6 +2433,8 @@ DiseqcSendByte(av7110_t *av7110, int data)
{
int i, par=1, d;
+ DEB_EE(("av7110: %p\n",av7110));
+
for (i=7; i>=0; i--)
{
d=(data>>i)&1;
@@ -2348,6 +2449,8 @@ SendDiSEqCMsg(av7110_t *av7110, int len, u8 *msg, int burst)
{
int i;
+ DEB_EE(("av7110: %p\n",av7110));
+
switch (av7110->card_type->type) {
case DVB_CARD_TT_SIEMENS:
{
@@ -2473,6 +2576,8 @@ get_video_format(av7110_t *av7110, u8 *buf, int count)
int sw;
u8 *p;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->sinfo)
return;
for (i=7; i<count-10; i++) {
@@ -2484,7 +2589,7 @@ get_video_format(av7110_t *av7110, u8 *buf, int count)
vsize = ((p[1] &0x0F) << 8) | (p[2]);
sw = (p[3]&0x0F);
SetMode(av7110, sw2mode[sw]);
- dprintk("dvb: playback %dx%d fr=%d\n", hsize, vsize, sw);
+ DEB_S(("dvb: playback %dx%d fr=%d\n", hsize, vsize, sw));
av7110->sinfo=1;
break;
}
@@ -2494,6 +2599,7 @@ static void
play_video_cb(u8 *buf, int count, void *priv)
{
av7110_t *av7110=(av7110_t *) priv;
+ DEB_EE(("av7110: %p\n",av7110));
if ((buf[3]&0xe0)==0xe0) {
get_video_format(av7110, buf, count);
@@ -2506,6 +2612,7 @@ static void
play_audio_cb(u8 *buf, int count, void *priv)
{
av7110_t *av7110=(av7110_t *) priv;
+ DEB_EE(("av7110: %p\n",av7110));
ring_buffer_write(&av7110->aout, buf, count, 0, 0);
}
@@ -2517,6 +2624,7 @@ dvb_play(av7110_t *av7110, const u8 *buf,
unsigned long count, int nonblock, int type, int umem)
{
unsigned long todo = count, n;
+ DEB_EE(("av7110: %p\n",av7110));
if (!av7110->kbuf[type])
return -ENOBUFS;
@@ -2555,6 +2663,7 @@ dvb_aplay(av7110_t *av7110, const u8 *buf,
unsigned long count, int nonblock, int type)
{
unsigned long todo = count, n;
+ DEB_EE(("av7110: %p\n",av7110));
if (!av7110->kbuf[type])
return -ENOBUFS;
@@ -2751,7 +2860,6 @@ int write_ts_header2(u16 pid, u8 *counter, int pes_start, u8 *buf, u8 length)
int fill;
u8 tshead[4] = { 0x47, 0x00, 0x00, 0x10};
-
fill = (TS_SIZE-4)-length;
if (pes_start) tshead[1] = 0x40;
if (fill) tshead[3] = 0x30;
@@ -2827,20 +2935,14 @@ void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter,
}
}
-
-/****************************************************************************
- * V4L SECTION
- ****************************************************************************/
-
/****************************************************************************
* V4L SECTION
****************************************************************************/
int av7110_ioctl(struct saa7146_dev *dev, unsigned int cmd, void *arg)
{
-/*
- av7110_t *av7110 = dev->ext_priv;
-*/
+ DEB_EE(("saa7146_dev: %p\n",dev));
+
switch(cmd) {
case VIDIOC_ENUMINPUT:
{
@@ -2881,6 +2983,8 @@ unsigned int dvb_audio_poll(struct file *file, poll_table *wait)
av7110_t *av7110=(av7110_t *) dvbdev->priv;
unsigned int mask=0;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->playing) {
if (ring_buffer_free(&av7110->aout)>20*1024)
return (POLLOUT | POLLWRNORM);
@@ -2921,6 +3025,8 @@ StartHWFilter(struct dvb_demux_filter *dvbdmxfilter)
// u16 mode=0x0320;
u16 mode=0xb96a;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (dvbdmxfilter->type==DMX_TYPE_SEC) {
buf[4]=(dvbdmxfilter->filter.filter_value[0]<<8)|
dvbdmxfilter->maskandmode[0];
@@ -2957,11 +3063,13 @@ StopHWFilter(struct dvb_demux_filter *dvbdmxfilter)
int ret;
u16 handle;
+ DEB_EE(("av7110: %p\n",av7110));
+
handle=dvbdmxfilter->hw_handle;
if (handle>32) {
- dprintk("dvb: StopHWFilter tried to stop invalid filter %d.\n",
- handle);
- dprintk("dvb: filter type = %d\n", dvbdmxfilter->type);
+ DEB_S(("dvb: StopHWFilter tried to stop invalid filter %d.\n",
+ handle));
+ DEB_S(("dvb: filter type = %d\n", dvbdmxfilter->type));
return 0;
}
@@ -2973,7 +3081,7 @@ StopHWFilter(struct dvb_demux_filter *dvbdmxfilter)
ret=CommandRequest(av7110, buf, 3, answ, 2);
if (answ[1] != handle) {
- dprintk("dvb: filter %d shutdown error :%d\n", handle, answ[1]);
+ DEB_S(("dvb: filter %d shutdown error :%d\n", handle, answ[1]));
ret=-1;
}
return ret;
@@ -2987,6 +3095,8 @@ av7110_write_to_decoder(struct dvb_demux_feed *feed, const u8 *buf, size_t len)
av7110_t *av7110 = (av7110_t *) demux->priv;
ipack *ipack = &av7110->ipack[feed->pes_type];
+ DEB_EE(("av7110: %p\n",av7110));
+
switch (feed->pes_type) {
case 0:
if (av7110->audiostate.stream_source==AUDIO_SOURCE_MEMORY)
@@ -3026,6 +3136,8 @@ dvb_feed_start_pid(struct dvb_demux_feed *dvbdmxfeed)
u16 *pid=dvbdmx->pids, npids[5];
int i;
+ DEB_EE(("av7110: %p\n",av7110));
+
npids[0]=npids[1]=npids[2]=npids[3]=0xffff;
npids[4]=0xffff;
i=dvbdmxfeed->pes_type;
@@ -3063,6 +3175,8 @@ dvb_feed_stop_pid(struct dvb_demux_feed *dvbdmxfeed)
u16 *pid=dvbdmx->pids, npids[5];
int i;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (dvbdmxfeed->pes_type<=1) {
AV_Stop(av7110, dvbdmxfeed->pes_type ?
RP_VIDEO : RP_AUDIO);
@@ -3097,6 +3211,8 @@ av7110_start_feed(struct dvb_demux_feed *feed)
struct dvb_demux *demux = feed->demux;
av7110_t *av7110 = (av7110_t *) demux->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (!demux->dmx.frontend)
return -EINVAL;
@@ -3157,6 +3273,8 @@ av7110_stop_feed(struct dvb_demux_feed *feed)
struct dvb_demux *demux = feed->demux;
av7110_t *av7110 = (av7110_t *) demux->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->card_type->type >= DVB_CARD_TT_BUDGET)
return TTBStop(av7110);
@@ -3201,6 +3319,8 @@ restart_feeds(av7110_t *av7110)
int mode;
int i;
+ DEB_EE(("av7110: %p\n",av7110));
+
mode=av7110->playing;
av7110->playing=0;
av7110->rec_mode=0;
@@ -3224,6 +3344,8 @@ int av7110_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
{
av7110_t *av7110 = fe->before_after_data;
+ DEB_EE(("av7110: %p\n",av7110));
+
switch (cmd) {
case FE_SET_TONE:
switch ((fe_sec_tone_mode_t) arg) {
@@ -3392,6 +3514,8 @@ dvb_ca_open(struct inode *inode, struct file *file)
av7110_t *av7110=(av7110_t *) dvbdev->priv;
int err=dvb_generic_open(inode, file);
+ DEB_EE(("av7110: %p\n",av7110));
+
if (err<0)
return err;
ci_ll_flush(&av7110->ci_rbuffer, &av7110->ci_wbuffer);
@@ -3409,6 +3533,8 @@ int dvb_ca_poll(struct file *file, poll_table *wait)
ring_buffer_t *rbuf=&av7110->ci_rbuffer;
ring_buffer_t *wbuf=&av7110->ci_wbuffer;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (!ring_buffer_empty(rbuf))
mask|=POLLIN;
if (ring_buffer_avail(wbuf)>1024)
@@ -3434,6 +3560,8 @@ dvb_ca_ioctl(struct inode *inode, struct file *file,
av7110_t *av7110=(av7110_t *) dvbdev->priv;
unsigned long arg=(unsigned long) parg;
+ DEB_EE(("av7110: %p\n",av7110));
+
switch (cmd) {
case CA_RESET:
#ifdef NEW_CI
@@ -3519,6 +3647,7 @@ dvb_ca_write(struct file *file, const char *buf,
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
return ci_ll_write(&av7110->ci_wbuffer, file, buf, count, ppos);
}
@@ -3528,8 +3657,8 @@ dvb_ca_read(struct file *file, char *buf, size_t count, loff_t *ppos)
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
return ci_ll_read(&av7110->ci_rbuffer, file, buf, count, ppos);
-
}
@@ -3544,6 +3673,8 @@ static unsigned int dvb_video_poll(struct file *file, poll_table *wait)
av7110_t *av7110=(av7110_t *) dvbdev->priv;
unsigned int mask=0;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->playing) {
if (FREE_COND)
return (POLLOUT | POLLWRNORM);
@@ -3565,6 +3696,8 @@ dvb_video_write(struct file *file, const char *buf,
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->videostate.stream_source!=VIDEO_SOURCE_MEMORY)
return -EPERM;
@@ -3578,6 +3711,8 @@ dvb_audio_write(struct file *file, const char *buf,
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->audiostate.stream_source!=AUDIO_SOURCE_MEMORY) {
printk(KERN_ERR "not audio source memory\n");
return -EPERM;
@@ -3594,6 +3729,8 @@ play_iframe(av7110_t *av7110, u8 *buf, unsigned int len, int nonblock)
{
int i, n=1;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (!(av7110->playing&RP_VIDEO)) {
AV_StartPlay(av7110, RP_VIDEO);
n=MIN_IFRAME/len+1;
@@ -3617,6 +3754,8 @@ dvb_video_ioctl(struct inode *inode, struct file *file,
unsigned long arg=(unsigned long) parg;
int ret=0;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (((file->f_flags&O_ACCMODE)==O_RDONLY) &&
(cmd!=VIDEO_GET_STATUS))
return -EPERM;
@@ -3806,6 +3945,8 @@ dvb_audio_ioctl(struct inode *inode, struct file *file,
unsigned long arg=(unsigned long) parg;
int ret=0;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (((file->f_flags&O_ACCMODE)==O_RDONLY) &&
(cmd!=AUDIO_GET_STATUS))
return -EPERM;
@@ -3923,6 +4064,8 @@ static int dvb_video_open(struct inode *inode, struct file *file)
av7110_t *av7110=(av7110_t *) dvbdev->priv;
int err;
+ DEB_EE(("av7110: %p\n",av7110));
+
if ((err=dvb_generic_open(inode, file))<0)
return err;
ring_buffer_flush(&av7110->aout);
@@ -3938,6 +4081,8 @@ static int dvb_video_release(struct inode *inode, struct file *file)
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
AV_Stop(av7110, RP_VIDEO);
return dvb_generic_release(inode, file);
}
@@ -3948,6 +4093,8 @@ static int dvb_audio_open(struct inode *inode, struct file *file)
av7110_t *av7110=(av7110_t *) dvbdev->priv;
int err=dvb_generic_open(inode, file);
+ DEB_EE(("av7110: %p\n",av7110));
+
if (err<0)
return err;
ring_buffer_flush(&av7110->aout);
@@ -3960,6 +4107,8 @@ static int dvb_audio_release(struct inode *inode, struct file *file)
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
av7110_t *av7110=(av7110_t *) dvbdev->priv;
+ DEB_EE(("av7110: %p\n",av7110));
+
AV_Stop(av7110, RP_AUDIO);
return dvb_generic_release(inode, file);
}
@@ -4028,6 +4177,8 @@ void av7110_before_after_tune (fe_status_t s, void *data)
{
struct av7110_s *av7110 = data;
+ DEB_EE(("av7110: %p\n",av7110));
+
av7110->fe_synced = (s & FE_HAS_LOCK) ? 1 : 0;
if (av7110->playing)
@@ -4056,6 +4207,8 @@ int av7110_register(av7110_t *av7110)
dmx_frontend_t *dvbfront=&av7110->hw_frontend;
struct dvb_demux *dvbdemux=&av7110->demux;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (av7110->registered)
return -1;
@@ -4201,6 +4354,8 @@ dvb_unregister(av7110_t *av7110)
{
struct dvb_demux *dvbdemux=&av7110->demux;
+ DEB_EE(("av7110: %p\n",av7110));
+
if (!av7110->registered)
return;
@@ -4251,6 +4406,8 @@ struct saa7146_extension_ioctls ioctls[] = {
int av7110_preinit(struct saa7146_dev* dev)
{
+ DEB_EE(("dev: %p\n",dev));
+
/* the Siemens DVB needs this if you want to have the i2c chips
get recognized before the main driver is loaded
*/
@@ -4325,6 +4482,8 @@ int av7110_probe(struct saa7146_dev* dev, unsigned int subvendor, unsigned int s
av7110_t *av7110;
int i = 0;
+ DEB_EE(("dev: %p\n",dev));
+
for(i = 0;;i++) {
if( 0xffff == match_data[i].sub->subvendor ) {
printk(KERN_ERR "dvb: device subvendor:0x%04x, subdevice:0x%04x is not a known dvb card.\n",subvendor,subdevice);
@@ -4357,6 +4516,8 @@ int av7110_attach (struct saa7146_dev* dev)
int pages = (length+PAGE_SIZE-1)/PAGE_SIZE;
int ret = 0;
+ DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
+
av7110->dev=(struct saa7146_dev *)dev;
dvb_register_adapter(&av7110->dvb_adapter, av7110->card_type->name);
@@ -4492,7 +4653,7 @@ int av7110_attach (struct saa7146_dev* dev)
/* remaining inits according to card and frontend type */
if (i2c_writereg(av7110, 0x20, 0x00, 0x00)==1) {
- dprintk("av7110%d: Crystal audio DAC detected\n",
+ printk("av7110%d: Crystal audio DAC detected\n",
av7110->dvb_adapter->num);
av7110->adac_type = DVB_ADAC_CRYSTAL;
i2c_writereg(av7110, 0x20, 0x01, 0xd2);
@@ -4546,6 +4707,7 @@ static
int av7110_detach (struct saa7146_dev* saa)
{
av7110_t *av7110 = (av7110_t*)saa->ext_priv;
+ DEB_EE(("av7110: %p\n",av7110));
av7110->arm_rmmod=1;
wake_up_interruptible(&av7110->arm_wait);
@@ -4587,6 +4749,8 @@ void av7110_irq(struct saa7146_dev* dev, u32 *isr)
{
av7110_t *av7110 = (av7110_t*)dev->ext_priv;
+ DEB_EE(("dev: %p, av7110: %p\n",dev,av7110));
+
if (*isr & MASK_19)
tasklet_schedule (&av7110->debi_tasklet);
@@ -4658,6 +4822,8 @@ struct saa7146_extension av7110_extension = {
static
int __init av7110_init(void)
{
+ DEB_EE((".\n"));
+
if (saa7146_register_extension(&av7110_extension))
return -ENODEV;
@@ -4668,6 +4834,8 @@ int __init av7110_init(void)
static
void __exit av7110_exit(void)
{
+ DEB_EE((".\n"));
+
if (saa7146_unregister_extension(&av7110_extension))
printk(KERN_ERR "dvb: extension deregistration failed.\n");
}