diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/cx88-core.c cx88-0.0.4-mdvh-hack4/cx88-core.c --- cx88-0.0.4/cx88-core.c 2004-02-22 02:59:35.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/cx88-core.c 2005-01-25 08:02:58.000000000 +0100 @@ -32,7 +32,7 @@ #include "cx88.h" -MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); +MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards. Hacked by Martin Dvh for testing purpose"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/cx88-video.c cx88-0.0.4-mdvh-hack4/cx88-video.c --- cx88-0.0.4/cx88-video.c 2004-04-15 12:39:34.000000000 +0200 +++ cx88-0.0.4-mdvh-hack4/cx88-video.c 2005-01-25 22:30:52.000000000 +0100 @@ -78,6 +78,96 @@ MODULE_PARM(nicam,"i"); MODULE_PARM_DESC(nicam,"tv audio is nicam"); + + +static unsigned int force_htotal = 0; +MODULE_PARM(force_htotal,"i"); +MODULE_PARM_DESC(force_htotal,"default PAL 1135, NTSC 910. Force htotal to this value, maximum is 2047.Programmable total number of pixel per line. This determines tha actual number of raw samples per line taken during a normal capture"); + +static unsigned int force_swidth = 0; +MODULE_PARM(force_swidth,"i"); +MODULE_PARM_DESC(force_swidth,"force scaled width to this value. default for PAL is 922, for NTSC 754"); + +static unsigned int force_hdelay = 0; +MODULE_PARM(force_hdelay,"i"); +MODULE_PARM_DESC(force_hdelay,"default PAL 186, NTSC 135, maximum 1023. HDELAY is programmed with the number of pixels between horizontal sync and the first pixel of each line to be displayed or captured. HDELAY should be an even number to get Cb as the first pixel, an odd number to get Cr. The register value is programmed with respect to the scaled frequency clock."); + +static unsigned int force_vdelay = 0; +MODULE_PARM(force_vdelay,"i"); +MODULE_PARM_DESC(force_vdelay,"default PAL 36,default NTSC 24 For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/"); + +static unsigned int force_fsc8 = 0; +MODULE_PARM(force_fsc8,"i"); +MODULE_PARM_DESC(force_fsc8,"pll frequency in Hz. (for videodecoder (will be scaled) and ADC) default PAL 35468950, NTSC 28636360. min 16000000 max 80000000"); + +static unsigned int force_vbi_pkt_size = 0; +MODULE_PARM(force_vbi_pkt_size,"i"); +MODULE_PARM_DESC(force_vbi_pkt_size,"default PAL 511, NTSC 288, max 1023 .VBI Packet Size. The number of raw data dwords (four 8-bit samples) to capture per line while in VBI capture mode (only used in VBI line mode)."); + +static unsigned int force_vactive = 0; +MODULE_PARM(force_vactive,"i"); +MODULE_PARM_DESC(force_vactive,"default PAL 576, NTSC 480, This is the vertical active. It defines the number of half lines used in the vertical scaling process. Values between 1 and 1023 are allowed."); + +static unsigned int force_hactive = 0; +MODULE_PARM(force_hactive,"i"); +MODULE_PARM_DESC(force_hactive,"default set to capture_width.This is the horizontal active. It defines the number of horizontal active pixels per line. Values between 1 and 1023 are allowed."); + +static unsigned int force_maxh = 0; +MODULE_PARM(force_maxh,"i"); +MODULE_PARM_DESC(force_maxh,"default PAL 576, NTSC 480, maximum value the driver will accept for height"); + +static unsigned int force_maxw = 0; +MODULE_PARM(force_maxw,"i"); +MODULE_PARM_DESC(force_maxw,"default PAL 768, NTSC 640, maximum value the driver will accept for width"); + +static unsigned int frm_size = 1024; +module_param(frm_size,int,0444); +MODULE_PARM_DESC(frm_size,"VBI Frame Size: default 1024. max 4095. Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet. Has to be QWORD boundary.\nThis number might need to correspond in some way to the exact height and /or width requested in the capture command."); + +static unsigned int vbi_v_del = 2; +module_param(vbi_v_del ,int,0444); +MODULE_PARM_DESC(vbi_v_del ,"The number of CLKx1 s to delay from the trailing edge of HRESET before starting VBI line capture. Used in both VBI line mode and VBI frame mode, where in VBI frame mode it has to set to a value of 2."); + +static unsigned int extend_vbi = 0; +module_param(extend_vbi,int,0444); +MODULE_PARM_DESC(extend_vbi,"A value of 1 extends the frame output capture region to include the 20 half lines prior to the default VACTIVE region. Can be used in vbi_frame_mode."); + +/*static unsigned int pll_freq = 0; +module_param(pll_freq ,int,0444); +MODULE_PARM_DESC(pll_freq ,"fsc8=pll_freq 28636360 for NTSC 35468950 for PAL");*/ + +static unsigned int disable_samplerateconverter = 0; +module_param(disable_samplerateconverter ,int,0444); +MODULE_PARM_DESC(disable_samplerateconverter ,"set to 1 to disable the samplerate_conversion for the video_decoder and make the videodecoderrate the same as the ADC sampling freq. If set to 0 the videodecoder works at a different frequency as the sampling frequency of the ADCs, for normal operation we should not need the samplerateconversion and just use pll_freq=fsc8 for everything. The datasheets are confusing about these settings"); + +static unsigned int disable_vscale = 0; +module_param(disable_vscale ,int,0444); +MODULE_PARM_DESC(disable_vscale ,"set to 1 to disable the vertical scaling."); + +static unsigned int disable_hscale = 0; +module_param(disable_hscale ,int,0444); +MODULE_PARM_DESC(disable_hscale ,"set to 1 to disable the horizontal scaling."); + +/*static unsigned int disable_size_checks = 0; +MODULE_PARM(disable_size_checks,"i"); +MODULE_PARM_DESC(disable_size_checks,"if set to 1 no width and height checks are performed, dangerous !");*/ + + + +static unsigned int cap_raw_all = 0; +module_param(cap_raw_all,int,0444); +MODULE_PARM_DESC(cap_raw_all,"A value of 1 enables continuous raw data mode capture. You also need to set frm_size"); + +static unsigned int raw16 = 0; +module_param(raw16,int,0444); +MODULE_PARM_DESC(raw16," 0 = 8xFsc 8-bit data mode (Raw Data)\n 1 = 4xFsc 16-bit data mode (Filtered VBI data)"); + +static unsigned int vbi_frame_capture_raw_mode = 0; +module_param(vbi_frame_capture_raw_mode,int,0444); +MODULE_PARM_DESC(vbi_frame_capture_raw_mode," This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size."); + + + #define dprintk(level,fmt, arg...) if (video_debug >= level) \ printk(KERN_DEBUG "%s: " fmt, dev->name , ## arg) @@ -91,6 +181,71 @@ static unsigned int inline norm_swidth(struct cx8800_tvnorm *norm) { + force_swidth=force_swidth & 0x1fff;/*mdvh This value is used to determine the scale factor so I don't know the exact maximum */ + return (force_swidth)?force_swidth:(norm->id & V4L2_STD_625_50) ? 922 : 754; +} + +static unsigned int inline norm_sheight(struct cx8800_tvnorm *norm) +{ + return (norm->id & V4L2_STD_625_50) ? 576 : 480; +} + +static unsigned int inline norm_maxh(struct cx8800_tvnorm *norm) +{ + force_maxh=force_maxh & 0x1fff; + return (force_maxh)?force_maxh:(norm->id & V4L2_STD_625_50) ? 576 : 480; +} + +static unsigned int inline norm_maxw(struct cx8800_tvnorm *norm) +{ + force_maxw=force_maxw & 0x1fff; + return (force_maxw)?force_maxw:(norm->id & V4L2_STD_625_50) ? 768 : 640; +} + +static unsigned int inline norm_hdelay(struct cx8800_tvnorm *norm) +{ + force_hdelay=force_hdelay&0x03FF; + return (force_hdelay)?force_hdelay:(norm->id & V4L2_STD_625_50) ? 186 : 135; +} + +static unsigned int inline norm_vdelay(struct cx8800_tvnorm *norm) +{ + force_vdelay=force_vdelay &0x03FF; + return (force_vdelay)?force_vdelay:(norm->id & V4L2_STD_625_50) ? 0x24 : 0x18; + /*For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/ + +} + +static unsigned int inline norm_fsc8(struct cx8800_tvnorm *norm) +{ + force_fsc8=(force_fsc8>16000000 && force_fsc8<80000000)?force_fsc8:0; + static const unsigned int ntsc = 28636360; + static const unsigned int pal = 35468950; + + return (force_fsc8)?force_fsc8:(norm->id & V4L2_STD_625_50) ? pal : ntsc; +} + +static unsigned int inline norm_notchfilter(struct cx8800_tvnorm *norm) +{ + return (norm->id & V4L2_STD_625_50) + ? HLNotchFilter135PAL + : HLNotchFilter135NTSC; +} + +static unsigned int inline norm_htotal(struct cx8800_tvnorm *norm) +{ + force_htotal=force_htotal &0x07FF; + return (force_htotal)?force_htotal:((norm->id & V4L2_STD_625_50) ? 1135 : 910); +} + +static unsigned int inline norm_vbipack(struct cx8800_tvnorm *norm) +{ + force_vbi_pkt_size=force_vbi_pkt_size & 0x03FF;//only used for vbi_line mode + return (force_vbi_pkt_size)?force_vbi_pkt_size:(norm->id & V4L2_STD_625_50) ? 511 : 288; +} + +/*static unsigned int inline norm_swidth(struct cx8800_tvnorm *norm) +{ return (norm->id & V4L2_STD_625_50) ? 922 : 754; } @@ -139,7 +294,7 @@ { return (norm->id & V4L2_STD_625_50) ? 511 : 288; } - +*/ static struct cx8800_tvnorm tvnorms[] = { { .name = "NTSC-M", @@ -537,7 +692,8 @@ dev->tvnorm = norm; fsc8 = norm_fsc8(norm); - adc_clock = xtal; + //adc_clock = xtal; + adc_clock = (disable_samplerateconverter)?fsc8:xtal; vdec_clock = fsc8; dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d\n", @@ -592,9 +748,16 @@ cx_write(MO_HTOTAL, htotal); // vbi stuff - cx_write(MO_VBI_PACKET, ((1 << 11) | /* (norm_vdelay(norm) << 11) | */ - norm_vbipack(norm))); - + //cx_write(MO_VBI_PACKET, ((1 << 11) | /* (norm_vdelay(norm) << 11) | */ + // norm_vbipack(norm))); + //mdvh: vbi and raw stuff + frm_size=frm_size &0x0FFF;//VBI Frame Size Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet has to be QWORD boundary. + vbi_v_del =vbi_v_del &0x3F;//vdelay=2 is minimum according to datasheet + //vbi_v_del=(vbi_v_del)?vbi_v_del:2; + extend_vbi =(extend_vbi )?1:0;//enable extend vbi capture range to include 20 halflines prior to vactive during vbi_frame capture mode + + cx_write(MO_VBI_PACKET,((cap_raw_all || vbi_frame_capture_raw_mode)? frm_size<<17:0)|(vbi_v_del << 11) |extend_vbi <<10| norm_vbipack(norm)); + // audio set_tvaudio(dev); @@ -616,40 +779,44 @@ int interlaced) { unsigned int swidth = norm_swidth(dev->tvnorm); - unsigned int sheight = norm_maxh(dev->tvnorm); + unsigned int sheight = norm_sheight(dev->tvnorm);//mdvh: was norm_maxh(dev->tvnorm); u32 value; dprintk(1,"set_scale: %dx%d [%s]\n", width, height, dev->tvnorm->name); // recalc H delay and scale registers - value = (width * norm_hdelay(dev->tvnorm)) / swidth; + value =(disable_hscale)?norm_hdelay(dev->tvnorm): (width * norm_hdelay(dev->tvnorm)) / swidth; value &= 0x3fe; cx_write(MO_HDELAY_EVEN, value); cx_write(MO_HDELAY_ODD, value); dprintk(1,"set_scale: hdelay 0x%04x\n", value); - value = (swidth * 4096 / width) - 4096; + value = (disable_hscale)?0:(swidth * 4096 / width) - 4096; cx_write(MO_HSCALE_EVEN, value); cx_write(MO_HSCALE_ODD, value); dprintk(1,"set_scale: hscale 0x%04x\n", value); - cx_write(MO_HACTIVE_EVEN, width); - cx_write(MO_HACTIVE_ODD, width); - dprintk(1,"set_scale: hactive 0x%04x\n", width); + force_hactive=force_hactive & 0x3ff; + value=(force_hactive)?force_hactive:width; + cx_write(MO_HACTIVE_EVEN, value); + cx_write(MO_HACTIVE_ODD, value); + dprintk(1,"set_scale: hactive 0x%04x\n", value); // recalc V scale Register (delay is constant) cx_write(MO_VDELAY_EVEN, norm_vdelay(dev->tvnorm)); cx_write(MO_VDELAY_ODD, norm_vdelay(dev->tvnorm)); dprintk(1,"set_scale: vdelay 0x%04x\n", norm_vdelay(dev->tvnorm)); - value = (0x10000 - (sheight * 512 / height - 512)) & 0x1fff; + value =(disable_vscale)?0: (0x10000 - (sheight * 512 / height - 512)) & 0x1fff; cx_write(MO_VSCALE_EVEN, value); cx_write(MO_VSCALE_ODD, value); dprintk(1,"set_scale: vscale 0x%04x\n", value); - cx_write(MO_VACTIVE_EVEN, sheight); - cx_write(MO_VACTIVE_ODD, sheight); - dprintk(1,"set_scale: vactive 0x%04x\n", sheight); + force_vactive=force_vactive &0x3ff; + value=(force_vactive)?force_vactive:sheight; + cx_write(MO_VACTIVE_EVEN, value); + cx_write(MO_VACTIVE_ODD, value); + dprintk(1,"set_scale: vactive 0x%04x\n", value); // setup filters value = 0; @@ -704,7 +871,9 @@ cx88_sram_channel_setup(dev, &cx88_sram_channels[SRAM_CH21], buf->bpl, buf->risc.dma); set_scale(dev, buf->vb.width, buf->vb.height, 1); - cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); + //cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); + cx_write(MO_COLOR_CTRL, ((vbi_frame_capture_raw_mode && (buf->fmt->cxformat==ColorFormatY8))?ColorFormatRAW: buf->fmt->cxformat)| ColorFormatGamma);/*mdvh: hack set vbi_frame capture raw format in stead of grey when requested*/ + /* reset counter */ cx_write(MO_VIDY_GPCNTRL,0x3); @@ -715,7 +884,10 @@ cx_set(MO_VID_INTMSK, 0x0f0011); /* enable capture */ - cx_set(VID_CAPTURE_CONTROL,0x06); + //cx_set(VID_CAPTURE_CONTROL,0x06); + cap_raw_all=(cap_raw_all)?1:0; + raw16=(raw16)?1:0; + cx_set(VID_CAPTURE_CONTROL,cap_raw_all<<6 | raw16<<5 | 0x06);/*mdvh: cap_raw_all:set contiunous raw capturing, raw16:8 bit 8Fsc or 16 bit 4xfsc raw capturing, 0x06 means capture_odd | capture_even*/ /* start dma */ cx_set(MO_DEV_CNTRL2, (1<<5)); diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/cx88_0_0_4_mdvh_hack3.prj cx88-0.0.4-mdvh-hack4/cx88_0_0_4_mdvh_hack3.prj --- cx88-0.0.4/cx88_0_0_4_mdvh_hack3.prj 1970-01-01 01:00:00.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/cx88_0_0_4_mdvh_hack3.prj 2005-01-25 17:27:07.000000000 +0100 @@ -0,0 +1,141 @@ +# Anjuta Version 1.2.2 +Compatibility Level: 1 + + + + + + + + + + + + + + + + + + + + +props.file.type=project + +anjuta.version=1.2.2 +anjuta.compatibility.level=1 + +project.name=cx88_0_0_4_mdvh_hack3 +project.type=GENERIC +project.target.type=EXECUTABLE +project.version=0.99 +project.author=Gerd Knorr +project.source.target=unknown +project.has.gettext=0 +project.gui.command= +project.programming.language=C +project.excluded.modules=intl + +project.config.extra.modules.before= +project.config.extra.modules.after= +project.config.blocked=1 +project.config.disable.overwriting=1 1 1 1 1 1 1 1 1 + +project.menu.entry=cx88_0_0_4_mdvh_hack3 Version 0.99 +project.menu.group=Application +project.menu.comment=cx88_0_0_4_mdvh_hack3 Version 0.99 +project.menu.icon= +project.menu.need.terminal=0 + +project.configure.options= +anjuta.program.arguments= +preferences.build.option.jobs=0 +preferences.build.option.silent=0 +preferences.build.option.autosave=0 +preferences.make=make +preferences.build.option.keep.going=1 +preferences.build.option.warn.undef=0 +preferences.autoformat.custom.style= -i8 -sc -bli0 -bl0 -cbi0 -ss +preferences.indent.opening=0 +preferences.autoformat.disable=1 +preferences.indent.automatic=1 +preferences.use.tabs=1 +preferences.indent.size=4 +preferences.tabsize=4 +preferences.indent.closing=0 + +module.include.name=. +module.include.type= +module.include.files=\ + video-buf.h\ + videodev.h\ + videodev2.h\ + tuner.h\ + tda9887.h\ + id.h\ + audiochip.h\ + i2c-compat.h\ + btcx-risc.h\ + cx88-reg.h\ + cx88.h + +module.source.name=. +module.source.type= +module.source.files=\ + v4l1-compat.c\ + v4l2-common.c\ + video-buf.c\ + tuner.c\ + tda9887.c\ + btcx-risc.c\ + cx88-cards.c\ + cx88-core.c\ + cx88-i2c.c\ + cx88-tvaudio.c\ + cx88-vbi.c\ + cx88-video.c\ + tuner.mod.c\ + video-buf.mod.c\ + v4l2-common.mod.c\ + v4l1-compat.mod.c\ + tda9887.mod.c\ + cx88xx.mod.c\ + cx8800.mod.c\ + btcx-risc.mod.c + +module.pixmap.name=. +module.pixmap.type= +module.pixmap.files= + +module.data.name=. +module.data.type= +module.data.files= + +module.help.name=. +module.help.type= +module.help.files= + +module.doc.name=. +module.doc.type= +module.doc.files= + +module.po.files= + +compiler.options.supports= +compiler.options.include.paths=\ + .\ + .. +compiler.options.library.paths= +compiler.options.libraries= +compiler.options.libraries.selected= +compiler.options.defines=\ + HAVE_CONFIG_H +compiler.options.defines.selected= +compiler.options.warning.buttons=0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 +compiler.options.optimize.buttons=0 0 1 0 +compiler.options.other.buttons=1 0 +compiler.options.other.c.flags= +compiler.options.other.l.flags= +compiler.options.other.l.libs= + +project.src.paths= diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/cx88_0_0_4_mdvh_hack3.prj.bak cx88-0.0.4-mdvh-hack4/cx88_0_0_4_mdvh_hack3.prj.bak --- cx88-0.0.4/cx88_0_0_4_mdvh_hack3.prj.bak 1970-01-01 01:00:00.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/cx88_0_0_4_mdvh_hack3.prj.bak 2005-01-25 17:27:03.000000000 +0100 @@ -0,0 +1,141 @@ +# Anjuta Version 1.2.2 +Compatibility Level: 1 + + + + + + + + + + + + + + + + + + + + +props.file.type=project + +anjuta.version=1.2.2 +anjuta.compatibility.level=1 + +project.name=cx88_0_0_4_mdvh_hack3 +project.type=GENERIC +project.target.type=EXECUTABLE +project.version=0.99 +project.author=Gerd Knorr +project.source.target=unknown +project.has.gettext=0 +project.gui.command= +project.programming.language=C +project.excluded.modules=intl + +project.config.extra.modules.before= +project.config.extra.modules.after= +project.config.blocked=1 +project.config.disable.overwriting=1 1 1 1 1 1 1 1 1 + +project.menu.entry=cx88_0_0_4_mdvh_hack3 Version 0.99 +project.menu.group=Application +project.menu.comment=cx88_0_0_4_mdvh_hack3 Version 0.99 +project.menu.icon= +project.menu.need.terminal=0 + +project.configure.options= +anjuta.program.arguments= +preferences.build.option.jobs=0 +preferences.build.option.silent=0 +preferences.build.option.autosave=0 +preferences.make=make +preferences.build.option.keep.going=1 +preferences.build.option.warn.undef=0 +preferences.autoformat.custom.style= -i8 -sc -bli0 -bl0 -cbi0 -ss +preferences.indent.opening=0 +preferences.autoformat.disable=1 +preferences.indent.automatic=1 +preferences.use.tabs=1 +preferences.indent.size=4 +preferences.tabsize=4 +preferences.indent.closing=0 + +module.include.name=. +module.include.type= +module.include.files=\ + video-buf.h\ + videodev.h\ + videodev2.h\ + tuner.h\ + tda9887.h\ + id.h\ + audiochip.h\ + i2c-compat.h\ + btcx-risc.h\ + cx88-reg.h\ + cx88.h + +module.source.name=. +module.source.type= +module.source.files=\ + v4l1-compat.c\ + v4l2-common.c\ + video-buf.c\ + tuner.c\ + tda9887.c\ + btcx-risc.c\ + cx88-cards.c\ + cx88-core.c\ + cx88-i2c.c\ + cx88-tvaudio.c\ + cx88-vbi.c\ + cx88-video.c\ + tuner.mod.c\ + video-buf.mod.c\ + v4l2-common.mod.c\ + v4l1-compat.mod.c\ + tda9887.mod.c\ + cx88xx.mod.c\ + cx8800.mod.c\ + btcx-risc.mod.c + +module.pixmap.name=. +module.pixmap.type= +module.pixmap.files= + +module.data.name=. +module.data.type= +module.data.files= + +module.help.name=. +module.help.type= +module.help.files= + +module.doc.name=. +module.doc.type= +module.doc.files= + +module.po.files= + +compiler.options.supports= +compiler.options.include.paths=\ + .\ + .. +compiler.options.library.paths= +compiler.options.libraries= +compiler.options.libraries.selected= +compiler.options.defines=\ + HAVE_CONFIG_H +compiler.options.defines.selected= +compiler.options.warning.buttons=0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 +compiler.options.optimize.buttons=0 0 1 0 +compiler.options.other.buttons=1 0 +compiler.options.other.c.flags= +compiler.options.other.l.flags= +compiler.options.other.l.libs= + +project.src.paths= diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/cx88_0_0_4_mdvh_hack3.pws cx88-0.0.4-mdvh-hack4/cx88_0_0_4_mdvh_hack3.pws --- cx88-0.0.4/cx88_0_0_4_mdvh_hack3.pws 1970-01-01 01:00:00.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/cx88_0_0_4_mdvh_hack3.pws 2005-01-25 17:27:03.000000000 +0100 @@ -0,0 +1,6 @@ + +[executer] +RunInTerminal=true + +[Project State] +clean before build=false diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/doc/BUILD_HOWTO cx88-0.0.4-mdvh-hack4/doc/BUILD_HOWTO --- cx88-0.0.4/doc/BUILD_HOWTO 1970-01-01 01:00:00.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/doc/BUILD_HOWTO 2005-01-25 08:02:59.000000000 +0100 @@ -0,0 +1,32 @@ +about this document + +This is a mini howto for compiling and installing v4l2 drivers, namely bttv 0.9.x, saa7134 and cx88. + +It is not a general introduction into kernel patching and building, if you are looking for this (or if you don't understand what this page is about ...) check out the Kernel Howto. +v4l2 on 2.4.x kernels + +You need a patched kernel. Patches for 2.4.26 which already include the drivers are available. They should work fine with newer kernels as well. + +I've stopped maintaining the drivers for 2.4 kernels. Current cvs drivers don't build on 2.4 kernels any more. I will keep the old stuff available for download of course, but don't expect any updates. If you have trouble with the 2.4 drivers or very new hardware which isn't supported yet I strongly suggest to update to 2.6 kernels. +v4l2 on 2.6.x kernels + +kernel 2.6.x already has everything included. Just enable the config options you need (i2c, video4linux and the actual driver), compile your kernel and you are done. + +If you run into trouble you can check if there are updates with fixes in the patch directory. + +You can also fetch a snapshot and build that one (they tend to be updated more often than the patchkits). To build and use the current drivers you need 2.6.2 or newer. +building the driver tarballs + +This is pretty simple: + +mkdir +cd +tar xzf /path/to/driver-version.tar.gz +cd driver-version +make KDIR=/path/to/kernel/source/tree +make install + +Usually the correct path to the kernel source tree is picked automagically, you only need the KDIR argument for make if this doesn't work for some reason. + +The driver tarballs install into another path than the kernels driver, so you should take care that really the correct modules get loaded. Make sure you don't mix the kernels and snapshots modules, there might be incompatibilies. +© Gerd Knorr diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/doc/cx2388x_tests1.txt cx88-0.0.4-mdvh-hack4/doc/cx2388x_tests1.txt --- cx88-0.0.4/doc/cx2388x_tests1.txt 1970-01-01 01:00:00.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/doc/cx2388x_tests1.txt 2005-01-26 01:20:52.000000000 +0100 @@ -0,0 +1,190 @@ +Tests for the hacked cx2388x video4linux driver to find out if it can do continuous capturing using the cap_raw_all flag, and to find out how to use it. + +first build the driver: +tar zxvf cx88-0.0.4-mdvh-hackX.tar.gz +cd cx88-0.0.4-mdvh-hackX +make KDIR=/path/to/kernel/source/tree + +Now use the insmod options below to load cx8800.ko. You also need to insmod cx88xx.ko but that one does not need any special options. +To see the list of new insmod options run: +modinfo ./cx8800.ko + +I tried to dig up the right parameters to get the continuous raw capturing working. +I think it will only work if you also enable vbi_frame mode. Since this mode was not yet supported in the driver I tried to find out the parameters used in the bttv driver (which does support vbi_frame mode, called BT848_COLOR_FMT_RAW in the driver) +Still there are lots of uncertainties because bttv and cx2388x are not the same and the datasheets leave a lot of room for interpretation. +But maybe the vbi_frame mode is not needed at all and we only need to set the cap_raw_all flag and the frm_size. +frm_size is needed for cap_raw_all mode but it is still quite a mistery to me. +It might need to correspond to capture_width or capture_width*2. I don't know exactly what a frame is here. I suspect it is the number of samples per output_line. In the bt878 chip there is no frm_size register. If using vbi_frame mode the bt878 always outputs 1024 samples per line. +The datasheet says: VBI Frame Size Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet has to be QWORD boundary. +But there is no description of what a packet is. +The datasheet also says: +In the VBI frame output mode, VBI data capture occurs in the active video region and includes all the horizontal blank/sync information in the data stream. This feature can be used to provide a high-quality still-capture of video. The data is vertically bound beginning at the first line during VACTIVE and ending after a fixed number of packets. The data stream is packetized into a series of 256-dword blocks. A fixed number of dword blocks (434 for NTSC and 650 for PAL) are captured during each field. This is equivalent to 111,104 dwords for NTSC (434 × 256 dwords) and 166,400 dwords for PAL (650 × 256 dwords) per field. The VBI frame capture region can be extended to include the 10 lines prior to the default VACTIVE region by setting the EXT_FRAME register bit. VDELAY must also be set to its minimum value of 2. + +So possibly the default frm_size=256 dwords =256*8=2048 +The only real option to find out is to try different settings. + +Here are the test videocaptures I thought of. I don't know if standard capture programs will allow you to use non-standard capture_sizes like 2048x692. If not please let me know and I will write a small test_capture appplication. +Any comments welcome. + + +Simple test to see what cap_raw_all in normal (not vbi_frame) mode does: +capture settings: +Try different standard settings. Also try grey 8bpp 1024x640 +insmod options: +cap_raw_all=1 +frm_size = try 2048 or 1024 or capture_width or capture_width/2 or 0 + +Try more things to see what cap_raw_all in normal (not vbi_frame) mode does: +capture settings: +capture_color :try different color modes, probably GREY, 8bpp works best +capture_width: try normal resolutions (640x480) or try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=try normal resolutions (640x480) or for PAL 625 or 674 or 692 for NTSC 450 or 466 or 525 +insmod options: +cap_raw_all=1 +vbi_frame_capture_raw_mode=0 +force_hactive=0 (or for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm)) +force_maxw=2048 (set to capture_width or greater) +force_maxh=800 (set to capture_height or greater) +frm_size = try 2048 or 1024 or capture_width or capture_width/2 or 0 +force_vdelay=2 +force_vactive=for PAL try 576, 610,625,692 (values from 576 to 694) for NTSC try 450,480,508,525 (values from 448 to 526) +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 or 0 +disable_hscale=1 or 0 + + +Test to determine if vbi_frame mode works: +normal vbi_frame mode without extend_vbi: +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 640 for NTSC 434 or 640 + +insmod options: +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=692 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 + +If vbi_frame mode works, try to get extra lines with this test. +normal vbi_frame mode with extend_vbi (you get more output lines): +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 674 for NTSC 450 or 674 +insmod options: +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=692 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +force_vdelay=2 +force_vactive=for try 610 (values from 600 to 694) for NTSC try 508 (values from 448 to 526) +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 + +Try to see what cap_raw_all does when in vbi_frame mode. +cap_raw_all in vbi_frame mode without extend_vbi: +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 640 for NTSC 434 or 640 + +insmod options: +cap_raw_all=1 +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=800 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 + +See if we can get more extra lines in cap_raw_all and vbi_frame mode: +cap_raw_all in vbi_frame mode with extend_vbi (you get more output lines): +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 674 for NTSC 450 or 674 +insmod options: +cap_raw_all=1 +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=800 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +force_vdelay=2 +force_vactive=for PAL try 576, 610,625,692 (values from 576 to 694) for NTSC try 450,480,508,525 (values from 448 to 526) +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 +cap_raw_all=1 + + + + + + + + + +frm_size versus capture_width versus htotal versus hactive: +force_htotal:default PAL 1135, NTSC 910. maximum is 2047.Programmable total number of pixel per line. This determines the actual number of raw samples per line/2 taken during a normal capture. We probably don't need to verride this. + +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +frm_size = try 2048 or 1024 ? This might need to correspond to capture_width or capture_width*2. I don't know exactly what a frame is here. I suspect it is the number of samples per output_line. In the bt878 chip there is no frm_size register. If using vbi_frame mode the bt878 always outputs 1024 samples per line. +The datasheet says: VBI Frame Size Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet has to be QWORD boundary. +But there is no description of what a packet is. +The datasheet also says: +In the VBI frame output mode, VBI data capture occurs in the active video region and includes all the horizontal blank/sync information in the data stream. This feature can be used to provide a high-quality still-capture of video. The data is vertically bound beginning at the first line during VACTIVE and ending after a fixed number of packets. The data stream is packetized into a series of 256-dword blocks. A fixed number of dword blocks (434 for NTSC and 650 for PAL) are captured during each field. This is equivalent to 111,104 dwords for NTSC (434 × 256 dwords) and 166,400 dwords for PAL (650 × 256 dwords) per field. The VBI frame capture region can be extended to include the 10 lines prior to the default VACTIVE region by setting the EXT_FRAME register bit. VDELAY must also be set to its minimum value of 2. + +So possibly the default frm_size=256 dwords =256*8=2048 + + +disable_samplerateconverter=1 Use the same clock for the ADC as for the video_decoder. Strangely enough the current driver nomally enables the samplerate_converter. I don't know why. Experiment with this setting +disable_vscale=1 Do not do any vertical scaling (needed for vbi_frame_mode, probably also for cap_caw_all) +disable_hscale=1 Do not do any horizontal scaling (needed for vbi_frame_mode, probably also for cap_raw_all) +cap_raw_all=0 of 1 A value of 1 enables continuous raw data mode capture. You also need to set frm_size to the correct value and probably use a capture height of 640 or 674 and a capture width corresponding to frm_size +vbi_frame_capture_raw_mode=1 Enable vbi_frame mode. This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size. + + +All new insmod options: (get the current list with modinfo ./cx8800.ko) +filename: ./cx8800.ko +description: v4l2 driver module for cx2388x based TV cards +parm: force_htotal:default PAL 1135, NTSC 910. Force htotal to this value, maximum is 2047.Programmable total number of pixel per line. This determines tha actual number of raw samples per line taken during a normal capture +parm: force_swidth:force scaled width to this value. default for PAL is 922, for NTSC 754 +parm: force_hdelay:default PAL 186, NTSC 135, maximum 1023. HDELAY is programmed with the number of pixels between horizontal sync and the first pixel of each line to be displayed or captured. HDELAY should be an even number to get Cb as the first pixel, an odd number to get Cr. The register value is programmed with respect to the scaled frequency clock. +parm: force_vdelay:default PAL 36,default NTSC 24 For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/ +parm: force_fsc8:pll frequency in Hz. (for videodecoder (will be scaled) and ADC) default PAL 35468950, NTSC 28636360. min 16000000 max 80000000 +parm: force_vbi_pkt_size:default PAL 511, NTSC 288, max 1023 .VBI Packet Size. The number of raw data dwords (four 8-bit samples) to capture per line while in VBI capture mode (only used in VBI line mode). +parm: force_vactive:default PAL 576, NTSC 480, This is the vertical active. It defines the number of half lines used in the vertical scaling process. Values between 1 and 1023 are allowed. +parm: force_hactive:default set to capture_width.This is the horizontal active. It defines the number of horizontal active pixels per line. Values between 1 and 1023 are allowed. +parm: force_maxh:default PAL 576, NTSC 480, maximum value the driver will accept for height +parm: force_maxw:default PAL 768, NTSC 640, maximum value the driver will accept for width +parm: frm_size:VBI Frame Size: default 1024. Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet. Has to be QWORD boundary. +This number might need to correspond in some way to the exact height and /or width requested in the capture command. +parm: vbi_v_del:The number of CLKx1 s to delay from the trailing edge of HRESET before starting VBI line capture. Used in both VBI line mode and VBI frame mode, where in VBI frame mode it has to set to a value of 2. +parm: extend_vbi:A value of 1 extends the frame output capture region to include the 20 half lines prior to the default VACTIVE region. Can be used in vbi_frame_mode. +parm: disable_samplerateconverter:set to 1 to disable the samplerate_conversion for the video_decoder and make the videodecoderrate the same as the ADC sampling freq. If set to 0 the videodecoder works at a different frequency as the sampling frequency of the ADCs, for normal operation we should not need the samplerateconversion and just use pll_freq=fsc8 for everything. The datasheets are confusing about these settings +parm: disable_vscale:set to 1 to disable the vertical scaling. +parm: disable_hscale:set to 1 to disable the horizontal scaling. +parm: cap_raw_all:A value of 1 enables continuous raw data mode capture. You also need to set frm_size +parm: raw16: 0 = 8xFsc 8-bit data mode (Raw Data) + 1 = 4xFsc 16-bit data mode (Filtered VBI data) +parm: vbi_frame_capture_raw_mode: This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size. + + +greetings, +Martin Dvh diff -urN -x .tm_project.cache -x .tmp_versions cx88-0.0.4/doc/cx8800_modinfo.txt cx88-0.0.4-mdvh-hack4/doc/cx8800_modinfo.txt --- cx88-0.0.4/doc/cx8800_modinfo.txt 1970-01-01 01:00:00.000000000 +0100 +++ cx88-0.0.4-mdvh-hack4/doc/cx8800_modinfo.txt 2005-01-26 00:57:04.000000000 +0100 @@ -0,0 +1,41 @@ +filename: ./cx8800.ko +description: v4l2 driver module for cx2388x based TV cards +author: Gerd Knorr [SuSE Labs] +license: GPL +parm: video_nr:video device numbers +parm: vbi_nr:vbi device numbers +parm: radio_nr:radio device numbers +parm: latency:pci latency timer +parm: video_debug:enable debug messages [video] +parm: irq_debug:enable debug messages [IRQ handler] +parm: vid_limit:capture memory limit in megabytes +parm: tuner:tuner type +parm: card:card type +parm: nicam:tv audio is nicam +parm: force_htotal:default PAL 1135, NTSC 910. Force htotal to this value, maximum is 2047.Programmable total number of pixel per line. This determines tha actual number of raw samples per line taken during a normal capture +parm: force_swidth:force scaled width to this value. default for PAL is 922, for NTSC 754 +parm: force_hdelay:default PAL 186, NTSC 135, maximum 1023. HDELAY is programmed with the number of pixels between horizontal sync and the first pixel of each line to be displayed or captured. HDELAY should be an even number to get Cb as the first pixel, an odd number to get Cr. The register value is programmed with respect to the scaled frequency clock. +parm: force_vdelay:default PAL 36,default NTSC 24 For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/ +parm: force_fsc8:pll frequency in Hz. (for videodecoder (will be scaled) and ADC) default PAL 35468950, NTSC 28636360. min 16000000 max 80000000 +parm: force_vbi_pkt_size:default PAL 511, NTSC 288, max 1023 .VBI Packet Size. The number of raw data dwords (four 8-bit samples) to capture per line while in VBI capture mode (only used in VBI line mode). +parm: force_vactive:default PAL 576, NTSC 480, This is the vertical active. It defines the number of half lines used in the vertical scaling process. Values between 1 and 1023 are allowed. +parm: force_hactive:default set to capture_width.This is the horizontal active. It defines the number of horizontal active pixels per line. Values between 1 and 1023 are allowed. +parm: force_maxh:default PAL 576, NTSC 480, maximum value the driver will accept for height +parm: force_maxw:default PAL 768, NTSC 640, maximum value the driver will accept for width +parm: frm_size:VBI Frame Size: default 1024. max 4095. Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet. Has to be QWORD boundary. +This number might need to correspond in some way to the exact height and /or width requested in the capture command. +parm: vbi_v_del:The number of CLKx1 s to delay from the trailing edge of HRESET before starting VBI line capture. Used in both VBI line mode and VBI frame mode, where in VBI frame mode it has to set to a value of 2. +parm: extend_vbi:A value of 1 extends the frame output capture region to include the 20 half lines prior to the default VACTIVE region. Can be used in vbi_frame_mode. +parm: disable_samplerateconverter:set to 1 to disable the samplerate_conversion for the video_decoder and make the videodecoderrate the same as the ADC sampling freq. If set to 0 the videodecoder works at a different frequency as the sampling frequency of the ADCs, for normal operation we should not need the samplerateconversion and just use pll_freq=fsc8 for everything. The datasheets are confusing about these settings +parm: disable_vscale:set to 1 to disable the vertical scaling. +parm: disable_hscale:set to 1 to disable the horizontal scaling. +parm: cap_raw_all:A value of 1 enables continuous raw data mode capture. You also need to set frm_size +parm: raw16: 0 = 8xFsc 8-bit data mode (Raw Data) + 1 = 4xFsc 16-bit data mode (Filtered VBI data) +parm: vbi_frame_capture_raw_mode: This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size. +parm: vbibufs:number of vbi buffers, range 2-32 +parm: vbi_debug:enable debug messages [video] +parm: audio_debug:enable debug messages [audio] +vermagic: 2.6.7-1-k7 preempt K7 gcc-3.3 +depends: cx88xx,video-buf,videodev,i2c-core,i2c-algo-bit,btcx-risc,v4l2-common,v4l1-compat +alias: pci:v000014F1d00008800sv*sd*bc*sc*i*