Commit 28003225 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] update the dvb core

parent c8639e86
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
# #
dvb-core-objs = dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ dvb-core-objs = dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \
dvb_frontend.o dvb_i2c.o dvb_net.o dvb_ksyms.o dvb_frontend.o dvb_i2c.o dvb_net.o dvb_ksyms.o dvb_ringbuffer.o
obj-$(CONFIG_DVB_CORE) += dvb-core.o obj-$(CONFIG_DVB_CORE) += dvb-core.o
obj-$(CONFIG_DVB_CORE) += crc32.o
...@@ -144,6 +144,14 @@ struct dmx_section_feed_s { ...@@ -144,6 +144,14 @@ struct dmx_section_feed_s {
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_s* parent; /* Back-pointer */ struct dmx_demux_s* 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;
u32 crc_val;
u8 secbuf[4096];
int secbufp;
int seclen;
int (*set) (struct dmx_section_feed_s* feed, int (*set) (struct dmx_section_feed_s* feed,
__u16 pid, __u16 pid,
size_t circular_buffer_size, size_t circular_buffer_size,
...@@ -162,16 +170,16 @@ typedef struct dmx_section_feed_s dmx_section_feed_t; ...@@ -162,16 +170,16 @@ typedef struct dmx_section_feed_s dmx_section_feed_t;
/* Callback functions */ /* Callback functions */
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
typedef int (*dmx_ts_cb) ( __u8 * buffer1, typedef int (*dmx_ts_cb) ( const u8 * buffer1,
size_t buffer1_length, size_t buffer1_length,
__u8 * buffer2, const u8 * buffer2,
size_t buffer2_length, size_t buffer2_length,
dmx_ts_feed_t* source, dmx_ts_feed_t* source,
dmx_success_t success); dmx_success_t success);
typedef int (*dmx_section_cb) ( __u8 * buffer1, typedef int (*dmx_section_cb) ( const u8 * buffer1,
size_t buffer1_len, size_t buffer1_len,
__u8 * buffer2, const u8 * buffer2,
size_t buffer2_len, size_t buffer2_len,
dmx_section_filter_t * source, dmx_section_filter_t * source,
dmx_success_t success); dmx_success_t success);
...@@ -278,6 +286,9 @@ struct dmx_demux_s { ...@@ -278,6 +286,9 @@ struct dmx_demux_s {
int (*disconnect_frontend) (struct dmx_demux_s* demux); int (*disconnect_frontend) (struct dmx_demux_s* demux);
int (*get_pes_pids) (struct dmx_demux_s* demux, __u16 *pids); int (*get_pes_pids) (struct dmx_demux_s* demux, __u16 *pids);
int (*get_stc) (struct dmx_demux_s* demux, unsigned int num,
uint64_t *stc, unsigned int *base);
}; };
typedef struct dmx_demux_s dmx_demux_t; typedef struct dmx_demux_s dmx_demux_t;
......
This diff is collapsed.
...@@ -85,6 +85,8 @@ typedef struct dmxdev_filter_s { ...@@ -85,6 +85,8 @@ typedef struct dmxdev_filter_s {
struct dmxdev_s *dev; struct dmxdev_s *dev;
dmxdev_buffer_t buffer; dmxdev_buffer_t buffer;
struct semaphore mutex;
// only for sections // only for sections
struct timer_list timer; struct timer_list timer;
int todo; int todo;
......
This diff is collapsed.
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#ifndef _DVB_DEMUX_H_ #ifndef _DVB_DEMUX_H_
#define _DVB_DEMUX_H_ #define _DVB_DEMUX_H_
#include <asm/semaphore.h>
#include <linux/timer.h>
#include "demux.h" #include "demux.h"
#define DMX_TYPE_TS 0 #define DMX_TYPE_TS 0
...@@ -59,6 +62,8 @@ struct dvb_demux_filter { ...@@ -59,6 +62,8 @@ struct dvb_demux_filter {
}; };
#define DMX_FEED_ENTRY(pos) list_entry(pos, struct dvb_demux_feed, list_head)
struct dvb_demux_feed { struct dvb_demux_feed {
union { union {
dmx_ts_feed_t ts; dmx_ts_feed_t ts;
...@@ -71,13 +76,13 @@ struct dvb_demux_feed { ...@@ -71,13 +76,13 @@ struct dvb_demux_feed {
} cb; } cb;
struct dvb_demux *demux; struct dvb_demux *demux;
void *priv;
int type; int type;
int state; int state;
u16 pid; u16 pid;
u8 *buffer; u8 *buffer;
int buffer_size; int buffer_size;
int descramble; int descramble;
int check_crc;
struct timespec timeout; struct timespec timeout;
struct dvb_demux_filter *filter; struct dvb_demux_filter *filter;
...@@ -86,12 +91,11 @@ struct dvb_demux_feed { ...@@ -86,12 +91,11 @@ struct dvb_demux_feed {
int ts_type; int ts_type;
dmx_ts_pes_t pes_type; dmx_ts_pes_t pes_type;
u8 secbuf[4096];
int secbufp;
int seclen;
int cc; int cc;
u16 peslen; u16 peslen;
struct list_head list_head;
}; };
struct dvb_demux { struct dvb_demux {
...@@ -99,10 +103,14 @@ struct dvb_demux { ...@@ -99,10 +103,14 @@ struct dvb_demux {
void *priv; void *priv;
int filternum; int filternum;
int feednum; int feednum;
int (*start_feed)(struct dvb_demux_feed *); int (*start_feed) (struct dvb_demux_feed *feed);
int (*stop_feed)(struct dvb_demux_feed *); int (*stop_feed) (struct dvb_demux_feed *feed);
int (*write_to_decoder)(struct dvb_demux_feed *, u8 *, size_t); int (*write_to_decoder) (struct dvb_demux_feed *feed,
const u8 *buf, size_t len);
u32 (*check_crc32) (struct dvb_demux_feed *feed,
const u8 *buf, size_t len);
void (*memcopy) (struct dvb_demux_feed *feed, u8 *dst,
const u8 *src, size_t len);
int users; int users;
#define MAX_DVB_DEMUX_USERS 10 #define MAX_DVB_DEMUX_USERS 10
...@@ -117,7 +125,7 @@ struct dvb_demux { ...@@ -117,7 +125,7 @@ struct dvb_demux {
int recording; int recording;
#define DMX_MAX_PID 0x2000 #define DMX_MAX_PID 0x2000
struct dvb_demux_feed *pid2feed[DMX_MAX_PID+1]; struct list_head feed_list;
u8 tsbuf[188]; u8 tsbuf[188];
int tsbufp; int tsbufp;
...@@ -129,6 +137,7 @@ struct dvb_demux { ...@@ -129,6 +137,7 @@ struct dvb_demux {
int dvb_dmx_init(struct dvb_demux *dvbdemux); int dvb_dmx_init(struct dvb_demux *dvbdemux);
int dvb_dmx_release(struct dvb_demux *dvbdemux); int dvb_dmx_release(struct dvb_demux *dvbdemux);
void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf); void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf);
void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, int count); void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, size_t count);
void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);
#endif /* _DVB_DEMUX_H_ */ #endif /* _DVB_DEMUX_H_ */
This diff is collapsed.
...@@ -17,6 +17,7 @@ typedef struct dvb_filter_pes2ts_s { ...@@ -17,6 +17,7 @@ typedef struct dvb_filter_pes2ts_s {
void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid, void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid,
dvb_filter_pes2ts_cb_t *cb, void *priv); dvb_filter_pes2ts_cb_t *cb, void *priv);
int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len); int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len);
...@@ -223,12 +224,7 @@ typedef struct audio_i{ ...@@ -223,12 +224,7 @@ typedef struct audio_i{
uint32_t off; uint32_t off;
} AudioInfo; } AudioInfo;
int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr);
void dvb_filter_ipack_reset(ipack *p);
int dvb_filter_instant_repack(u8 *buf, int count, ipack *p);
void dvb_filter_ipack_init(ipack *p, int size,
void (*func)(u8 *buf, int size, void *priv));
void dvb_filter_ipack_free(ipack * p);
void dvb_filter_ipack_flush(ipack *p);
#endif #endif
This diff is collapsed.
...@@ -52,8 +52,10 @@ struct dvb_frontend { ...@@ -52,8 +52,10 @@ struct dvb_frontend {
int (*before_ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg); int (*before_ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg);
int (*ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg); int (*ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg);
int (*after_ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg); int (*after_ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg);
void (*notifier_callback) (fe_status_t s, void *data);
struct dvb_i2c_bus *i2c; struct dvb_i2c_bus *i2c;
void *before_after_data; /* can be used by hardware module... */ void *before_after_data; /* can be used by hardware module... */
void *notifier_data; /* can be used by hardware module... */
void *data; /* can be used by hardware module... */ void *data; /* can be used by hardware module... */
}; };
......
This diff is collapsed.
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
struct dvb_i2c_bus { struct dvb_i2c_bus {
struct list_head list_head; struct list_head list_head;
int (*xfer) (struct dvb_i2c_bus *i2c, struct i2c_msg msgs[], int num); int (*xfer) (struct dvb_i2c_bus *i2c,
const struct i2c_msg msgs[],
int num);
void *data; void *data;
struct dvb_adapter *adapter; struct dvb_adapter *adapter;
int id; int id;
...@@ -38,17 +40,16 @@ struct dvb_i2c_bus { ...@@ -38,17 +40,16 @@ struct dvb_i2c_bus {
}; };
extern extern struct dvb_i2c_bus*
struct dvb_i2c_bus* dvb_register_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c, dvb_register_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[], const struct i2c_msg *msgs, int num),
int num), void *data,
void *data, struct dvb_adapter *adapter,
struct dvb_adapter *adapter, int id);
int id);
extern extern
void dvb_unregister_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c, void dvb_unregister_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c,
struct i2c_msg msgs[], int num), const struct i2c_msg msgs[], int num),
struct dvb_adapter *adapter, struct dvb_adapter *adapter,
int id); int id);
......
...@@ -8,6 +8,69 @@ ...@@ -8,6 +8,69 @@
#include "dvb_demux.h" #include "dvb_demux.h"
#include "dvb_net.h" #include "dvb_net.h"
/* if the miracle happens and "generic_usercopy()" is included into
the kernel, then this can vanish. please don't make the mistake and
define this as video_usercopy(). this will introduce a dependecy
to the v4l "videodev.o" module, which is unnecessary for some
cards (ie. the budget dvb-cards don't need the v4l module...) */
int dvb_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg))
{
char sbuf[128];
void *mbuf = NULL;
void *parg = NULL;
int err = -EINVAL;
/* Copy arguments into temp kernel buffer */
switch (_IOC_DIR(cmd)) {
case _IOC_NONE:
parg = (void *)arg;
break;
case _IOC_READ: /* some v4l ioctls are marked wrong ... */
case _IOC_WRITE:
case (_IOC_WRITE | _IOC_READ):
if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
parg = sbuf;
} else {
/* too big to allocate from stack */
mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
if (NULL == mbuf)
return -ENOMEM;
parg = mbuf;
}
err = -EFAULT;
if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd)))
goto out;
break;
}
/* call driver */
if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD)
err = -EINVAL;
if (err < 0)
goto out;
/* Copy results into user buffer */
switch (_IOC_DIR(cmd))
{
case _IOC_READ:
case (_IOC_WRITE | _IOC_READ):
if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd)))
err = -EFAULT;
break;
}
out:
if (mbuf)
kfree(mbuf);
return err;
}
EXPORT_SYMBOL(dvb_usercopy);
EXPORT_SYMBOL(dvb_dmxdev_init); EXPORT_SYMBOL(dvb_dmxdev_init);
EXPORT_SYMBOL(dvb_dmxdev_release); EXPORT_SYMBOL(dvb_dmxdev_release);
...@@ -15,6 +78,7 @@ EXPORT_SYMBOL(dvb_dmx_init); ...@@ -15,6 +78,7 @@ EXPORT_SYMBOL(dvb_dmx_init);
EXPORT_SYMBOL(dvb_dmx_release); EXPORT_SYMBOL(dvb_dmx_release);
EXPORT_SYMBOL(dvb_dmx_swfilter_packet); EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
EXPORT_SYMBOL(dvb_dmx_swfilter_packets); EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
EXPORT_SYMBOL(dvb_dmx_swfilter);
EXPORT_SYMBOL(dvb_register_frontend); EXPORT_SYMBOL(dvb_register_frontend);
EXPORT_SYMBOL(dvb_unregister_frontend); EXPORT_SYMBOL(dvb_unregister_frontend);
...@@ -39,11 +103,7 @@ EXPORT_SYMBOL(dvb_generic_ioctl); ...@@ -39,11 +103,7 @@ EXPORT_SYMBOL(dvb_generic_ioctl);
EXPORT_SYMBOL(dvb_generic_open); EXPORT_SYMBOL(dvb_generic_open);
EXPORT_SYMBOL(dvb_generic_release); EXPORT_SYMBOL(dvb_generic_release);
EXPORT_SYMBOL(dvb_filter_ipack_init);
EXPORT_SYMBOL(dvb_filter_ipack_reset);
EXPORT_SYMBOL(dvb_filter_ipack_free);
EXPORT_SYMBOL(dvb_filter_ipack_flush);
EXPORT_SYMBOL(dvb_filter_instant_repack);
EXPORT_SYMBOL(dvb_filter_pes2ts_init); EXPORT_SYMBOL(dvb_filter_pes2ts_init);
EXPORT_SYMBOL(dvb_filter_pes2ts); EXPORT_SYMBOL(dvb_filter_pes2ts);
EXPORT_SYMBOL(dvb_filter_get_ac3info);
This diff is collapsed.
...@@ -32,23 +32,9 @@ ...@@ -32,23 +32,9 @@
#include "dvbdev.h" #include "dvbdev.h"
#define DVB_NET_DEVICES_MAX 10 #define DVB_NET_DEVICES_MAX 10
#define DVB_NET_MULTICAST_MAX 10
typedef struct dvb_net_priv_s {
struct net_device_stats stats;
char name[6];
u16 pid;
dmx_demux_t *demux;
dmx_section_feed_t *secfeed;
dmx_section_filter_t *secfilter;
int multi_num;
dmx_section_filter_t *multi_secfilter[DVB_NET_MULTICAST_MAX];
unsigned char multi_macs[DVB_NET_MULTICAST_MAX][6];
} dvb_net_priv_t;
typedef struct dvb_net_s {
struct dvb_device *dvbdev;
typedef struct dvb_net {
struct dvb_device *dvbdev;
int card_num; int card_num;
int dev_num; int dev_num;
struct net_device device[DVB_NET_DEVICES_MAX]; struct net_device device[DVB_NET_DEVICES_MAX];
...@@ -57,7 +43,8 @@ typedef struct dvb_net_s { ...@@ -57,7 +43,8 @@ typedef struct dvb_net_s {
} dvb_net_t; } dvb_net_t;
void dvb_net_release(dvb_net_t *); void dvb_net_release(struct dvb_net *);
int dvb_net_init(struct dvb_adapter *, dvb_net_t *, dmx_demux_t *); int dvb_net_init(struct dvb_adapter *, struct dvb_net *, dmx_demux_t *);
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -48,6 +48,7 @@ struct dvb_adapter { ...@@ -48,6 +48,7 @@ struct dvb_adapter {
devfs_handle_t devfs_handle; devfs_handle_t devfs_handle;
struct list_head list_head; struct list_head list_head;
struct list_head device_list; struct list_head device_list;
const char *name;
}; };
...@@ -63,14 +64,14 @@ struct dvb_device { ...@@ -63,14 +64,14 @@ struct dvb_device {
int writers; int writers;
/* 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;
}; };
extern int dvb_register_adapter (struct dvb_adapter **padap, char *name); extern int dvb_register_adapter (struct dvb_adapter **padap, const char *name);
extern int dvb_unregister_adapter (struct dvb_adapter *adap); extern int dvb_unregister_adapter (struct dvb_adapter *adap);
extern int dvb_register_device (struct dvb_adapter *adap, extern int dvb_register_device (struct dvb_adapter *adap,
...@@ -84,7 +85,10 @@ extern void dvb_unregister_device (struct dvb_device *dvbdev); ...@@ -84,7 +85,10 @@ extern void dvb_unregister_device (struct dvb_device *dvbdev);
extern int dvb_generic_open (struct inode *inode, struct file *file); extern int dvb_generic_open (struct inode *inode, struct file *file);
extern int dvb_generic_release (struct inode *inode, struct file *file); extern int dvb_generic_release (struct inode *inode, struct file *file);
extern int dvb_generic_ioctl (struct inode *inode, struct file *file, extern int dvb_generic_ioctl (struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
int dvb_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg));
#endif /* #ifndef _DVBDEV_H_ */ #endif /* #ifndef _DVBDEV_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment