Beispiel #1
0
void TIMER_Configuration()				   
{

    DrvTIMER_Init();														

	DrvSYS_SelectIPClockSource(E_SYS_TMR0_CLKSRC,0);					

	DrvTIMER_Open(E_TMR0,5,E_PERIODIC_MODE);								
	
 	DrvTIMER_SetTimerEvent(E_TMR0,1,(TIMER_CALLBACK) Timer0_Callback,0);

	DrvTIMER_EnableInt(E_TMR0);											

	DrvTIMER_Start(E_TMR0);												
}
Beispiel #2
0
void setupUART()
{
#ifdef M451
	setupCommandUART();
#else
	STR_UART_T param;
	DrvGPIO_InitFunction(E_FUNC_UART1);
	DrvSYS_SelectIPClockSource(E_SYS_UART_CLKSRC,3);
	param.u32BaudRate        = UART_BAUD_RATE;
	param.u8cDataBits        = DRVUART_DATABITS_8;
	param.u8cStopBits        = DRVUART_STOPBITS_1;
	param.u8cParity          = DRVUART_PARITY_NONE;
	param.u8cRxTriggerLevel  = DRVUART_FIFO_1BYTES;
	param.u8TimeOut        	 = 0;
	DrvUART_Open(UART_PORT1, &param);
#endif
	printf("Version:%d\n", VERSION_CODE);
}
Beispiel #3
0
/*
*********************************************************************************************************
*                                            LOCAL FUCTION
*********************************************************************************************************
*/
int32_t BSP_INIT_UART0(void)
{
	STR_UART_T param;

	/* SYSCLK =>12Mhz*/
	DrvGPIO_InitFunction(E_FUNC_UART0_RX_TX);

	/* Select UART Clock Source From 12MHz */
	DrvSYS_SelectIPClockSource(E_SYS_UART_CLKSRC,0); 
	
    param.u32BaudRate        = 115200;
    param.u8cDataBits        = DRVUART_DATABITS_8;
    param.u8cStopBits        = DRVUART_STOPBITS_1;
    param.u8cParity          = DRVUART_PARITY_NONE;
    param.u8cRxTriggerLevel  = DRVUART_FIFO_62BYTES;
    param.u8TimeOut        	 = 250;
    if(DrvUART_Open(UART_PORT0,&param) == 0)
		return TRUE;
	else
		return FALSE;
}
Beispiel #4
0
/******************************************************************************//**
 *@brief  A simple FMC example. It Erase the LDROM and Verify ,then Program LDROM
 *        and read out data to compare.
 *@param  None
 *@return None 
**********************************************************************************/
void FMC_LDROM(void)
{
	uint32_t u32Data, i;
	int32_t  i32Err;
//	STR_UART_T sParam;

	/* Unlock the protected registers */
	UNLOCKREG();

	/* Enable the 12MHz oscillator oscillation */
	SYSCLK->PWRCON.XTL12M_EN = 1;

	/* Waiting for 12M Xtal stable */
	while (DrvSYS_GetChipClockSourceStatus(E_SYS_XTL12M) != 1);

	/* Set UART Pin */
	DrvGPIO_InitFunction(E_FUNC_UART0);

	/* UART Setting */
/*	sParam.u32BaudRate 		= 115200;
	sParam.u8cDataBits 		= DRVUART_DATABITS_8;
	sParam.u8cStopBits 		= DRVUART_STOPBITS_1;
	sParam.u8cParity 		= DRVUART_PARITY_NONE;
	sParam.u8cRxTriggerLevel= DRVUART_FIFO_1BYTES;
*/
	/* Select UART Clock Source From 12MHz */
	DrvSYS_SelectIPClockSource(E_SYS_UART_CLKSRC, 0);

	/* Set UART Configuration */
//	DrvUART_Open(UART_PORT0, &sParam);

	/* Enable ISP function */
	DrvFMC_EnableISP();
	/* Enable LDROM update */
	DrvFMC_EnableLDUpdate();

	/* Page Erase LDROM */
	printf("Erase LDROM test...............................");
	for(i=0; i<4096; i+=PAGE_SIZE)
		DrvFMC_Erase(LDROM_BASE + i);
	/* Erase Verify */
	i32Err = 0;
	for(i = LDROM_BASE; i < (LDROM_BASE+4096); i += 4)
	{
		DrvFMC_Read(i, &u32Data);

		if(u32Data != 0xFFFFFFFF)
		{
			i32Err = 1;
		}
	}
    if (i32Err)
        printf("[FAIL]\n\r");
    else
        printf("[OK]\n\r");

	/* Program LD ROM and read out data to compare */
	printf("Program LDROM test.............................");
	for(i = LDROM_BASE; i < (LDROM_BASE+4096); i += 4)
	{
		DrvFMC_Write(i, i);
	}
	i32Err = 0;
	for(i = LDROM_BASE; i < (LDROM_BASE+4096); i += 4)
	{
		DrvFMC_Read(i, &u32Data);
		if(u32Data != i)
		{
			i32Err = 1;
		}
	}
    if (i32Err)
        printf("[FAIL]\n\r");
    else
        printf("[OK]\n\r");

	/* Disable ISP function */
	DrvFMC_DisableISP();

	/* Lock protected registers */
	LOCKREG();

	printf("FMC Sample Code Completed!\n\r");
}