Welcome to mirror list, hosted at ThFree Co, Russian Federation.

erc32-io.c « sparc « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 082d9f9c51a81c4bc767b2c6264c2387a6420c27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#define USE_PORT_A

#define RXADATA (int *) 0x01F800E0
#define RXBDATA (int *) 0x01F800E4
#define RXSTAT (int *) 0x01F800E8

void
outbyte (int c)
{
  volatile int *rxstat;
  volatile int *rxadata;
  int rxmask;

  rxstat = RXSTAT;
#ifdef USE_PORT_A
  rxadata = RXADATA;
  rxmask = 6;
#else
  rxadata = RXBDATA;
  rxmask = 0x60000;
#endif

  while ((*rxstat & rxmask) == 0);

  *rxadata = c;
}

int
inbyte (void)
{
  volatile int *rxstat;
  volatile int *rxadata;
  int rxmask;

  rxstat = RXSTAT;
#ifdef USE_PORT_A
  rxadata = RXADATA;
  rxmask = 1;
#else
  rxadata = RXBDATA;
  rxmask = 0x10000;
#endif

  while ((*rxstat & rxmask) == 0);

  return *rxadata;
}