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

Subversion Repositories tv80

[/] [tv80/] [branches/] [restruc2/] [tests/] [tv80_env.h] - Blame information for rev 39

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

Line No. Rev Author Line
1 2 ghutchis
// Environment library
2
// Creates definitions of the special I/O ports used by the
3
// environment, as well as some utility functions to allow
4
// programs to print out strings in the test log.
5
 
6
#ifndef TV80_ENV_H
7
#define TV80_ENV_H
8
 
9
sfr at 0x80 sim_ctl_port;
10
sfr at 0x81 msg_port;
11
sfr at 0x82 timeout_port;
12
sfr at 0x83 max_timeout_low;
13
sfr at 0x84 max_timeout_high;
14 32 ghutchis
sfr at 0x90 intr_cntdwn;
15 39 ghutchis
sfr at 0x91 cksum_value;
16
sfr at 0x92 cksum_accum;
17
sfr at 0x93 inc_on_read;
18 2 ghutchis
 
19
#define SC_TEST_PASSED 0x01
20
#define SC_TEST_FAILED 0x02
21
#define SC_DUMPON      0x03
22
#define SC_DUMPOFF     0x04
23
 
24
void print (char *string)
25
{
26
  char *iter;
27
 
28
  timeout_port = 0x02;
29
  timeout_port = 0x01;
30
 
31
  iter = string;
32
  while (*iter != 0) {
33
    msg_port = *iter++;
34
  }
35
}
36
 
37
void print_num (int num)
38
{
39
  int cd = 0;
40
  int i;
41
  char digits[8];
42
 
43
  timeout_port = 0x02;
44
  timeout_port = 0x01;
45
 
46
  while (num > 0) {
47
    digits[cd++] = (num % 10) + '0';
48
    num /= 10;
49
  }
50
  for (i=cd; i>0; i--)
51
    msg_port = digits[i-1];
52
}
53
 
54 32 ghutchis
#define sim_ctl(code) sim_ctl_port = code
55 2 ghutchis
 
56
void set_timeout (unsigned int max_timeout)
57
{
58
  timeout_port = 0x02;
59
 
60
  max_timeout_low = (max_timeout & 0xFF);
61
  max_timeout_high = (max_timeout >> 8);
62
 
63
  timeout_port = 0x01;
64
}
65
 
66
#endif

powered by: WebSVN 2.1.0

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