Re: dib0700 and analog broadcasting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I already discussed this dibcom + analog with Michael and Pattrick and I ended with the conclusion that was better to wait a little for Michael (or somebody) integrate the standard stuff with the dvb-usb api. Seeing there's more people interested that what we thought initialy I just send the answer from Pattrick which give good guides on the dibcom stuff. I'm not going to start anything, as I said I think is better to wait a little.

Albert

Here's Pattrick answer for the interested (again thanks for your kind help);

Analog and DiBCom, *sigh*, it works, but it is a baby nobody really wants.
OK, let me tell you, what I had once in mind: The analog and DVB hardware abstraction in the driver is signifacantly different. That's why it was possible for me to create something like dvb-usb, but not so easy to have something like v4l-usb, which abstracts the streaming and other common things.
Mainly the frontend-architecture is it, which makes DVB more powerful that v4l hardware abstraction. But OK.
If there would be a generic streaming mechanism which works similar to the one in dvb-usb, I think it would be relatively easy to add analog-support for dvb-usb or to add a analog-support to a dvb-usb-based device (function pointer which is called each time a URB is returned instead of directly passing it to the dvb-demuxer).
For the dib0700-driver you need some things to set up in order to receive analog audio and video (see attached):
First you need to configure the streaming interface on the dib0700-usb-bridge. This is done with a USB request from the host and depends on the video format.
Then the streaming needs to be enabled in a different way then in DVB.
That's it. If I understand everything correctly, there are no special settings for the cx2584x, but time will tell. Also it is important to know, that the audio is coming in on endpoint3 and the video on endpoint2, which might give some AV async.

Patrick.

2008/8/21 Michael Krufky <mkrufky@xxxxxxxxxxx>
On Thu, Aug 21, 2008 at 4:25 PM, Devin Heitmueller
<devin.heitmueller@xxxxxxxxx> wrote:
> On Thu, Aug 21, 2008 at 4:21 PM, Michael Krufky <mkrufky@xxxxxxxxxxx> wrote:
>> On Thu, Aug 21, 2008 at 4:13 PM, gothic nafik <nafik@xxxxxxxx> wrote:
>>> One more question - what about radio and remote control via lirc? Can i
>>> receive radio signal via antenna (for digital tv) i got in box with
>>> notebook? Is today's version of dib0700 module able to create /dev/radio?
>>
>> The driver supports IR, but does not require LIRC, afaik -- try it
>> yourself and find out if your device is supported.
>>
>> Radio is analog, thus, not supported by this driver.
>
> FWIW:  Working on CX25843 analog support for the dib0700 based
> Pinnnacle PCTV HD Pro was next on my list once I get the ATSC support
> working.

Devin,

Lets sync up when you get to that point -- I have a good chunk of code
written that will add analog support to the dvb-usb framework as an
optional additional adapter type.

Hopefully I'll get more work done on it before then, but if not, this
is at least a good starting point.

The idea is to add support to the framework so that the sub-drivers
(such as dib0700, cxusb et al) can all use the common code.

CX25843 is already supported, just the dvb-usb framework currently
lacks a v4l2 interface.

Regards,

Mike

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

// First byte data received on Endpoint 0 (control byte)
enum TYPE_USB_REQUEST
{
	REQUEST_UNUSED_0 = 0,
	REQUEST_DOWNLOAD,
	REQUEST_I2C_READ,
	REQUEST_I2C_WRITE,
	REQUEST_POLL_RC,
	REQUEST_DISCONNECT,
	REQUEST_GET_GPIO,
	REQUEST_SET_IOCTL,
	REQUEST_JUMPRAM,
	REQUEST_AHB_READ,
	REQUEST_AHB_WRITE,
	REQUEST_SET_CLOCK,
	REQUEST_SET_GPIO,
	REQUEST_SET_PWM,
	REQUEST_SET_ANA_MODE,
	REQUEST_ENABLE_VIDEO,
	REQUEST_SET_I2C_PARAM,
	REQUEST_SET_RC,
	REQUEST_NEW_I2C_READ,
	REQUEST_NEW_I2C_WRITE,
	REQUEST_SET_SUSP_PARAM,
	REQUEST_GET_VERSION,
	REQUEST_SRAM_READ_SMALL,
	REQUEST_SRAM_READ_BIG,
	REQUEST_SRAM_WRITE,
	REQUEST_MAX
};

