2008-09-05 22:04:19 PPI and DMA problem
Matthew Wang (CHINA)
Message: 61719
I am writing an av camera driver, there are an av camera sensor, TVP5150AM1 decoder and BF537 on my board
I make PPI and DMA enabled, it should generate an interrupt request, and DMA_IRQ_STATUS should be set, however it didn't work!!!
so when I writing a camera driver , HOW should I do to make PPI receive a frame data, and generate an interrupt , then DMA transfer the captured data from PPI to SDRAM
here is my register value:
TVP5150AM1:
REG: 03h register ---TVP5150AM1 Miscellaneous Control Register
VALUE: 0x09
DMA0_PERIPHERAL_MAP:
/*
* DMA0_PERIPHERAL_MAP
* PMAP[3:0]: PPI
* CTYPE: Peripheral DMA
*/
cd->ppiDev.dma_peripheral_map = 0x0;
DMA0_CONFIG:
/*
* DMA0_CONFIG
* FLOW[2:0]: autobuffer mode
* NDSIZE[3:0]: Required if in stop or autobuffer mode
* DI_EN: allow completion of work unit to generate a data interrupt
* DI_SEL: interrupt after completing each row(inner loop)
* SYNC: continuous transition
* DMA2D: two-dimensional
* WDSIZE[1:0]: 8-bit transfers
* WNR: DAM is a memory write(destination) operation
* DMAEN: disable DMA channel
*/
cd->ppiDev.dma_config = 0x1096;
DMA0_START_ADDR,DMA0_X_COUNT,DMA0_X_MODIFY and so on:
dmaBuffer = kmalloc( ( cd->videoV4l1.videoCap.maxwidth * cd->videoV4l1.videoCap.maxheight*4 ),
GFP_KERNEL );
cd->ppiDev.dma_start_addr = dmaBuffer;
cd->ppiDev.dma_x_count = 352;
cd->ppiDev.dma_x_modify = 2;
cd->ppiDev.dma_y_count = 288;
cd->ppiDev.dma_y_modify = 2;
PORT_MUX:
/*
* PORT_MUX
* PGTE: enable PPI D13, PPI D14, PPI D15
* PGRE: enable PPI D10, PPI D11, PPI D12
* PGSE: enable PPI D8, PPI D9
* PFFE: enable PPI frame sync 3
*/
cd->ppiDev.port_mux = PGTE_PPI | PGRE_PPI | PGSE_PPI | PFFE_PPI; //0x0100
cd->ppiDev.portF_fer = VALUE_PPI_CLK | VALUE_PPI_FS1 | VALUE_PPI_FS2 | VALUE_PPI_FS3; //0x8380
cd->ppiDev.portG_fer = VALUE_PPI_D0TOD15; //0xFF
PPI_CONTROL:
/*
* PPI_CONTROL
* POLS: PPI_FS1 and PPI_FS2 are treated as rising edge
* POLC: PPI samples data on rising edge and drives data on falling edge of PPI_CLK
* DLEN[2:0]: 8 bits
* SKIP_EN: in ITU-R 656 and GP input modes, skipping disabled
* PACK_EN: (packing mode) disabled
* FLD_SEL: (active field select) in ITU-R 656 modes, when XFR_TYPE = 00, fields 1 and 2
* PORT_CFG[1:0]: not used
* XFR_TYPE[1:0]: in input mode, ITU-R 656, active field only
* PORT_DIR: PPI in receive mode(input)
* PORT_EN: PPI disabled
*/
//cd->ppiDev->ppi_control = FLD_SEL | DLEN_8; //0x0040
cd->ppiDev.ppi_control = 0x00C0;
cd->ppiDev.ppi_frame = 288;
cd->ppiDev.ppi_count = 351;
ANY HELP WILL BE APPRECIATED!
TranslateQuoteReplyEditDelete
2008-09-05 22:21:30 Re: PPI and DMA problem
Mike Frysinger (UNITED STATES)
Message: 61720
there are a bunch of camera drivers that use PPI and DMA already in the distribution which you can review ... there is also some documentation on the V4L interface in the documentation wiki
QuoteReplyEditDelete
2008-09-06 04:21:26 Re: PPI and DMA problem
yaqin yu (AFGHANISTAN)
Message: 61745
hello!Mike Frysinger.
I use the same hardware with Matthew Wang.I configured the ppi and dma,but I can't get the capture data.I think maybe I understand the dma wrong.I config the dma and ppi with interrupt after one frame completed .when begint to capture, open the dam and ppi, it will transmit the data to buffer pointed by the dma_start_addr,which is configured in dma_start_addr register.After a frame is transmited,a interrupt occure.In the interrupt routine,
diable the ppi and dma,then it can't capture. then I read the data in the buffer ,but it is null. Am I right? Thanks!
TranslateQuoteReplyEditDelete
2008-09-07 11:32:37 Re: PPI and DMA problem
renjith kumar (INDIA)
Message: 61758
hi all,
I find, this is a common problem that all the people struggle with initilly at starting phase of their project.
if someone could suggest the Best PPI-DMA configuration that gives the fastest throoughput in PPI ports,
it would be a great helping hand for All of us.
Please suggest if any alternative for DMA-PPI combination.
Is this the Only method to achieve this ???
Thanks and
Regards,
ren.
QuoteReplyEditDelete
2008-09-07 15:24:57 Re: PPI and DMA problem
Mike Frysinger (UNITED STATES)
Message: 61762
there is no magical setting combination that will work best in all hardware/software configurations
we provide example drivers that work for cameras and framebuffers (lcds/etc...) which you can consult