Beispiel #1
0
/* Implementing a usleep alternative*/
void _delay_us(u32 delay_us)
{
    tick_us = 0;
    desired_us = delay_us;
    systick_counter_enable();
    while( tick_us < desired_us);// This provides the busy-wait
    systick_counter_disable();// Kill the interrupt if not using it.  The ISR just slows down the uC
}
Beispiel #2
0
void time_delay_ms(unsigned int delay) {
  uint32_t wake = system_ms + delay;
  uint32_t cnt;
  do {
    systick_counter_disable();
    cnt = system_ms;
    systick_counter_enable();
  }
  while (wake > cnt);
}
Beispiel #3
0
void
jump_to_app()
{
	const uint32_t *app_base = (const uint32_t *)APP_LOAD_ADDRESS;

	/*
	 * We refuse to program the first word of the app until the upload is marked
	 * complete by the host.  So if it's not 0xffffffff, we should try booting it.
	 */
	if (app_base[0] == 0xffffffff)
		return;
	/*
	 * The second word of the app is the entrypoint; it must point within the
	 * flash area (or we have a bad flash).
	 */
	if (app_base[1] < APP_LOAD_ADDRESS)
		return;
	if (app_base[1] >= (APP_LOAD_ADDRESS + board_info.fw_size))
		return;

	/* just for paranoia's sake */
	flash_lock();

	/* kill the systick interrupt */
	systick_interrupt_disable();
	systick_counter_disable();

	/* and set a specific LED pattern */
	led_off(LED_ACTIVITY);
	led_on(LED_BOOTLOADER);

	/* the interface */
	cfini();

	/* switch exception handlers to the application */
	SCB_VTOR = APP_LOAD_ADDRESS;

	/* extract the stack and entrypoint from the app vector table and go */
	do_jump(app_base[0], app_base[1]);
}
Beispiel #4
0
void systickDisable(){
	systick_interrupt_disable();
	systick_counter_disable();
};