static int dib0700_set_streaming(struct dibBusAdapter *ctrl, struct dibStreamingRequest *request)
{
	struct dib0700_state *state = ctrl->priv;
	uint8_t mode = 0, sub_mode;
	uint8_t ch1_en;
	uint8_t ch2_en;

	if (state->sram_sdio_active) /* in case of SRAM enabled don't do any set_streaming request */
		return DIB_RETURN_SUCCESS;

	if (request->mode & MODE_DIGITAL)
		mode = 0;
	else if (request->mode & MODE_ANALOG)
		mode = 1;
	else if (request->mode & MODE_ANALOG_ADC)
		mode = 2;

	if (request->video_standard == AnalogVideo_None)
		request->video_standard = state->current_standard;
	else
		state->current_standard = request->video_standard;

	if ((mode == 1 && (request->video_standard & AnalogVideo_NTSC_Mask) != 0))
		sub_mode = 0x00;   // (0x01 << 4) == Ntsc mode, 0x01 == channel enabled
	else
		sub_mode = 0x01;   // (0x01 << 4) == Pal mode, 0x01 == channel enabled

	dbgpl(&dib0700_dbg, "modifying (%d) streaming state for %d", request->onoff, request->id);

	if (request->id == 0)
        ch1_en = request->onoff;
	else
        ch1_en = !request->onoff;
    ch2_en = !ch1_en;

	return dib0700_video_enable(state, request->onoff, mode, sub_mode, ch1_en, ch2_en);
}

static int dib0700_set_scaling(struct dibBusAdapter* ctrl, struct dibVideoConfig * video_config, struct dibVideoTransitions * video_transitions)
{
	struct dib0700_state *state = ctrl->priv;

	uint8_t b[21];

	//For now, we get the nb of the line in the SAV and always get VBI informations
	b[ 0] = (((video_config->Standard == 625)?1:0)<<7) | (1<<6) | (1<<5) | (1<<4);
	// bit shifted by 6 = SAV enable
	// bit shifted by 5 = VBI is present
	// bit shifted by 4 = insertion of line Number

	b[ 1] = (uint8_t)(video_config->HwVideoLineSize+4)&0xff;
	b[ 2] = (uint8_t)((video_config->HwVideoLineSize+4)>>8)&0xff;

	b[ 3] = (uint8_t)(video_config->HwVbiLineSize+4)&0xff;
	b[ 4] = (uint8_t)((video_config->HwVbiLineSize+4)>>8)&0xff;

	b[ 5] = (uint8_t)state->desc->urb_max_size&0xff;
	b[ 6] = (uint8_t)(state->desc->urb_max_size>>8)&0xff;

	b[ 7] = (uint8_t)video_transitions->StartOfOddField&0xff;
	b[ 8] = (uint8_t)(video_transitions->StartOfOddField>>8)&0xff;
	b[ 9] = (uint8_t)video_transitions->StartOfEvenField&0xff;
	b[10] = (uint8_t)(video_transitions->StartOfEvenField>>8)&0xff;

	b[11] = (uint8_t)video_transitions->StartOfActiveOdd&0xff;
	b[12] = (uint8_t)(video_transitions->StartOfActiveOdd>>8)&0xff;
	b[13] = (uint8_t)video_transitions->EndOfActiveOdd&0xff;
	b[14] = (uint8_t)(video_transitions->EndOfActiveOdd>>8)&0xff;

	b[15] = (uint8_t)video_transitions->StartOfActiveEven&0xff;
	b[16] = (uint8_t)(video_transitions->StartOfActiveEven>>8)&0xff;
	b[17] = (uint8_t)video_transitions->EndOfActiveEven&0xff;
	b[18] = (uint8_t)(video_transitions->EndOfActiveEven>>8)&0xff;


	b[19] = ((uint8_t)video_transitions->TotalNumberOfLines)&0xff;
	b[20] = ((uint8_t)(video_transitions->TotalNumberOfLines>>8))&0xff;

	dbgpl(&dib0700_dbg, "data for scaling: %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x %2x",b[0],b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20]);

	return dib0700_ctrl_write(state, REQUEST_SET_ANA_MODE, b, 21);
}

/* and the calls to set_scaling */

