Commit 33e9942c authored by Michael Hunold's avatar Michael Hunold Committed by Linus Torvalds

[PATCH] update dvb subsystem core

 - update dvb subsystem core
 - switched from user-land types like __u8 to u8 and uint16_t to u16
   this makes the patch rather large.
 - updated the dvr (digital videorecording) facility
 - renamed some structures, like "struct dmxdev_s" to "struct dmxdev"
 - introduced dvb_functions.[ch], where some linux-kernel specific
   functions are encapsulated.  by this, the dvb subsystem stays quite
   independent from deeper linux kernel functions.
 - moved dvb_usercopy() to dvb_functions.c -- this is essentially
   video_usercopy() which should be generic_usercopy() instead...
 - Made the dvb-core in dvbdev.c work with devfs again.
 - remove all typedefs from structs
 - remove all typedefs from enums
parent 03ff595c
......@@ -3,6 +3,6 @@
#
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_ringbuffer.o
dvb_functions.o dvb_frontend.o dvb_i2c.o dvb_net.o dvb_ksyms.o dvb_ringbuffer.o
obj-$(CONFIG_DVB_CORE) += dvb-core.o
This diff is collapsed.
This diff is collapsed.
......@@ -24,55 +24,54 @@
#ifndef _DMXDEV_H_
#define _DMXDEV_H_
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include <linux/dvb/dmx.h>
#include <linux/version.h>
#include <asm/types.h>
#include <asm/semaphore.h>
#include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/wait.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/dvb/dmx.h>
#include "dvbdev.h"
#include "demux.h"
typedef enum {
enum dmxdevype {
DMXDEV_TYPE_NONE,
DMXDEV_TYPE_SEC,
DMXDEV_TYPE_PES,
} dmxdev_type_t;
};
typedef enum {
enum dmxdev_state {
DMXDEV_STATE_FREE,
DMXDEV_STATE_ALLOCATED,
DMXDEV_STATE_SET,
DMXDEV_STATE_GO,
DMXDEV_STATE_DONE,
DMXDEV_STATE_TIMEDOUT
} dmxdev_state_t;
};
typedef struct dmxdev_buffer_s {
uint8_t *data;
uint32_t size;
int32_t pread;
int32_t pwrite;
struct dmxdev_buffer {
u8 *data;
int size;
int pread;
int pwrite;
wait_queue_head_t queue;
int error;
} dmxdev_buffer_t;
};
typedef struct dmxdev_filter_s {
struct dmxdev_filter {
struct dvb_device *dvbdev;
union {
dmx_section_filter_t *sec;
struct dmx_section_filter *sec;
} filter;
union {
dmx_ts_feed_t *ts;
dmx_section_feed_t *sec;
struct dmx_ts_feed *ts;
struct dmx_section_feed *sec;
} feed;
union {
......@@ -81,50 +80,50 @@ typedef struct dmxdev_filter_s {
} params;
int type;
dmxdev_state_t state;
struct dmxdev_s *dev;
dmxdev_buffer_t buffer;
enum dmxdev_state state;
struct dmxdev *dev;
struct dmxdev_buffer buffer;
struct semaphore mutex;
// only for sections
/* only for sections */
struct timer_list timer;
int todo;
uint8_t secheader[3];
u8 secheader[3];
u16 pid;
} dmxdev_filter_t;
};
typedef struct dmxdev_dvr_s {
struct dmxdev_dvr {
int state;
struct dmxdev_s *dev;
dmxdev_buffer_t buffer;
} dmxdev_dvr_t;
struct dmxdev *dev;
struct dmxdev_buffer buffer;
};
typedef struct dmxdev_s {
struct dmxdev {
struct dvb_device *dvbdev;
struct dvb_device *dvr_dvbdev;
dmxdev_filter_t *filter;
dmxdev_dvr_t *dvr;
dmx_demux_t *demux;
struct dmxdev_filter *filter;
struct dmxdev_dvr *dvr;
struct dmx_demux *demux;
int filternum;
int capabilities;
#define DMXDEV_CAP_DUPLEX 1
dmx_frontend_t *dvr_orig_fe;
struct dmx_frontend *dvr_orig_fe;
dmxdev_buffer_t dvr_buffer;
struct dmxdev_buffer dvr_buffer;
#define DVR_BUFFER_SIZE (10*188*1024)
struct semaphore mutex;
spinlock_t lock;
} dmxdev_t;
};
int dvb_dmxdev_init(dmxdev_t *dmxdev, struct dvb_adapter *);
void dvb_dmxdev_release(dmxdev_t *dmxdev);
int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *);
void dvb_dmxdev_release(struct dmxdev *dmxdev);
#endif /* _DMXDEV_H_ */
This diff is collapsed.
......@@ -26,7 +26,9 @@
#define _DVB_DEMUX_H_
#include <asm/semaphore.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/spinlock.h>
#include "demux.h"
......@@ -43,7 +45,7 @@
#define DVB_DEMUX_MASK_MAX 18
struct dvb_demux_filter {
dmx_section_filter_t filter;
struct dmx_section_filter filter;
u8 maskandmode [DMX_MAX_FILTER_SIZE];
u8 maskandnotmode [DMX_MAX_FILTER_SIZE];
int doneq;
......@@ -66,8 +68,8 @@ struct dvb_demux_filter {
struct dvb_demux_feed {
union {
dmx_ts_feed_t ts;
dmx_section_feed_t sec;
struct dmx_ts_feed ts;
struct dmx_section_feed sec;
} feed;
union {
......@@ -89,7 +91,7 @@ struct dvb_demux_feed {
int cb_length;
int ts_type;
dmx_ts_pes_t pes_type;
enum dmx_ts_pes pes_type;
int cc;
......@@ -99,7 +101,7 @@ struct dvb_demux_feed {
};
struct dvb_demux {
dmx_demux_t dmx;
struct dmx_demux dmx;
void *priv;
int filternum;
int feednum;
......@@ -140,4 +142,8 @@ void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf);
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);
int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend);
int dvbdmx_disconnect_frontend(struct dmx_demux *demux);
#endif /* _DVB_DEMUX_H_ */
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include "dvb_filter.h"
unsigned int bitrates[3][16] =
......@@ -6,14 +8,14 @@ unsigned int bitrates[3][16] =
{0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,0},
{0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}};
uint32_t freq[4] = {441, 480, 320, 0};
u32 freq[4] = {441, 480, 320, 0};
unsigned int ac3_bitrates[32] =
{32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640,
0,0,0,0,0,0,0,0,0,0,0,0,0};
uint32_t ac3_freq[4] = {480, 441, 320, 0};
uint32_t ac3_frames[3][32] =
u32 ac3_freq[4] = {480, 441, 320, 0};
u32 ac3_frames[3][32] =
{{64,80,96,112,128,160,192,224,256,320,384,448,512,640,768,896,1024,
1152,1280,0,0,0,0,0,0,0,0,0,0,0,0,0},
{69,87,104,121,139,174,208,243,278,348,417,487,557,696,835,975,1114,
......@@ -67,9 +69,9 @@ void ts_to_pes(ipack *p, u8 *buf) // don't need count (=188)
#if 0
/* needs 5 byte input, returns picture coding type*/
static
int read_picture_header(uint8_t *headr, mpg_picture *pic, int field, int pr)
int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, int pr)
{
uint8_t pct;
u8 pct;
if (pr) printk( "Pic header: ");
pic->temporal_reference[field] = (( headr[0] << 2 ) |
......@@ -114,7 +116,7 @@ int read_picture_header(uint8_t *headr, mpg_picture *pic, int field, int pr)
#if 0
/* needs 4 byte input */
static
int read_gop_header(uint8_t *headr, mpg_picture *pic, int pr)
int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr)
{
if (pr) printk("GOP header: ");
......@@ -146,7 +148,7 @@ int read_gop_header(uint8_t *headr, mpg_picture *pic, int pr)
#if 0
/* needs 8 byte input */
static
int read_sequence_header(uint8_t *headr, VideoInfo *vi, int pr)
int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
{
int sw;
int form = -1;
......@@ -261,14 +263,14 @@ int read_sequence_header(uint8_t *headr, VideoInfo *vi, int pr)
#if 0
static
int get_vinfo(uint8_t *mbuf, int count, VideoInfo *vi, int pr)
int get_vinfo(u8 *mbuf, int count, struct dvb_video_info *vi, int pr)
{
uint8_t *headr;
u8 *headr;
int found = 0;
int c = 0;
while (found < 4 && c+4 < count){
uint8_t *b;
u8 *b;
b = mbuf+c;
if ( b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01
......@@ -291,15 +293,15 @@ int get_vinfo(uint8_t *mbuf, int count, VideoInfo *vi, int pr)
#if 0
static
int get_ainfo(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
int get_ainfo(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr)
{
uint8_t *headr;
u8 *headr;
int found = 0;
int c = 0;
int fr = 0;
while (found < 2 && c < count){
uint8_t b[2];
u8 b[2];
memcpy( b, mbuf+c, 2);
if ( b[0] == 0xff && (b[1] & 0xf8) == 0xf8)
......@@ -346,16 +348,16 @@ int get_ainfo(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
#endif
int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr)
{
uint8_t *headr;
u8 *headr;
int found = 0;
int c = 0;
uint8_t frame = 0;
u8 frame = 0;
int fr = 0;
while ( !found && c < count){
uint8_t *b = mbuf+c;
u8 *b = mbuf+c;
if ( b[0] == 0x0b && b[1] == 0x77 )
found = 1;
......@@ -378,18 +380,18 @@ int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
ai->bit_rate = ac3_bitrates[frame >> 1]*1000;
if (pr)
printk(" BRate: %d kb/s", ai->bit_rate/1000);
printk(" BRate: %d kb/s", (int) ai->bit_rate/1000);
ai->frequency = (headr[2] & 0xc0 ) >> 6;
fr = (headr[2] & 0xc0 ) >> 6;
ai->frequency = freq[fr]*100;
if (pr) printk (" Freq: %d Hz\n", ai->frequency);
if (pr) printk (" Freq: %d Hz\n", (int) ai->frequency);
ai->framesize = ac3_frames[fr][frame >> 1];
if ((frame & 1) && (fr == 1)) ai->framesize++;
ai->framesize = ai->framesize << 1;
if (pr) printk (" Framesize %d\n", ai->framesize);
if (pr) printk (" Framesize %d\n",(int) ai->framesize);
return 0;
......@@ -398,11 +400,11 @@ int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
#if 0
static
uint8_t *skip_pes_header(uint8_t **bufp)
u8 *skip_pes_header(u8 **bufp)
{
uint8_t *inbuf = *bufp;
uint8_t *buf = inbuf;
uint8_t *pts = NULL;
u8 *inbuf = *bufp;
u8 *buf = inbuf;
u8 *pts = NULL;
int skip = 0;
static const int mpeg1_skip_table[16] = {
......@@ -437,7 +439,7 @@ uint8_t *skip_pes_header(uint8_t **bufp)
#if 0
static
void initialize_quant_matrix( uint32_t *matrix )
void initialize_quant_matrix( u32 *matrix )
{
int i;
......@@ -465,7 +467,7 @@ void initialize_quant_matrix( uint32_t *matrix )
#if 0
static
void initialize_mpg_picture(mpg_picture *pic)
void initialize_mpg_picture(struct mpg_picture *pic)
{
int i;
......@@ -493,7 +495,7 @@ void initialize_mpg_picture(mpg_picture *pic)
#if 0
static
void mpg_set_picture_parameter( int32_t field_type, mpg_picture *pic )
void mpg_set_picture_parameter( int32_t field_type, struct mpg_picture *pic )
{
int16_t last_h_offset;
int16_t last_v_offset;
......@@ -532,7 +534,7 @@ void mpg_set_picture_parameter( int32_t field_type, mpg_picture *pic )
#if 0
static
void init_mpg_picture( mpg_picture *pic, int chan, int32_t field_type)
void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_type)
{
pic->picture_header = 0;
pic->sequence_header_data
......@@ -561,7 +563,7 @@ void init_mpg_picture( mpg_picture *pic, int chan, int32_t field_type)
}
#endif
void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid,
void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
dvb_filter_pes2ts_cb_t *cb, void *priv)
{
unsigned char *buf=p2ts->buf;
......@@ -574,7 +576,7 @@ void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid,
p2ts->priv=priv;
}
int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len)
int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, int len)
{
unsigned char *buf=p2ts->buf;
int ret=0, rest;
......
......@@ -2,23 +2,22 @@
#define _DVB_FILTER_H_
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include "demux.h"
typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
typedef struct dvb_filter_pes2ts_s {
struct dvb_filter_pes2ts {
unsigned char buf[188];
unsigned char cc;
dvb_filter_pes2ts_cb_t *cb;
void *priv;
} dvb_filter_pes2ts_t;
};
void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid,
void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
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(struct dvb_filter_pes2ts *p2ts, unsigned char *pes, int len);
#define PROG_STREAM_MAP 0xBC
......@@ -35,14 +34,14 @@ int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len);
#define ISO13522_STREAM 0xF3
#define PROG_STREAM_DIR 0xFF
#define PICTURE_START 0x00
#define USER_START 0xb2
#define SEQUENCE_HEADER 0xb3
#define SEQUENCE_ERROR 0xb4
#define EXTENSION_START 0xb5
#define SEQUENCE_END 0xb7
#define GOP_START 0xb8
#define EXCEPT_SLICE 0xb0
#define DVB_PICTURE_START 0x00
#define DVB_USER_START 0xb2
#define DVB_SEQUENCE_HEADER 0xb3
#define DVB_SEQUENCE_ERROR 0xb4
#define DVB_EXTENSION_START 0xb5
#define DVB_SEQUENCE_END 0xb7
#define DVB_GOP_START 0xb8
#define DVB_EXCEPT_SLICE 0xb0
#define SEQUENCE_EXTENSION 0x01
#define SEQUENCE_DISPLAY_EXTENSION 0x02
......@@ -111,12 +110,12 @@ int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len);
#define IPACKS 2048
#endif
typedef struct ipack_s {
struct ipack {
int size;
int found;
u8 *buf;
u8 cid;
uint32_t plength;
u32 plength;
u8 plen[2];
u8 flag1;
u8 flag2;
......@@ -131,34 +130,33 @@ typedef struct ipack_s {
void (*func)(u8 *buf, int size, void *priv);
int count;
int repack_subids;
} ipack;
typedef struct video_i{
uint32_t horizontal_size;
uint32_t vertical_size;
uint32_t aspect_ratio;
uint32_t framerate;
uint32_t video_format;
uint32_t bit_rate;
uint32_t comp_bit_rate;
uint32_t vbv_buffer_size;
int16_t vbv_delay;
uint32_t CSPF;
uint32_t off;
} VideoInfo;
};
struct dvb_video_info {
u32 horizontal_size;
u32 vertical_size;
u32 aspect_ratio;
u32 framerate;
u32 video_format;
u32 bit_rate;
u32 comp_bit_rate;
u32 vbv_buffer_size;
s16 vbv_delay;
u32 CSPF;
u32 off;
};
#define OFF_SIZE 4
#define FIRST_FIELD 0
#define SECOND_FIELD 1
#define VIDEO_FRAME_PICTURE 0x03
typedef struct mpg_picture_s{
struct mpg_picture {
int channel;
VideoInfo vinfo;
uint32_t *sequence_gop_header;
uint32_t *picture_header;
int32_t time_code;
struct dvb_video_info vinfo;
u32 *sequence_gop_header;
u32 *picture_header;
s32 time_code;
int low_delay;
int closed_gop;
int broken_link;
......@@ -166,12 +164,12 @@ typedef struct mpg_picture_s{
int gop_flag;
int sequence_end_flag;
uint8_t profile_and_level;
int32_t picture_coding_parameter;
uint32_t matrix[32];
int8_t matrix_change_flag;
u8 profile_and_level;
s32 picture_coding_parameter;
u32 matrix[32];
s8 matrix_change_flag;
uint8_t picture_header_parameter;
u8 picture_header_parameter;
/* bit 0 - 2: bwd f code
bit 3 : fpb vector
bit 4 - 6: fwd f code
......@@ -180,11 +178,11 @@ typedef struct mpg_picture_s{
int mpeg1_flag;
int progressive_sequence;
int sequence_display_extension_flag;
uint32_t sequence_header_data;
int16_t last_frame_centre_horizontal_offset;
int16_t last_frame_centre_vertical_offset;
u32 sequence_header_data;
s16 last_frame_centre_horizontal_offset;
s16 last_frame_centre_vertical_offset;
uint32_t pts[2]; /* [0] 1st field, [1] 2nd field */
u32 pts[2]; /* [0] 1st field, [1] 2nd field */
int top_field_first;
int repeat_first_field;
int progressive_frame;
......@@ -192,39 +190,36 @@ typedef struct mpg_picture_s{
int forward_bank;
int backward_bank;
int compress;
int16_t frame_centre_horizontal_offset[OFF_SIZE];
s16 frame_centre_horizontal_offset[OFF_SIZE];
/* [0-2] 1st field, [3] 2nd field */
int16_t frame_centre_vertical_offset[OFF_SIZE];
s16 frame_centre_vertical_offset[OFF_SIZE];
/* [0-2] 1st field, [3] 2nd field */
int16_t temporal_reference[2];
s16 temporal_reference[2];
/* [0] 1st field, [1] 2nd field */
int8_t picture_coding_type[2];
s8 picture_coding_type[2];
/* [0] 1st field, [1] 2nd field */
int8_t picture_structure[2];
s8 picture_structure[2];
/* [0] 1st field, [1] 2nd field */
int8_t picture_display_extension_flag[2];
s8 picture_display_extension_flag[2];
/* [0] 1st field, [1] 2nd field */
/* picture_display_extenion() 0:no 1:exit*/
int8_t pts_flag[2];
s8 pts_flag[2];
/* [0] 1st field, [1] 2nd field */
} mpg_picture;
};
typedef struct audio_i{
struct dvb_audio_info {
int layer ;
uint32_t bit_rate ;
uint32_t frequency ;
uint32_t mode ;
uint32_t mode_extension ;
uint32_t emphasis ;
uint32_t framesize;
uint32_t off;
} AudioInfo;
int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr);
u32 bit_rate;
u32 frequency;
u32 mode;
u32 mode_extension ;
u32 emphasis;
u32 framesize;
u32 off;
};
int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr);
#endif
......@@ -22,8 +22,12 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#include <asm/processor.h>
#include <asm/semaphore.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/module.h>
......@@ -31,6 +35,7 @@
#include "dvb_frontend.h"
#include "dvbdev.h"
#include "dvb_functions.h"
static int dvb_frontend_debug = 0;
......@@ -59,7 +64,7 @@ struct dvb_frontend_data {
struct semaphore sem;
struct list_head list_head;
wait_queue_head_t wait_queue;
struct task_struct *thread;
pid_t thread_pid;
unsigned long release_jiffies;
unsigned long lost_sync_jiffies;
int bending;
......@@ -97,14 +102,6 @@ static LIST_HEAD(frontend_notifier_list);
static DECLARE_MUTEX(frontend_mutex);
static
inline void ddelay (int ms)
{
current->state=TASK_INTERRUPTIBLE;
schedule_timeout((HZ*ms)/1000);
}
static
int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend,
unsigned int cmd, void *arg)
......@@ -116,10 +113,10 @@ int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend,
if (frontend->before_ioctl)
err = frontend->before_ioctl (frontend, cmd, arg);
if (err) {
if (err == -EOPNOTSUPP) {
err = frontend->ioctl (frontend, cmd, arg);
if (err && frontend->after_ioctl)
if ((err == -EOPNOTSUPP) && frontend->after_ioctl)
err = frontend->after_ioctl (frontend, cmd, arg);
}
......@@ -198,7 +195,7 @@ void dvb_call_frontend_notifiers (struct dvb_frontend_data *fe,
fe->lost_sync_jiffies = jiffies;
if (((s ^ fe->status) & FE_HAS_LOCK) && (s & FE_HAS_LOCK))
ddelay (fe->info->notifier_delay);
dvb_delay (fe->info->notifier_delay);
fe->status = s;
......@@ -313,7 +310,7 @@ int dvb_frontend_set_parameters (struct dvb_frontend_data *fe,
dvb_bend_frequency (fe, 0);
dprintk ("%s: f == %i, drift == %i\n",
__FUNCTION__, param->frequency, fe->lnb_drift);
__FUNCTION__, (int) param->frequency, (int) fe->lnb_drift);
param->frequency += fe->lnb_drift + fe->bending;
err = dvb_frontend_internal_ioctl (frontend, FE_SET_FRONTEND, param);
......@@ -391,6 +388,8 @@ void dvb_frontend_recover (struct dvb_frontend_data *fe)
if (fe->info->type == FE_QPSK)
stepsize = fe->parameters.u.qpsk.symbol_rate / 16000;
else if (fe->info->type == FE_QAM)
stepsize = 0;
else
stepsize = fe->info->frequency_stepsize * 2;
......@@ -428,42 +427,31 @@ static
int dvb_frontend_thread (void *data)
{
struct dvb_frontend_data *fe = (struct dvb_frontend_data *) data;
char name [15];
int quality = 0, delay = 3*HZ;
fe_status_t s;
dprintk ("%s\n", __FUNCTION__);
lock_kernel ();
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61))
daemonize ();
#else
daemonize ("dvb fe");
#endif
/* not needed anymore in 2.5.x, done in daemonize() */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
reparent_to_init ();
#endif
sigfillset (&current->blocked);
fe->thread = current;
snprintf (current->comm, sizeof (current->comm), "kdvb-fe-%i:%i",
snprintf (name, sizeof(name), "kdvb-fe-%i:%i",
fe->frontend.i2c->adapter->num, fe->frontend.i2c->id);
unlock_kernel ();
dvb_call_frontend_notifiers (fe, 0);
dvb_frontend_init (fe);
dvb_kernel_thread_setup (name);
fe->lost_sync_count = -1;
dvb_call_frontend_notifiers (fe, 0);
dvb_frontend_init (fe);
while (!dvb_frontend_is_exiting (fe)) {
up (&fe->sem); /* is locked when we enter the thread... */
interruptible_sleep_on_timeout (&fe->wait_queue, delay);
if (signal_pending(current))
break;
if (down_interruptible (&fe->sem)) {
fe->thread = NULL;
return -ERESTARTSYS;
}
if (down_interruptible (&fe->sem))
break;
if (fe->lost_sync_count == -1)
continue;
......@@ -505,7 +493,11 @@ int dvb_frontend_thread (void *data)
dvb_frontend_internal_ioctl (&fe->frontend, FE_SLEEP, NULL);
up (&fe->sem);
fe->thread = NULL;
fe->thread_pid = 0;
mb();
wake_up_interruptible (&fe->wait_queue);
return 0;
}
......@@ -515,32 +507,63 @@ void dvb_frontend_stop (struct dvb_frontend_data *fe)
{
dprintk ("%s\n", __FUNCTION__);
while (fe->thread) {
fe->exit = 1;
mb();
if (!fe->thread_pid)
return;
/* check if the thread is really alive */
if (kill_proc(fe->thread_pid, 0, 1) == -ESRCH) {
printk("dvb_frontend_stop: thread PID %d already died\n",
fe->thread_pid);
/* make sure the mutex was not held by the thread */
init_MUTEX (&fe->sem);
return;
}
wake_up_interruptible (&fe->wait_queue);
current->state = TASK_INTERRUPTIBLE;
schedule_timeout (5);
if (signal_pending(current))
break;
};
interruptible_sleep_on(&fe->wait_queue);
/* paranoia check */
if (fe->thread_pid)
printk("dvb_frontend_stop: warning: thread PID %d won't exit\n",
fe->thread_pid);
}
static
void dvb_frontend_start (struct dvb_frontend_data *fe)
int dvb_frontend_start (struct dvb_frontend_data *fe)
{
int ret;
dprintk ("%s\n", __FUNCTION__);
if (fe->thread)
if (fe->thread_pid) {
if (!fe->exit)
return 0;
else
dvb_frontend_stop (fe);
}
if (signal_pending(current))
return -EINTR;
if (down_interruptible (&fe->sem))
return;
return -EINTR;
fe->exit = 0;
fe->thread = (void*) ~0;
fe->thread_pid = 0;
mb();
kernel_thread (dvb_frontend_thread, fe, 0);
ret = kernel_thread (dvb_frontend_thread, fe, 0);
if (ret < 0) {
printk("dvb_frontend_start: failed to start kernel_thread (%d)\n", ret);
up(&fe->sem);
return ret;
}
fe->thread_pid = ret;
return 0;
}
......@@ -618,10 +641,12 @@ int dvb_frontend_open (struct inode *inode, struct file *file)
return ret;
if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
dvb_frontend_start (fe);
ret = dvb_frontend_start (fe);
if (ret)
dvb_generic_release (inode, file);
/* empty event queue */
fe->events.eventr = fe->events.eventw;
fe->events.eventr = fe->events.eventw = 0;
}
return ret;
......
......@@ -30,10 +30,7 @@
#include <linux/ioctl.h>
#include <linux/i2c.h>
#include <linux/module.h>
#ifndef MODULE_LICENSE
#define MODULE_LICENSE(x)
#endif
#include <linux/errno.h>
#include <linux/dvb/frontend.h>
......
#include <linux/smp_lock.h>
#include <linux/version.h>
#include <asm/uaccess.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/version.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/fs.h>
void dvb_kernel_thread_setup (const char *thread_name)
{
lock_kernel ();
daemonize (thread_name);
sigfillset (&current->blocked);
unlock_kernel ();
}
/* 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_kernel_thread_setup);
#ifndef __DVB_FUNCTIONS_H__
#define __DVB_FUNCTIONS_H__
/**
* a sleeping delay function, waits i ms
*
*/
static inline
void dvb_delay(int i)
{
current->state=TASK_INTERRUPTIBLE;
schedule_timeout((HZ*i)/1000);
}
/* we don't mess with video_usercopy() any more,
we simply define out own dvb_usercopy(), which will hopefull become
generic_usercopy() someday... */
extern 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));
extern void dvb_kernel_thread_setup (const char *thread_name);
#endif
......@@ -19,16 +19,15 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/
#include <asm/semaphore.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#include "compat.h"
#endif
#include "dvb_i2c.h"
#include "dvb_functions.h"
struct dvb_i2c_device {
struct list_head list_head;
......
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include "dmxdev.h"
#include "dvb_filter.h"
#include "dvb_frontend.h"
#include "dvb_i2c.h"
#include "dvbdev.h"
#include "dvb_demux.h"
#include "dvb_frontend.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);
#include "dvb_filter.h"
EXPORT_SYMBOL(dvb_dmxdev_init);
EXPORT_SYMBOL(dvb_dmxdev_release);
......@@ -79,6 +18,8 @@ EXPORT_SYMBOL(dvb_dmx_release);
EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
EXPORT_SYMBOL(dvb_dmx_swfilter);
EXPORT_SYMBOL(dvbdmx_connect_frontend);
EXPORT_SYMBOL(dvbdmx_disconnect_frontend);
EXPORT_SYMBOL(dvb_register_frontend);
EXPORT_SYMBOL(dvb_unregister_frontend);
......
......@@ -25,14 +25,17 @@
*/
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/dvb/net.h>
#include "dvb_demux.h"
#include "dvb_net.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#include "compat.h"
#endif
#include "dvb_functions.h"
#define DVB_NET_MULTICAST_MAX 10
......@@ -40,11 +43,11 @@ struct dvb_net_priv {
struct net_device_stats stats;
char name[6];
u16 pid;
struct dmx_demux_s *demux;
dmx_section_feed_t *secfeed;
dmx_section_filter_t *secfilter;
struct dmx_demux *demux;
struct dmx_section_feed *secfeed;
struct dmx_section_filter *secfilter;
int multi_num;
dmx_section_filter_t *multi_secfilter[DVB_NET_MULTICAST_MAX];
struct dmx_section_filter *multi_secfilter[DVB_NET_MULTICAST_MAX];
unsigned char multi_macs[DVB_NET_MULTICAST_MAX][6];
int mode;
};
......@@ -135,8 +138,8 @@ dvb_net_sec(struct net_device *dev, const u8 *pkt, int pkt_len)
static int
dvb_net_callback(const u8 *buffer1, size_t buffer1_len,
const u8 *buffer2, size_t buffer2_len,
dmx_section_filter_t *filter,
dmx_success_t success)
struct dmx_section_filter *filter,
enum dmx_success success)
{
struct net_device *dev=(struct net_device *) filter->priv;
......@@ -159,7 +162,7 @@ static u8 mask_promisc[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static int
dvb_net_filter_set(struct net_device *dev,
dmx_section_filter_t **secfilter,
struct dmx_section_filter **secfilter,
u8 *mac, u8 *mac_mask)
{
struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv;
......@@ -205,7 +208,7 @@ dvb_net_feed_start(struct net_device *dev)
{
int ret, i;
struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv;
dmx_demux_t *demux = priv->demux;
struct dmx_demux *demux = priv->demux;
unsigned char *mac = (unsigned char *) dev->dev_addr;
priv->secfeed=0;
......@@ -430,7 +433,7 @@ int
dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
{
struct net_device *net;
dmx_demux_t *demux;
struct dmx_demux *demux;
struct dvb_net_priv *priv;
int result;
int if_num;
......@@ -524,7 +527,7 @@ int dvb_net_do_ioctl(struct inode *inode, struct file *file,
break;
}
case NET_REMOVE_IF:
return dvb_net_remove_if(dvbnet, (int) parg);
return dvb_net_remove_if(dvbnet, (long) parg);
default:
return -EINVAL;
}
......@@ -569,7 +572,7 @@ dvb_net_release(struct dvb_net *dvbnet)
}
int
dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet, dmx_demux_t *dmx)
dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet, struct dmx_demux *dmx)
{
int i;
......
......@@ -33,18 +33,18 @@
#define DVB_NET_DEVICES_MAX 10
typedef struct dvb_net {
struct dvb_net {
struct dvb_device *dvbdev;
int card_num;
int dev_num;
struct net_device device[DVB_NET_DEVICES_MAX];
int state[DVB_NET_DEVICES_MAX];
dmx_demux_t *demux;
} dvb_net_t;
struct dmx_demux *demux;
};
void dvb_net_release(struct dvb_net *);
int dvb_net_init(struct dvb_adapter *, struct dvb_net *, dmx_demux_t *);
int dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
#endif
......@@ -32,16 +32,18 @@
#define __KERNEL_SYSCALLS__
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <asm/uaccess.h>
#include <linux/sched.h>
#include <linux/string.h>
#include "dvb_ringbuffer.h"
void dvb_ringbuffer_init(dvb_ringbuffer_t *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->data=data;
......@@ -50,19 +52,18 @@ void dvb_ringbuffer_init(dvb_ringbuffer_t *rbuf, void *data, size_t len)
init_waitqueue_head(&rbuf->queue);
spin_lock_init(&(rbuf->lock));
rbuf->lock=SPIN_LOCK_UNLOCKED;
}
int dvb_ringbuffer_empty(dvb_ringbuffer_t *rbuf)
int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf)
{
return (rbuf->pread==rbuf->pwrite);
}
ssize_t dvb_ringbuffer_free(dvb_ringbuffer_t *rbuf)
ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf)
{
ssize_t free;
......@@ -74,7 +75,7 @@ ssize_t dvb_ringbuffer_free(dvb_ringbuffer_t *rbuf)
ssize_t dvb_ringbuffer_avail(dvb_ringbuffer_t *rbuf)
ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf)
{
ssize_t avail;
......@@ -86,14 +87,14 @@ ssize_t dvb_ringbuffer_avail(dvb_ringbuffer_t *rbuf)
void dvb_ringbuffer_flush(dvb_ringbuffer_t *rbuf)
void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
{
rbuf->pread = rbuf->pwrite;
}
void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf)
void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf)
{
unsigned long flags;
......@@ -106,7 +107,7 @@ void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf)
ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *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 split;
......@@ -135,7 +136,7 @@ ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *rbuf, u8 *buf, size_t len, int use
ssize_t dvb_ringbuffer_write(dvb_ringbuffer_t *rbuf, const u8 *buf,
ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
size_t len, int usermem)
{
size_t todo = len;
......
......@@ -32,8 +32,10 @@
#ifndef _DVB_RINGBUFFER_H_
#define _DVB_RINGBUFFER_H_
#include <linux/spinlock.h>
#include <linux/wait.h>
typedef struct dvb_ringbuffer {
struct dvb_ringbuffer {
u8 *data;
ssize_t size;
ssize_t pread;
......@@ -41,7 +43,7 @@ typedef struct dvb_ringbuffer {
wait_queue_head_t queue;
spinlock_t lock;
} dvb_ringbuffer_t;
};
/*
......@@ -73,25 +75,25 @@ typedef struct dvb_ringbuffer {
*/
/* initialize ring buffer, lock and queue */
extern void dvb_ringbuffer_init(dvb_ringbuffer_t *rbuf, void *data, size_t len);
extern void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len);
/* test whether buffer is empty */
extern int dvb_ringbuffer_empty(dvb_ringbuffer_t *rbuf);
extern int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf);
/* return the number of free bytes in the buffer */
extern ssize_t dvb_ringbuffer_free(dvb_ringbuffer_t *rbuf);
extern ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf);
/* return the number of bytes waiting in the buffer */
extern ssize_t dvb_ringbuffer_avail(dvb_ringbuffer_t *rbuf);
extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf);
/* read routines & macros */
/* ---------------------- */
/* flush buffer */
extern void dvb_ringbuffer_flush(dvb_ringbuffer_t *rbuf);
extern void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf);
/* flush buffer protected by spinlock and wake-up waiting task(s) */
extern void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf);
extern void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf);
/* peek at byte <offs> in the buffer */
#define DVB_RINGBUFFER_PEEK(rbuf,offs) \
......@@ -106,7 +108,7 @@ extern void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf);
** <usermem> specifies whether <buf> resides in user space
** returns number of bytes transferred or -EFAULT
*/
extern ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *rbuf, u8 *buf,
extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf,
size_t len, int usermem);
......@@ -121,7 +123,7 @@ extern ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *rbuf, u8 *buf,
** <usermem> specifies whether <buf> resides in user space
** returns number of bytes transferred or -EFAULT
*/
extern ssize_t dvb_ringbuffer_write(dvb_ringbuffer_t *rbuf, const u8 *buf,
extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
size_t len, int usermem);
#endif /* _DVB_RINGBUFFER_H_ */
......@@ -21,26 +21,19 @@
*
*/
#include <linux/config.h>
#include <linux/version.h>
#include <asm/types.h>
#include <asm/semaphore.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/version.h>
#include "dvbdev.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#include "compat.h"
#endif
#include "dvb_functions.h"
static int dvbdev_debug = 0;
#define dprintk if (dvbdev_debug) printk
......@@ -188,8 +181,8 @@ int dvbdev_get_free_id (struct dvb_adapter *adap, int type)
int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
const struct dvb_device *template, void *priv, int type)
{
u32 id;
struct dvb_device *dvbdev;
int id;
if (down_interruptible (&dvbdev_register_lock))
return -ERESTARTSYS;
......@@ -284,10 +277,6 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name)
memset (adap, 0, sizeof(struct dvb_adapter));
INIT_LIST_HEAD (&adap->device_list);
/* fixme: is this correct? */
/* No */
try_module_get(THIS_MODULE);
printk ("DVB: registering new adapter (%s).\n", name);
devfs_mk_dir("dvb/adapter%d", num);
......@@ -310,9 +299,6 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
list_del (&adap->list_head);
up (&dvbdev_register_lock);
kfree (adap);
/* fixme: is this correct? */
/* No. */
module_put(THIS_MODULE);
return 0;
}
......
......@@ -24,9 +24,9 @@
#ifndef _DVBDEV_H_
#define _DVBDEV_H_
#include <linux/types.h>
#include <linux/version.h>
#include <asm/types.h>
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/list.h>
......@@ -84,9 +84,5 @@ 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_ioctl (struct inode *inode, struct file *file,
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_ */
......@@ -24,10 +24,10 @@
#ifndef _DVBDMX_H_
#define _DVBDMX_H_
#include <asm/types.h>
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/time.h>
#else
#include <stdint.h>
#include <time.h>
#endif
......@@ -103,18 +103,18 @@ typedef enum
typedef struct dmx_filter
{
uint8_t filter[DMX_FILTER_SIZE];
uint8_t mask[DMX_FILTER_SIZE];
uint8_t mode[DMX_FILTER_SIZE];
__u8 filter[DMX_FILTER_SIZE];
__u8 mask[DMX_FILTER_SIZE];
__u8 mode[DMX_FILTER_SIZE];
} dmx_filter_t;
struct dmx_sct_filter_params
{
uint16_t pid;
__u16 pid;
dmx_filter_t filter;
uint32_t timeout;
uint32_t flags;
__u32 timeout;
__u32 flags;
#define DMX_CHECK_CRC 1
#define DMX_ONESHOT 2
#define DMX_IMMEDIATE_START 4
......@@ -124,11 +124,11 @@ struct dmx_sct_filter_params
struct dmx_pes_filter_params
{
uint16_t pid;
__u16 pid;
dmx_input_t input;
dmx_output_t output;
dmx_pes_type_t pes_type;
uint32_t flags;
__u32 flags;
};
......@@ -143,7 +143,7 @@ struct dmx_event
};
typedef struct dmx_caps {
uint32_t caps;
__u32 caps;
int num_decoders;
} dmx_caps_t;
......@@ -161,7 +161,7 @@ typedef enum {
struct dmx_stc {
unsigned int num; /* input : which STC? 0..N */
unsigned int base; /* output: divisor for stc to get 90 kHz clock */
uint64_t stc; /* output: stc in 'base'*90 kHz units */
__u64 stc; /* output: stc in 'base'*90 kHz units */
};
......@@ -171,7 +171,7 @@ struct dmx_stc {
#define DMX_SET_PES_FILTER _IOW('o',44,struct dmx_pes_filter_params)
#define DMX_SET_BUFFER_SIZE _IO('o',45)
#define DMX_GET_EVENT _IOR('o',46,struct dmx_event)
#define DMX_GET_PES_PIDS _IOR('o',47,uint16_t[5])
#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
#define DMX_GET_CAPS _IOR('o',48,dmx_caps_t)
#define DMX_SET_SOURCE _IOW('o',49,dmx_source_t)
#define DMX_GET_STC _IOWR('o',50,struct dmx_stc)
......
......@@ -26,11 +26,7 @@
#ifndef _DVBFRONTEND_H_
#define _DVBFRONTEND_H_
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif
#include <asm/types.h>
typedef enum fe_type {
......@@ -72,14 +68,14 @@ typedef enum fe_caps {
struct dvb_frontend_info {
char name[128];
fe_type_t type;
uint32_t frequency_min;
uint32_t frequency_max;
uint32_t frequency_stepsize;
uint32_t frequency_tolerance;
uint32_t symbol_rate_min;
uint32_t symbol_rate_max;
uint32_t symbol_rate_tolerance; /* ppm */
uint32_t notifier_delay; /* ms */
__u32 frequency_min;
__u32 frequency_max;
__u32 frequency_stepsize;
__u32 frequency_tolerance;
__u32 symbol_rate_min;
__u32 symbol_rate_max;
__u32 symbol_rate_tolerance; /* ppm */
__u32 notifier_delay; /* ms */
fe_caps_t caps;
};
......@@ -89,21 +85,22 @@ struct dvb_frontend_info {
* the meaning of this struct...
*/
struct dvb_diseqc_master_cmd {
uint8_t msg [6]; /* { framing, address, command, data [3] } */
uint8_t msg_len; /* valid values are 3...6 */
__u8 msg [6]; /* { framing, address, command, data [3] } */
__u8 msg_len; /* valid values are 3...6 */
};
struct dvb_diseqc_slave_reply {
uint8_t msg [4]; /* { framing, data [3] } */
uint8_t msg_len; /* valid values are 0...4, 0 means no msg */
__u8 msg [4]; /* { framing, data [3] } */
__u8 msg_len; /* valid values are 0...4, 0 means no msg */
int timeout; /* return from ioctl after timeout ms with */
}; /* errorcode when no message was received */
typedef enum fe_sec_voltage {
SEC_VOLTAGE_13,
SEC_VOLTAGE_18
SEC_VOLTAGE_18,
SEC_VOLTAGE_OFF
} fe_sec_voltage_t;
......@@ -195,13 +192,13 @@ typedef enum fe_hierarchy {
struct dvb_qpsk_parameters {
uint32_t symbol_rate; /* symbol rate in Symbols per second */
__u32 symbol_rate; /* symbol rate in Symbols per second */
fe_code_rate_t fec_inner; /* forward error correction (see above) */
};
struct dvb_qam_parameters {
uint32_t symbol_rate; /* symbol rate in Symbols per second */
__u32 symbol_rate; /* symbol rate in Symbols per second */
fe_code_rate_t fec_inner; /* forward error correction (see above) */
fe_modulation_t modulation; /* modulation type (see above) */
};
......@@ -219,7 +216,7 @@ struct dvb_ofdm_parameters {
struct dvb_frontend_parameters {
uint32_t frequency; /* (absolute) frequency in Hz for QAM/OFDM */
__u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM */
/* intermediate frequency in kHz for QPSK */
fe_spectral_inversion_t inversion;
union {
......@@ -249,10 +246,10 @@ struct dvb_frontend_event {
#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */
#define FE_READ_STATUS _IOR('o', 69, fe_status_t)
#define FE_READ_BER _IOR('o', 70, uint32_t)
#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, uint16_t)
#define FE_READ_SNR _IOR('o', 72, uint16_t)
#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, uint32_t)
#define FE_READ_BER _IOR('o', 70, __u32)
#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16)
#define FE_READ_SNR _IOR('o', 72, __u16)
#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
......
......@@ -24,16 +24,12 @@
#ifndef _DVBNET_H_
#define _DVBNET_H_
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif
#include <asm/types.h>
struct dvb_net_if {
uint16_t pid;
uint16_t if_num;
__u16 pid;
__u16 if_num;
};
......
/*
* version.h
*
* Copyright (C) 2000 Holger Waechtler <holger@convergence.de>
* for convergence integrated media GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _DVBVERSION_H_
#define _DVBVERSION_H_
#define DVB_API_VERSION 3
#endif /*_DVBVERSION_H_*/
......@@ -34,7 +34,8 @@
typedef enum {
VIDEO_FORMAT_4_3, /* Select 4:3 format */
VIDEO_FORMAT_16_9 /* Select 16:9 format. */
VIDEO_FORMAT_16_9, /* Select 16:9 format. */
VIDEO_FORMAT_221_1 /* 2.21:1 */
} video_format_t;
......@@ -56,6 +57,11 @@ typedef enum {
VIDEO_CENTER_CUT_OUT /* use center cut out format */
} video_displayformat_t;
typedef struct {
int w;
int h;
video_format_t aspect_ratio;
} video_size_t;
typedef enum {
VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
......@@ -74,9 +80,10 @@ typedef enum {
struct video_event {
int32_t type;
#define VIDEO_EVENT_SIZE_CHANGED 1
time_t timestamp;
union {
video_format_t video_format;
video_size_t size;
} u;
};
......@@ -186,6 +193,7 @@ typedef uint16_t video_attributes_t;
#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
#endif /*_DVBVIDEO_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