static void prvSetupHardware( void ) { /* Configuration taken from the ST code. Set Flash banks size & address */ FMI_BankRemapConfig( 4, 2, 0, 0x80000 ); /* FMI Waite States */ FMI_Config( FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE, FMI_LVD_ENABLE, FMI_FREQ_HIGH ); /* Configure the FPLL = 96MHz, and APB to 48MHz. */ SCU_PCLKDivisorConfig( SCU_PCLK_Div2 ); SCU_PLLFactorsConfig( 192, 25, 2 ); SCU_PLLCmd( ENABLE ); SCU_MCLKSourceConfig( SCU_MCLK_PLL ); WDG_Cmd( DISABLE ); VIC_DeInit(); /* GPIO8 clock source enable, used by the LCD. */ SCU_APBPeriphClockConfig(__GPIO8, ENABLE); GPIO_DeInit(GPIO8); /* GPIO 9 clock source enable, used by the LCD. */ SCU_APBPeriphClockConfig(__GPIO9, ENABLE); GPIO_DeInit(GPIO9); /* Enable VIC clock */ SCU_AHBPeriphClockConfig(__VIC, ENABLE); SCU_AHBPeriphReset(__VIC, DISABLE); /* Peripheral initialisation. */ vParTestInitialise(); }
int platform_init() { unsigned i; TIM_InitTypeDef tim; TIM_TypeDef* base; // System configuration platform_config_scu(); // PIO setup for( i = 0; i < 10; i ++ ) GPIO_DeInit( ( GPIO_TypeDef* )port_data[ i ] ); // Initialize VIC VIC_DeInit(); // UART setup (only STR9_UART is used in this example) platform_uart_setup( CON_UART_ID, CON_UART_SPEED, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 ); // Initialize timers for( i = 0; i < 4; i ++ ) { base = ( TIM_TypeDef* )timer_data[ i ]; TIM_DeInit( base ); TIM_StructInit( &tim ); tim.TIM_Clock_Source = TIM_CLK_APB; tim.TIM_Prescaler = 255; TIM_Init( base, &tim ); TIM_CounterCmd( base, TIM_START ); } cmn_platform_init(); return PLATFORM_OK; }
void systemInit(void) { //Default configuration SCU_MCLKSourceConfig(SCU_MCLK_OSC); //Configure the FMI FMI_Config(FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE, FMI_LVD_ENABLE, FMI_FREQ_HIGH); //Configure PLL factors SCU_PLLFactorsConfig(192, 25, 2); //Enable PLL and wait for the the PLL to lock SCU_PLLCmd(ENABLE); //Set clock dividers SCU_RCLKDivisorConfig(SCU_RCLK_Div1); SCU_HCLKDivisorConfig(SCU_HCLK_Div1); SCU_FMICLKDivisorConfig(SCU_FMICLK_Div1); SCU_PCLKDivisorConfig(SCU_PCLK_Div2); //Switch to PLL clock SCU_MCLKSourceConfig(SCU_MCLK_PLL); //Enable VIC clock SCU_AHBPeriphClockConfig(__VIC, ENABLE); //Reset VIC peripheral VIC_DeInit(); //Assign default vectors VIC_InitDefaultVectors(); }
/******************************************************************************* * Function Name : VIC_Configuration * Description : Configure the used I/O ports pins * Input : None * Output : None * Return : None *******************************************************************************/ void VIC_Configuration(void) { /* VIC Configuration */ VIC_DeInit(); VIC_Config(I2C0_ITLine,VIC_IRQ , 0); VIC_Config(I2C1_ITLine,VIC_IRQ , 1); VIC_ITCmd(I2C0_ITLine, ENABLE); VIC_ITCmd(I2C1_ITLine, ENABLE); }
// Configure the interrupt vector. static void VICConfig(void) { // Enable the AHB (advanced high-performance but) clock for VIC (vectored // interrupt controller). SCU_AHBPeriphClockConfig(__VIC,ENABLE); // Reset the VIC registers (to their default reset values). VIC_DeInit(); // Initialize VICs default vector registers. VIC_InitDefaultVectors(); // Reset the wakeup interrupt unit registers. WIU_DeInit(); }