Пример #1
0
int main(void)
{
    pin_setup();

    enable_1v8_power();

    cpu_clock_init();

    scs_dwt_cycle_counter_enabled();

    systick_setup();

    gpio_set(PORT_LED1_3, (PIN_LED1|PIN_LED2|PIN_LED3)); /* LEDs on */

    while (1)
    {
        gpio_set(PORT_LED1_3, (PIN_LED1)); /* LED1 on */
        gpio_set(PORT_LED1_3, (PIN_LED2)); /* LED2 on */
        gpio_set(PORT_LED1_3, (PIN_LED3)); /* LED3 on */

        sys_tick_wait_time_ms(500);

        gpio_clear(PORT_LED1_3, (PIN_LED3)); /* LED3 off */
        gpio_clear(PORT_LED1_3, (PIN_LED2)); /* LED2 off */
        gpio_clear(PORT_LED1_3, (PIN_LED1)); /* LED1 off  */

        sys_tick_wait_time_ms(500);
    }

    return 0;
}
Пример #2
0
int main(void)
{
	pin_setup();

	enable_1v8_power();

	cpu_clock_init();

	scs_dwt_cycle_counter_enabled();

	systick_setup();

	led_on(LED1);
	led_on(LED2);
	led_on(LED3);

	while (1) 
	{
		led_on(LED1);
		led_on(LED2);
		led_on(LED3);

		sys_tick_wait_time_ms(500);

		led_off(LED1);
		led_off(LED2);
		led_off(LED3);

		sys_tick_wait_time_ms(500);
	}

	return 0;
}
Пример #3
0
void tick_init(void)
{
  uint32_t systick_reload_val;
  g_ulSysTickCount = 0;

  /* Disable IRQ globally */
  asm volatile ("cpsid i");

  /* Set processor Clock as Source Clock */
  systick_set_clocksource(STK_CSR_CLKSOURCE_AHB);

  systick_set_reload(rcc_ahb_frequency / 1000);

  systick_interrupt_enable();

  /* Start counting. */
  systick_counter_enable();

  /* Set SysTick Priority to maximum */
  nvic_set_priority(NVIC_SYSTICK_IRQ, 255);

  /* Enable IRQ globally */
  asm volatile ("cpsie i");
  scs_dwt_cycle_counter_enabled();
}
Пример #4
0
int main(void)
{
	systick_setup();

	gpio_setup();

	/* SCS & Cycle Counter enabled (used to count number of cycles executed per second see g_NbCyclePerSecond */
	scs_dwt_cycle_counter_enabled();

	while (1) 
	{
		gpio_set(PORT_LED1_3, (PIN_LED1|PIN_LED2|PIN_LED3)); /* LEDs on */

		sys_tick_wait_time_ms(500);

		gpio_clear(PORT_LED1_3, (PIN_LED1|PIN_LED2|PIN_LED3)); /* LED off */

		sys_tick_wait_time_ms(500);
	}

	return 0;
}
Пример #5
0
int main(void)
{
	pin_setup();

	gpio_set(PORT_EN1V8, PIN_EN1V8); /* 1V8 on */

	cpu_clock_init();

	scs_dwt_cycle_counter_enabled();

	systick_setup();

	gpio_clear(PORT_LED1_3, (PIN_LED1)); /* LED1 off */

	/* Test number of instruction per second (MIPS) slow blink ON 1s, OFF 1s */
LED1_TOGGLE();
	nb_inst_per_sec[0] = test_nb_instruction_per_sec_100_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[1]= test_nb_instruction_per_sec_105_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[2]= test_nb_instruction_per_sec_110_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[3]= test_nb_instruction_per_sec_115_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[4] = test_nb_instruction_per_sec_120_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[5] = test_nb_instruction_per_sec_150_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[6] = test_nb_instruction_per_sec_200_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[7] = test_nb_instruction_per_sec_1000_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[8] = test_nb_instruction_per_sec_100_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[9]= test_nb_instruction_per_sec_105_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[10]= test_nb_instruction_per_sec_110_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[11]= test_nb_instruction_per_sec_115_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[12] = test_nb_instruction_per_sec_120_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[13] = test_nb_instruction_per_sec_150_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[14] = test_nb_instruction_per_sec_200_nop_asm();
LED1_TOGGLE();
	nb_inst_per_sec[15] = test_nb_instruction_per_sec_1000_nop_asm();
LED1_TOGGLE();

	/* Test finished fast blink */
	while (1) 
	{
		gpio_set(PORT_LED1_3, (PIN_LED1)); /* LED1 on */
		gpio_set(PORT_LED1_3, (PIN_LED2)); /* LED2 on */
		gpio_set(PORT_LED1_3, (PIN_LED3)); /* LED3 on */

		sys_tick_wait_time_ms(250);

		gpio_clear(PORT_LED1_3, (PIN_LED3)); /* LED3 off */
		gpio_clear(PORT_LED1_3, (PIN_LED2)); /* LED2 off */
		gpio_clear(PORT_LED1_3, (PIN_LED1)); /* LED1 off  */

		sys_tick_wait_time_ms(250);
	}

	return 0;
}