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 @@ ...@@ -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_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 obj-$(CONFIG_DVB_CORE) += dvb-core.o
This diff is collapsed.
This diff is collapsed.
...@@ -24,55 +24,54 @@ ...@@ -24,55 +24,54 @@
#ifndef _DMXDEV_H_ #ifndef _DMXDEV_H_
#define _DMXDEV_H_ #define _DMXDEV_H_
#ifndef __KERNEL__ #include <asm/types.h>
#define __KERNEL__ #include <asm/semaphore.h>
#endif #include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/dvb/dmx.h> #include <linux/timer.h>
#include <linux/version.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/types.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/string.h>
#include <linux/dvb/dmx.h>
#include "dvbdev.h" #include "dvbdev.h"
#include "demux.h" #include "demux.h"
typedef enum { enum dmxdevype {
DMXDEV_TYPE_NONE, DMXDEV_TYPE_NONE,
DMXDEV_TYPE_SEC, DMXDEV_TYPE_SEC,
DMXDEV_TYPE_PES, DMXDEV_TYPE_PES,
} dmxdev_type_t; };
typedef enum { enum dmxdev_state {
DMXDEV_STATE_FREE, DMXDEV_STATE_FREE,
DMXDEV_STATE_ALLOCATED, DMXDEV_STATE_ALLOCATED,
DMXDEV_STATE_SET, DMXDEV_STATE_SET,
DMXDEV_STATE_GO, DMXDEV_STATE_GO,
DMXDEV_STATE_DONE, DMXDEV_STATE_DONE,
DMXDEV_STATE_TIMEDOUT DMXDEV_STATE_TIMEDOUT
} dmxdev_state_t; };
typedef struct dmxdev_buffer_s { struct dmxdev_buffer {
uint8_t *data; u8 *data;
uint32_t size; int size;
int32_t pread; int pread;
int32_t pwrite; int pwrite;
wait_queue_head_t queue; wait_queue_head_t queue;
int error; int error;
} dmxdev_buffer_t; };
typedef struct dmxdev_filter_s { struct dmxdev_filter {
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
union { union {
dmx_section_filter_t *sec; struct dmx_section_filter *sec;
} filter; } filter;
union { union {
dmx_ts_feed_t *ts; struct dmx_ts_feed *ts;
dmx_section_feed_t *sec; struct dmx_section_feed *sec;
} feed; } feed;
union { union {
...@@ -81,50 +80,50 @@ typedef struct dmxdev_filter_s { ...@@ -81,50 +80,50 @@ typedef struct dmxdev_filter_s {
} params; } params;
int type; int type;
dmxdev_state_t state; enum dmxdev_state state;
struct dmxdev_s *dev; struct dmxdev *dev;
dmxdev_buffer_t 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;
uint8_t secheader[3]; u8 secheader[3];
u16 pid; u16 pid;
} dmxdev_filter_t; };
typedef struct dmxdev_dvr_s { struct dmxdev_dvr {
int state; int state;
struct dmxdev_s *dev; struct dmxdev *dev;
dmxdev_buffer_t buffer; struct dmxdev_buffer buffer;
} dmxdev_dvr_t; };
typedef struct dmxdev_s { struct dmxdev {
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
struct dvb_device *dvr_dvbdev; struct dvb_device *dvr_dvbdev;
dmxdev_filter_t *filter; struct dmxdev_filter *filter;
dmxdev_dvr_t *dvr; struct dmxdev_dvr *dvr;
dmx_demux_t *demux; struct dmx_demux *demux;
int filternum; int filternum;
int capabilities; int capabilities;
#define DMXDEV_CAP_DUPLEX 1 #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) #define DVR_BUFFER_SIZE (10*188*1024)
struct semaphore mutex; struct semaphore mutex;
spinlock_t lock; spinlock_t lock;
} dmxdev_t; };
int dvb_dmxdev_init(dmxdev_t *dmxdev, struct dvb_adapter *); int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *);
void dvb_dmxdev_release(dmxdev_t *dmxdev); void dvb_dmxdev_release(struct dmxdev *dmxdev);
#endif /* _DMXDEV_H_ */ #endif /* _DMXDEV_H_ */
This diff is collapsed.
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
#define _DVB_DEMUX_H_ #define _DVB_DEMUX_H_
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include <linux/time.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/spinlock.h>
#include "demux.h" #include "demux.h"
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
#define DVB_DEMUX_MASK_MAX 18 #define DVB_DEMUX_MASK_MAX 18
struct dvb_demux_filter { struct dvb_demux_filter {
dmx_section_filter_t filter; struct dmx_section_filter filter;
u8 maskandmode [DMX_MAX_FILTER_SIZE]; u8 maskandmode [DMX_MAX_FILTER_SIZE];
u8 maskandnotmode [DMX_MAX_FILTER_SIZE]; u8 maskandnotmode [DMX_MAX_FILTER_SIZE];
int doneq; int doneq;
...@@ -66,8 +68,8 @@ struct dvb_demux_filter { ...@@ -66,8 +68,8 @@ struct dvb_demux_filter {
struct dvb_demux_feed { struct dvb_demux_feed {
union { union {
dmx_ts_feed_t ts; struct dmx_ts_feed ts;
dmx_section_feed_t sec; struct dmx_section_feed sec;
} feed; } feed;
union { union {
...@@ -89,7 +91,7 @@ struct dvb_demux_feed { ...@@ -89,7 +91,7 @@ struct dvb_demux_feed {
int cb_length; int cb_length;
int ts_type; int ts_type;
dmx_ts_pes_t pes_type; enum dmx_ts_pes pes_type;
int cc; int cc;
...@@ -99,7 +101,7 @@ struct dvb_demux_feed { ...@@ -99,7 +101,7 @@ struct dvb_demux_feed {
}; };
struct dvb_demux { struct dvb_demux {
dmx_demux_t dmx; struct dmx_demux dmx;
void *priv; void *priv;
int filternum; int filternum;
int feednum; int feednum;
...@@ -140,4 +142,8 @@ void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf); ...@@ -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_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); 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_ */ #endif /* _DVB_DEMUX_H_ */
#include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/string.h>
#include "dvb_filter.h" #include "dvb_filter.h"
unsigned int bitrates[3][16] = unsigned int bitrates[3][16] =
...@@ -6,14 +8,14 @@ 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,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}}; {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] = unsigned int ac3_bitrates[32] =
{32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640, {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}; 0,0,0,0,0,0,0,0,0,0,0,0,0};
uint32_t ac3_freq[4] = {480, 441, 320, 0}; u32 ac3_freq[4] = {480, 441, 320, 0};
uint32_t ac3_frames[3][32] = u32 ac3_frames[3][32] =
{{64,80,96,112,128,160,192,224,256,320,384,448,512,640,768,896,1024, {{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}, 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, {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) ...@@ -67,9 +69,9 @@ void ts_to_pes(ipack *p, u8 *buf) // don't need count (=188)
#if 0 #if 0
/* needs 5 byte input, returns picture coding type*/ /* needs 5 byte input, returns picture coding type*/
static 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: "); if (pr) printk( "Pic header: ");
pic->temporal_reference[field] = (( headr[0] << 2 ) | 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) ...@@ -114,7 +116,7 @@ int read_picture_header(uint8_t *headr, mpg_picture *pic, int field, int pr)
#if 0 #if 0
/* needs 4 byte input */ /* needs 4 byte input */
static 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: "); if (pr) printk("GOP header: ");
...@@ -146,7 +148,7 @@ int read_gop_header(uint8_t *headr, mpg_picture *pic, int pr) ...@@ -146,7 +148,7 @@ int read_gop_header(uint8_t *headr, mpg_picture *pic, int pr)
#if 0 #if 0
/* needs 8 byte input */ /* needs 8 byte input */
static 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 sw;
int form = -1; int form = -1;
...@@ -261,14 +263,14 @@ int read_sequence_header(uint8_t *headr, VideoInfo *vi, int pr) ...@@ -261,14 +263,14 @@ int read_sequence_header(uint8_t *headr, VideoInfo *vi, int pr)
#if 0 #if 0
static 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 found = 0;
int c = 0; int c = 0;
while (found < 4 && c+4 < count){ while (found < 4 && c+4 < count){
uint8_t *b; u8 *b;
b = mbuf+c; b = mbuf+c;
if ( b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01 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) ...@@ -291,15 +293,15 @@ int get_vinfo(uint8_t *mbuf, int count, VideoInfo *vi, int pr)
#if 0 #if 0
static 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 found = 0;
int c = 0; int c = 0;
int fr = 0; int fr = 0;
while (found < 2 && c < count){ while (found < 2 && c < count){
uint8_t b[2]; u8 b[2];
memcpy( b, mbuf+c, 2); memcpy( b, mbuf+c, 2);
if ( b[0] == 0xff && (b[1] & 0xf8) == 0xf8) if ( b[0] == 0xff && (b[1] & 0xf8) == 0xf8)
...@@ -346,16 +348,16 @@ int get_ainfo(uint8_t *mbuf, int count, AudioInfo *ai, int pr) ...@@ -346,16 +348,16 @@ int get_ainfo(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
#endif #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 found = 0;
int c = 0; int c = 0;
uint8_t frame = 0; u8 frame = 0;
int fr = 0; int fr = 0;
while ( !found && c < count){ while ( !found && c < count){
uint8_t *b = mbuf+c; u8 *b = mbuf+c;
if ( b[0] == 0x0b && b[1] == 0x77 ) if ( b[0] == 0x0b && b[1] == 0x77 )
found = 1; found = 1;
...@@ -378,18 +380,18 @@ int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr) ...@@ -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; ai->bit_rate = ac3_bitrates[frame >> 1]*1000;
if (pr) 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; ai->frequency = (headr[2] & 0xc0 ) >> 6;
fr = (headr[2] & 0xc0 ) >> 6; fr = (headr[2] & 0xc0 ) >> 6;
ai->frequency = freq[fr]*100; 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]; ai->framesize = ac3_frames[fr][frame >> 1];
if ((frame & 1) && (fr == 1)) ai->framesize++; if ((frame & 1) && (fr == 1)) ai->framesize++;
ai->framesize = ai->framesize << 1; ai->framesize = ai->framesize << 1;
if (pr) printk (" Framesize %d\n", ai->framesize); if (pr) printk (" Framesize %d\n",(int) ai->framesize);
return 0; return 0;
...@@ -398,11 +400,11 @@ int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr) ...@@ -398,11 +400,11 @@ int dvb_filter_get_ac3info(uint8_t *mbuf, int count, AudioInfo *ai, int pr)
#if 0 #if 0
static static
uint8_t *skip_pes_header(uint8_t **bufp) u8 *skip_pes_header(u8 **bufp)
{ {
uint8_t *inbuf = *bufp; u8 *inbuf = *bufp;
uint8_t *buf = inbuf; u8 *buf = inbuf;
uint8_t *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] = {
...@@ -437,7 +439,7 @@ uint8_t *skip_pes_header(uint8_t **bufp) ...@@ -437,7 +439,7 @@ uint8_t *skip_pes_header(uint8_t **bufp)
#if 0 #if 0
static static
void initialize_quant_matrix( uint32_t *matrix ) void initialize_quant_matrix( u32 *matrix )
{ {
int i; int i;
...@@ -465,7 +467,7 @@ void initialize_quant_matrix( uint32_t *matrix ) ...@@ -465,7 +467,7 @@ void initialize_quant_matrix( uint32_t *matrix )
#if 0 #if 0
static static
void initialize_mpg_picture(mpg_picture *pic) void initialize_mpg_picture(struct mpg_picture *pic)
{ {
int i; int i;
...@@ -493,7 +495,7 @@ void initialize_mpg_picture(mpg_picture *pic) ...@@ -493,7 +495,7 @@ void initialize_mpg_picture(mpg_picture *pic)
#if 0 #if 0
static 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_h_offset;
int16_t last_v_offset; int16_t last_v_offset;
...@@ -532,7 +534,7 @@ void mpg_set_picture_parameter( int32_t field_type, mpg_picture *pic ) ...@@ -532,7 +534,7 @@ void mpg_set_picture_parameter( int32_t field_type, mpg_picture *pic )
#if 0 #if 0
static 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->picture_header = 0;
pic->sequence_header_data pic->sequence_header_data
...@@ -561,7 +563,7 @@ void init_mpg_picture( mpg_picture *pic, int chan, int32_t field_type) ...@@ -561,7 +563,7 @@ void init_mpg_picture( mpg_picture *pic, int chan, int32_t field_type)
} }
#endif #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) dvb_filter_pes2ts_cb_t *cb, void *priv)
{ {
unsigned char *buf=p2ts->buf; unsigned char *buf=p2ts->buf;
...@@ -574,7 +576,7 @@ void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid, ...@@ -574,7 +576,7 @@ void dvb_filter_pes2ts_init(dvb_filter_pes2ts_t *p2ts, unsigned short pid,
p2ts->priv=priv; 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; unsigned char *buf=p2ts->buf;
int ret=0, rest; int ret=0, rest;
......
...@@ -2,23 +2,22 @@ ...@@ -2,23 +2,22 @@
#define _DVB_FILTER_H_ #define _DVB_FILTER_H_
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/vmalloc.h>
#include "demux.h" #include "demux.h"
typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *); 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 buf[188];
unsigned char cc; unsigned char cc;
dvb_filter_pes2ts_cb_t *cb; dvb_filter_pes2ts_cb_t *cb;
void *priv; 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); 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 #define PROG_STREAM_MAP 0xBC
...@@ -35,14 +34,14 @@ int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len); ...@@ -35,14 +34,14 @@ int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len);
#define ISO13522_STREAM 0xF3 #define ISO13522_STREAM 0xF3
#define PROG_STREAM_DIR 0xFF #define PROG_STREAM_DIR 0xFF
#define PICTURE_START 0x00 #define DVB_PICTURE_START 0x00
#define USER_START 0xb2 #define DVB_USER_START 0xb2
#define SEQUENCE_HEADER 0xb3 #define DVB_SEQUENCE_HEADER 0xb3
#define SEQUENCE_ERROR 0xb4 #define DVB_SEQUENCE_ERROR 0xb4
#define EXTENSION_START 0xb5 #define DVB_EXTENSION_START 0xb5
#define SEQUENCE_END 0xb7 #define DVB_SEQUENCE_END 0xb7
#define GOP_START 0xb8 #define DVB_GOP_START 0xb8
#define EXCEPT_SLICE 0xb0 #define DVB_EXCEPT_SLICE 0xb0
#define SEQUENCE_EXTENSION 0x01 #define SEQUENCE_EXTENSION 0x01
#define SEQUENCE_DISPLAY_EXTENSION 0x02 #define SEQUENCE_DISPLAY_EXTENSION 0x02
...@@ -111,12 +110,12 @@ int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len); ...@@ -111,12 +110,12 @@ int dvb_filter_pes2ts(dvb_filter_pes2ts_t *p2ts, unsigned char *pes, int len);
#define IPACKS 2048 #define IPACKS 2048
#endif #endif
typedef struct ipack_s { struct ipack {
int size; int size;
int found; int found;
u8 *buf; u8 *buf;
u8 cid; u8 cid;
uint32_t plength; u32 plength;
u8 plen[2]; u8 plen[2];
u8 flag1; u8 flag1;
u8 flag2; u8 flag2;
...@@ -131,34 +130,33 @@ typedef struct ipack_s { ...@@ -131,34 +130,33 @@ typedef struct ipack_s {
void (*func)(u8 *buf, int size, void *priv); void (*func)(u8 *buf, int size, void *priv);
int count; int count;
int repack_subids; int repack_subids;
} ipack; };
typedef struct video_i{ struct dvb_video_info {
uint32_t horizontal_size; u32 horizontal_size;
uint32_t vertical_size; u32 vertical_size;
uint32_t aspect_ratio; u32 aspect_ratio;
uint32_t framerate; u32 framerate;
uint32_t video_format; u32 video_format;
uint32_t bit_rate; u32 bit_rate;
uint32_t comp_bit_rate; u32 comp_bit_rate;
uint32_t vbv_buffer_size; u32 vbv_buffer_size;
int16_t vbv_delay; s16 vbv_delay;
uint32_t CSPF; u32 CSPF;
uint32_t off; u32 off;
} VideoInfo; };
#define OFF_SIZE 4 #define OFF_SIZE 4
#define FIRST_FIELD 0 #define FIRST_FIELD 0
#define SECOND_FIELD 1 #define SECOND_FIELD 1
#define VIDEO_FRAME_PICTURE 0x03 #define VIDEO_FRAME_PICTURE 0x03
typedef struct mpg_picture_s{ struct mpg_picture {
int channel; int channel;
VideoInfo vinfo; struct dvb_video_info vinfo;
uint32_t *sequence_gop_header; u32 *sequence_gop_header;
uint32_t *picture_header; u32 *picture_header;
int32_t time_code; s32 time_code;
int low_delay; int low_delay;
int closed_gop; int closed_gop;
int broken_link; int broken_link;
...@@ -166,12 +164,12 @@ typedef struct mpg_picture_s{ ...@@ -166,12 +164,12 @@ typedef struct mpg_picture_s{
int gop_flag; int gop_flag;
int sequence_end_flag; int sequence_end_flag;
uint8_t profile_and_level; u8 profile_and_level;
int32_t picture_coding_parameter; s32 picture_coding_parameter;
uint32_t matrix[32]; u32 matrix[32];
int8_t matrix_change_flag; s8 matrix_change_flag;
uint8_t 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
...@@ -180,11 +178,11 @@ typedef struct mpg_picture_s{ ...@@ -180,11 +178,11 @@ typedef struct mpg_picture_s{
int mpeg1_flag; int mpeg1_flag;
int progressive_sequence; int progressive_sequence;
int sequence_display_extension_flag; int sequence_display_extension_flag;
uint32_t sequence_header_data; u32 sequence_header_data;
int16_t last_frame_centre_horizontal_offset; s16 last_frame_centre_horizontal_offset;
int16_t last_frame_centre_vertical_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 top_field_first;
int repeat_first_field; int repeat_first_field;
int progressive_frame; int progressive_frame;
...@@ -192,39 +190,36 @@ typedef struct mpg_picture_s{ ...@@ -192,39 +190,36 @@ typedef struct mpg_picture_s{
int forward_bank; int forward_bank;
int backward_bank; int backward_bank;
int compress; int compress;
int16_t 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 */
int16_t 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 */
int16_t temporal_reference[2]; s16 temporal_reference[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
int8_t picture_coding_type[2]; s8 picture_coding_type[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
int8_t picture_structure[2]; s8 picture_structure[2];
/* [0] 1st field, [1] 2nd field */ /* [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 */ /* [0] 1st field, [1] 2nd field */
/* picture_display_extenion() 0:no 1:exit*/ /* picture_display_extenion() 0:no 1:exit*/
int8_t pts_flag[2]; s8 pts_flag[2];
/* [0] 1st field, [1] 2nd field */ /* [0] 1st field, [1] 2nd field */
} mpg_picture; };
typedef struct audio_i{ struct dvb_audio_info {
int layer ; int layer ;
uint32_t bit_rate ; u32 bit_rate;
uint32_t frequency ; u32 frequency;
uint32_t mode ; u32 mode;
uint32_t mode_extension ; u32 mode_extension ;
uint32_t emphasis ; u32 emphasis;
uint32_t framesize; u32 framesize;
uint32_t off; u32 off;
} AudioInfo; };
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);
#endif #endif
...@@ -22,8 +22,12 @@ ...@@ -22,8 +22,12 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html * 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/sched.h>
#include <linux/smp_lock.h> #include <linux/wait.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -31,6 +35,7 @@ ...@@ -31,6 +35,7 @@
#include "dvb_frontend.h" #include "dvb_frontend.h"
#include "dvbdev.h" #include "dvbdev.h"
#include "dvb_functions.h"
static int dvb_frontend_debug = 0; static int dvb_frontend_debug = 0;
...@@ -59,7 +64,7 @@ struct dvb_frontend_data { ...@@ -59,7 +64,7 @@ struct dvb_frontend_data {
struct semaphore sem; struct semaphore sem;
struct list_head list_head; struct list_head list_head;
wait_queue_head_t wait_queue; wait_queue_head_t wait_queue;
struct task_struct *thread; pid_t thread_pid;
unsigned long release_jiffies; unsigned long release_jiffies;
unsigned long lost_sync_jiffies; unsigned long lost_sync_jiffies;
int bending; int bending;
...@@ -97,14 +102,6 @@ static LIST_HEAD(frontend_notifier_list); ...@@ -97,14 +102,6 @@ static LIST_HEAD(frontend_notifier_list);
static DECLARE_MUTEX(frontend_mutex); static DECLARE_MUTEX(frontend_mutex);
static
inline void ddelay (int ms)
{
current->state=TASK_INTERRUPTIBLE;
schedule_timeout((HZ*ms)/1000);
}
static static
int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend, int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
...@@ -116,10 +113,10 @@ int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend, ...@@ -116,10 +113,10 @@ int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend,
if (frontend->before_ioctl) if (frontend->before_ioctl)
err = frontend->before_ioctl (frontend, cmd, arg); err = frontend->before_ioctl (frontend, cmd, arg);
if (err) { if (err == -EOPNOTSUPP) {
err = frontend->ioctl (frontend, cmd, arg); err = frontend->ioctl (frontend, cmd, arg);
if (err && frontend->after_ioctl) if ((err == -EOPNOTSUPP) && frontend->after_ioctl)
err = frontend->after_ioctl (frontend, cmd, arg); err = frontend->after_ioctl (frontend, cmd, arg);
} }
...@@ -198,7 +195,7 @@ void dvb_call_frontend_notifiers (struct dvb_frontend_data *fe, ...@@ -198,7 +195,7 @@ void dvb_call_frontend_notifiers (struct dvb_frontend_data *fe,
fe->lost_sync_jiffies = jiffies; fe->lost_sync_jiffies = jiffies;
if (((s ^ fe->status) & FE_HAS_LOCK) && (s & FE_HAS_LOCK)) 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; fe->status = s;
...@@ -313,7 +310,7 @@ int dvb_frontend_set_parameters (struct dvb_frontend_data *fe, ...@@ -313,7 +310,7 @@ int dvb_frontend_set_parameters (struct dvb_frontend_data *fe,
dvb_bend_frequency (fe, 0); dvb_bend_frequency (fe, 0);
dprintk ("%s: f == %i, drift == %i\n", 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; param->frequency += fe->lnb_drift + fe->bending;
err = dvb_frontend_internal_ioctl (frontend, FE_SET_FRONTEND, param); err = dvb_frontend_internal_ioctl (frontend, FE_SET_FRONTEND, param);
...@@ -391,6 +388,8 @@ void dvb_frontend_recover (struct dvb_frontend_data *fe) ...@@ -391,6 +388,8 @@ void dvb_frontend_recover (struct dvb_frontend_data *fe)
if (fe->info->type == FE_QPSK) if (fe->info->type == FE_QPSK)
stepsize = fe->parameters.u.qpsk.symbol_rate / 16000; stepsize = fe->parameters.u.qpsk.symbol_rate / 16000;
else if (fe->info->type == FE_QAM)
stepsize = 0;
else else
stepsize = fe->info->frequency_stepsize * 2; stepsize = fe->info->frequency_stepsize * 2;
...@@ -428,42 +427,31 @@ static ...@@ -428,42 +427,31 @@ static
int dvb_frontend_thread (void *data) int dvb_frontend_thread (void *data)
{ {
struct dvb_frontend_data *fe = (struct dvb_frontend_data *) data; struct dvb_frontend_data *fe = (struct dvb_frontend_data *) data;
char name [15];
int quality = 0, delay = 3*HZ; int quality = 0, delay = 3*HZ;
fe_status_t s; fe_status_t s;
dprintk ("%s\n", __FUNCTION__); dprintk ("%s\n", __FUNCTION__);
lock_kernel (); snprintf (name, sizeof(name), "kdvb-fe-%i:%i",
#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",
fe->frontend.i2c->adapter->num, fe->frontend.i2c->id); fe->frontend.i2c->adapter->num, fe->frontend.i2c->id);
unlock_kernel ();
dvb_call_frontend_notifiers (fe, 0); dvb_kernel_thread_setup (name);
dvb_frontend_init (fe);
fe->lost_sync_count = -1; fe->lost_sync_count = -1;
dvb_call_frontend_notifiers (fe, 0);
dvb_frontend_init (fe);
while (!dvb_frontend_is_exiting (fe)) { while (!dvb_frontend_is_exiting (fe)) {
up (&fe->sem); /* is locked when we enter the thread... */ up (&fe->sem); /* is locked when we enter the thread... */
interruptible_sleep_on_timeout (&fe->wait_queue, delay); interruptible_sleep_on_timeout (&fe->wait_queue, delay);
if (signal_pending(current))
break;
if (down_interruptible (&fe->sem)) { if (down_interruptible (&fe->sem))
fe->thread = NULL; break;
return -ERESTARTSYS;
}
if (fe->lost_sync_count == -1) if (fe->lost_sync_count == -1)
continue; continue;
...@@ -505,7 +493,11 @@ int dvb_frontend_thread (void *data) ...@@ -505,7 +493,11 @@ int dvb_frontend_thread (void *data)
dvb_frontend_internal_ioctl (&fe->frontend, FE_SLEEP, NULL); dvb_frontend_internal_ioctl (&fe->frontend, FE_SLEEP, NULL);
up (&fe->sem); up (&fe->sem);
fe->thread = NULL;
fe->thread_pid = 0;
mb();
wake_up_interruptible (&fe->wait_queue);
return 0; return 0;
} }
...@@ -515,32 +507,63 @@ void dvb_frontend_stop (struct dvb_frontend_data *fe) ...@@ -515,32 +507,63 @@ void dvb_frontend_stop (struct dvb_frontend_data *fe)
{ {
dprintk ("%s\n", __FUNCTION__); dprintk ("%s\n", __FUNCTION__);
while (fe->thread) {
fe->exit = 1; 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); wake_up_interruptible (&fe->wait_queue);
current->state = TASK_INTERRUPTIBLE; interruptible_sleep_on(&fe->wait_queue);
schedule_timeout (5);
if (signal_pending(current)) /* paranoia check */
break; if (fe->thread_pid)
}; printk("dvb_frontend_stop: warning: thread PID %d won't exit\n",
fe->thread_pid);
} }
static 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__); dprintk ("%s\n", __FUNCTION__);
if (fe->thread) if (fe->thread_pid) {
if (!fe->exit)
return 0;
else
dvb_frontend_stop (fe); dvb_frontend_stop (fe);
}
if (signal_pending(current))
return -EINTR;
if (down_interruptible (&fe->sem)) if (down_interruptible (&fe->sem))
return; return -EINTR;
fe->exit = 0; 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) ...@@ -618,10 +641,12 @@ int dvb_frontend_open (struct inode *inode, struct file *file)
return ret; return ret;
if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 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 */ /* empty event queue */
fe->events.eventr = fe->events.eventw; fe->events.eventr = fe->events.eventw = 0;
} }
return ret; return ret;
......
...@@ -30,10 +30,7 @@ ...@@ -30,10 +30,7 @@
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h>
#ifndef MODULE_LICENSE
#define MODULE_LICENSE(x)
#endif
#include <linux/dvb/frontend.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 @@ ...@@ -19,16 +19,15 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html * 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/slab.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/module.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_i2c.h"
#include "dvb_functions.h"
struct dvb_i2c_device { struct dvb_i2c_device {
struct list_head list_head; struct list_head list_head;
......
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include "dmxdev.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_demux.h"
#include "dvb_frontend.h"
#include "dvb_net.h" #include "dvb_net.h"
#include "dvb_filter.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);
...@@ -79,6 +18,8 @@ EXPORT_SYMBOL(dvb_dmx_release); ...@@ -79,6 +18,8 @@ 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_dmx_swfilter);
EXPORT_SYMBOL(dvbdmx_connect_frontend);
EXPORT_SYMBOL(dvbdmx_disconnect_frontend);
EXPORT_SYMBOL(dvb_register_frontend); EXPORT_SYMBOL(dvb_register_frontend);
EXPORT_SYMBOL(dvb_unregister_frontend); EXPORT_SYMBOL(dvb_unregister_frontend);
......
...@@ -25,14 +25,17 @@ ...@@ -25,14 +25,17 @@
*/ */
#include <asm/uaccess.h> #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 <linux/dvb/net.h>
#include "dvb_demux.h" #include "dvb_demux.h"
#include "dvb_net.h" #include "dvb_net.h"
#include "dvb_functions.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#include "compat.h"
#endif
#define DVB_NET_MULTICAST_MAX 10 #define DVB_NET_MULTICAST_MAX 10
...@@ -40,11 +43,11 @@ struct dvb_net_priv { ...@@ -40,11 +43,11 @@ struct dvb_net_priv {
struct net_device_stats stats; struct net_device_stats stats;
char name[6]; char name[6];
u16 pid; u16 pid;
struct dmx_demux_s *demux; struct dmx_demux *demux;
dmx_section_feed_t *secfeed; struct dmx_section_feed *secfeed;
dmx_section_filter_t *secfilter; struct dmx_section_filter *secfilter;
int multi_num; 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]; unsigned char multi_macs[DVB_NET_MULTICAST_MAX][6];
int mode; int mode;
}; };
...@@ -135,8 +138,8 @@ dvb_net_sec(struct net_device *dev, const u8 *pkt, int pkt_len) ...@@ -135,8 +138,8 @@ dvb_net_sec(struct net_device *dev, const u8 *pkt, int pkt_len)
static int static int
dvb_net_callback(const u8 *buffer1, size_t buffer1_len, dvb_net_callback(const u8 *buffer1, size_t buffer1_len,
const u8 *buffer2, size_t buffer2_len, const u8 *buffer2, size_t buffer2_len,
dmx_section_filter_t *filter, struct dmx_section_filter *filter,
dmx_success_t success) enum dmx_success success)
{ {
struct net_device *dev=(struct net_device *) filter->priv; struct net_device *dev=(struct net_device *) filter->priv;
...@@ -159,7 +162,7 @@ static u8 mask_promisc[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; ...@@ -159,7 +162,7 @@ static u8 mask_promisc[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static int static int
dvb_net_filter_set(struct net_device *dev, dvb_net_filter_set(struct net_device *dev,
dmx_section_filter_t **secfilter, struct dmx_section_filter **secfilter,
u8 *mac, u8 *mac_mask) u8 *mac, u8 *mac_mask)
{ {
struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv;
...@@ -205,7 +208,7 @@ dvb_net_feed_start(struct net_device *dev) ...@@ -205,7 +208,7 @@ dvb_net_feed_start(struct net_device *dev)
{ {
int ret, i; int ret, i;
struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; 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; unsigned char *mac = (unsigned char *) dev->dev_addr;
priv->secfeed=0; priv->secfeed=0;
...@@ -430,7 +433,7 @@ int ...@@ -430,7 +433,7 @@ int
dvb_net_add_if(struct dvb_net *dvbnet, u16 pid) dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
{ {
struct net_device *net; struct net_device *net;
dmx_demux_t *demux; struct dmx_demux *demux;
struct dvb_net_priv *priv; struct dvb_net_priv *priv;
int result; int result;
int if_num; int if_num;
...@@ -524,7 +527,7 @@ int dvb_net_do_ioctl(struct inode *inode, struct file *file, ...@@ -524,7 +527,7 @@ int dvb_net_do_ioctl(struct inode *inode, struct file *file,
break; break;
} }
case NET_REMOVE_IF: case NET_REMOVE_IF:
return dvb_net_remove_if(dvbnet, (int) parg); return dvb_net_remove_if(dvbnet, (long) parg);
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -569,7 +572,7 @@ dvb_net_release(struct dvb_net *dvbnet) ...@@ -569,7 +572,7 @@ dvb_net_release(struct dvb_net *dvbnet)
} }
int 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; int i;
......
...@@ -33,18 +33,18 @@ ...@@ -33,18 +33,18 @@
#define DVB_NET_DEVICES_MAX 10 #define DVB_NET_DEVICES_MAX 10
typedef struct dvb_net { struct dvb_net {
struct dvb_device *dvbdev; 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];
int state[DVB_NET_DEVICES_MAX]; int state[DVB_NET_DEVICES_MAX];
dmx_demux_t *demux; struct dmx_demux *demux;
} dvb_net_t; };
void dvb_net_release(struct dvb_net *); 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 #endif
...@@ -32,16 +32,18 @@ ...@@ -32,16 +32,18 @@
#define __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/uaccess.h> #include <linux/sched.h>
#include <linux/string.h>
#include "dvb_ringbuffer.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->pread=rbuf->pwrite=0;
rbuf->data=data; rbuf->data=data;
...@@ -50,19 +52,18 @@ void dvb_ringbuffer_init(dvb_ringbuffer_t *rbuf, void *data, size_t len) ...@@ -50,19 +52,18 @@ void dvb_ringbuffer_init(dvb_ringbuffer_t *rbuf, void *data, size_t len)
init_waitqueue_head(&rbuf->queue); init_waitqueue_head(&rbuf->queue);
spin_lock_init(&(rbuf->lock)); 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); 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; ssize_t free;
...@@ -74,7 +75,7 @@ ssize_t dvb_ringbuffer_free(dvb_ringbuffer_t *rbuf) ...@@ -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; ssize_t avail;
...@@ -86,14 +87,14 @@ ssize_t dvb_ringbuffer_avail(dvb_ringbuffer_t *rbuf) ...@@ -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; 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; unsigned long flags;
...@@ -106,7 +107,7 @@ void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf) ...@@ -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 todo = len;
size_t split; size_t split;
...@@ -135,7 +136,7 @@ ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *rbuf, u8 *buf, size_t len, int use ...@@ -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 len, int usermem)
{ {
size_t todo = len; size_t todo = len;
......
...@@ -32,8 +32,10 @@ ...@@ -32,8 +32,10 @@
#ifndef _DVB_RINGBUFFER_H_ #ifndef _DVB_RINGBUFFER_H_
#define _DVB_RINGBUFFER_H_ #define _DVB_RINGBUFFER_H_
#include <linux/spinlock.h>
#include <linux/wait.h>
typedef struct dvb_ringbuffer { struct dvb_ringbuffer {
u8 *data; u8 *data;
ssize_t size; ssize_t size;
ssize_t pread; ssize_t pread;
...@@ -41,7 +43,7 @@ typedef struct dvb_ringbuffer { ...@@ -41,7 +43,7 @@ typedef struct dvb_ringbuffer {
wait_queue_head_t queue; wait_queue_head_t queue;
spinlock_t lock; spinlock_t lock;
} dvb_ringbuffer_t; };
/* /*
...@@ -73,25 +75,25 @@ typedef struct dvb_ringbuffer { ...@@ -73,25 +75,25 @@ typedef struct dvb_ringbuffer {
*/ */
/* initialize ring buffer, lock and queue */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* read routines & macros */
/* ---------------------- */ /* ---------------------- */
/* flush buffer */ /* 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) */ /* 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 */ /* peek at byte <offs> in the buffer */
#define DVB_RINGBUFFER_PEEK(rbuf,offs) \ #define DVB_RINGBUFFER_PEEK(rbuf,offs) \
...@@ -106,7 +108,7 @@ extern void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf); ...@@ -106,7 +108,7 @@ extern void dvb_ringbuffer_flush_spinlock_wakeup(dvb_ringbuffer_t *rbuf);
** <usermem> specifies whether <buf> resides in user space ** <usermem> specifies whether <buf> resides in user space
** returns number of bytes transferred or -EFAULT ** 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); size_t len, int usermem);
...@@ -121,7 +123,7 @@ extern ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *rbuf, u8 *buf, ...@@ -121,7 +123,7 @@ extern ssize_t dvb_ringbuffer_read(dvb_ringbuffer_t *rbuf, u8 *buf,
** <usermem> specifies whether <buf> resides in user space ** <usermem> specifies whether <buf> resides in user space
** returns number of bytes transferred or -EFAULT ** 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); size_t len, int usermem);
#endif /* _DVB_RINGBUFFER_H_ */ #endif /* _DVB_RINGBUFFER_H_ */
...@@ -21,26 +21,19 @@ ...@@ -21,26 +21,19 @@
* *
*/ */
#include <linux/config.h> #include <asm/types.h>
#include <linux/version.h> #include <asm/semaphore.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <linux/kmod.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/version.h>
#include "dvbdev.h" #include "dvbdev.h"
#include "dvb_functions.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51)
#include "compat.h"
#endif
static int dvbdev_debug = 0; static int dvbdev_debug = 0;
#define dprintk if (dvbdev_debug) printk #define dprintk if (dvbdev_debug) printk
...@@ -188,8 +181,8 @@ int dvbdev_get_free_id (struct dvb_adapter *adap, int type) ...@@ -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, int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
const struct dvb_device *template, void *priv, int type) const struct dvb_device *template, void *priv, int type)
{ {
u32 id;
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
int id;
if (down_interruptible (&dvbdev_register_lock)) if (down_interruptible (&dvbdev_register_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -284,10 +277,6 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name) ...@@ -284,10 +277,6 @@ int dvb_register_adapter(struct dvb_adapter **padap, const char *name)
memset (adap, 0, sizeof(struct dvb_adapter)); memset (adap, 0, sizeof(struct dvb_adapter));
INIT_LIST_HEAD (&adap->device_list); INIT_LIST_HEAD (&adap->device_list);
/* fixme: is this correct? */
/* No */
try_module_get(THIS_MODULE);
printk ("DVB: registering new adapter (%s).\n", name); printk ("DVB: registering new adapter (%s).\n", name);
devfs_mk_dir("dvb/adapter%d", num); devfs_mk_dir("dvb/adapter%d", num);
...@@ -310,9 +299,6 @@ int dvb_unregister_adapter(struct dvb_adapter *adap) ...@@ -310,9 +299,6 @@ int dvb_unregister_adapter(struct dvb_adapter *adap)
list_del (&adap->list_head); list_del (&adap->list_head);
up (&dvbdev_register_lock); up (&dvbdev_register_lock);
kfree (adap); kfree (adap);
/* fixme: is this correct? */
/* No. */
module_put(THIS_MODULE);
return 0; return 0;
} }
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#ifndef _DVBDEV_H_ #ifndef _DVBDEV_H_
#define _DVBDEV_H_ #define _DVBDEV_H_
#include <linux/types.h> #include <asm/types.h>
#include <linux/version.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/fs.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -84,9 +84,5 @@ extern int dvb_generic_open (struct inode *inode, struct file *file); ...@@ -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_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_ */
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
#ifndef _DVBDMX_H_ #ifndef _DVBDMX_H_
#define _DVBDMX_H_ #define _DVBDMX_H_
#include <asm/types.h>
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/types.h> #include <linux/time.h>
#else #else
#include <stdint.h>
#include <time.h> #include <time.h>
#endif #endif
...@@ -103,18 +103,18 @@ typedef enum ...@@ -103,18 +103,18 @@ typedef enum
typedef struct dmx_filter typedef struct dmx_filter
{ {
uint8_t filter[DMX_FILTER_SIZE]; __u8 filter[DMX_FILTER_SIZE];
uint8_t mask[DMX_FILTER_SIZE]; __u8 mask[DMX_FILTER_SIZE];
uint8_t mode[DMX_FILTER_SIZE]; __u8 mode[DMX_FILTER_SIZE];
} dmx_filter_t; } dmx_filter_t;
struct dmx_sct_filter_params struct dmx_sct_filter_params
{ {
uint16_t pid; __u16 pid;
dmx_filter_t filter; dmx_filter_t filter;
uint32_t timeout; __u32 timeout;
uint32_t flags; __u32 flags;
#define DMX_CHECK_CRC 1 #define DMX_CHECK_CRC 1
#define DMX_ONESHOT 2 #define DMX_ONESHOT 2
#define DMX_IMMEDIATE_START 4 #define DMX_IMMEDIATE_START 4
...@@ -124,11 +124,11 @@ struct dmx_sct_filter_params ...@@ -124,11 +124,11 @@ struct dmx_sct_filter_params
struct dmx_pes_filter_params struct dmx_pes_filter_params
{ {
uint16_t pid; __u16 pid;
dmx_input_t input; dmx_input_t input;
dmx_output_t output; dmx_output_t output;
dmx_pes_type_t pes_type; dmx_pes_type_t pes_type;
uint32_t flags; __u32 flags;
}; };
...@@ -143,7 +143,7 @@ struct dmx_event ...@@ -143,7 +143,7 @@ struct dmx_event
}; };
typedef struct dmx_caps { typedef struct dmx_caps {
uint32_t caps; __u32 caps;
int num_decoders; int num_decoders;
} dmx_caps_t; } dmx_caps_t;
...@@ -161,7 +161,7 @@ typedef enum { ...@@ -161,7 +161,7 @@ typedef enum {
struct dmx_stc { struct dmx_stc {
unsigned int num; /* input : which STC? 0..N */ unsigned int num; /* input : which STC? 0..N */
unsigned int base; /* output: divisor for stc to get 90 kHz clock */ 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 { ...@@ -171,7 +171,7 @@ struct dmx_stc {
#define DMX_SET_PES_FILTER _IOW('o',44,struct dmx_pes_filter_params) #define DMX_SET_PES_FILTER _IOW('o',44,struct dmx_pes_filter_params)
#define DMX_SET_BUFFER_SIZE _IO('o',45) #define DMX_SET_BUFFER_SIZE _IO('o',45)
#define DMX_GET_EVENT _IOR('o',46,struct dmx_event) #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_GET_CAPS _IOR('o',48,dmx_caps_t)
#define DMX_SET_SOURCE _IOW('o',49,dmx_source_t) #define DMX_SET_SOURCE _IOW('o',49,dmx_source_t)
#define DMX_GET_STC _IOWR('o',50,struct dmx_stc) #define DMX_GET_STC _IOWR('o',50,struct dmx_stc)
......
...@@ -26,11 +26,7 @@ ...@@ -26,11 +26,7 @@
#ifndef _DVBFRONTEND_H_ #ifndef _DVBFRONTEND_H_
#define _DVBFRONTEND_H_ #define _DVBFRONTEND_H_
#ifdef __KERNEL__ #include <asm/types.h>
#include <linux/types.h>
#else
#include <stdint.h>
#endif
typedef enum fe_type { typedef enum fe_type {
...@@ -72,14 +68,14 @@ typedef enum fe_caps { ...@@ -72,14 +68,14 @@ typedef enum fe_caps {
struct dvb_frontend_info { struct dvb_frontend_info {
char name[128]; char name[128];
fe_type_t type; fe_type_t type;
uint32_t frequency_min; __u32 frequency_min;
uint32_t frequency_max; __u32 frequency_max;
uint32_t frequency_stepsize; __u32 frequency_stepsize;
uint32_t frequency_tolerance; __u32 frequency_tolerance;
uint32_t symbol_rate_min; __u32 symbol_rate_min;
uint32_t symbol_rate_max; __u32 symbol_rate_max;
uint32_t symbol_rate_tolerance; /* ppm */ __u32 symbol_rate_tolerance; /* ppm */
uint32_t notifier_delay; /* ms */ __u32 notifier_delay; /* ms */
fe_caps_t caps; fe_caps_t caps;
}; };
...@@ -89,21 +85,22 @@ struct dvb_frontend_info { ...@@ -89,21 +85,22 @@ struct dvb_frontend_info {
* the meaning of this struct... * the meaning of this struct...
*/ */
struct dvb_diseqc_master_cmd { struct dvb_diseqc_master_cmd {
uint8_t msg [6]; /* { framing, address, command, data [3] } */ __u8 msg [6]; /* { framing, address, command, data [3] } */
uint8_t msg_len; /* valid values are 3...6 */ __u8 msg_len; /* valid values are 3...6 */
}; };
struct dvb_diseqc_slave_reply { struct dvb_diseqc_slave_reply {
uint8_t msg [4]; /* { framing, data [3] } */ __u8 msg [4]; /* { framing, data [3] } */
uint8_t msg_len; /* valid values are 0...4, 0 means no msg */ __u8 msg_len; /* valid values are 0...4, 0 means no msg */
int timeout; /* return from ioctl after timeout ms with */ int timeout; /* return from ioctl after timeout ms with */
}; /* errorcode when no message was received */ }; /* errorcode when no message was received */
typedef enum fe_sec_voltage { typedef enum fe_sec_voltage {
SEC_VOLTAGE_13, SEC_VOLTAGE_13,
SEC_VOLTAGE_18 SEC_VOLTAGE_18,
SEC_VOLTAGE_OFF
} fe_sec_voltage_t; } fe_sec_voltage_t;
...@@ -195,13 +192,13 @@ typedef enum fe_hierarchy { ...@@ -195,13 +192,13 @@ typedef enum fe_hierarchy {
struct dvb_qpsk_parameters { 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) */ fe_code_rate_t fec_inner; /* forward error correction (see above) */
}; };
struct dvb_qam_parameters { 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_code_rate_t fec_inner; /* forward error correction (see above) */
fe_modulation_t modulation; /* modulation type (see above) */ fe_modulation_t modulation; /* modulation type (see above) */
}; };
...@@ -219,7 +216,7 @@ struct dvb_ofdm_parameters { ...@@ -219,7 +216,7 @@ struct dvb_ofdm_parameters {
struct dvb_frontend_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 */ /* intermediate frequency in kHz for QPSK */
fe_spectral_inversion_t inversion; fe_spectral_inversion_t inversion;
union { union {
...@@ -249,10 +246,10 @@ struct dvb_frontend_event { ...@@ -249,10 +246,10 @@ struct dvb_frontend_event {
#define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */ #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */
#define FE_READ_STATUS _IOR('o', 69, fe_status_t) #define FE_READ_STATUS _IOR('o', 69, fe_status_t)
#define FE_READ_BER _IOR('o', 70, uint32_t) #define FE_READ_BER _IOR('o', 70, __u32)
#define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, uint16_t) #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16)
#define FE_READ_SNR _IOR('o', 72, uint16_t) #define FE_READ_SNR _IOR('o', 72, __u16)
#define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, uint32_t) #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
#define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters) #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
#define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters) #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
......
...@@ -24,16 +24,12 @@ ...@@ -24,16 +24,12 @@
#ifndef _DVBNET_H_ #ifndef _DVBNET_H_
#define _DVBNET_H_ #define _DVBNET_H_
#ifdef __KERNEL__ #include <asm/types.h>
#include <linux/types.h>
#else
#include <stdint.h>
#endif
struct dvb_net_if { struct dvb_net_if {
uint16_t pid; __u16 pid;
uint16_t if_num; __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 @@ ...@@ -34,7 +34,8 @@
typedef enum { typedef enum {
VIDEO_FORMAT_4_3, /* Select 4:3 format */ 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; } video_format_t;
...@@ -56,6 +57,11 @@ typedef enum { ...@@ -56,6 +57,11 @@ typedef enum {
VIDEO_CENTER_CUT_OUT /* use center cut out format */ VIDEO_CENTER_CUT_OUT /* use center cut out format */
} video_displayformat_t; } video_displayformat_t;
typedef struct {
int w;
int h;
video_format_t aspect_ratio;
} video_size_t;
typedef enum { typedef enum {
VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */ VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
...@@ -74,9 +80,10 @@ typedef enum { ...@@ -74,9 +80,10 @@ typedef enum {
struct video_event { struct video_event {
int32_t type; int32_t type;
#define VIDEO_EVENT_SIZE_CHANGED 1
time_t timestamp; time_t timestamp;
union { union {
video_format_t video_format; video_size_t size;
} u; } u;
}; };
...@@ -186,6 +193,7 @@ typedef uint16_t video_attributes_t; ...@@ -186,6 +193,7 @@ typedef uint16_t video_attributes_t;
#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_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_GET_NAVI _IOR('o', 52, video_navi_pack_t)
#define VIDEO_SET_ATTRIBUTES _IO('o', 53) #define VIDEO_SET_ATTRIBUTES _IO('o', 53)
#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
#endif /*_DVBVIDEO_H_*/ #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