static void setup_hook_analog_video_config(struct dibBoard *board, int num_of_lines, int use_hook_line_numbering)
{
	struct dibVideoConfig      cfg;
	struct dibVideoTransitions trans;
	struct dibVideoFraming     framing;
	uint16_t num_active_lines;

	if (num_of_lines != 525 && num_of_lines != 625)
		return;

	/* TODO correct for scaling */
	num_active_lines = num_of_lines == 525 ? 480 : 576;

	cfg.HwVideoLineSize = 1440;
	cfg.HwNbActiveLines = num_active_lines;
	cfg.HwVbiLineSize   = 1440;
	cfg.Standard        = num_of_lines;

	if (num_of_lines == 525) {
		uint32_t NbRealActiveLines;
		debug_printf("-D-  NTSC\n");
		if (cfg.HwNbActiveLines == 480)
			NbRealActiveLines = 487;
		else
			NbRealActiveLines = 243;

		trans.StartOfOddField    = 4;
		trans.StartOfActiveOdd   = 21;
		trans.EndOfActiveOdd     = trans.StartOfActiveOdd + NbRealActiveLines/2; //265
		trans.StartOfEvenField   = trans.EndOfActiveOdd + 2; //266
		trans.StartOfActiveEven  = trans.StartOfEvenField + 18; //283
		trans.EndOfActiveEven    = trans.StartOfActiveEven + NbRealActiveLines/2; //525
		trans.TotalNumberOfLines = trans.EndOfActiveEven; //525

		framing.VbiLines    = 12;
		framing.VbiF0Start  = 9;
		framing.VbiF0Stop   = 20;
		framing.VbiF1Start  = trans.StartOfEvenField + 5;//273;
		framing.VbiF1Stop   = framing.VbiF1Start +11;//284;

		framing.VideoF0Start= trans.StartOfActiveOdd;
		framing.VideoF0Stop = framing.VideoF0Start + num_active_lines/2-1; //261      // 240 lines (261 included)
		framing.VideoF1Start= trans.StartOfActiveEven;//285;
		framing.VideoF1Stop = framing.VideoF1Start + num_active_lines/2 -1 ;//524;

	} else {
		debug_printf("-D-  PAL/SECAM\n");
#if 01
		trans.StartOfOddField    = 1;
		trans.StartOfActiveOdd   = 23;
		trans.EndOfActiveOdd     = trans.StartOfActiveOdd + num_active_lines/2; //311
		trans.StartOfEvenField   = trans.EndOfActiveOdd + 2; //312
		trans.StartOfActiveEven  = trans.StartOfEvenField + 23; //335
		trans.EndOfActiveEven    = trans.StartOfActiveEven + num_active_lines/2; //623
		trans.TotalNumberOfLines = trans.EndOfActiveEven + 2; //625

#else
		trans.StartOfOddField    = 1;
		trans.StartOfActiveOdd   = 100;
		trans.EndOfActiveOdd     = 400;//trans.StartOfActiveOdd + num_active_lines/2; //311
		trans.StartOfEvenField   = 500; //trans.EndOfActiveOdd + 2; //312
		trans.StartOfActiveEven  = 600; //trans.StartOfEvenField + 23; //335
		trans.EndOfActiveEven    = 900; //trans.StartOfActiveEven + num_active_lines/2; //623
		trans.TotalNumberOfLines = 1000; //625
#endif

		framing.VbiLines    = 17;
		framing.VbiF0Start  = 6;
		framing.VbiF0Stop   = 22;
		framing.VideoF0Start= trans.StartOfActiveOdd ;       // Clip first 1/2 line
		framing.VideoF0Stop = trans.EndOfActiveOdd -1; //310
		framing.VbiF1Start  = trans.StartOfEvenField + 6; //319
		framing.VbiF1Stop   = framing.VbiF1Start + 16; //335
		framing.VideoF1Start= trans.StartOfActiveEven; //336
		framing.VideoF1Stop = trans.EndOfActiveEven-1; //623
	}
	debug_printf("-D-  Framing:    %d, %d, %d, %d, %d, %d, %d, %d, %d\n", framing.VbiLines,framing.VbiF0Start ,framing.VbiF0Stop,
		framing.VideoF0Start,framing.VideoF0Stop ,framing.VbiF1Start  ,framing.VbiF1Stop ,framing.VideoF1Start,framing.VideoF1Stop);
	debug_printf("-D-  Transition: %d, %d, %d, %d, %d, %d, %d\n", trans.StartOfOddField, trans.StartOfEvenField, trans.StartOfActiveOdd,
		trans.EndOfActiveOdd, trans.StartOfActiveEven, trans.EndOfActiveEven, trans.TotalNumberOfLines);
	debug_printf("-D-  Config:     %d, %d, %d, %d\n", cfg.HwVbiLineSize, cfg.HwVideoLineSize, cfg.HwNbActiveLines, cfg.Standard);

	board_set_scaling(board, &cfg, &trans);
}

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux