blob: 91bdad14835c231cd755fecdbe276af6992cbb74 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include <io.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "system.h"
#define msleep(msec) usleep(1000*msec);
#ifdef PIO_0_BASE
pio_write (unsigned int data)
{
IOWR (PIO_0_BASE, 0, data);
}
#endif
void
ebb_write (unsigned int addr, uint8_t data)
{
IOWR (ASYNC_8BIT_BUS_ADAPTER_0_BASE, addr, data);
}
uint8_t
ebb_read (unsigned int addr)
{
return (uint8_t) IORD (ASYNC_8BIT_BUS_ADAPTER_0_BASE, addr);
}
int
main (void)
{
int i;
printf ("Working...\n");
srand (12833213);
for (;;)
{
printf ("W:");
printf(" xx");
printf(" xx");
printf(" xx");
for (i = 0; i < 32; ++i)
{
uint8_t v;
v = rand () & 0xff;
ebb_write (i, v);
printf (" %02x", v);
}
printf ("\n");
msleep (1000);
printf ("R:");
printf (" %02x", ebb_read (0));
printf (" %02x", ebb_read (0));
printf (" %02x", ebb_read (0));
for (i = 0; i < 32; ++i)
{
printf (" %02x", ebb_read (i));
}
printf ("\n");
msleep (1000);
}
}
|