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

Subversion Repositories tv80

[/] [tv80/] [branches/] [restruc1/] [tests/] [bintr.c] - Blame information for rev 32

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 32 ghutchis
#include "tv80_env.h"
2
 
3
/*
4
 * This test covers interrupt handling routines.  The actual interrupt code
5
 * is in assembly, in bintr_crt0.asm.
6
 *
7
 * The test generates five interrupts, and clears the interrupt after
8
 * each one.
9
 *
10
 * The isr routine uses the two writes to intr_cntdwn to first clear
11
 * assertion of the current interrupt and then disable the countdown
12
 * timer.
13
 */
14
 
15
unsigned char foo;
16
volatile unsigned char test_pass;
17
static unsigned char triggers;
18
 
19
void isr (void)
20
{
21
  triggers++;
22
 
23
  if (triggers > 5) {
24
    test_pass = 1;
25
    intr_cntdwn = 255;
26
    intr_cntdwn = 0;
27
  } else
28
    intr_cntdwn = 32;
29
}
30
 
31
int main ()
32
{
33
  int i;
34
  unsigned char check;
35
 
36
  test_pass = 0;
37
  triggers = 0;
38
 
39
  // start interrupt countdown
40
  intr_cntdwn = 64;
41
 
42
  for (i=0; i<200; i++)
43
    check = sim_ctl_port;
44
 
45
  if (test_pass)
46
    sim_ctl (SC_TEST_PASSED);
47
  else
48
    sim_ctl (SC_TEST_FAILED);
49
 
50
  return 0;
51
}
52
 

powered by: WebSVN 2.1.0

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