[PATCH] V4L/DVB: (3086c) Whitespaces cleanups part 3

Clean up whitespaces at v4l/dvb files

Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Mauro Carvalho Chehab
2005-12-12 00:37:27 -08:00
committed by Linus Torvalds
parent 808824b5f7
commit afd1a0c9ac
35 changed files with 785 additions and 785 deletions
+3 -3
View File
@@ -174,8 +174,8 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt)
int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
{ {
u32 *cpu; u32 *cpu;
dma_addr_t dma_addr; dma_addr_t dma_addr;
cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr); cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr);
if (NULL == cpu) { if (NULL == cpu) {
@@ -405,7 +405,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
pci_set_drvdata(pci, dev); pci_set_drvdata(pci, dev);
init_MUTEX(&dev->lock); init_MUTEX(&dev->lock);
spin_lock_init(&dev->int_slock); spin_lock_init(&dev->int_slock);
spin_lock_init(&dev->slock); spin_lock_init(&dev->slock);
+16 -16
View File
@@ -1,6 +1,6 @@
#include <media/saa7146_vv.h> #include <media/saa7146_vv.h>
#define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1)
/****************************************************************************/ /****************************************************************************/
/* resource management functions, shamelessly stolen from saa7134 driver */ /* resource management functions, shamelessly stolen from saa7134 driver */
@@ -102,9 +102,9 @@ void saa7146_buffer_finish(struct saa7146_dev *dev,
/* finish current buffer */ /* finish current buffer */
if (NULL == q->curr) { if (NULL == q->curr) {
DEB_D(("aiii. no current buffer\n")); DEB_D(("aiii. no current buffer\n"));
return; return;
} }
q->curr->vb.state = state; q->curr->vb.state = state;
do_gettimeofday(&q->curr->vb.ts); do_gettimeofday(&q->curr->vb.ts);
wake_up(&q->curr->vb.done); wake_up(&q->curr->vb.done);
@@ -143,13 +143,13 @@ void saa7146_buffer_next(struct saa7146_dev *dev,
// fixme: fix this for vflip != 0 // fixme: fix this for vflip != 0
saa7146_write(dev, PROT_ADDR1, 0); saa7146_write(dev, PROT_ADDR1, 0);
saa7146_write(dev, MC2, (MASK_02|MASK_18)); saa7146_write(dev, MC2, (MASK_02|MASK_18));
/* write the address of the rps-program */ /* write the address of the rps-program */
saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle); saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle);
/* turn on rps */ /* turn on rps */
saa7146_write(dev, MC1, (MASK_12 | MASK_28)); saa7146_write(dev, MC1, (MASK_12 | MASK_28));
/* /*
printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1)); printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1));
printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1)); printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1));
@@ -246,7 +246,7 @@ static int fops_open(struct inode *inode, struct file *file)
goto out; goto out;
} }
memset(fh,0,sizeof(*fh)); memset(fh,0,sizeof(*fh));
file->private_data = fh; file->private_data = fh;
fh->dev = dev; fh->dev = dev;
fh->type = type; fh->type = type;
@@ -275,7 +275,7 @@ out:
file->private_data = NULL; file->private_data = NULL;
} }
up(&saa7146_devices_lock); up(&saa7146_devices_lock);
return result; return result;
} }
static int fops_release(struct inode *inode, struct file *file) static int fops_release(struct inode *inode, struct file *file)
@@ -405,7 +405,7 @@ static struct file_operations video_fops =
static void vv_callback(struct saa7146_dev *dev, unsigned long status) static void vv_callback(struct saa7146_dev *dev, unsigned long status)
{ {
u32 isr = status; u32 isr = status;
DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status)); DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status));
if (0 != (isr & (MASK_27))) { if (0 != (isr & (MASK_27))) {
@@ -454,11 +454,11 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
handle different devices that might need different handle different devices that might need different
configuration data) */ configuration data) */
dev->ext_vv_data = ext_vv; dev->ext_vv_data = ext_vv;
vv->video_minor = -1; vv->video_minor = -1;
vv->vbi_minor = -1; vv->vbi_minor = -1;
vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle);
if( NULL == vv->d_clipping.cpu_addr ) { if( NULL == vv->d_clipping.cpu_addr ) {
ERR(("out of memory. aborting.\n")); ERR(("out of memory. aborting.\n"));
kfree(vv); kfree(vv);
@@ -468,7 +468,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
saa7146_video_uops.init(dev,vv); saa7146_video_uops.init(dev,vv);
saa7146_vbi_uops.init(dev,vv); saa7146_vbi_uops.init(dev,vv);
dev->vv_data = vv; dev->vv_data = vv;
dev->vv_callback = &vv_callback; dev->vv_callback = &vv_callback;
@@ -480,12 +480,12 @@ int saa7146_vv_release(struct saa7146_dev* dev)
struct saa7146_vv *vv = dev->vv_data; struct saa7146_vv *vv = dev->vv_data;
DEB_EE(("dev:%p\n",dev)); DEB_EE(("dev:%p\n",dev));
pci_free_consistent(dev->pci, SAA7146_RPS_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); pci_free_consistent(dev->pci, SAA7146_RPS_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle);
kfree(vv); kfree(vv);
dev->vv_data = NULL; dev->vv_data = NULL;
dev->vv_callback = NULL; dev->vv_callback = NULL;
return 0; return 0;
} }
@@ -498,7 +498,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type));
// released by vfd->release // released by vfd->release
vfd = video_device_alloc(); vfd = video_device_alloc();
if (vfd == NULL) if (vfd == NULL)
return -ENOMEM; return -ENOMEM;
@@ -530,7 +530,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev)
{ {
struct saa7146_vv *vv = dev->vv_data; struct saa7146_vv *vv = dev->vv_data;
DEB_EE(("dev:%p\n",dev)); DEB_EE(("dev:%p\n",dev));
if( VFL_TYPE_GRABBER == (*vid)->type ) { if( VFL_TYPE_GRABBER == (*vid)->type ) {
+8 -8
View File
@@ -276,8 +276,8 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
int i = 0, count = 0; int i = 0, count = 0;
u32* buffer = dev->d_i2c.cpu_addr; u32* buffer = dev->d_i2c.cpu_addr;
int err = 0; int err = 0;
int address_err = 0; int address_err = 0;
int short_delay = 0; int short_delay = 0;
if (down_interruptible (&dev->i2c_lock)) if (down_interruptible (&dev->i2c_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
@@ -325,7 +325,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) { if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) {
goto out; goto out;
} }
address_err++; address_err++;
} }
DEB_I2C(("error while sending message(s). starting again.\n")); DEB_I2C(("error while sending message(s). starting again.\n"));
break; break;
@@ -336,14 +336,14 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
break; break;
} }
/* delay a bit before retrying */ /* delay a bit before retrying */
msleep(10); msleep(10);
} while (err != num && retries--); } while (err != num && retries--);
/* if every retry had an address error, exit right away */ /* if every retry had an address error, exit right away */
if (address_err == retries) { if (address_err == retries) {
goto out; goto out;
} }
/* if any things had to be read, get the results */ /* if any things had to be read, get the results */
+2 -2
View File
@@ -6,8 +6,8 @@ static int vbi_workaround(struct saa7146_dev *dev)
{ {
struct saa7146_vv *vv = dev->vv_data; struct saa7146_vv *vv = dev->vv_data;
u32 *cpu; u32 *cpu;
dma_addr_t dma_addr; dma_addr_t dma_addr;
int count = 0; int count = 0;
int i; int i;
+23 -23
View File
@@ -150,23 +150,23 @@ static int try_win(struct saa7146_dev *dev, struct v4l2_window *win)
maxh = vv->standard->v_max_out; maxh = vv->standard->v_max_out;
if (V4L2_FIELD_ANY == field) { if (V4L2_FIELD_ANY == field) {
field = (win->w.height > maxh/2) field = (win->w.height > maxh/2)
? V4L2_FIELD_INTERLACED ? V4L2_FIELD_INTERLACED
: V4L2_FIELD_TOP; : V4L2_FIELD_TOP;
} }
switch (field) { switch (field) {
case V4L2_FIELD_TOP: case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM: case V4L2_FIELD_BOTTOM:
case V4L2_FIELD_ALTERNATE: case V4L2_FIELD_ALTERNATE:
maxh = maxh / 2; maxh = maxh / 2;
break; break;
case V4L2_FIELD_INTERLACED: case V4L2_FIELD_INTERLACED:
break; break;
default: { default: {
DEB_D(("no known field mode '%d'.\n",field)); DEB_D(("no known field mode '%d'.\n",field));
return -EINVAL; return -EINVAL;
}
} }
}
win->field = field; win->field = field;
if (win->w.width > maxw) if (win->w.width > maxw)
@@ -887,7 +887,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
DEB_EE(("VIDIOC_QUERYCAP\n")); DEB_EE(("VIDIOC_QUERYCAP\n"));
strcpy(cap->driver, "saa7146 v4l2"); strcpy(cap->driver, "saa7146 v4l2");
strlcpy(cap->card, dev->ext->name, sizeof(cap->card)); strlcpy(cap->card, dev->ext->name, sizeof(cap->card));
sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci));
cap->version = SAA7146_VERSION_CODE; cap->version = SAA7146_VERSION_CODE;
@@ -1011,19 +1011,19 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
err = set_control(fh,arg); err = set_control(fh,arg);
return err; return err;
} }
case VIDIOC_G_PARM: case VIDIOC_G_PARM:
{ {
struct v4l2_streamparm *parm = arg; struct v4l2_streamparm *parm = arg;
if( parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ) { if( parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ) {
return -EINVAL; return -EINVAL;
} }
memset(&parm->parm.capture,0,sizeof(struct v4l2_captureparm)); memset(&parm->parm.capture,0,sizeof(struct v4l2_captureparm));
parm->parm.capture.readbuffers = 1; parm->parm.capture.readbuffers = 1;
// fixme: only for PAL! // fixme: only for PAL!
parm->parm.capture.timeperframe.numerator = 1; parm->parm.capture.timeperframe.numerator = 1;
parm->parm.capture.timeperframe.denominator = 25; parm->parm.capture.timeperframe.denominator = 25;
return 0; return 0;
} }
case VIDIOC_G_FMT: case VIDIOC_G_FMT:
{ {
struct v4l2_format *f = arg; struct v4l2_format *f = arg;
@@ -1383,7 +1383,7 @@ static struct videobuf_queue_ops video_qops = {
static void video_init(struct saa7146_dev *dev, struct saa7146_vv *vv) static void video_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
{ {
INIT_LIST_HEAD(&vv->video_q.queue); INIT_LIST_HEAD(&vv->video_q.queue);
init_timer(&vv->video_q.timeout); init_timer(&vv->video_q.timeout);
vv->video_q.timeout.function = saa7146_buffer_timeout; vv->video_q.timeout.function = saa7146_buffer_timeout;
+46 -46
View File
@@ -86,25 +86,25 @@ enum dmx_success {
enum dmx_ts_pes enum dmx_ts_pes
{ /* also send packets to decoder (if it exists) */ { /* also send packets to decoder (if it exists) */
DMX_TS_PES_AUDIO0, DMX_TS_PES_AUDIO0,
DMX_TS_PES_VIDEO0, DMX_TS_PES_VIDEO0,
DMX_TS_PES_TELETEXT0, DMX_TS_PES_TELETEXT0,
DMX_TS_PES_SUBTITLE0, DMX_TS_PES_SUBTITLE0,
DMX_TS_PES_PCR0, DMX_TS_PES_PCR0,
DMX_TS_PES_AUDIO1, DMX_TS_PES_AUDIO1,
DMX_TS_PES_VIDEO1, DMX_TS_PES_VIDEO1,
DMX_TS_PES_TELETEXT1, DMX_TS_PES_TELETEXT1,
DMX_TS_PES_SUBTITLE1, DMX_TS_PES_SUBTITLE1,
DMX_TS_PES_PCR1, DMX_TS_PES_PCR1,
DMX_TS_PES_AUDIO2, DMX_TS_PES_AUDIO2,
DMX_TS_PES_VIDEO2, DMX_TS_PES_VIDEO2,
DMX_TS_PES_TELETEXT2, DMX_TS_PES_TELETEXT2,
DMX_TS_PES_SUBTITLE2, DMX_TS_PES_SUBTITLE2,
DMX_TS_PES_PCR2, DMX_TS_PES_PCR2,
DMX_TS_PES_AUDIO3, DMX_TS_PES_AUDIO3,
DMX_TS_PES_VIDEO3, DMX_TS_PES_VIDEO3,
DMX_TS_PES_TELETEXT3, DMX_TS_PES_TELETEXT3,
DMX_TS_PES_SUBTITLE3, DMX_TS_PES_SUBTITLE3,
@@ -121,17 +121,17 @@ enum dmx_ts_pes
struct dmx_ts_feed { struct dmx_ts_feed {
int is_filtering; /* Set to non-zero when filtering in progress */ int is_filtering; /* Set to non-zero when filtering in progress */
struct dmx_demux *parent; /* Back-pointer */ struct dmx_demux *parent; /* Back-pointer */
void *priv; /* Pointer to private data of the API client */ void *priv; /* Pointer to private data of the API client */
int (*set) (struct dmx_ts_feed *feed, int (*set) (struct dmx_ts_feed *feed,
u16 pid, u16 pid,
int type, int type,
enum dmx_ts_pes pes_type, enum dmx_ts_pes pes_type,
size_t circular_buffer_size, size_t circular_buffer_size,
struct timespec timeout); struct timespec timeout);
int (*start_filtering) (struct dmx_ts_feed* feed); int (*start_filtering) (struct dmx_ts_feed* feed);
int (*stop_filtering) (struct dmx_ts_feed* feed); int (*stop_filtering) (struct dmx_ts_feed* feed);
}; };
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -139,35 +139,35 @@ struct dmx_ts_feed {
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
struct dmx_section_filter { struct dmx_section_filter {
u8 filter_value [DMX_MAX_FILTER_SIZE]; u8 filter_value [DMX_MAX_FILTER_SIZE];
u8 filter_mask [DMX_MAX_FILTER_SIZE]; u8 filter_mask [DMX_MAX_FILTER_SIZE];
u8 filter_mode [DMX_MAX_FILTER_SIZE]; u8 filter_mode [DMX_MAX_FILTER_SIZE];
struct dmx_section_feed* parent; /* Back-pointer */ struct dmx_section_feed* parent; /* Back-pointer */
void* priv; /* Pointer to private data of the API client */ void* priv; /* Pointer to private data of the API client */
}; };
struct dmx_section_feed { struct dmx_section_feed {
int is_filtering; /* Set to non-zero when filtering in progress */ int is_filtering; /* Set to non-zero when filtering in progress */
struct dmx_demux* parent; /* Back-pointer */ struct dmx_demux* parent; /* Back-pointer */
void* priv; /* Pointer to private data of the API client */ void* priv; /* Pointer to private data of the API client */
int check_crc; int check_crc;
u32 crc_val; u32 crc_val;
u8 *secbuf; u8 *secbuf;
u8 secbuf_base[DMX_MAX_SECFEED_SIZE]; u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
u16 secbufp, seclen, tsfeedp; u16 secbufp, seclen, tsfeedp;
int (*set) (struct dmx_section_feed* feed, int (*set) (struct dmx_section_feed* feed,
u16 pid, u16 pid,
size_t circular_buffer_size, size_t circular_buffer_size,
int check_crc); int check_crc);
int (*allocate_filter) (struct dmx_section_feed* feed, int (*allocate_filter) (struct dmx_section_feed* feed,
struct dmx_section_filter** filter); struct dmx_section_filter** filter);
int (*release_filter) (struct dmx_section_feed* feed, int (*release_filter) (struct dmx_section_feed* feed,
struct dmx_section_filter* filter); struct dmx_section_filter* filter);
int (*start_filtering) (struct dmx_section_feed* feed); int (*start_filtering) (struct dmx_section_feed* feed);
int (*stop_filtering) (struct dmx_section_feed* feed); int (*stop_filtering) (struct dmx_section_feed* feed);
}; };
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -205,10 +205,10 @@ enum dmx_frontend_source {
}; };
struct dmx_frontend { struct dmx_frontend {
struct list_head connectivity_list; /* List of front-ends that can struct list_head connectivity_list; /* List of front-ends that can
be connected to a particular be connected to a particular
demux */ demux */
enum dmx_frontend_source source; enum dmx_frontend_source source;
}; };
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@@ -240,38 +240,38 @@ struct dmx_frontend {
#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list) #define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list)
struct dmx_demux { struct dmx_demux {
u32 capabilities; /* Bitfield of capability flags */ u32 capabilities; /* Bitfield of capability flags */
struct dmx_frontend* frontend; /* Front-end connected to the demux */ struct dmx_frontend* frontend; /* Front-end connected to the demux */
void* priv; /* Pointer to private data of the API client */ void* priv; /* Pointer to private data of the API client */
int (*open) (struct dmx_demux* demux); int (*open) (struct dmx_demux* demux);
int (*close) (struct dmx_demux* demux); int (*close) (struct dmx_demux* demux);
int (*write) (struct dmx_demux* demux, const char* buf, size_t count); int (*write) (struct dmx_demux* demux, const char* buf, size_t count);
int (*allocate_ts_feed) (struct dmx_demux* demux, int (*allocate_ts_feed) (struct dmx_demux* demux,
struct dmx_ts_feed** feed, struct dmx_ts_feed** feed,
dmx_ts_cb callback); dmx_ts_cb callback);
int (*release_ts_feed) (struct dmx_demux* demux, int (*release_ts_feed) (struct dmx_demux* demux,
struct dmx_ts_feed* feed); struct dmx_ts_feed* feed);
int (*allocate_section_feed) (struct dmx_demux* demux, int (*allocate_section_feed) (struct dmx_demux* demux,
struct dmx_section_feed** feed, struct dmx_section_feed** feed,
dmx_section_cb callback); dmx_section_cb callback);
int (*release_section_feed) (struct dmx_demux* demux, int (*release_section_feed) (struct dmx_demux* demux,
struct dmx_section_feed* feed); struct dmx_section_feed* feed);
int (*add_frontend) (struct dmx_demux* demux, int (*add_frontend) (struct dmx_demux* demux,
struct dmx_frontend* frontend); struct dmx_frontend* frontend);
int (*remove_frontend) (struct dmx_demux* demux, int (*remove_frontend) (struct dmx_demux* demux,
struct dmx_frontend* frontend); struct dmx_frontend* frontend);
struct list_head* (*get_frontends) (struct dmx_demux* demux); struct list_head* (*get_frontends) (struct dmx_demux* demux);
int (*connect_frontend) (struct dmx_demux* demux, int (*connect_frontend) (struct dmx_demux* demux,
struct dmx_frontend* frontend); struct dmx_frontend* frontend);
int (*disconnect_frontend) (struct dmx_demux* demux); int (*disconnect_frontend) (struct dmx_demux* demux);
int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids); int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids);
int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps); int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps);
int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src); int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src);
int (*get_stc) (struct dmx_demux* demux, unsigned int num, int (*get_stc) (struct dmx_demux* demux, unsigned int num,
u64 *stc, unsigned int *base); u64 *stc, unsigned int *base);
}; };
+1 -1
View File
@@ -947,7 +947,7 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file,
case DMX_GET_STC: case DMX_GET_STC:
if (!dmxdev->demux->get_stc) { if (!dmxdev->demux->get_stc) {
ret=-EINVAL; ret=-EINVAL;
break; break;
} }
ret = dmxdev->demux->get_stc(dmxdev->demux, ret = dmxdev->demux->get_stc(dmxdev->demux,
+32 -32
View File
@@ -53,51 +53,51 @@ enum dmxdev_state {
}; };
struct dmxdev_buffer { struct dmxdev_buffer {
u8 *data; u8 *data;
int size; int size;
int pread; int pread;
int pwrite; int pwrite;
wait_queue_head_t queue; wait_queue_head_t queue;
int error; int error;
}; };
struct dmxdev_filter { struct dmxdev_filter {
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
union { union {
struct dmx_section_filter *sec; struct dmx_section_filter *sec;
} filter; } filter;
union { union {
struct dmx_ts_feed *ts; struct dmx_ts_feed *ts;
struct dmx_section_feed *sec; struct dmx_section_feed *sec;
} feed; } feed;
union { union {
struct dmx_sct_filter_params sec; struct dmx_sct_filter_params sec;
struct dmx_pes_filter_params pes; struct dmx_pes_filter_params pes;
} params; } params;
int type; int type;
enum dmxdev_state state; enum dmxdev_state state;
struct dmxdev *dev; struct dmxdev *dev;
struct dmxdev_buffer buffer; struct dmxdev_buffer buffer;
struct semaphore mutex; struct semaphore mutex;
/* only for sections */ /* only for sections */
struct timer_list timer; struct timer_list timer;
int todo; int todo;
u8 secheader[3]; u8 secheader[3];
u16 pid; u16 pid;
}; };
struct dmxdev_dvr { struct dmxdev_dvr {
int state; int state;
struct dmxdev *dev; struct dmxdev *dev;
struct dmxdev_buffer buffer; struct dmxdev_buffer buffer;
}; };
@@ -105,16 +105,16 @@ struct dmxdev {
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
struct dvb_device *dvr_dvbdev; struct dvb_device *dvr_dvbdev;
struct dmxdev_filter *filter; struct dmxdev_filter *filter;
struct dmxdev_dvr *dvr; struct dmxdev_dvr *dvr;
struct dmx_demux *demux; struct dmx_demux *demux;
int filternum; int filternum;
int capabilities; int capabilities;
#define DMXDEV_CAP_DUPLEX 1 #define DMXDEV_CAP_DUPLEX 1
struct dmx_frontend *dvr_orig_fe; struct dmx_frontend *dvr_orig_fe;
struct dmxdev_buffer dvr_buffer; struct dmxdev_buffer dvr_buffer;
#define DVR_BUFFER_SIZE (10*188*1024) #define DVR_BUFFER_SIZE (10*188*1024)
struct semaphore mutex; struct semaphore mutex;
+1 -1
View File
@@ -498,7 +498,7 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
/* process the CFTABLE_ENTRY tuples, and any after those */ /* process the CFTABLE_ENTRY tuples, and any after those */
while ((!end_chain) && (address < 0x1000)) { while ((!end_chain) && (address < 0x1000)) {
if ((status = dvb_ca_en50221_read_tuple(ca, slot, &address, &tupleType, if ((status = dvb_ca_en50221_read_tuple(ca, slot, &address, &tupleType,
&tupleLength, tuple)) < 0) &tupleLength, tuple)) < 0)
return status; return status;
switch (tupleType) { switch (tupleType) {
case 0x1B: // CISTPL_CFTABLE_ENTRY case 0x1B: // CISTPL_CFTABLE_ENTRY
+154 -154
View File
@@ -72,12 +72,12 @@ static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, in
u8 pct; u8 pct;
if (pr) printk( "Pic header: "); if (pr) printk( "Pic header: ");
pic->temporal_reference[field] = (( headr[0] << 2 ) | pic->temporal_reference[field] = (( headr[0] << 2 ) |
(headr[1] & 0x03) )& 0x03ff; (headr[1] & 0x03) )& 0x03ff;
if (pr) printk( " temp ref: 0x%04x", pic->temporal_reference[field]); if (pr) printk( " temp ref: 0x%04x", pic->temporal_reference[field]);
pct = ( headr[1] >> 2 ) & 0x07; pct = ( headr[1] >> 2 ) & 0x07;
pic->picture_coding_type[field] = pct; pic->picture_coding_type[field] = pct;
if (pr) { if (pr) {
switch(pct){ switch(pct){
case I_FRAME: case I_FRAME:
@@ -93,17 +93,17 @@ static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, in
} }
pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) | pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) |
( (headr[3] & 0x1F) << 11) ) & 0xffff; ( (headr[3] & 0x1F) << 11) ) & 0xffff;
if (pr) printk( " vbv delay: 0x%04x", pic->vinfo.vbv_delay); if (pr) printk( " vbv delay: 0x%04x", pic->vinfo.vbv_delay);
pic->picture_header_parameter = ( headr[3] & 0xe0 ) | pic->picture_header_parameter = ( headr[3] & 0xe0 ) |
((headr[4] & 0x80) >> 3); ((headr[4] & 0x80) >> 3);
if ( pct == B_FRAME ){ if ( pct == B_FRAME ){
pic->picture_header_parameter |= ( headr[4] >> 3 ) & 0x0f; pic->picture_header_parameter |= ( headr[4] >> 3 ) & 0x0f;
} }
if (pr) printk( " pic head param: 0x%x", if (pr) printk( " pic head param: 0x%x",
pic->picture_header_parameter); pic->picture_header_parameter);
@@ -124,18 +124,18 @@ static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr)
((headr[0]<<4)& 0x30)| ((headr[1]>>4)& 0x0F), ((headr[0]<<4)& 0x30)| ((headr[1]>>4)& 0x0F),
((headr[1]<<3)& 0x38)| ((headr[2]>>5)& 0x0F)); ((headr[1]<<3)& 0x38)| ((headr[2]>>5)& 0x0F));
if ( ( headr[3] & 0x40 ) != 0 ){ if ( ( headr[3] & 0x40 ) != 0 ){
pic->closed_gop = 1; pic->closed_gop = 1;
} else { } else {
pic->closed_gop = 0; pic->closed_gop = 0;
} }
if (pr) printk("closed: %d", pic->closed_gop); if (pr) printk("closed: %d", pic->closed_gop);
if ( ( headr[3] & 0x20 ) != 0 ){ if ( ( headr[3] & 0x20 ) != 0 ){
pic->broken_link = 1; pic->broken_link = 1;
} else { } else {
pic->broken_link = 0; pic->broken_link = 0;
} }
if (pr) printk(" broken: %d\n", pic->broken_link); if (pr) printk(" broken: %d\n", pic->broken_link);
return 0; return 0;
@@ -146,7 +146,7 @@ static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr)
/* needs 8 byte input */ /* needs 8 byte input */
static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr) static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
{ {
int sw; int sw;
int form = -1; int form = -1;
if (pr) printk("Reading sequence header\n"); if (pr) printk("Reading sequence header\n");
@@ -154,9 +154,9 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
vi->horizontal_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4); vi->horizontal_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4);
vi->vertical_size = ((headr[1] &0x0F) << 8) | (headr[2]); vi->vertical_size = ((headr[1] &0x0F) << 8) | (headr[2]);
sw = (int)((headr[3]&0xF0) >> 4) ; sw = (int)((headr[3]&0xF0) >> 4) ;
switch( sw ){ switch( sw ){
case 1: case 1:
if (pr) if (pr)
printk("Videostream: ASPECT: 1:1"); printk("Videostream: ASPECT: 1:1");
@@ -165,84 +165,84 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
case 2: case 2:
if (pr) if (pr)
printk("Videostream: ASPECT: 4:3"); printk("Videostream: ASPECT: 4:3");
vi->aspect_ratio = 133; vi->aspect_ratio = 133;
break; break;
case 3: case 3:
if (pr) if (pr)
printk("Videostream: ASPECT: 16:9"); printk("Videostream: ASPECT: 16:9");
vi->aspect_ratio = 177; vi->aspect_ratio = 177;
break; break;
case 4: case 4:
if (pr) if (pr)
printk("Videostream: ASPECT: 2.21:1"); printk("Videostream: ASPECT: 2.21:1");
vi->aspect_ratio = 221; vi->aspect_ratio = 221;
break; break;
case 5 ... 15: case 5 ... 15:
if (pr) if (pr)
printk("Videostream: ASPECT: reserved"); printk("Videostream: ASPECT: reserved");
vi->aspect_ratio = 0; vi->aspect_ratio = 0;
break; break;
default: default:
vi->aspect_ratio = 0; vi->aspect_ratio = 0;
return -1; return -1;
} }
if (pr) if (pr)
printk(" Size = %dx%d",vi->horizontal_size,vi->vertical_size); printk(" Size = %dx%d",vi->horizontal_size,vi->vertical_size);
sw = (int)(headr[3]&0x0F); sw = (int)(headr[3]&0x0F);
switch ( sw ) { switch ( sw ) {
case 1: case 1:
if (pr) if (pr)
printk(" FRate: 23.976 fps"); printk(" FRate: 23.976 fps");
vi->framerate = 23976; vi->framerate = 23976;
form = -1; form = -1;
break; break;
case 2: case 2:
if (pr) if (pr)
printk(" FRate: 24 fps"); printk(" FRate: 24 fps");
vi->framerate = 24000; vi->framerate = 24000;
form = -1; form = -1;
break; break;
case 3: case 3:
if (pr) if (pr)
printk(" FRate: 25 fps"); printk(" FRate: 25 fps");
vi->framerate = 25000; vi->framerate = 25000;
form = VIDEO_MODE_PAL; form = VIDEO_MODE_PAL;
break; break;
case 4: case 4:
if (pr) if (pr)
printk(" FRate: 29.97 fps"); printk(" FRate: 29.97 fps");
vi->framerate = 29970; vi->framerate = 29970;
form = VIDEO_MODE_NTSC; form = VIDEO_MODE_NTSC;
break; break;
case 5: case 5:
if (pr) if (pr)
printk(" FRate: 30 fps"); printk(" FRate: 30 fps");
vi->framerate = 30000; vi->framerate = 30000;
form = VIDEO_MODE_NTSC; form = VIDEO_MODE_NTSC;
break; break;
case 6: case 6:
if (pr) if (pr)
printk(" FRate: 50 fps"); printk(" FRate: 50 fps");
vi->framerate = 50000; vi->framerate = 50000;
form = VIDEO_MODE_PAL; form = VIDEO_MODE_PAL;
break; break;
case 7: case 7:
if (pr) if (pr)
printk(" FRate: 60 fps"); printk(" FRate: 60 fps");
vi->framerate = 60000; vi->framerate = 60000;
form = VIDEO_MODE_NTSC; form = VIDEO_MODE_NTSC;
break; break;
} }
vi->bit_rate = (headr[4] << 10) | (headr[5] << 2) | (headr[6] & 0x03); vi->bit_rate = (headr[4] << 10) | (headr[5] << 2) | (headr[6] & 0x03);
vi->vbv_buffer_size vi->vbv_buffer_size
= (( headr[6] & 0xF8) >> 3 ) | (( headr[7] & 0x1F )<< 5); = (( headr[6] & 0xF8) >> 3 ) | (( headr[7] & 0x1F )<< 5);
if (pr){ if (pr){
printk(" BRate: %d Mbit/s",4*(vi->bit_rate)/10000); printk(" BRate: %d Mbit/s",4*(vi->bit_rate)/10000);
@@ -250,7 +250,7 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
printk("\n"); printk("\n");
} }
vi->video_format = form; vi->video_format = form;
return 0; return 0;
} }
@@ -308,7 +308,7 @@ static int get_ainfo(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr)
if (!found) return -1; if (!found) return -1;
if (c+3 >= count) return -1; if (c+3 >= count) return -1;
headr = mbuf+c; headr = mbuf+c;
ai->layer = (headr[1] & 0x06) >> 1; ai->layer = (headr[1] & 0x06) >> 1;
@@ -368,7 +368,7 @@ int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int p
if (c+5 >= count) return -1; if (c+5 >= count) return -1;
ai->layer = 0; // 0 for AC3 ai->layer = 0; // 0 for AC3
headr = mbuf+c+2; headr = mbuf+c+2;
frame = (headr[2]&0x3f); frame = (headr[2]&0x3f);
ai->bit_rate = ac3_bitrates[frame >> 1]*1000; ai->bit_rate = ac3_bitrates[frame >> 1]*1000;
@@ -396,159 +396,159 @@ EXPORT_SYMBOL(dvb_filter_get_ac3info);
#if 0 #if 0
static u8 *skip_pes_header(u8 **bufp) static u8 *skip_pes_header(u8 **bufp)
{ {
u8 *inbuf = *bufp; u8 *inbuf = *bufp;
u8 *buf = inbuf; u8 *buf = inbuf;
u8 *pts = NULL; u8 *pts = NULL;
int skip = 0; int skip = 0;
static const int mpeg1_skip_table[16] = { static const int mpeg1_skip_table[16] = {
1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff, 1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
}; };
if ((inbuf[6] & 0xc0) == 0x80){ /* mpeg2 */ if ((inbuf[6] & 0xc0) == 0x80){ /* mpeg2 */
if (buf[7] & PTS_ONLY) if (buf[7] & PTS_ONLY)
pts = buf+9; pts = buf+9;
else pts = NULL; else pts = NULL;
buf = inbuf + 9 + inbuf[8]; buf = inbuf + 9 + inbuf[8];
} else { /* mpeg1 */ } else { /* mpeg1 */
for (buf = inbuf + 6; *buf == 0xff; buf++) for (buf = inbuf + 6; *buf == 0xff; buf++)
if (buf == inbuf + 6 + 16) { if (buf == inbuf + 6 + 16) {
break; break;
} }
if ((*buf & 0xc0) == 0x40) if ((*buf & 0xc0) == 0x40)
buf += 2; buf += 2;
skip = mpeg1_skip_table [*buf >> 4]; skip = mpeg1_skip_table [*buf >> 4];
if (skip == 5 || skip == 10) pts = buf; if (skip == 5 || skip == 10) pts = buf;
else pts = NULL; else pts = NULL;
buf += mpeg1_skip_table [*buf >> 4]; buf += mpeg1_skip_table [*buf >> 4];
} }
*bufp = buf; *bufp = buf;
return pts; return pts;
} }
#endif #endif
#if 0 #if 0
static void initialize_quant_matrix( u32 *matrix ) static void initialize_quant_matrix( u32 *matrix )
{ {
int i; int i;
matrix[0] = 0x08101013; matrix[0] = 0x08101013;
matrix[1] = 0x10131616; matrix[1] = 0x10131616;
matrix[2] = 0x16161616; matrix[2] = 0x16161616;
matrix[3] = 0x1a181a1b; matrix[3] = 0x1a181a1b;
matrix[4] = 0x1b1b1a1a; matrix[4] = 0x1b1b1a1a;
matrix[5] = 0x1a1a1b1b; matrix[5] = 0x1a1a1b1b;
matrix[6] = 0x1b1d1d1d; matrix[6] = 0x1b1d1d1d;
matrix[7] = 0x2222221d; matrix[7] = 0x2222221d;
matrix[8] = 0x1d1d1b1b; matrix[8] = 0x1d1d1b1b;
matrix[9] = 0x1d1d2020; matrix[9] = 0x1d1d2020;
matrix[10] = 0x22222526; matrix[10] = 0x22222526;
matrix[11] = 0x25232322; matrix[11] = 0x25232322;
matrix[12] = 0x23262628; matrix[12] = 0x23262628;
matrix[13] = 0x28283030; matrix[13] = 0x28283030;
matrix[14] = 0x2e2e3838; matrix[14] = 0x2e2e3838;
matrix[15] = 0x3a454553; matrix[15] = 0x3a454553;
for ( i = 16 ; i < 32 ; i++ ) for ( i = 16 ; i < 32 ; i++ )
matrix[i] = 0x10101010; matrix[i] = 0x10101010;
} }
#endif #endif
#if 0 #if 0
static void initialize_mpg_picture(struct mpg_picture *pic) static void initialize_mpg_picture(struct mpg_picture *pic)
{ {
int i; int i;
/* set MPEG1 */ /* set MPEG1 */
pic->mpeg1_flag = 1; pic->mpeg1_flag = 1;
pic->profile_and_level = 0x4A ; /* MP@LL */ pic->profile_and_level = 0x4A ; /* MP@LL */
pic->progressive_sequence = 1; pic->progressive_sequence = 1;
pic->low_delay = 0; pic->low_delay = 0;
pic->sequence_display_extension_flag = 0; pic->sequence_display_extension_flag = 0;
for ( i = 0 ; i < 4 ; i++ ){ for ( i = 0 ; i < 4 ; i++ ){
pic->frame_centre_horizontal_offset[i] = 0; pic->frame_centre_horizontal_offset[i] = 0;
pic->frame_centre_vertical_offset[i] = 0; pic->frame_centre_vertical_offset[i] = 0;
} }
pic->last_frame_centre_horizontal_offset = 0; pic->last_frame_centre_horizontal_offset = 0;
pic->last_frame_centre_vertical_offset = 0; pic->last_frame_centre_vertical_offset = 0;
pic->picture_display_extension_flag[0] = 0; pic->picture_display_extension_flag[0] = 0;
pic->picture_display_extension_flag[1] = 0; pic->picture_display_extension_flag[1] = 0;
pic->sequence_header_flag = 0; pic->sequence_header_flag = 0;
pic->gop_flag = 0; pic->gop_flag = 0;
pic->sequence_end_flag = 0; pic->sequence_end_flag = 0;
} }
#endif #endif
#if 0 #if 0
static void mpg_set_picture_parameter( int32_t field_type, struct mpg_picture *pic ) static void mpg_set_picture_parameter( int32_t field_type, struct mpg_picture *pic )
{ {
int16_t last_h_offset; int16_t last_h_offset;
int16_t last_v_offset; int16_t last_v_offset;
int16_t *p_h_offset; int16_t *p_h_offset;
int16_t *p_v_offset; int16_t *p_v_offset;
if ( pic->mpeg1_flag ){ if ( pic->mpeg1_flag ){
pic->picture_structure[field_type] = VIDEO_FRAME_PICTURE; pic->picture_structure[field_type] = VIDEO_FRAME_PICTURE;
pic->top_field_first = 0; pic->top_field_first = 0;
pic->repeat_first_field = 0; pic->repeat_first_field = 0;
pic->progressive_frame = 1; pic->progressive_frame = 1;
pic->picture_coding_parameter = 0x000010; pic->picture_coding_parameter = 0x000010;
} }
/* Reset flag */ /* Reset flag */
pic->picture_display_extension_flag[field_type] = 0; pic->picture_display_extension_flag[field_type] = 0;
last_h_offset = pic->last_frame_centre_horizontal_offset; last_h_offset = pic->last_frame_centre_horizontal_offset;
last_v_offset = pic->last_frame_centre_vertical_offset; last_v_offset = pic->last_frame_centre_vertical_offset;
if ( field_type == FIRST_FIELD ){ if ( field_type == FIRST_FIELD ){
p_h_offset = pic->frame_centre_horizontal_offset; p_h_offset = pic->frame_centre_horizontal_offset;
p_v_offset = pic->frame_centre_vertical_offset; p_v_offset = pic->frame_centre_vertical_offset;
*p_h_offset = last_h_offset; *p_h_offset = last_h_offset;
*(p_h_offset + 1) = last_h_offset; *(p_h_offset + 1) = last_h_offset;
*(p_h_offset + 2) = last_h_offset; *(p_h_offset + 2) = last_h_offset;
*p_v_offset = last_v_offset; *p_v_offset = last_v_offset;
*(p_v_offset + 1) = last_v_offset; *(p_v_offset + 1) = last_v_offset;
*(p_v_offset + 2) = last_v_offset; *(p_v_offset + 2) = last_v_offset;
} else { } else {
pic->frame_centre_horizontal_offset[3] = last_h_offset; pic->frame_centre_horizontal_offset[3] = last_h_offset;
pic->frame_centre_vertical_offset[3] = last_v_offset; pic->frame_centre_vertical_offset[3] = last_v_offset;
} }
} }
#endif #endif
#if 0 #if 0
static void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_type) static void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_type)
{ {
pic->picture_header = 0; pic->picture_header = 0;
pic->sequence_header_data pic->sequence_header_data
= ( INIT_HORIZONTAL_SIZE << 20 ) = ( INIT_HORIZONTAL_SIZE << 20 )
| ( INIT_VERTICAL_SIZE << 8 ) | ( INIT_VERTICAL_SIZE << 8 )
| ( INIT_ASPECT_RATIO << 4 ) | ( INIT_ASPECT_RATIO << 4 )
| ( INIT_FRAME_RATE ); | ( INIT_FRAME_RATE );
pic->mpeg1_flag = 0; pic->mpeg1_flag = 0;
pic->vinfo.horizontal_size pic->vinfo.horizontal_size
= INIT_DISP_HORIZONTAL_SIZE; = INIT_DISP_HORIZONTAL_SIZE;
pic->vinfo.vertical_size pic->vinfo.vertical_size
= INIT_DISP_VERTICAL_SIZE; = INIT_DISP_VERTICAL_SIZE;
pic->picture_display_extension_flag[field_type] pic->picture_display_extension_flag[field_type]
= 0; = 0;
pic->pts_flag[field_type] = 0; pic->pts_flag[field_type] = 0;
pic->sequence_gop_header = 0; pic->sequence_gop_header = 0;
pic->picture_header = 0; pic->picture_header = 0;
pic->sequence_header_flag = 0; pic->sequence_header_flag = 0;
pic->gop_flag = 0; pic->gop_flag = 0;
pic->sequence_end_flag = 0; pic->sequence_end_flag = 0;
pic->sequence_display_extension_flag = 0; pic->sequence_display_extension_flag = 0;
pic->last_frame_centre_horizontal_offset = 0; pic->last_frame_centre_horizontal_offset = 0;
pic->last_frame_centre_vertical_offset = 0; pic->last_frame_centre_vertical_offset = 0;
pic->channel = chan; pic->channel = chan;
} }
#endif #endif
@@ -588,11 +588,11 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
buf[1]&=~0x40; buf[1]&=~0x40;
} }
if (!len) if (!len)
return 0; return 0;
buf[3]=0x30|((p2ts->cc++)&0x0f); buf[3]=0x30|((p2ts->cc++)&0x0f);
rest=183-len; rest=183-len;
if (rest) { if (rest) {
buf[5]=0x00; buf[5]=0x00;
if (rest-1) if (rest-1)
memset(buf+6, 0xff, rest-1); memset(buf+6, 0xff, rest-1);
} }
+47 -47
View File
@@ -29,8 +29,8 @@ typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
struct dvb_filter_pes2ts { struct dvb_filter_pes2ts {
unsigned char buf[188]; unsigned char buf[188];
unsigned char cc; unsigned char cc;
dvb_filter_pes2ts_cb_t *cb; dvb_filter_pes2ts_cb_t *cb;
void *priv; void *priv;
}; };
@@ -162,7 +162,7 @@ struct dvb_video_info {
u32 bit_rate; u32 bit_rate;
u32 comp_bit_rate; u32 comp_bit_rate;
u32 vbv_buffer_size; u32 vbv_buffer_size;
s16 vbv_delay; s16 vbv_delay;
u32 CSPF; u32 CSPF;
u32 off; u32 off;
}; };
@@ -173,60 +173,60 @@ struct dvb_video_info {
#define VIDEO_FRAME_PICTURE 0x03 #define VIDEO_FRAME_PICTURE 0x03
struct mpg_picture { struct mpg_picture {
int channel; int channel;
struct dvb_video_info vinfo; struct dvb_video_info vinfo;
u32 *sequence_gop_header; u32 *sequence_gop_header;
u32 *picture_header; u32 *picture_header;
s32 time_code; s32 time_code;
int low_delay; int low_delay;
int closed_gop; int closed_gop;
int broken_link; int broken_link;
int sequence_header_flag; int sequence_header_flag;
int gop_flag; int gop_flag;
int sequence_end_flag; int sequence_end_flag;
u8 profile_and_level; u8 profile_and_level;
s32 picture_coding_parameter; s32 picture_coding_parameter;
u32 matrix[32]; u32 matrix[32];
s8 matrix_change_flag; s8 matrix_change_flag;
u8 picture_header_parameter; u8 picture_header_parameter;
/* bit 0 - 2: bwd f code /* bit 0 - 2: bwd f code
bit 3 : fpb vector bit 3 : fpb vector
bit 4 - 6: fwd f code bit 4 - 6: fwd f code
bit 7 : fpf vector */ bit 7 : fpf vector */
int mpeg1_flag; int mpeg1_flag;
int progressive_sequence; int progressive_sequence;
int sequence_display_extension_flag; int sequence_display_extension_flag;
u32 sequence_header_data; u32 sequence_header_data;
s16 last_frame_centre_horizontal_offset; s16 last_frame_centre_horizontal_offset;
s16 last_frame_centre_vertical_offset; s16 last_frame_centre_vertical_offset;
u32 pts[2]; /* [0] 1st field, [1] 2nd field */ u32 pts[2]; /* [0] 1st field, [1] 2nd field */
int top_field_first; int top_field_first;
int repeat_first_field; int repeat_first_field;
int progressive_frame; int progressive_frame;
int bank; int bank;
int forward_bank; int forward_bank;
int backward_bank; int backward_bank;
int compress; int compress;
s16 frame_centre_horizontal_offset[OFF_SIZE]; s16 frame_centre_horizontal_offset[OFF_SIZE];
/* [0-2] 1st field, [3] 2nd field */ /* [0-2] 1st field, [3] 2nd field */
s16 frame_centre_vertical_offset[OFF_SIZE]; s16 frame_centre_vertical_offset[OFF_SIZE];
/* [0-2] 1st field, [3] 2nd field */ /* [0-2] 1st field, [3] 2nd field */
s16 temporal_reference[2]; s16 temporal_reference[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
s8 picture_coding_type[2]; s8 picture_coding_type[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
s8 picture_structure[2]; s8 picture_structure[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
s8 picture_display_extension_flag[2]; s8 picture_display_extension_flag[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
/* picture_display_extenion() 0:no 1:exit*/ /* picture_display_extenion() 0:no 1:exit*/
s8 pts_flag[2]; s8 pts_flag[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
}; };
struct dvb_audio_info { struct dvb_audio_info {
+4 -4
View File
@@ -372,10 +372,10 @@ static int dvb_frontend_thread(void *data)
snprintf (name, sizeof(name), "kdvb-fe-%i", fe->dvb->num); snprintf (name, sizeof(name), "kdvb-fe-%i", fe->dvb->num);
lock_kernel(); lock_kernel();
daemonize(name); daemonize(name);
sigfillset(&current->blocked); sigfillset(&current->blocked);
unlock_kernel(); unlock_kernel();
fepriv->status = 0; fepriv->status = 0;
dvb_frontend_init(fe); dvb_frontend_init(fe);
+4 -4
View File
@@ -41,10 +41,10 @@
#include "dvbdev.h" #include "dvbdev.h"
struct dvb_frontend_tune_settings { struct dvb_frontend_tune_settings {
int min_delay_ms; int min_delay_ms;
int step_size; int step_size;
int max_drift; int max_drift;
struct dvb_frontend_parameters parameters; struct dvb_frontend_parameters parameters;
}; };
struct dvb_frontend; struct dvb_frontend;
+21 -21
View File
@@ -713,7 +713,7 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
if (buffer1_len > 32768) if (buffer1_len > 32768)
printk(KERN_WARNING "length > 32k: %zu.\n", buffer1_len); printk(KERN_WARNING "length > 32k: %zu.\n", buffer1_len);
/* printk("TS callback: %u bytes, %u TS cells @ %p.\n", /* printk("TS callback: %u bytes, %u TS cells @ %p.\n",
buffer1_len, buffer1_len / TS_SZ, buffer1); */ buffer1_len, buffer1_len / TS_SZ, buffer1); */
dvb_net_ule(dev, buffer1, buffer1_len); dvb_net_ule(dev, buffer1, buffer1_len);
return 0; return 0;
} }
@@ -721,8 +721,8 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len) static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
{ {
u8 *eth; u8 *eth;
struct sk_buff *skb; struct sk_buff *skb;
struct net_device_stats *stats = &(((struct dvb_net_priv *) dev->priv)->stats); struct net_device_stats *stats = &(((struct dvb_net_priv *) dev->priv)->stats);
int snap = 0; int snap = 0;
@@ -754,7 +754,7 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
return; return;
} }
snap = 8; snap = 8;
} }
if (pkt[7]) { if (pkt[7]) {
/* FIXME: assemble datagram from multiple sections */ /* FIXME: assemble datagram from multiple sections */
stats->rx_errors++; stats->rx_errors++;
@@ -778,14 +778,14 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
memcpy(eth + 14, pkt + 12 + snap, pkt_len - 12 - 4 - snap); memcpy(eth + 14, pkt + 12 + snap, pkt_len - 12 - 4 - snap);
/* create ethernet header: */ /* create ethernet header: */
eth[0]=pkt[0x0b]; eth[0]=pkt[0x0b];
eth[1]=pkt[0x0a]; eth[1]=pkt[0x0a];
eth[2]=pkt[0x09]; eth[2]=pkt[0x09];
eth[3]=pkt[0x08]; eth[3]=pkt[0x08];
eth[4]=pkt[0x04]; eth[4]=pkt[0x04];
eth[5]=pkt[0x03]; eth[5]=pkt[0x03];
eth[6]=eth[7]=eth[8]=eth[9]=eth[10]=eth[11]=0; eth[6]=eth[7]=eth[8]=eth[9]=eth[10]=eth[11]=0;
if (snap) { if (snap) {
eth[12] = pkt[18]; eth[12] = pkt[18];
@@ -807,7 +807,7 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
stats->rx_packets++; stats->rx_packets++;
stats->rx_bytes+=skb->len; stats->rx_bytes+=skb->len;
netif_rx(skb); netif_rx(skb);
} }
static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len, static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
@@ -815,7 +815,7 @@ static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
struct dmx_section_filter *filter, struct dmx_section_filter *filter,
enum dmx_success success) enum dmx_success success)
{ {
struct net_device *dev = filter->priv; struct net_device *dev = filter->priv;
/** /**
* we rely on the DVB API definition where exactly one complete * we rely on the DVB API definition where exactly one complete
@@ -885,8 +885,8 @@ static int dvb_net_feed_start(struct net_device *dev)
{ {
int ret = 0, i; int ret = 0, i;
struct dvb_net_priv *priv = dev->priv; struct dvb_net_priv *priv = dev->priv;
struct dmx_demux *demux = priv->demux; struct dmx_demux *demux = priv->demux;
unsigned char *mac = (unsigned char *) dev->dev_addr; unsigned char *mac = (unsigned char *) dev->dev_addr;
dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode); dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode);
down(&priv->mutex); down(&priv->mutex);
@@ -1129,12 +1129,12 @@ static int dvb_net_stop(struct net_device *dev)
struct dvb_net_priv *priv = dev->priv; struct dvb_net_priv *priv = dev->priv;
priv->in_use--; priv->in_use--;
return dvb_net_feed_stop(dev); return dvb_net_feed_stop(dev);
} }
static struct net_device_stats * dvb_net_get_stats(struct net_device *dev) static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
{ {
return &((struct dvb_net_priv*) dev->priv)->stats; return &((struct dvb_net_priv*) dev->priv)->stats;
} }
static void dvb_net_setup(struct net_device *dev) static void dvb_net_setup(struct net_device *dev)
@@ -1360,10 +1360,10 @@ static struct file_operations dvb_net_fops = {
}; };
static struct dvb_device dvbdev_net = { static struct dvb_device dvbdev_net = {
.priv = NULL, .priv = NULL,
.users = 1, .users = 1,
.writers = 1, .writers = 1,
.fops = &dvb_net_fops, .fops = &dvb_net_fops,
}; };
+123 -123
View File
@@ -42,216 +42,216 @@
void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len) void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len)
{ {
rbuf->pread=rbuf->pwrite=0; rbuf->pread=rbuf->pwrite=0;
rbuf->data=data; rbuf->data=data;
rbuf->size=len; rbuf->size=len;
init_waitqueue_head(&rbuf->queue); init_waitqueue_head(&rbuf->queue);
spin_lock_init(&(rbuf->lock)); spin_lock_init(&(rbuf->lock));
} }
int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf) int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf)
{ {
return (rbuf->pread==rbuf->pwrite); return (rbuf->pread==rbuf->pwrite);
} }
ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf) ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf)
{ {
ssize_t free; ssize_t free;
free = rbuf->pread - rbuf->pwrite; free = rbuf->pread - rbuf->pwrite;
if (free <= 0) if (free <= 0)
free += rbuf->size; free += rbuf->size;
return free-1; return free-1;
} }
ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf) ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf)
{ {
ssize_t avail; ssize_t avail;
avail = rbuf->pwrite - rbuf->pread; avail = rbuf->pwrite - rbuf->pread;
if (avail < 0) if (avail < 0)
avail += rbuf->size; avail += rbuf->size;
return avail; return avail;
} }
void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf) void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
{ {
rbuf->pread = rbuf->pwrite; rbuf->pread = rbuf->pwrite;
} }
void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf) void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&rbuf->lock, flags); spin_lock_irqsave(&rbuf->lock, flags);
dvb_ringbuffer_flush(rbuf); dvb_ringbuffer_flush(rbuf);
spin_unlock_irqrestore(&rbuf->lock, flags); spin_unlock_irqrestore(&rbuf->lock, flags);
wake_up(&rbuf->queue); wake_up(&rbuf->queue);
} }
ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, int usermem) ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, int usermem)
{ {
size_t todo = len; size_t todo = len;
size_t split; size_t split;
split = (rbuf->pread + len > rbuf->size) ? rbuf->size - rbuf->pread : 0; split = (rbuf->pread + len > rbuf->size) ? rbuf->size - rbuf->pread : 0;
if (split > 0) { if (split > 0) {
if (!usermem) if (!usermem)
memcpy(buf, rbuf->data+rbuf->pread, split); memcpy(buf, rbuf->data+rbuf->pread, split);
else else
if (copy_to_user(buf, rbuf->data+rbuf->pread, split)) if (copy_to_user(buf, rbuf->data+rbuf->pread, split))
return -EFAULT; return -EFAULT;
buf += split; buf += split;
todo -= split; todo -= split;
rbuf->pread = 0; rbuf->pread = 0;
} }
if (!usermem) if (!usermem)
memcpy(buf, rbuf->data+rbuf->pread, todo); memcpy(buf, rbuf->data+rbuf->pread, todo);
else else
if (copy_to_user(buf, rbuf->data+rbuf->pread, todo)) if (copy_to_user(buf, rbuf->data+rbuf->pread, todo))
return -EFAULT; return -EFAULT;
rbuf->pread = (rbuf->pread + todo) % rbuf->size; rbuf->pread = (rbuf->pread + todo) % rbuf->size;
return len; return len;
} }
ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len) ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len)
{ {
size_t todo = len; size_t todo = len;
size_t split; size_t split;
split = (rbuf->pwrite + len > rbuf->size) ? rbuf->size - rbuf->pwrite : 0; split = (rbuf->pwrite + len > rbuf->size) ? rbuf->size - rbuf->pwrite : 0;
if (split > 0) { if (split > 0) {
memcpy(rbuf->data+rbuf->pwrite, buf, split); memcpy(rbuf->data+rbuf->pwrite, buf, split);
buf += split; buf += split;
todo -= split; todo -= split;
rbuf->pwrite = 0; rbuf->pwrite = 0;
} }
memcpy(rbuf->data+rbuf->pwrite, buf, todo); memcpy(rbuf->data+rbuf->pwrite, buf, todo);
rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size; rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size;
return len; return len;
} }
ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len) ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len)
{ {
int status; int status;
ssize_t oldpwrite = rbuf->pwrite; ssize_t oldpwrite = rbuf->pwrite;
DVB_RINGBUFFER_WRITE_BYTE(rbuf, len >> 8); DVB_RINGBUFFER_WRITE_BYTE(rbuf, len >> 8);
DVB_RINGBUFFER_WRITE_BYTE(rbuf, len & 0xff); DVB_RINGBUFFER_WRITE_BYTE(rbuf, len & 0xff);
DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY); DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY);
status = dvb_ringbuffer_write(rbuf, buf, len); status = dvb_ringbuffer_write(rbuf, buf, len);
if (status < 0) rbuf->pwrite = oldpwrite; if (status < 0) rbuf->pwrite = oldpwrite;
return status; return status;
} }
ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx, ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx,
int offset, u8* buf, size_t len, int usermem) int offset, u8* buf, size_t len, int usermem)
{ {
size_t todo; size_t todo;
size_t split; size_t split;
size_t pktlen; size_t pktlen;
pktlen = rbuf->data[idx] << 8; pktlen = rbuf->data[idx] << 8;
pktlen |= rbuf->data[(idx + 1) % rbuf->size]; pktlen |= rbuf->data[(idx + 1) % rbuf->size];
if (offset > pktlen) return -EINVAL; if (offset > pktlen) return -EINVAL;
if ((offset + len) > pktlen) len = pktlen - offset; if ((offset + len) > pktlen) len = pktlen - offset;
idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size; idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size;
todo = len; todo = len;
split = ((idx + len) > rbuf->size) ? rbuf->size - idx : 0; split = ((idx + len) > rbuf->size) ? rbuf->size - idx : 0;
if (split > 0) { if (split > 0) {
if (!usermem) if (!usermem)
memcpy(buf, rbuf->data+idx, split); memcpy(buf, rbuf->data+idx, split);
else else
if (copy_to_user(buf, rbuf->data+idx, split)) if (copy_to_user(buf, rbuf->data+idx, split))
return -EFAULT; return -EFAULT;
buf += split; buf += split;
todo -= split; todo -= split;
idx = 0; idx = 0;
} }
if (!usermem) if (!usermem)
memcpy(buf, rbuf->data+idx, todo); memcpy(buf, rbuf->data+idx, todo);
else else
if (copy_to_user(buf, rbuf->data+idx, todo)) if (copy_to_user(buf, rbuf->data+idx, todo))
return -EFAULT; return -EFAULT;
return len; return len;
} }
void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer *rbuf, size_t idx) void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer *rbuf, size_t idx)
{ {
size_t pktlen; size_t pktlen;
rbuf->data[(idx + 2) % rbuf->size] = PKT_DISPOSED; rbuf->data[(idx + 2) % rbuf->size] = PKT_DISPOSED;
// clean up disposed packets // clean up disposed packets
while(dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) { while(dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) {
if (DVB_RINGBUFFER_PEEK(rbuf, 2) == PKT_DISPOSED) { if (DVB_RINGBUFFER_PEEK(rbuf, 2) == PKT_DISPOSED) {
pktlen = DVB_RINGBUFFER_PEEK(rbuf, 0) << 8; pktlen = DVB_RINGBUFFER_PEEK(rbuf, 0) << 8;
pktlen |= DVB_RINGBUFFER_PEEK(rbuf, 1); pktlen |= DVB_RINGBUFFER_PEEK(rbuf, 1);
DVB_RINGBUFFER_SKIP(rbuf, pktlen + DVB_RINGBUFFER_PKTHDRSIZE); DVB_RINGBUFFER_SKIP(rbuf, pktlen + DVB_RINGBUFFER_PKTHDRSIZE);
} else { } else {
// first packet is not disposed, so we stop cleaning now // first packet is not disposed, so we stop cleaning now
break; break;
} }
} }
} }
ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* pktlen) ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* pktlen)
{ {
int consumed; int consumed;
int curpktlen; int curpktlen;
int curpktstatus; int curpktstatus;
if (idx == -1) { if (idx == -1) {
idx = rbuf->pread; idx = rbuf->pread;
} else { } else {
curpktlen = rbuf->data[idx] << 8; curpktlen = rbuf->data[idx] << 8;
curpktlen |= rbuf->data[(idx + 1) % rbuf->size]; curpktlen |= rbuf->data[(idx + 1) % rbuf->size];
idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size; idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size;
} }
consumed = (idx - rbuf->pread) % rbuf->size; consumed = (idx - rbuf->pread) % rbuf->size;
while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) { while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) {
curpktlen = rbuf->data[idx] << 8; curpktlen = rbuf->data[idx] << 8;
curpktlen |= rbuf->data[(idx + 1) % rbuf->size]; curpktlen |= rbuf->data[(idx + 1) % rbuf->size];
curpktstatus = rbuf->data[(idx + 2) % rbuf->size]; curpktstatus = rbuf->data[(idx + 2) % rbuf->size];
if (curpktstatus == PKT_READY) { if (curpktstatus == PKT_READY) {
*pktlen = curpktlen; *pktlen = curpktlen;
return idx; return idx;
} }
consumed += curpktlen + DVB_RINGBUFFER_PKTHDRSIZE; consumed += curpktlen + DVB_RINGBUFFER_PKTHDRSIZE;
idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size; idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size;
} }
// no packets available // no packets available
return -1; return -1;
} }
+10 -10
View File
@@ -31,13 +31,13 @@
#include <linux/wait.h> #include <linux/wait.h>
struct dvb_ringbuffer { struct dvb_ringbuffer {
u8 *data; u8 *data;
ssize_t size; ssize_t size;
ssize_t pread; ssize_t pread;
ssize_t pwrite; ssize_t pwrite;
wait_queue_head_t queue; wait_queue_head_t queue;
spinlock_t lock; spinlock_t lock;
}; };
#define DVB_RINGBUFFER_PKTHDRSIZE 3 #define DVB_RINGBUFFER_PKTHDRSIZE 3
@@ -106,7 +106,7 @@ extern void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf);
** returns number of bytes transferred or -EFAULT ** returns number of bytes transferred or -EFAULT
*/ */
extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf,
size_t len, int usermem); size_t len, int usermem);
/* write routines & macros */ /* write routines & macros */
@@ -121,7 +121,7 @@ extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf,
** returns number of bytes transferred or -EFAULT ** returns number of bytes transferred or -EFAULT
*/ */
extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
size_t len); size_t len);
/** /**
@@ -133,7 +133,7 @@ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
* returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL. * returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL.
*/ */
extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf,
size_t len); size_t len);
/** /**
* Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this * Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this
@@ -149,7 +149,7 @@ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf,
* returns Number of bytes read, or -EFAULT. * returns Number of bytes read, or -EFAULT.
*/ */
extern ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx, extern ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx,
int offset, u8* buf, size_t len, int usermem); int offset, u8* buf, size_t len, int usermem);
/** /**
* Dispose of a packet in the ring buffer. * Dispose of a packet in the ring buffer.
+66 -66
View File
@@ -47,7 +47,7 @@ static LIST_HEAD(dvb_adapter_list);
static DECLARE_MUTEX(dvbdev_register_lock); static DECLARE_MUTEX(dvbdev_register_lock);
static const char * const dnames[] = { static const char * const dnames[] = {
"video", "audio", "sec", "frontend", "demux", "dvr", "ca", "video", "audio", "sec", "frontend", "demux", "dvr", "ca",
"net", "osd" "net", "osd"
}; };
@@ -90,15 +90,15 @@ static int dvb_device_open(struct inode *inode, struct file *file)
file->private_data = dvbdev; file->private_data = dvbdev;
old_fops = file->f_op; old_fops = file->f_op;
file->f_op = fops_get(dvbdev->fops); file->f_op = fops_get(dvbdev->fops);
if(file->f_op->open) if(file->f_op->open)
err = file->f_op->open(inode,file); err = file->f_op->open(inode,file);
if (err) { if (err) {
fops_put(file->f_op); fops_put(file->f_op);
file->f_op = fops_get(old_fops); file->f_op = fops_get(old_fops);
} }
fops_put(old_fops); fops_put(old_fops);
return err; return err;
} }
return -ENODEV; return -ENODEV;
} }
@@ -117,21 +117,21 @@ static struct cdev dvb_device_cdev = {
int dvb_generic_open(struct inode *inode, struct file *file) int dvb_generic_open(struct inode *inode, struct file *file)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
if (!dvbdev) if (!dvbdev)
return -ENODEV; return -ENODEV;
if (!dvbdev->users) if (!dvbdev->users)
return -EBUSY; return -EBUSY;
if ((file->f_flags & O_ACCMODE) == O_RDONLY) { if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
if (!dvbdev->readers) if (!dvbdev->readers)
return -EBUSY; return -EBUSY;
dvbdev->readers--; dvbdev->readers--;
} else { } else {
if (!dvbdev->writers) if (!dvbdev->writers)
return -EBUSY; return -EBUSY;
dvbdev->writers--; dvbdev->writers--;
} }
@@ -143,10 +143,10 @@ EXPORT_SYMBOL(dvb_generic_open);
int dvb_generic_release(struct inode *inode, struct file *file) int dvb_generic_release(struct inode *inode, struct file *file)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
if (!dvbdev) if (!dvbdev)
return -ENODEV; return -ENODEV;
if ((file->f_flags & O_ACCMODE) == O_RDONLY) { if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
dvbdev->readers++; dvbdev->readers++;
@@ -163,10 +163,10 @@ EXPORT_SYMBOL(dvb_generic_release);
int dvb_generic_ioctl(struct inode *inode, struct file *file, int dvb_generic_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct dvb_device *dvbdev = file->private_data; struct dvb_device *dvbdev = file->private_data;
if (!dvbdev) if (!dvbdev)
return -ENODEV; return -ENODEV;
if (!dvbdev->kernel_ioctl) if (!dvbdev->kernel_ioctl)
return -EINVAL; return -EINVAL;
@@ -334,63 +334,63 @@ EXPORT_SYMBOL(dvb_unregister_adapter);
to the v4l "videodev.o" module, which is unnecessary for some to the v4l "videodev.o" module, which is unnecessary for some
cards (ie. the budget dvb-cards don't need the v4l module...) */ cards (ie. the budget dvb-cards don't need the v4l module...) */
int dvb_usercopy(struct inode *inode, struct file *file, int dvb_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg, unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file, int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)) unsigned int cmd, void *arg))
{ {
char sbuf[128]; char sbuf[128];
void *mbuf = NULL; void *mbuf = NULL;
void *parg = NULL; void *parg = NULL;
int err = -EINVAL; int err = -EINVAL;
/* Copy arguments into temp kernel buffer */ /* Copy arguments into temp kernel buffer */
switch (_IOC_DIR(cmd)) { switch (_IOC_DIR(cmd)) {
case _IOC_NONE: case _IOC_NONE:
/* /*
* For this command, the pointer is actually an integer * For this command, the pointer is actually an integer
* argument. * argument.
*/ */
parg = (void *) arg; parg = (void *) arg;
break; break;
case _IOC_READ: /* some v4l ioctls are marked wrong ... */ case _IOC_READ: /* some v4l ioctls are marked wrong ... */
case _IOC_WRITE: case _IOC_WRITE:
case (_IOC_WRITE | _IOC_READ): case (_IOC_WRITE | _IOC_READ):
if (_IOC_SIZE(cmd) <= sizeof(sbuf)) { if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
parg = sbuf; parg = sbuf;
} else { } else {
/* too big to allocate from stack */ /* too big to allocate from stack */
mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL); mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
if (NULL == mbuf) if (NULL == mbuf)
return -ENOMEM; return -ENOMEM;
parg = mbuf; parg = mbuf;
} }
err = -EFAULT; err = -EFAULT;
if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
goto out; goto out;
break; break;
} }
/* call driver */ /* call driver */
if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD) if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD)
err = -EINVAL; err = -EINVAL;
if (err < 0) if (err < 0)
goto out; goto out;
/* Copy results into user buffer */ /* Copy results into user buffer */
switch (_IOC_DIR(cmd)) switch (_IOC_DIR(cmd))
{ {
case _IOC_READ: case _IOC_READ:
case (_IOC_WRITE | _IOC_READ): case (_IOC_WRITE | _IOC_READ):
if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd))) if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
err = -EFAULT; err = -EFAULT;
break; break;
} }
out: out:
kfree(mbuf); kfree(mbuf);
return err; return err;
} }
static int __init init_dvbdev(void) static int __init init_dvbdev(void)
@@ -427,10 +427,10 @@ error:
static void __exit exit_dvbdev(void) static void __exit exit_dvbdev(void)
{ {
devfs_remove("dvb"); devfs_remove("dvb");
class_destroy(dvb_class); class_destroy(dvb_class);
cdev_del(&dvb_device_cdev); cdev_del(&dvb_device_cdev);
unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
} }
module_init(init_dvbdev); module_init(init_dvbdev);
+3 -3
View File
@@ -68,8 +68,8 @@ struct dvb_device {
int writers; int writers;
int users; int users;
/* don't really need those !? -- FIXME: use video_usercopy */ /* don't really need those !? -- FIXME: use video_usercopy */
int (*kernel_ioctl)(struct inode *inode, struct file *file, int (*kernel_ioctl)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg); unsigned int cmd, void *arg);
void *priv; void *priv;
@@ -97,7 +97,7 @@ we simply define out own dvb_usercopy(), which will hopefully become
generic_usercopy() someday... */ generic_usercopy() someday... */
extern int dvb_usercopy(struct inode *inode, struct file *file, extern int dvb_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg, unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file, int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)); unsigned int cmd, void *arg));
+7 -7
View File
@@ -231,18 +231,18 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
static struct i2c_driver driver = { static struct i2c_driver driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "i2c bt832 driver", .name = "i2c bt832 driver",
.id = -1, /* FIXME */ .id = -1, /* FIXME */
.flags = I2C_DF_NOTIFY, .flags = I2C_DF_NOTIFY,
.attach_adapter = bt832_probe, .attach_adapter = bt832_probe,
.detach_client = bt832_detach, .detach_client = bt832_detach,
.command = bt832_command, .command = bt832_command,
}; };
static struct i2c_client client_template = static struct i2c_client client_template =
{ {
.name = "bt832", .name = "bt832",
.flags = I2C_CLIENT_ALLOW_USE, .flags = I2C_CLIENT_ALLOW_USE,
.driver = &driver, .driver = &driver,
}; };
+39 -39
View File
@@ -727,71 +727,71 @@ void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
static void set_pll_freq(struct bttv *btv, unsigned int fin, unsigned int fout) static void set_pll_freq(struct bttv *btv, unsigned int fin, unsigned int fout)
{ {
unsigned char fl, fh, fi; unsigned char fl, fh, fi;
/* prevent overflows */ /* prevent overflows */
fin/=4; fin/=4;
fout/=4; fout/=4;
fout*=12; fout*=12;
fi=fout/fin; fi=fout/fin;
fout=(fout%fin)*256; fout=(fout%fin)*256;
fh=fout/fin; fh=fout/fin;
fout=(fout%fin)*256; fout=(fout%fin)*256;
fl=fout/fin; fl=fout/fin;
btwrite(fl, BT848_PLL_F_LO); btwrite(fl, BT848_PLL_F_LO);
btwrite(fh, BT848_PLL_F_HI); btwrite(fh, BT848_PLL_F_HI);
btwrite(fi|BT848_PLL_X, BT848_PLL_XCI); btwrite(fi|BT848_PLL_X, BT848_PLL_XCI);
} }
static void set_pll(struct bttv *btv) static void set_pll(struct bttv *btv)
{ {
int i; int i;
if (!btv->pll.pll_crystal) if (!btv->pll.pll_crystal)
return; return;
if (btv->pll.pll_ofreq == btv->pll.pll_current) { if (btv->pll.pll_ofreq == btv->pll.pll_current) {
dprintk("bttv%d: PLL: no change required\n",btv->c.nr); dprintk("bttv%d: PLL: no change required\n",btv->c.nr);
return; return;
} }
if (btv->pll.pll_ifreq == btv->pll.pll_ofreq) { if (btv->pll.pll_ifreq == btv->pll.pll_ofreq) {
/* no PLL needed */ /* no PLL needed */
if (btv->pll.pll_current == 0) if (btv->pll.pll_current == 0)
return; return;
bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n", bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n",
btv->c.nr,btv->pll.pll_ifreq); btv->c.nr,btv->pll.pll_ifreq);
btwrite(0x00,BT848_TGCTRL); btwrite(0x00,BT848_TGCTRL);
btwrite(0x00,BT848_PLL_XCI); btwrite(0x00,BT848_PLL_XCI);
btv->pll.pll_current = 0; btv->pll.pll_current = 0;
return; return;
} }
bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr, bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr,
btv->pll.pll_ifreq, btv->pll.pll_ofreq); btv->pll.pll_ifreq, btv->pll.pll_ofreq);
set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq); set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq);
for (i=0; i<10; i++) { for (i=0; i<10; i++) {
/* Let other people run while the PLL stabilizes */ /* Let other people run while the PLL stabilizes */
bttv_printk("."); bttv_printk(".");
msleep(10); msleep(10);
if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) { if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) {
btwrite(0,BT848_DSTATUS); btwrite(0,BT848_DSTATUS);
} else { } else {
btwrite(0x08,BT848_TGCTRL); btwrite(0x08,BT848_TGCTRL);
btv->pll.pll_current = btv->pll.pll_ofreq; btv->pll.pll_current = btv->pll.pll_ofreq;
bttv_printk(" ok\n"); bttv_printk(" ok\n");
return; return;
} }
} }
btv->pll.pll_current = -1; btv->pll.pll_current = -1;
bttv_printk("failed\n"); bttv_printk("failed\n");
return; return;
} }
/* used to switch between the bt848's analog/digital video capture modes */ /* used to switch between the bt848's analog/digital video capture modes */

Some files were not shown because too many files have changed in this diff Show More