diff options
Diffstat (limited to 'tests/simple_grid/test.c')
| -rw-r--r-- | tests/simple_grid/test.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/simple_grid/test.c b/tests/simple_grid/test.c index 07f1123..2891a6e 100644 --- a/tests/simple_grid/test.c +++ b/tests/simple_grid/test.c @@ -1,23 +1,21 @@ -#define X 64 -#define Y 64 +#define X 16 +#define Y 16 void _start(unsigned short x, unsigned short y) { - volatile unsigned long *counter = (unsigned long *)((1ULL << 48) | (1ULL << 32)); + volatile unsigned long *control = (unsigned long *)(((unsigned long)x << 32) | ((unsigned long)y << 48) + 128); volatile char *uart = (char *)4096; /* very hacky, not recommended but good enough for testing */ - if (x == 0 && y == 1) { - *counter = 0; + if (x == 0 && y == 2) { *uart = '0'; *uart = '\n'; } else - while (*counter != ((x << 8) | y)) - ; + *control = 0; /* go to sleep */ *uart = '('; - /* [0 - 63] as two octal numbers */ + /* [0 - 16] as two octal numbers */ *uart = ((x >> 3) & 0x7) + '0'; *uart = ((x >> 0) & 0x7) + '0'; @@ -30,17 +28,17 @@ void _start(unsigned short x, unsigned short y) *uart = ')'; *uart = '\n'; - if (y == 63) { + if (x == 15 && y == 15) + asm ("ebreak\n"); + + if (y == 15) { x++; y = 0; } else y++; - *counter = (x << 8) | y; - - while (*counter != (64 << 8)) - ; - - asm ("ebreak\n"); + volatile unsigned long *next = (unsigned long *)(((unsigned long)x << 32) | ((unsigned long)y << 48) + 128); + *next = 1; /* wake next core */ + *control = 0; /* go to sleep again */ } |
