void main (void)
{
	unsigned char	flags;

	/* Init the hardware */
	flags = catgenie_init();

#ifdef HAS_BLUETOOTH
	serial_init(BT_BITRATE);
	bluetooth_init();
	serial_term();
#endif /* HAS_BLUETOOTH */

	/* Initialize the serial port */
	serial_init(BITRATE);

	printf("\n*** GenieDiag ***\n");
	if (!nPOR) {
		DBG("Power-on reset\n");
		flags |= POWER_FAILURE;
	} else if (!nBOR) {
		DBG("Brown-out reset\n");
		flags |= POWER_FAILURE;
	}
#ifdef __RESETBITS_ADDR
	else if (!__timeout)
		DBG("Watchdog reset\n");
	else if (!__powerdown)
		DBG("Pin reset (sleep)\n");
	else
		DBG("Pin reset\n");
#else
	else
Exemple #2
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
//	int c;
   /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */     
    SystemInit();
	RCC_GetClocksFreq(&RCC_Clocks);
    SysTick_Config(SystemCoreClock / SYSTICK_FREQUENCY_HZ);

#ifdef TRACEUART
    TRACEUART_Configuration();
#endif //TRACEUART
	UART_Configuration();

	LED_Init();

	/* Output a message on Hyperterminal using printf function */
	printf("\n\r\n\r");
	printf("*** LATTICE FW LOADER V1.00 Build by phalt on ("__DATE__ "-" __TIME__ ")\n\r");
	printf("*** LATTICE FW LOADER V1.00 Rebooting ...\n\r");

	/*
     * wait for a keystroke (or a button press if you want.)
	*/
//    printf("\n\rPress Return to start, any other key To Enter the Console ...\n\r");
//	c = awaitkey(DEFAULT_BOOT_DELAY);
	if(1) 			//(((c != '\r') && (c != '\n') && (c != '\0')))
    {
		Delay(500);
		GPIO_ResetBits(BLINK_PORT, (0xF << LED1));
//		traceprintf("\rtrace start OK\n\r");
//		Codec_GPIO_Init();
//		Delay(1);
//		/* Reset the Codec Registers */
//		Codec_Reset();
//		Delay(1);
//		/* Initialize the Control interface of the Audio Codec */
//		Codec_CtrlInterface_Init();
//		Delay(1);
		if(1)
		{
	        GPIO_SetBits(BLINK_PORT, (0xF << LED1));
//	        WavePlayBack(AUDIOFREQ, 1);
	        WavePlayerInit(AUDIOFREQ);
	        GPIO_ResetBits(BLINK_PORT, (0xF << LED1));
		}
		while(1)						//eugene loop
		{
//			Codec_CtrlInterface_Init();
			GPIO_SetBits(BLINK_PORT, (0x1 << LED1));
//			Codec_Write();
			Codec_ReadRegister(0x00); //test read of codec
			GPIO_ResetBits(BLINK_PORT, (0x1 << LED1));
			Delay(1000);
		}

		if(1)									//test
		{
			init_builtin_cmds();
			serial_term();
		}


    }
	printf("*** JUMP to Application now ...\n\r");
    run_app(0x08000000);



    /* Infinite loop */
	while (1);
}