int cambus_init(uint8_t reg_wid) { dvp_init(reg_wid); return 0; }
/*static*/ int __init StmLoadModule (void) { int Result; int i; DvbContext = kmalloc (sizeof (struct DvbContext_s), GFP_KERNEL); #ifdef __TDT__ memset(DvbContext, 0, sizeof*DvbContext); #endif if (DvbContext == NULL) { DVB_ERROR("Unable to allocate device memory\n"); return -ENOMEM; } #ifdef __TDT__ if (swts) printk("swts ->routing streams from dvr0 to tsm to pti to player\n"); else printk("no swts ->routing streams from dvr0 direct to the player\n"); #endif #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17) #if (DVB_API_VERSION > 3) Result = dvb_register_adapter (&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE,NULL, adapter_num); #else Result = dvb_register_adapter (&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE,NULL); #endif #else /* STLinux 2.2 kernel */ #ifdef __TDT__ Result = dvb_register_adapter (&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE,NULL); #else Result = dvb_register_adapter (&DvbContext->DvbAdapter, MODULE_NAME, THIS_MODULE); #endif #endif if (Result < 0) { DVB_ERROR("Failed to register adapter (%d)\n", Result); kfree(DvbContext); DvbContext = NULL; return -ENOMEM; } mutex_init (&(DvbContext->Lock)); mutex_lock (&(DvbContext->Lock)); /*{{{ Register devices*/ for (i = 0; i < DVB_MAX_DEVICES_PER_ADAPTER; i++) { struct DeviceContext_s* DeviceContext = &DvbContext->DeviceContext[i]; struct dvb_demux* DvbDemux = &DeviceContext->DvbDemux; struct dmxdev* DmxDevice = &DeviceContext->DmxDevice; struct dvb_device* DvrDevice; //sylvester: wenn der stream vom user kommt soll WriteToDecoder nix //tun, da das ja hier schon passiert. keine ahnung wie man das ansonsten //verhindern soll;-) DeviceContext->dvr_write = 0; DeviceContext->DvbContext = DvbContext; #if defined (USE_KERNEL_DEMUX) memset (DvbDemux, 0, sizeof (struct dvb_demux)); #ifdef __TDT__ DvbDemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING | DMX_TS_DESCRAMBLING; /* currently only dummy to avoid EINVAL error. Later we need it for second frontend ?! */ DvbDemux->dmx.set_source = SetSource; #else DvbDemux->dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING; #endif DvbDemux->priv = DeviceContext; DvbDemux->filternum = 32; DvbDemux->feednum = 32; DvbDemux->start_feed = StartFeed; DvbDemux->stop_feed = StopFeed; DvbDemux->write_to_decoder = WriteToDecoder; Result = dvb_dmx_init (DvbDemux); if (Result < 0) { DVB_ERROR ("dvb_dmx_init failed (errno = %d)\n", Result); return Result; } memset (DmxDevice, 0, sizeof (struct dmxdev)); DmxDevice->filternum = DvbDemux->filternum; DmxDevice->demux = &DvbDemux->dmx; DmxDevice->capabilities = 0; Result = dvb_dmxdev_init (DmxDevice, &DvbContext->DvbAdapter); if (Result < 0) { DVB_ERROR("dvb_dmxdev_init failed (errno = %d)\n", Result); dvb_dmx_release (DvbDemux); return Result; } DvrDevice = DvrInit (DmxDevice->dvr_dvbdev->fops); /* Unregister the built-in dvr device and replace it with our own version */ #ifdef __TDT__ printk("%d: DeviceContext %p, DvbDemux %p, DmxDevice %p\n", i, DeviceContext, DvbDemux, DmxDevice); #endif dvb_unregister_device (DmxDevice->dvr_dvbdev); dvb_register_device (&DvbContext->DvbAdapter, &DmxDevice->dvr_dvbdev, DvrDevice, DmxDevice, DVB_DEVICE_DVR); DeviceContext->MemoryFrontend.source = DMX_MEMORY_FE; Result = DvbDemux->dmx.add_frontend (&DvbDemux->dmx, &DeviceContext->MemoryFrontend); if (Result < 0) { DVB_ERROR ("add_frontend failed (errno = %d)\n", Result); dvb_dmxdev_release (DmxDevice); dvb_dmx_release (DvbDemux); return Result; } #else dvb_register_device (&DvbContext->DvbAdapter, &DeviceContext->DemuxDevice, DemuxInit (DeviceContext), DeviceContext, DVB_DEVICE_DEMUX); dvb_register_device (&DvbContext->DvbAdapter, &DeviceContext->DvrDevice, DvrInit (DeviceContext), DeviceContext, DVB_DEVICE_DVR); #endif dvb_register_device (&DvbContext->DvbAdapter, &DeviceContext->AudioDevice, AudioInit (DeviceContext), DeviceContext, DVB_DEVICE_AUDIO); /* register the CA device (e.g. CIMAX) */ #ifdef __TDT__ if(i < 2) #endif #ifndef VIP2_V1 dvb_register_device (&DvbContext->DvbAdapter, &DeviceContext->CaDevice, CaInit (DeviceContext), DeviceContext, DVB_DEVICE_CA); #endif dvb_register_device (&DvbContext->DvbAdapter, &DeviceContext->VideoDevice, VideoInit (DeviceContext), DeviceContext, DVB_DEVICE_VIDEO); DeviceContext->Id = i; DeviceContext->DemuxContext = DeviceContext; /* wire directly to own demux by default */ DeviceContext->SyncContext = DeviceContext; /* we are our own sync group by default */ DeviceContext->Playback = NULL; DeviceContext->StreamType = STREAM_TYPE_TRANSPORT; DeviceContext->DvbContext = DvbContext; DeviceContext->DemuxStream = NULL; DeviceContext->VideoStream = NULL; DeviceContext->AudioStream = NULL; DeviceContext->PlaySpeed = DVB_SPEED_NORMAL_PLAY; DeviceContext->PlayInterval.start = DVB_TIME_NOT_BOUNDED; DeviceContext->PlayInterval.end = DVB_TIME_NOT_BOUNDED; DeviceContext->dvr_in = kmalloc(65536,GFP_KERNEL); // 128Kbytes is quite a lot per device. DeviceContext->dvr_out = kmalloc(65536,GFP_KERNEL); // However allocating on each write is expensive. DeviceContext->EncryptionOn = 0; #ifdef __TDT__ DeviceContext->VideoPlaySpeed = DVB_SPEED_NORMAL_PLAY; DeviceContext->provideToDecoder = 0; DeviceContext->feedPesType = 0; mutex_init(&DeviceContext->injectMutex); if(i < 3) { ptiInit(DeviceContext); } if(i < 1) { init_e2_proc(DeviceContext); } #endif } /*}}} */ mutex_unlock (&(DvbContext->Lock)); BackendInit (); #ifndef __TDT__ dvp_init(); #endif linuxdvb_v4l2_init(); DVB_DEBUG("STM stream device loaded\n"); return 0; }