diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-02-24 21:31:46 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-02-24 21:31:46 +0200 |
| commit | e991095180f774e3582329447c291a11499989ba (patch) | |
| tree | 0708d2308a229b932a84d8ae803b31d296f9fc0f /tests/starved_mesh/test.c | |
| parent | 238116c1cf08b93335abd493df110a669786553e (diff) | |
| download | gran-e991095180f774e3582329447c291a11499989ba.tar.gz gran-e991095180f774e3582329447c291a11499989ba.zip | |
overhaul meshes
+ Previous name was grid
Diffstat (limited to 'tests/starved_mesh/test.c')
| -rw-r--r-- | tests/starved_mesh/test.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/starved_mesh/test.c b/tests/starved_mesh/test.c new file mode 100644 index 0000000..c91868c --- /dev/null +++ b/tests/starved_mesh/test.c @@ -0,0 +1,46 @@ +#define X 16 +#define Y 16 + +void _start(unsigned short x, unsigned short y) +{ + volatile unsigned long *counter = (unsigned long *)((unsigned long)1 << 48); + volatile char *uart = (char *)4096; + + /* very hacky, not recommended but good enough for testing */ + if (x == 0 && y == 2) { + *counter = 0; + *uart = '0'; + *uart = '\n'; + } + else + while (*counter != (((unsigned long)x << 16) | y)) + ; + + *uart = '('; + /* [0 - 16] as two octal numbers */ + *uart = ((x >> 3) & 0x7) + '0'; + *uart = ((x >> 0) & 0x7) + '0'; + + *uart = ','; + *uart = ' '; + + *uart = ((y >> 3) & 0x7) + '0'; + *uart = ((y >> 0) & 0x7) + '0'; + + *uart = ')'; + *uart = '\n'; + + if (x == 15 && y == 15) + asm ("ebreak\n"); + + if (y == 15) { + x++; + y = 0; + } + else + y++; + + *counter = ((unsigned long)x << 16) | y; + while (1) + ; +} |
