OpenCores
URL https://opencores.org/ocsvn/openfire2/openfire2/trunk

Subversion Repositories openfire2

[/] [openfire2/] [trunk/] [sw/] [test-int/] [sample.c] - Rev 6

Compare with Previous | Blame | View Log

#include "openfire.h"
 
// --- prototypes ---
void interrupt_handler(void) __attribute__((interrupt_handler));
 
// -------------------------------------
void interrupt_handler(void)
{
   uart1_printchar('.');
}
 
// -------------------------------------
void main(void)
{
  int n;
  uart1_printline("inicio del test\r\n");
 
  uart1_printline("setting interrupt handler\r\n");
  asm volatile ("la  r6, r0, interrupt_handler	\n\t" \
		"sw  r6, r1, r0			\n\t" \
		"lhu r7, r1, r0			\n\t" \
		"shi r7, r0, 0x12		\n\t" \
		"shi r6, r0, 0x16 		\n\t" \
		"la  r6, r0, 0x2		\n\t" \
		"mts rmsr, r6			\n\t" );
 
  uart1_printline("configure timer1\r\n");
  *(unsigned long *) TIMER1_PORT = TIMER1_CONTROL | 50000000L;	// pulse each 2 seconds
 
  uart1_printline("enable interrupts for timer1\r\n");
  *(unsigned long *) INTERRUPT_ENABLE = INTERRUPT_TIMER1; 
 
  uart1_printline("working...");
 
  while(1)
  {
    for(n = 0; n < 1000000; n++);
    uart1_printchar('+');
  }
 
 
}
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.