void main() { CSL_TmrRegsOvly timer0Regs = (CSL_TmrRegsOvly)CSL_TMR_0_REGS; printf("Starting %s example.\r\n",exampleName); // Make sure PRU is first disabled/reset PRU_disable(); printf("\tINFO: Loading example.\r\n"); PRU_load(PRU_NUM, (Uint32*)PRU_Code, (sizeof(PRU_Code)/sizeof(Uint32))); printf("\tINFO: Initializing example.\r\n"); // Configure Timer0 LOCAL_exampleInit(PRU_NUM); printf("\tINFO: Executing example.\r\n"); PRU_run(PRU_NUM); // Give PRU some time UTIL_waitLoop(0x100); // Enable Timer0 in one-shot mode timer0Regs->TCR = 0x00000040; // Wait for the PRU to call the HALT command if (PRU_waitForHalt(PRU_NUM,-1) == E_PASS) { printf("\tINFO: PRU halted successfully.\r\n"); } else { printf("\tINFO: PRU halt failed.\r\n"); } // Check to see if the example produced desired result if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Example executed succesfully.\r\n"); } else { printf("Example failed.\r\n"); } }
void main() { printf("Starting %s example.\r\n",exampleName); // Make sure PRU is first disabled/reset PRU_disable(); // Enable and load the code to the specified pru printf("\tINFO: Loading example.\r\n"); PRU_load(PRU_NUM, (Uint32*)PRU_Code, (sizeof(PRU_Code)/sizeof(Uint32))); printf("\tINFO: Initializing example.\r\n"); LOCAL_exampleInit(PRU_NUM); printf("\tINFO: Executing example.\r\n"); PRU_run(PRU_NUM); // Wait for EDMA CC0 interrupt. while ( !edmaIntReceived ); printf("\tINFO: EDMA interrupt received.\r\n"); // Wait for the PRU to call the HALT command if (PRU_waitForHalt(PRU_NUM,-1) == E_PASS) { printf("\tINFO: PRU halted successfully.\r\n"); } else { printf("\tINFO: PRU halt failed.\r\n"); } // Check if the example executed successfully if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Example completed successfully."); } else { printf("Example failed."); } // Disable the PRUSS when done PRU_disable(); }
Int32 main (void) { printf("Starting PRU %s example.\r\n",exampleName); // Make sure PRU sub system is first disabled/reset PRU_disable(); // Enable and load the code to the specified pru printf("\tINFO: Loading example.\r\n"); PRU_load(PRU_NUM, (Uint32*)PRU_Code, (sizeof(PRU_Code)/sizeof(int))); printf("\tINFO: Initializing example.\r\n"); LOCAL_exampleInit(PRU_NUM); printf("\tINFO: Executing example.\r\n"); PRU_run(PRU_NUM); // Wait for the PRU to call the HALT command if (PRU_waitForHalt(PRU_NUM,-1) == E_PASS) { printf("\tINFO: PRU halted successfully.\r\n"); } else { printf("\tINFO: PRU halt failed.\r\n"); } if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Example completed successfully."); } else { printf("Example failed."); } // Disable the PRUSS when done PRU_disable(); return 0; }
void init_ColorVision(void) { // initialize ov6620 cmos camera i2cdata[0] = 0x01; i2cdata[1] = 0x8F; // Blue Gain control (default 0x80) i2cdata[2] = 0x8F; // Red Gain Control i2cdata[3] = 0x80; // Saturation i2cdata[4] = 0x00; // Reserved i2cdata[5] = 0x4f; // Contrast i2cdata[6] = 0x9f; // Brightness i2cdata[7] = 0xCF; // Sharpness (default 0xC6) i2cdata[8] = 0x00; // Reserved i2cdata[9] = 0x00; // Reserved i2cdata[10] = 0x00; // Reserved i2cdata[11] = 0x00; // Reserved i2cdata[12] = 0x20; // AWB - Blue i2cdata[13] = 0x20; // AWB - Red i2cdata[14] = 0x0D; // COMR i2cdata[15] = 0x05; // COMS i2cdata[16] = 0x9A; // AEC i2cdata[17] = 0x01; // CLKRC i2cdata[18] = 0x28; // COMA i2cdata[19] = 0x01; // 0x01; // COMB I2C_write(I2C0, 0x60, i2cdata, 20, SET_STOP_BIT_AFTER_WRITE); i2cdata[0] = 0x20; i2cdata[1] = 0x01; // COME I2C_write(I2C0, 0x60, i2cdata, 2, SET_STOP_BIT_AFTER_WRITE); i2cdata[0] = 0x28; i2cdata[1] = 0x81; // COMH I2C_write(I2C0, 0x60, i2cdata, 2, SET_STOP_BIT_AFTER_WRITE); i2cdata[0] = 0x39; // changed to PCLK always on. i2cdata[1] = 0x00; //0x40; // COML I2C_write(I2C0, 0x60, i2cdata, 2, SET_STOP_BIT_AFTER_WRITE); VPIF_initReceive(VIDEO_CONN_CAMERA); // PRU setup EVMOMAPL138_lpscTransition(PSC0, DOMAIN0, LPSC_DMAX, PSC_ENABLE); PRU_stop(PRU0); PRU_reset(PRU0); PRU_load(PRU0_PROG, PRUCode, sizeof(PRUCode)/sizeof(uint32_t)); PRU_reset(PRU0); PRU_run(PRU0); // VPIF (95) interrupt serviced by INT4 ICR = 0x010; // clear pending interrupts IER |= 0x010; // enable interrupt on line // PRU (6) interrupt serviced by INT6 ICR = 0x040; // clear pending interrupts IER |= 0x040; // enable interrupt on line pic_data = (int *)ADDR_VIDEO_DATA_BASE; Image_data = (bgr *)(IMAGE_DATA_MEM); Thres_Image = (unsigned char *)(THRES_IMAGE_MEM); Linux_Image = (bgr *)(ADDR_VIDEO_DATA_BASE+LINUX_IMAGE_OFFSET); LCD_Image = (bgr *)(ADDR_VIDEO_DATA_BASE+LCD_IMAGE_OFFSET); ptrshrdmem = (sharedmemstruct *)SHARED_MEM; while (CHKBIT(VPIF->INTSTAT,INT_FRAME_CH1) == 0) {} SETBIT(VPIF->INTSTATCLR, INT_FRAME_CH1); }