From: <ad...@us...> - 2003-03-17 18:03:51
|
Update of /cvsroot/bdadev/NovaTDriver In directory sc8-pr-cvs1:/tmp/cvs-serv15298 Modified Files: driver.cpp l64781.cpp saa7146.cpp saa7146.h Log Message: Updated stream handling Index: driver.cpp =================================================================== RCS file: /cvsroot/bdadev/NovaTDriver/driver.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** driver.cpp 6 Mar 2003 17:48:43 -0000 1.6 --- driver.cpp 17 Mar 2003 18:03:47 -0000 1.7 *************** *** 304,308 **** NTSTATUS OutputProcess(IN PKSPIN Pin) { ! return STATUS_SUCCESS; } --- 304,308 ---- NTSTATUS OutputProcess(IN PKSPIN Pin) { ! return SAA7134_OutputProcess(Pin); } *************** *** 535,538 **** --- 535,541 ---- /*****************************************************************************\ * $Log$ + * Revision 1.7 2003/03/17 18:03:47 adcockj + * Updated stream handling + * * Revision 1.6 2003/03/06 17:48:43 adcockj * Added TPS change monitoring thread Index: l64781.cpp =================================================================== RCS file: /cvsroot/bdadev/NovaTDriver/l64781.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** l64781.cpp 10 Mar 2003 18:36:22 -0000 1.8 --- l64781.cpp 17 Mar 2003 18:03:47 -0000 1.9 *************** *** 201,209 **** // this is accurate and should work for any ppm ! qwSPIBias=(__int64)(1512 * fec_tab[hp_coderate] * qam_tab[constellation]); ! qwSPIBias*=(__int64)((1<<10) * 32 * bandwidth); ! qwSPIBias*=(__int64)1000000; ! qwSPIBias/=(__int64)((fec_tab[hp_coderate] + 1) * (guard_tab[guardinterval]+32)); ! qwSPIBias/=(__int64)(8 * (1000000 + ppm)); spi_bias = (unsigned __int32)qwSPIBias; --- 201,209 ---- // this is accurate and should work for any ppm ! qwSPIBias=(unsigned __int64)(1512 * fec_tab[hp_coderate] * qam_tab[constellation]); ! qwSPIBias*=(unsigned __int64)((1<<10) * 32 * bandwidth); ! qwSPIBias*=(unsigned __int64)1000000; ! qwSPIBias/=(unsigned __int64)((fec_tab[hp_coderate] + 1) * (guard_tab[guardinterval]+32)); ! qwSPIBias/=(unsigned __int64)(8 * (1000000 + ppm)); spi_bias = (unsigned __int32)qwSPIBias; *************** *** 349,352 **** --- 349,353 ---- qwInitFreq/=(unsigned __int64)(p_bandwidth*1000000); init_freq=(unsigned __int32)qwInitFreq; + // From Linux source - This works up to 20000 ppm, it overflows if too large ppm! //init_freq=(((8UL<<24)+(8UL<<19)/25*ppm/(15625/25))/p_bandwidth&0xFFFFFF); *************** *** 413,416 **** --- 414,420 ---- /*****************************************************************************\ * $Log$ + * Revision 1.9 2003/03/17 18:03:47 adcockj + * Updated stream handling + * * Revision 1.8 2003/03/10 18:36:22 adcockj * Changes to ties up to chip spec more closely Index: saa7146.cpp =================================================================== RCS file: /cvsroot/bdadev/NovaTDriver/saa7146.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** saa7146.cpp 7 Mar 2003 08:04:15 -0000 1.6 --- saa7146.cpp 17 Mar 2003 18:03:47 -0000 1.7 *************** *** 125,139 **** void SAA7146_Interrupt_FIDB(PKSDEVICE device) { - // Time to send some frames out - int table_start,table_offset; - - // Find out start address of memory to be sent - if(GETCONTEXT(device)->switcher) { - table_start=((TS_HEIGHT*TS_WIDTH)/2)/0x1000; - table_offset=((TS_HEIGHT*TS_WIDTH)/2)%0x1000; - } else { - table_start=0; - table_offset=0; - } // Tell chip which half isn't being used GETCONTEXT(device)->switcher^=1; --- 125,128 ---- *************** *** 142,146 **** // Queue DPC call to be run when kernel IRQL gets better if((GETCONTEXT(device)->cur_state==KSSTATE_RUN)/*&&(((unsigned char**)GETCONTEXT(device)->dma_pages)[table_start][table_offset]==0x47)*/) ! if(!KeInsertQueueDpc(&GETCONTEXT(device)->dpc,(LPVOID)table_start,(LPVOID)table_offset)) GETCONTEXT(device)->lost_error++; } --- 131,135 ---- // Queue DPC call to be run when kernel IRQL gets better if((GETCONTEXT(device)->cur_state==KSSTATE_RUN)/*&&(((unsigned char**)GETCONTEXT(device)->dma_pages)[table_start][table_offset]==0x47)*/) ! if(!KeInsertQueueDpc(&GETCONTEXT(device)->dpc,(LPVOID)0,(LPVOID)0)) GETCONTEXT(device)->lost_error++; } *************** *** 149,152 **** --- 138,151 ---- void SAA7146_DPCRoutine(PKDPC Dpc,PVOID DeferredContext,PVOID SystemArgument1,PVOID SystemArgument2) { + PKSDEVICE device; + + device=(PKSDEVICE)DeferredContext; + + // get the framework to call our output pin's process + // function but not asynchronously as we need to clear out the + // data before the next batch overwrites it + KsPinAttemptProcessing(GETCONTEXT(device)->pin_out, FALSE); + return; + // DeferredContext == PKSDEVICE device // SystemArgument1 == int table_start *************** *** 179,184 **** } */ ! NTSTATUS result; ! PKSDEVICE device; unsigned char *packet; PKSSTREAM_POINTER stream_pointer; --- 178,183 ---- } */ ! //NTSTATUS result; ! //PKSDEVICE device; unsigned char *packet; PKSSTREAM_POINTER stream_pointer; *************** *** 216,219 **** --- 215,263 ---- } + NTSTATUS SAA7134_OutputProcess(IN PKSPIN Pin) + { + // Time to send some frames out + unsigned char *packet; + int page,offset; + int size,copy,outsize; + PKSSTREAM_POINTER stream_pointer; + + PKSDEVICE device = KsPinGetDevice(Pin); + + // Find out start address of memory to be sent + if(GETCONTEXT(device)->switcher) { + page=0; + offset=0; + } else { + page=((TS_HEIGHT*TS_WIDTH)/2)/0x1000; + offset=((TS_HEIGHT*TS_WIDTH)/2)%0x1000; + } + + stream_pointer=KsPinGetLeadingEdgeStreamPointer(GETCONTEXT(device)->pin_out,KSSTREAM_POINTER_STATE_LOCKED); + if(stream_pointer!=NULL) { + packet=stream_pointer->OffsetOut.Data; + size=0; + while(size<(TRANSPORT_PACKET_SIZE*TRANSPORT_PACKET_COUNT)) { + copy=SAA7146_PAGE_SIZE-offset; + if(copy>((TRANSPORT_PACKET_SIZE*TRANSPORT_PACKET_COUNT)-size)) copy=(TRANSPORT_PACKET_SIZE*TRANSPORT_PACKET_COUNT)-size; + RtlCopyMemory(packet+size,((unsigned char*)(GETCONTEXT(device)->dma_pages[page]))+offset,copy); + size+=copy; + offset+=copy; + if(offset==SAA7146_PAGE_SIZE) { + page++; + offset=0; + } + } + + KsStreamPointerAdvanceOffsetsAndUnlock(stream_pointer,0,TRANSPORT_PACKET_SIZE*TRANSPORT_PACKET_COUNT,FALSE); + GETCONTEXT(device)->counter++; + return STATUS_SUCCESS; + } + else { + return STATUS_PENDING; + } + } + + // I2C functions *************** *** 372,375 **** --- 416,422 ---- /*****************************************************************************\ * $Log$ + * Revision 1.7 2003/03/17 18:03:47 adcockj + * Updated stream handling + * * Revision 1.6 2003/03/07 08:04:15 adcockj * Temp remove monitoring thread Index: saa7146.h =================================================================== RCS file: /cvsroot/bdadev/NovaTDriver/saa7146.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** saa7146.h 17 Feb 2003 11:07:12 -0000 1.2 --- saa7146.h 17 Mar 2003 18:03:47 -0000 1.3 *************** *** 18,21 **** --- 18,24 ---- void SAA7146_DPCRoutine(PKDPC Dpc,PVOID DeferredContext,PVOID SystemArgument1,PVOID SystemArgument2); + // actually copy the information to the stream + NTSTATUS SAA7134_OutputProcess(IN PKSPIN Pin); + // Control DMA from the demodulator input on the SAA7146 NTSTATUS SAA7146_StartStream(PKSDEVICE device); |