AN2676 Freescale Semiconductor / Motorola, AN2676 Datasheet - Page 14

no-image

AN2676

Manufacturer Part Number
AN2676
Description
Image Capture with i.MX21
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Software Design
8.3 Reference Settings for PRP
Table 8 and Table 9 on page 15 show example settings for PRP with CSI input.
14
//Module init
*(uint32_t *)CRM_PCCR0 |= 0x8008000;
*(uint32_t *)EMMA_PRP_CNTL |= 0x10000;
//common control
*(uint32_t *)EMMA_PRP_CNTL = 0x0008323E;
*(uint32_t *)EMMA_PRP_CNTL |= 0x8000000;
*(uint32_t *)EMMA_PRP_RSIZE_CTRL = 0x40;
*(uint32_t *)EMMA_PRP_INTRCTRL = 0x00000000; //disable interrupt
//source control
//*(uint32_t *)EMMA_PRP_SY_PTR;
*(uint32_t *)EMMA_PRP_SPIX_FMT = 0x03080888; //YUV422 input, UYVY...
*(uint32_t *)EMMA_PRP_SFRM_SIZE = 0x028001E0;//source = 640 x 480
//*(uint32_t *)EMMA_PRP_SLIN_STRID;
//ch1 (RGB) dest control
*(uint32_t *)EMMA_PRP_DRGB1_PTR = rgb;
*(uint32_t *)EMMA_PRP_DRGB2_PTR = rgb;
*(uint32_t *)EMMA_PRP_DISIZE_CH1 = 0x00F000F0;//dest size = 240 x 240
*(uint32_t *)EMMA_PRP_DPIX_FMT = 0x2CA00565; //RGB565 output
*(uint32_t *)EMMA_PRP_DLST_CH1 = 0x000001E0; //dest line stride = 240
//ch2 (YUV) dest control
*(uint32_t *)EMMA_PRP_DY_PTR = y;
*(uint32_t *)EMMA_PRP_DCB_PTR = u;
*(uint32_t *)EMMA_PRP_DCR_PTR = v;
*(uint32_t *)EMMA_PRP_SY_PTR = y;
*(uint32_t *)EMMA_PRP_SCB_PTR = u;
*(uint32_t *)EMMA_PRP_SCR_PTR = v;
*(uint32_t *)EMMA_PRP_DISIZE_CH2 = 0x000000F0;//dest image height = 240
*(uint32_t *)EMMA_PRP_CNTL |= 0x1;
//module init
* (uint32_t *)GPIOB_GIUS &= ~0x3FFC00;
* (uint32_t *)CRM_PCCR0 |= 0x80000000;
*(uint32_t *) CSI_CSICR1 = 0x0;
*(uint32_t *) CSI_CSICR1 |= 0x0200;
//CCIR control
*(uint32_t *) CSI_CSICR1 |= 0x400;
*(uint32_t *) CSI_CSICR1 |= 0x8000000;
*(uint32_t *) CSI_CSICR1 |= 0x40000000;
//timing control
*(uint32_t *) CSI_CSICR1 |= 0x10000;
*(uint32_t *) CSI_CSICR1 |= 0x2;
//FIFO control
*(uint32_t *) CSI_CSICR1 |= 0x100;
*(uint32_t *) CSI_CSICR1 |= 0x100000;
//PRP i/f control
*(uint32_t *) CSI_CSICR1 |= 0x10000000;
Freescale Semiconductor, Inc.
For More Information On This Product,
MC9328MX21 Application Note
Code Example 4. PRP Init
Code Example 3. CSI Init
Go to: www.freescale.com
//Clock enable for PRP
//PRP reset
//LOOP mode
//matrix A1 (YUV2RGB), matrix B0 (RGB2YUV)
//YUV422 => RGB565 (ch1), YUV420 (ch2)
//CSI i/f enable
//ch1, ch2 enable
//bug fix
//MAIN ratio 2:1, CSC resize = 1:1
//source ptr : NOT used with CSI
//source line stride : NOT used with CSI
//output buf1
//output buf2
//output buf1
//output buf2 (re-used in LOOP mode)
//PRP enable
//disable GPIO PB[21..10]
//HCLK clock enable
//register clear
//MCLK = HCLK / 2
//CCIR mode enable
//CCIR interlace mode
//external VSYNC
//SOF INT enable
//latch on rising edge
//sync FIFO clear
//RXFF level = 16
//PRP i/f enable
MOTOROLA

Related parts for AN2676