Beispiel #1
0
int fpu_post_test (int flags)
{
	int fpu = fpu_status ();

	int ret = 0;

	WATCHDOG_RESET ();

	if (!fpu)
		fpu_enable ();

	if (ret == 0)
		ret = fpu_post_test_math1 ();
	if (ret == 0)
		ret = fpu_post_test_math2 ();
	if (ret == 0)
		ret = fpu_post_test_math3 ();
	if (ret == 0)
		ret = fpu_post_test_math4 ();
	if (ret == 0)
		ret = fpu_post_test_math5 ();
	if (ret == 0)
		ret = fpu_post_test_math6 ();
	if (ret == 0)
		ret = fpu_post_test_math7 ();

	if (!fpu)
		fpu_disable ();

	WATCHDOG_RESET ();

	return ret;
}
int main(void)
{
	fpu_enable();
	system_init();
	pll_start(CRYSTAL, FREQUENCY);

	gpio_pin_cfg(GPIOD, 12, GPIO_OUT_PP_25MHz);
	gpio_pin_cfg(GPIOD, 13, GPIO_OUT_PP_25MHz);
	gpio_pin_cfg(GPIOD, 14, GPIO_OUT_PP_25MHz);
	gpio_pin_cfg(GPIOD, 15, GPIO_OUT_PP_25MHz);

	USBD_Init(&USB_Dev, USB_OTG_FS_CORE_ID, &USR_desc, &AUDIO_cb, &USR_cb);

	while(1);
}
Beispiel #3
0
/**
 * \brief This is the code that gets called on processor reset.
 * To initialize the device, and call the main() routine.
 */
void Reset_Handler(void)
{
	uint32_t *pSrc, *pDest;

	/* Initialize the relocate segment */
	pSrc = &_etext;
	pDest = &_srelocate;

	if (pSrc > pDest) {
		/* Copy segment block from beginning to end */
		for (; pDest < &_erelocate;) {
			*pDest++ = *pSrc++;
		}
	} else if (pSrc < pDest) {
		/* Copy segment block from end to beginning */
		uint32_t bytes_relocate = (uint32_t)&_erelocate - (uint32_t)&_srelocate;
		pSrc = (uint32_t*)((uint32_t)pSrc + bytes_relocate) - 1;
		pDest = (uint32_t*)((uint32_t)pDest + bytes_relocate) - 1;

		for (; bytes_relocate; bytes_relocate -= 4) {
			*pDest-- = *pSrc--;
		}
	}

	/* Clear the zero segment */
	for (pDest = &_szero; pDest < &_ezero;) {
		*pDest++ = 0;
	}

	/* Set the vector table base address */
	pSrc = (uint32_t *) & _sfixed;
	SCB->VTOR = (uint32_t)pSrc;

#if __FPU_USED
	/* Enable FPU */
	fpu_enable();
#endif

	/* Initialize the C library */
	__libc_init_array();

	/* Branch to main function */
	main();

	/* Infinite loop */
	while (1);
}
Beispiel #4
0
int main(void)
{
    SystemInit();

    ////////////////// SPI2 - SD
    fpu_enable();
    delay_init( 168 );
    SPI_SD_Init();
    //////////////////

    RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_RNG, ENABLE);	  //rng
    RNG_Cmd(ENABLE); //switch on

    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE); //button

    InitEXTIButtonPA0();//accept
    InitEXTIButtonPA1();//up
    InitEXTIButtonPA2();//right
    InitEXTIButtonPA3();//down
    InitEXTIButtonPA4();//left

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); //timer
    ConfTim2();

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //timer

    ConfTim3(350); //init with start_value game period
    SetSnakeSpeed(3);

    PCD8544_Init(0x38); 				//Initialize LCD with 0x38 software contrast
////////////////////////////////////////////

    DrawBitMap(SnakeBitMap);

    PCD8544_Refresh();
    WaitForAcceptButton();
    PCD8544_Clear();

    MainMenu();

    while (1)
	{

	}
}
Beispiel #5
0
int main(void)
{
	volatile uint32_t count, count_max = 10000000;

	fpu_enable();
	pll_start(CRYSTAL, FREQUENCY);

	LPC_GPIO_PORT->DIR[LED_GPIO] |= LED;	// configure GPIO pin as output

	while (1)
	{
		for (count = 0; count < count_max; count++);	// delay
		LED_bb = 1;
		for (count = 0; count < count_max; count++);	// delay
		LED_bb = 0;
	}

	return 0;
}
/*
 * An "unofficial" function (not exposed in any header)
 * that performs initialization of MCU's peripherals.
 *
 * It should only be called from the startup routine before
 * the execution is passed to a user application
 * (typically started in main().)
 */
void _init(void)
{
    /* Initializes the MCU revision number: */
    sysctl_mcuRevision();

    /* Configure system clock frequency to 50 MHz (default) */
    sysctl_configSysClock(APP_SYS_CLOCK_DIV);

    /* Depending on configuration, enable GPIO AHB mode: */
    if ( 0 != APP_GPIO_AHB )
    {
        _sysctl_enableGpioAhb();
    }


    /* Enable/disable FPU: */
    if ( 0 != APP_FPU_ENABLE )
    {
        fpu_enable();

        /* Enable/disable lazy stacking of FPU's registers */
        if ( 0 != APP_FPU_LAZY_STACKING )
        {
        	fpu_enableLazyStacking();
        }
        else
        {
            fpu_enableStacking();
        }
    }
    else
    {
        fpu_disable();
    }

    /*
     * Initialize the tables of GPIO and
     * watchdog interrupt handlers.
     */
    _gpio_initIntHandlers();
    _wd_initIntHandlers();
}
Beispiel #7
0
/**
 * \brief This is the code that gets called on processor reset.
 * To initialize the device, and call the main() routine.
 */
void Reset_Handler(void)
{
	uint32_t *pSrc, *pDest;

	/* Initialize the relocate segment */
	pSrc = &_etext;
	pDest = &_srelocate;

	if (pSrc != pDest) {
		for (; pDest < &_erelocate;) {
			*pDest++ = *pSrc++;
		}
	}

	/* Clear the zero segment */
	for (pDest = &_szero; pDest < &_ezero;) {
		*pDest++ = 0;
	}

	/* Set the vector table base address */
	pSrc = (uint32_t *) & _sfixed;
	SCB->VTOR = ((uint32_t) pSrc & SCB_VTOR_TBLOFF_Msk);

#if __FPU_USED
	fpu_enable();
#endif

	if (((uint32_t) pSrc >= IRAM_ADDR) && ((uint32_t) pSrc < IRAM_ADDR + IRAM_SIZE)) {
		SCB->VTOR |= 1 << SCB_VTOR_TBLBASE_Pos;
	}

	/* Initialize the C library */
	__libc_init_array();

	/* Branch to main function */
	main();

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