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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [tests/] [tv80_env.h] - Blame information for rev 32

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

powered by: WebSVN 2.1.0

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