Developer’s Guide
www.ti.com
512
SWRU543–January 2019
Submit Documentation Feedback
Copyright © 2019, Texas Instruments Incorporated
Parallel Camera Interface Module
DMASetupTransfer(UDMA_CH22_CAMERA, UDMA_MODE_PINGPONG, <total_dma_elements>>, UDMA_SIZE_32,
UDMA_ARB_8, (void *)CAM_BUFFER_ADDR, UDMA_SRC_INC_32,
(void *)<data_buffer>,UDMA_DST_INC_32);
<data_buffer>+=<total_dma_elements>;/* Setup the buffer for pong */
DMASetupTransfer(UDMA_CH22_CAMERA|UDMA_ALT_SELECT,
UDMA_MODE_PINGPONG, <total_dma_elements>,UDMA_SIZE_32,
UDMA_ARB_8, (void *)CAM_BUFFER_ADDR,
UDMA_SRC_INC_32, (void
*)<data_buffer>,UDMA_DST_INC_32);<data_buffer> += <total_dma_elements>;/* Setup buffer for
next ping */
10. Clear and unmask the interrupts by setting BIT-8 of DMA_DONE_INT_ACK and
DMA_DONE_INT_MASK_CLR, respectively.
11. Now capture the image by using the peripheral driver API CameraCaptureStart. This function enables
the sensor interface of the camera core module.
• An interrupt is continuously generated until the capture is stopped, and the interrupt-handler
registered in this procedure handles the interrupts appropriately.
• Because the DMA is configured for ping-pong transfer, the <data_buffer> must be adjusted for the
next ping-pong transaction.
• Depending on the value set for <total_dma_elements>, a DMA-Done interrupt is generated every
time after <total_dma_elements> elements are copied to memory.
The following code snippet is for handling the camera interrupts:
void <camera_interrupt_handler>() {
/* Stop capture on receiving a frame-end */
if(CameraIntStatus(CAMERA_BASE) &CAM_INT_FE)
{
CameraIntClear(CAMERA_BASE, CAM_INT_FE);
CameraCaptureStop(CAMERA_BASE, true);
}
/* Check if ‘CAM_THRESHHOLD_DMA_DONE’ is active */
if(<write_register>(DMA_DONE_INT_STS_RAW) & (1<<8))
{
/* Clear the interrupt */
<write_register>(DMA_DONE_INT_ACK) |= 1 << 8; <total_dma_elements> += <total_dma_elements>
* <32-bits>; /* For every iteration, set either the ping or pong transactions */
if(<check condition for even iterations>)
{
DMASetupTransfer(UDMA_CH22_CAMERA, UDMA_MODE_PINGPONG,<total_dma_elements>,
UDMA_SIZE_32,
UDMA_ARB_8, (void *)CAM_BUFFER_ADDR,
UDMA_SRC_INC_32,
(void *)<data_buffer>, UDMA_DST_INC_32);
}
else(<check condition for odd iterations>) {
DMASetupTransfer(UDMA_CH22_CAMERA|UDMA_ALT_SELECT,
UDMA_MODE_PINGPONG, <total_dma_elements>,
UDMA_SIZE_32, UDMA_ARB_8, (void *)CAM_BUFFER_ADDR,
UDMA_SRC_INC_32, (void *)<data_buffer>,
UDMA_DST_INC_32);
}
/* Setup the buffer for the next ping/pong */<data_buffer> += <total_dma_elements>;
if (<on an error>)
{
/* Disable DMA and mask ‘CAM_THRESHHOLD_DMA_DONE’ */
UDMAStopTransfer(UDMA_CH22_CAMERA);<write_register>(0x44026090) |= 1 << 8;
}
}