Ejemplo n.º 1
0
void clock_init(void)
{
    timer0_en_write(0);
    timer0_load_write(0x7fffffffffffffffLL);
    timer0_reload_write(0x7fffffffffffffffLL);
    timer0_en_write(1);
}
Ejemplo n.º 2
0
void misoc_timer_initialize(void)
{
  /* Clear event pending */

  timer0_ev_pending_write(timer0_ev_pending_read());

  /* Disable timer*/

  timer0_en_write(0);

  /* Setup the timer reload register to generate interrupts at the rate of
   * CLOCKS_PER_SEC.
   */

  timer0_reload_write(SYSTICK_RELOAD);
  timer0_load_write(SYSTICK_RELOAD);

  /* Enable timer */

  timer0_en_write(1);

  /* Attach the timer interrupt vector */

  (void)irq_attach(TIMER0_INTERRUPT, up_timerisr);

  /* And enable the timer interrupt */

  up_enable_irq(TIMER0_INTERRUPT);

  /* Enable IRQ of the timer core */

  timer0_ev_enable_write(1);
}
Ejemplo n.º 3
0
static int test_user_abort(void)
{
    char c;

    printf("Automatic boot in 2 seconds...\n");
    printf("Q/ESC: abort boot\n");
    printf("F7:    boot from serial\n");
#ifdef MINIMAC_BASE
    printf("F8:    boot from network\n");
#endif
    timer0_en_write(0);
    timer0_reload_write(0);
    timer0_load_write(identifier_frequency_read()*2);
    timer0_en_write(1);
    timer0_update_value_write(1);
    while(timer0_value_read()) {
        if(readchar_nonblock()) {
            c = readchar();
            if((c == 'Q')||(c == '\e')) {
                puts("Aborted");
                return 0;
            }
            if(c == 0x06) {
                serialboot();
                return 0;
            }
#ifdef MINIMAC_BASE
            if(c == 0x07) {
                netboot();
                return 0;
            }
#endif
        }
        timer0_update_value_write(1);
    }
Ejemplo n.º 4
0
Archivo: boot.c Proyecto: RP7/misoc
static int check_ack(void)
{
	int recognized;
	static const char str[SFL_MAGIC_LEN] = SFL_MAGIC_ACK;

	timer0_en_write(0);
	timer0_reload_write(0);
	timer0_load_write(identifier_frequency_read()/4);
	timer0_en_write(1);
	timer0_update_value_write(1);
	recognized = 0;
	while(timer0_value_read()) {
		if(uart_read_nonblock()) {
			char c;
			c = uart_read();
			if(c == str[recognized]) {
				recognized++;
				if(recognized == SFL_MAGIC_LEN)
					return 1;
			} else {
				if(c == str[0])
					recognized = 1;
				else
					recognized = 0;
			}
		}
		timer0_update_value_write(1);
	}
	return 0;
}