int main(void) { /** * Initialize managed drivers and/or services that have been added to * the project. * @return zero on success */ adi_initComponents(); /* Begin adding your custom code here */ return 0; }
int main(void) { /** * Initialize managed drivers and/or services that have been added to * the project. * @return zero on success */ adi_initComponents(); /** * The default startup code does not include any functionality to allow * core 0 to enable core 1. A convenient way to enable core 1 is to use the * 'adi_core_1_enable' function. */ /* Begin adding your custom code here */ *pREG_PORTG_DIR|=0x8000; *pREG_PORTG_DIR|=0x4000; *pTCNTL = 1; /* Turn on timer, TMPWR */ *pTSCALE = 0; /* Load scale */ *pTCOUNT = 500000;//200000; /* Load counter */ *pTPERIOD = 500000;//200000; /* Load counter into period as well */ UART::init(); adi_rtl_register_dispatched_handler(ADI_RTL_CORE_IID(INT_TMR), OS::system_timer_isr, NULL); adi_rtl_activate_dispatched_handler(ADI_RTL_CORE_IID(INT_TMR)); adi_rtl_register_dispatched_handler (ADI_RTL_CORE_IID(INT_IVG14), context_switcher_isr, NULL); adi_rtl_activate_dispatched_handler(ADI_RTL_CORE_IID(INT_IVG14)); SetupGPTimer(0,TimerMemory,TimerHandler,&hTimer,5000000,1000000); adi_sec_SetCoreID(INTR_TIMER0_TMR0, ADI_SEC_CORE_0); *pTCNTL = 0x7; adi_tmr_EnableDataInt(&hTimer,true); OS::run(); return 0; }
void main ( void ) { ADI_ETHER_HANDLE hEthernet; ADI_ETHER_RESULT etherResult; ADI_ETHER_DEV_INIT EtherInitData[MAX_NETWORK_IF] = { { true, &memtable[0] }, { true, &memtable[1] }}; // data-cache,driver memory uint32_t reg_data; int i, nEtherDevUsed; char *ether_stack_block; ADI_GPIO_RESULT gpio_result; uint32_t gpioMaxCallbacks; int nRet; /** * Initialize managed drivers and/or services that have been added to * the project. * @return zero on success */ adi_initComponents(); /** * The default startup code does not include any functionality to allow * core 0 to enable core 1. A convenient way to enable core 1 is to use the * 'adi_core_1_enable' function. */ adi_core_1_enable(); /* Begin adding your custom code here */ g_AuxiTMIsFirstUpdated = 1; /* init CGU first time */ CGU_Init ( MULTIPLIER_SEL, CCLK_SEL, DDRCLK_SEL ); /* CCLK=16.384*iMultiplier /1 Mhz, 16.384*iMultiplier/iDDCLKSel Mhz DDR2 CLK */ #if defined(__DEBUG_FILE__) /* open the debug file */ pDebugFile = fopen(__DEBUG_FILE_NAME__, "w"); if (pDebugFile == 0) { fclose(pDebugFile); return; } #elif defined(__DEBUG_UART__) Init_UART(); #endif Init_PTPAuxin(); /* configures the switches */ #if BF609_EZ_BRD DEBUG_STATEMENT ( "Configuring switches for the ethernet operation \n\n" ); ConfigSoftSwitches(); #endif /* open ethernet device */ nEtherDevUsed = ( user_net_num_ifces > MAX_NETWORK_IF ) ? MAX_NETWORK_IF : user_net_num_ifces; #if BF609_EZ_BRD nEtherDevUsed = 1; #endif DEBUG_STATEMENT ( " init EMAC\n\n" ); for ( i = 0; i < nEtherDevUsed; i++ ) { etherResult = adi_ether_Open ( g_pDevEntry[i], &EtherInitData[i], g_pEthCallBack[i], &hEthernet ); if ( etherResult != ADI_ETHER_RESULT_SUCCESS ) { DEBUG_STATEMENT ( "adi_ether_Open: failed to open ethernet driver\n\n" ); return ; } g_hDev[i] = hEthernet; /* get the mac address */ memcpy ( ( ( ADI_EMAC_DEVICE * ) hEthernet )->MacAddress, user_net_config_info[i].hwaddr, 6 ); /* allocate memory */ ether_stack_block = heap_malloc ( i+1, g_contEthHeapSize[i] ); if ( ether_stack_block == NULL ) { DEBUG_PRINT ( " heap_malloc: in heap %d, failed to allocate memory to the stack \n\n" , i+1); return ; } /* init buf mem */ nRet = InitBuff ( g_contEthHeapSize[i], ether_stack_block, hEthernet, &user_net_config_info[i] ); if( nRet<0 ) { DEBUG_STATEMENT ( " InitBuff: failed to enable Init Buffs\n\n" ); return ; } /* Enable the MAC */ etherResult = adi_ether_EnableMAC ( hEthernet ); if ( etherResult != ADI_ETHER_RESULT_SUCCESS ) { DEBUG_STATEMENT ( " adi_ether_EnableMAC: failed to enable EMAC\n\n" ); return ; } } //enable EMAC INT adi_int_EnableInt ( ( (ADI_EMAC_DEVICE *)g_hDev[0])->Interrupt, true); adi_int_EnableInt ( ( (ADI_EMAC_DEVICE *)g_hDev[1])->Interrupt, true); /* activate rx channel DMA */ enable_rx ( g_hDev[0] ); enable_rx ( g_hDev[1] ); /* activate tx channel DMA */ enable_tx ( g_hDev[0] ); enable_tx ( g_hDev[1] ); //enable emac0 tx,rx enable_emac_tx_rx ( g_hDev[0] ); //enable emac1 tx,rx enable_emac_tx_rx ( g_hDev[1] ); //enable Enable_Time_Stamp_Auxin_Interrupt(); // HandleLoop(); return ; }//main
void main(void) { uint8_t *pFilledFrame = NULL; uint8_t *pDisplayFrame = NULL; bool bDisplayEnabled = false; adi_initComponents(); /* auto-generated code */ /* Adjust the core frequency */ if (adi_pwr_Init (PROC_CLOCK_IN, PROC_MAX_CORE_CLOCK, PROC_MAX_SYS_CLOCK, PROC_MIN_VCO_CLOCK) != ADI_PWR_SUCCESS) { printf ("Failed to initialize Power service\n"); return; } if(adi_pwr_SetFreq(PROC_REQ_CORE_CLOCK, PROC_REQ_SYS_CLOCK)!= ADI_PWR_SUCCESS ) { printf ("Failed to initialize Power service\n"); return; } /* Configure the Software controlled switches on BF609 EZ-Board */ //ConfigSoftSwitches_BF609(); #if defined(VIDEOLOOPBACKYUV_720P) FINBOARD_CLK_Synth_Config_OUT4_74_25_MHz(); #else FINBOARD_CLK_Synth_Config_OUT4_27_00_MHz(); #endif FINBOARD_LED_Drivers_Init(); FINBOARD_LED_Drivers_Config(1); /* Configure the sensor */ if(ConfigureSensor() != SUCCESS) { printf("Failed to configure Sensor \n"); return; } /* Configure the sensor for display */ if(ConfigureEncoder() != SUCCESS) { printf("Failed to configure LCD \n"); return; } FINBOARD_ADV7511_16bit_Mode(); /* Submit the frame for filling */ if(SubmitEmptyVideoFrame() != SUCCESS) { printf("Failed to submit empty video frame to the sensor \n"); return; } /* Submit the next frame for filling */ if(SubmitEmptyVideoFrame() != SUCCESS) { printf("Failed to submit empty video frame to the sensor \n"); return; } /* Enable the sensor to capture the frames */ if(EnableSensor(true) != SUCCESS) { printf("Failed to enable sensor \n"); return; } #if (EXAMPLE_TIMEOUT > 0) while(NumFilledFrames < EXAMPLE_TIMEOUT) #else while(1) #endif { /* Get filled frame from sensor */ if(GetFilledVideoFrame(&pFilledFrame) != SUCCESS) { printf("Failed to get filled frame from the sensor \n"); return; } if(pFilledFrame != NULL) { NumFilledFrames++; pDisplayFrame = pFilledFrame; /* Submit the next frame for filling */ if(SubmitEmptyVideoFrame() != SUCCESS) { printf("Failed to submit empty video frame to the sensor \n"); return; } if(bDisplayEnabled == false) { /* Submit the filled frame to encoder for display */ if(DisplayFrame(pDisplayFrame) != SUCCESS) { printf("Failed to submit the filled frame to LCD for display \n"); return; } } if(NumFilledFrames == 2) { /* Enable video display after submitting two frames */ if(EnableDisplay(true) != SUCCESS) { printf("Failed to enable video display \n"); return; } bDisplayEnabled = true; } } if(bDisplayEnabled == true) { uint8_t *pFrame; if(GetDisplayedFrame((void **)&pFrame) != SUCCESS) { printf("Failed to get the displayed frame \n"); } /* Submit the filled frame to the encoder for display */ if(DisplayFrame(pDisplayFrame) != SUCCESS) { printf("Failed to submit the filled frame to encoder for display \n"); return; } } } FINBOARD_LED_Drivers_Config(0); printf("All done \n"); }
void main(void) { uint32_t nResult= SUCCESS; /* Buffer pointer used to get the frames with data */ void *pVideoBuffer=NULL; uint32_t *pTemp = (uint32_t *)&buffer[0]; //MT9M114_VIDEO_BUF *pBufTemp; //uint32_t *pBuf; //int32_t nSize; /* Initialize the ADI components such as pin muxing etc */ adi_initComponents(); /* auto-generated code */ /* Initialize DMC */ adi_DMCamInit(); /* By default, Graphics is not used to draw the bounding rectangle around the detected dot */ InitTitle((void*)(*pTemp)); nBoundingRectFlag = 0; #if defined(FINBOARD) nIllumination = prevIllumination = 1; #endif /* Registering the MDMA callback for Channel-1(Dest) with Interrupt ID 91 (page 219, HRM) * to Core-B since it is used to mark the canny output */ //nSize = sizeof(uint32_t); /******************************************************/ /*mcapi_finalize(&mcapi_status); if (MCAPI_SUCCESS != mcapi_status) { exit(1); }*/ #ifdef DEBUG_INFO printf("[CORE A]: BF609_MCAPI_msg: %s\n", retVal == PASS ? "All done" : "Error..."); #endif /******************************************************/ do { /* Initialize the power services*/ if (adi_pwr_Init (PROC_CLOCK_IN, PROC_MAX_CORE_CLOCK, PROC_MAX_SYS_CLOCK, PROC_MIN_VCO_CLOCK) != ADI_PWR_SUCCESS) { printf ("Failed to initialize Power service\n"); nResult= FAILURE; break; } /* Set the required core clock and system clock */ if(adi_pwr_SetFreq(PROC_REQ_CORE_CLOCK, PROC_REQ_SYS_CLOCK)!= ADI_PWR_SUCCESS ) { printf ("Failed to initialize Power service\n"); nResult= FAILURE; break; } /* Initialize the GPIO for enabling/disabling the PB1 which inturn control the graphics to draw the rectangle around the detected dots */ if(Init_GPIO()!= SUCCESS) { printf("\n GPIO initialization failed \n"); nResult= FAILURE; break; } #if !defined(FINBOARD) /* Configure the Software controlled switches on BF609 EZ-Board */ ConfigSoftSwitches_BF609(); #else // !defined(FINBOARD) FINBOARD_CLK_Synth_Restore(); // restore firmware settings FINBOARD_LED_Drivers_Init(); FINBOARD_LED_Drivers_Config( nIllumination ); #endif // defined(FINBOARD) /* Configure the sensor */ if(ConfigureSensor() != SUCCESS) { printf("Failed to configure Sensor \n"); nResult= FAILURE; break; } /* Configure the sensor for display */ if(ConfigureEncoder() != SUCCESS) { printf("Failed to configure LCD \n"); nResult= FAILURE; break; } #if defined(FINBOARD) FINBOARD_ADV7511_16bit_Mode(); #endif /* Submit the first frame for filling */ if(SubmitEmptyVideoFrame() != SUCCESS) { printf("Failed to submit empty video frame to the sensor \n"); nResult= FAILURE; break; } /* Submit the second frame for filling */ if(SubmitEmptyVideoFrame() != SUCCESS) { printf("Failed to submit empty video frame to the sensor \n"); nResult= FAILURE; break; } /* Submit first buffer to encoder */ if(SubmitEncBuf(pEncDispStartBuf) != SUCCESS) { printf("Failed to submit video frame to the encoder \n"); nResult= FAILURE; break; } /* Submit same buffer since we will be waiting for the first frame from the sensor */ if(SubmitEncBuf(pEncDispStartBuf) != SUCCESS) { printf("Failed to submit video frame to the encoder \n"); nResult= FAILURE; break; } /* Wait till the first frame is captured */ /* Enable the sensor to capture the frames */ if(EnableDisplay(true) != SUCCESS) { printf("Failed to enable video encoder \n"); nResult= FAILURE; break; } if(EnableSensor(true) != SUCCESS) { printf("Failed to enable sensor \n"); nResult= FAILURE; break; } /* Start the display */ while( NumFramesCaptured == 0 ); }while(0); printf( "\nVersion: %s-%s\n", __DATE__, __TIME__); /* A while loop to timeout the example*/ while(NumFramesCaptured < EXAMPLE_TIMEOUT && nResult == SUCCESS ) { /* Get the video display frame */ pVideoBuffer = NULL; while(pVideoBuffer == NULL) { GetProcessedSensorBuf (&pVideoBuffer); } if(pVideoBuffer != NULL ) { #if defined(FINBOARD) if ( prevIllumination != nIllumination ) { prevIllumination = nIllumination; FINBOARD_LED_Drivers_Config( nIllumination ); } #endif } /* Increment the counter */ NumFilledFrames++; } /* end of while loop */ if(nResult == SUCCESS) { printf("All done \n"); } else { printf("Failed to run dot count application.\n"); } }