Exemple #1
0
void EMI_DeInit(void)
{

  SCU_AHBPeriphReset(__EMI, ENABLE);          /* EMI peripheral under Reset */
  SCU_AHBPeriphReset(__EMI,DISABLE );         /* EMI not under Reset */

}
Exemple #2
0
void DMA_DeInit(void)

{

  SCU_AHBPeriphReset(__DMA, ENABLE);         /*DMA peripheral is under Reset " Reset on"*/
  SCU_AHBPeriphReset(__DMA, DISABLE);        /*DMA peripheral Reset off*/
}
Exemple #3
0
/*******************************************************************************
* Function Name  : ENET_InitClocksGPIO
* Description    : Reset, clocks & GPIO Ethernet Pin initializations
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void ENET_InitClocksGPIO(void)
{

  GPIO_InitTypeDef GPIO_Struct;

  SCU_AHBPeriphClockConfig(__ENET, ENABLE);
  SCU_AHBPeriphReset(__ENET,DISABLE);
  SCU_PHYCLKConfig(ENABLE);

  GPIO_DeInit(GPIO1);
  GPIO_Struct.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 |GPIO_Pin_3 |GPIO_Pin_4 |GPIO_Pin_7 ;
  GPIO_Struct.GPIO_Type = GPIO_Type_PushPull;
  GPIO_Struct.GPIO_Direction = GPIO_PinOutput;
  GPIO_Struct.GPIO_IPConnected = GPIO_IPConnected_Disable;
  GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2;
  GPIO_Init(GPIO1, &GPIO_Struct);


  GPIO_DeInit(GPIO5);
  GPIO_Struct.GPIO_Pin = GPIO_Pin_2 | GPIO_Pin_3;
  GPIO_Struct.GPIO_Type = GPIO_Type_PushPull;
  GPIO_Struct.GPIO_Direction = GPIO_PinOutput;
  GPIO_Struct.GPIO_IPConnected = GPIO_IPConnected_Disable;
  GPIO_Struct.GPIO_Alternate=GPIO_OutputAlt2;
  GPIO_Init(GPIO5, &GPIO_Struct);

}
Exemple #4
0
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();
}
Exemple #5
0
static void platform_config_scu()
{     
  volatile u16 i = 0xFFFF;
  while (i-- > 0);  
  
   // SCU initialization
  SCU_MCLKSourceConfig(SCU_MCLK_OSC);
  SCU_PLLFactorsConfig(192,25,2);            /* PLL = 96 MHz */
  SCU_PLLCmd(ENABLE);                        /* PLL Enabled  */
  SCU_MCLKSourceConfig(SCU_MCLK_PLL);        /* MCLK = PLL   */  
  
  SCU_PFQBCCmd( ENABLE );

  /* Set the RCLK Clock divider to max speed*/
  SCU_RCLKDivisorConfig(SCU_RCLK_Div1);
  /* Set the PCLK Clock to MCLK/2 */
  SCU_PCLKDivisorConfig(SCU_PCLK_Div2);
  /* Set the HCLK Clock to MCLK */
  SCU_HCLKDivisorConfig(SCU_HCLK_Div1);
  /* Set the BRCLK Clock to MCLK */
  SCU_BRCLKDivisorConfig(SCU_BRCLK_Div1);
  
  // Enable VIC clock
  SCU_AHBPeriphClockConfig(__VIC, ENABLE);
  SCU_AHBPeriphReset(__VIC, DISABLE);
                 
  // Enable the UART clocks
  SCU_APBPeriphClockConfig(__UART_ALL, ENABLE);

  // Enable the timer clocks
  SCU_APBPeriphClockConfig(__TIM01, ENABLE);
  SCU_APBPeriphReset(__TIM01, DISABLE);
  SCU_APBPeriphClockConfig(__TIM23, ENABLE);
  SCU_APBPeriphReset(__TIM23, DISABLE);

  // Enable the GPIO clocks  
  SCU_APBPeriphClockConfig(__GPIO_ALL, ENABLE);  

  // Enable the WIU clock
  SCU_APBPeriphClockConfig(__WIU, ENABLE);
  SCU_APBPeriphReset(__WIU, DISABLE);

  // Enable the I2C clocks
  SCU_APBPeriphClockConfig(__I2C0, ENABLE);
  SCU_APBPeriphReset(__I2C0, DISABLE);
  SCU_APBPeriphClockConfig(__I2C1, ENABLE);
  SCU_APBPeriphReset(__I2C1, DISABLE);
  
  // Enable the ADC clocks
  SCU_APBPeriphClockConfig(__ADC, ENABLE);

  // Enable the SSP clocks
  SCU_APBPeriphClockConfig(__SSP0,ENABLE);
  SCU_APBPeriphReset(__SSP0,DISABLE);
  SCU_APBPeriphClockConfig(__SSP1,ENABLE);
  SCU_APBPeriphReset(__SSP1,DISABLE);
}
Exemple #6
0
//-----------------------------------------------------------------
void USB_ConfigInit(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;

	UART1_PutString("\r\n USB init...");
  	#ifdef MCLK96MHZ
	//USB clock = MCLK/2 = 48MHz
	SCU_USBCLKConfig(SCU_USBCLK_MCLK2);
	#else
	//USB clock = MCLK = 48MHz
	SCU_USBCLKConfig(SCU_USBCLK_MCLK);
	#endif
	//Enable USB clock
	SCU_AHBPeriphClockConfig(__USB,ENABLE);
	SCU_AHBPeriphReset(__USB,DISABLE);
	SCU_AHBPeriphClockConfig(__USB48M,ENABLE);

	//Configure GPIO0 (D+ Pull-Up on P0.1)
	SCU_APBPeriphClockConfig(__GPIO0 ,ENABLE);
	SCU_APBPeriphReset(__GPIO0,DISABLE);

	// GPIO_DeInit(P0.1);
	GPIO_StructInit(&GPIO_InitStructure);
	GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
	GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
	GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Enable;
	GPIO_InitStructure.GPIO_Alternate=GPIO_OutputAlt1;
	GPIO_Init (GPIO0, &GPIO_InitStructure);

	// initialize the rx fifo, block UART IRQ geting a byte from fifo
	fifo_init(&USB_rx_fifo, USB_rxfifobuffer, USB_RX_FIFO_LEN, NO_ITLine, USBLP_ITLine);

	// initialize txd buffer
	Buffer_Init(&USB_tx_buffer, USB_tbuffer, USB_TX_BUFFER_LEN);

	// initialize rxd buffer
	Buffer_Init(&USB_rx_buffer, USB_rbuffer, USB_RX_BUFFER_LEN);

	VIC_Config(USBLP_ITLine, VIC_IRQ, PRIORITY_USB);
	VIC_ITCmd(USBLP_ITLine, ENABLE);

	USB_Init();

	UART1_PutString("ok");
}
Exemple #7
0
/* Private functions ---------------------------------------------------------*/
void System_Setup(void)
{
  SCU_MCLKSourceConfig(SCU_MCLK_OSC);
  SCU_PCLKDivisorConfig(SCU_PCLK_Div2);
  SCU_PLLFactorsConfig(128,25,4);
  SCU_PLLCmd(ENABLE);
  SCU_MCLKSourceConfig(SCU_MCLK_PLL);

  SCU_APBPeriphClockConfig(__CAN, ENABLE);
  SCU_APBPeriphClockConfig(__GPIO0, ENABLE);
  SCU_APBPeriphClockConfig(__GPIO1, ENABLE);
  SCU_APBPeriphClockConfig(__GPIO3, ENABLE);
  SCU_APBPeriphClockConfig(__GPIO5, ENABLE);
   SCU_AHBPeriphClockConfig(__VIC, ENABLE);

  SCU_APBPeriphReset(__CAN, DISABLE);
  SCU_APBPeriphReset(__GPIO0, DISABLE);
  SCU_APBPeriphReset(__GPIO1, DISABLE);
  SCU_APBPeriphReset(__GPIO3, DISABLE);
  SCU_APBPeriphReset(__GPIO5, DISABLE);
  SCU_AHBPeriphReset(__VIC, DISABLE);
}
Exemple #8
0
/*******************************************************************************
* Function Name  : VIC_DeInit
* Description    : Deinitialize the VIC module registers to their default reset
*                  values.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void VIC_DeInit(void)
{
  SCU_AHBPeriphReset(__VIC, ENABLE);     /* VIC peripheral is under Reset */
  SCU_AHBPeriphReset(__VIC, DISABLE);    /* VIC peripheral Reset off */
}