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

Subversion Repositories tv80

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

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 40 ghutchis
sfr at 0x94 randval;
19 2 ghutchis
 
20
#define SC_TEST_PASSED 0x01
21
#define SC_TEST_FAILED 0x02
22
#define SC_DUMPON      0x03
23
#define SC_DUMPOFF     0x04
24
 
25
void print (char *string)
26
{
27
  char *iter;
28
 
29
  timeout_port = 0x02;
30
  timeout_port = 0x01;
31
 
32
  iter = string;
33
  while (*iter != 0) {
34
    msg_port = *iter++;
35
  }
36
}
37
 
38
void print_num (int num)
39
{
40
  int cd = 0;
41
  int i;
42
  char digits[8];
43
 
44
  timeout_port = 0x02;
45
  timeout_port = 0x01;
46
 
47
  while (num > 0) {
48
    digits[cd++] = (num % 10) + '0';
49
    num /= 10;
50
  }
51
  for (i=cd; i>0; i--)
52
    msg_port = digits[i-1];
53
}
54
 
55 32 ghutchis
#define sim_ctl(code) sim_ctl_port = code
56 2 ghutchis
 
57
void set_timeout (unsigned int max_timeout)
58
{
59
  timeout_port = 0x02;
60
 
61
  max_timeout_low = (max_timeout & 0xFF);
62
  max_timeout_high = (max_timeout >> 8);
63
 
64
  timeout_port = 0x01;
65
}
66
 
67
#endif

powered by: WebSVN 2.1.0

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