From 1853f5d6594bc371e4d8e631c24acd011a620915 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 9 Aug 2025 17:20:05 +0300 Subject: refactor mesh3d to match 2d,1d --- tests/simple_mesh3d/test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tests/simple_mesh3d/test.c') diff --git a/tests/simple_mesh3d/test.c b/tests/simple_mesh3d/test.c index 2953d41..e00e717 100644 --- a/tests/simple_mesh3d/test.c +++ b/tests/simple_mesh3d/test.c @@ -6,7 +6,8 @@ static inline void print_int8(volatile char *uart, unsigned x) } __attribute__((always_inline)) -static inline void print_addr(volatile char *uart, unsigned x, unsigned y, unsigned z) +static inline void print_addr(volatile char *uart, unsigned x, unsigned y, + unsigned z) { *uart = '('; print_int8(uart, x); @@ -27,7 +28,8 @@ static inline unsigned wrap(unsigned x, unsigned X) } __attribute__((always_inline)) -static inline unsigned next_idx(unsigned x, unsigned y, unsigned z, unsigned X, unsigned Y, unsigned Z) +static inline unsigned next_idx(unsigned x, unsigned y, unsigned z, unsigned X, + unsigned Y, unsigned Z) { unsigned zi = wrap(z, Z); unsigned yi = zi < z ? wrap(y, Y) : y; @@ -36,11 +38,11 @@ static inline unsigned next_idx(unsigned x, unsigned y, unsigned z, unsigned X, return (xi << 16) | (yi << 8) | zi; } -void _start(unsigned x, unsigned y, unsigned z, unsigned X, unsigned Y, unsigned Z) +void _start(unsigned x, unsigned y, unsigned z, unsigned X, unsigned Y, + unsigned Z) { volatile char *uart = (char *)4096; - /* x = 1ULL << 32, y = 1ULL << 40, z = 1ULL << 48 I guess */ - volatile unsigned *control = (unsigned *)(1ULL << 48); + volatile unsigned *control = (unsigned *)(1ULL << 56); if (x == 0 && y == 0 && z == 2) { @@ -54,7 +56,7 @@ do_work: *control = next_idx(x, y, z, X, Y, Z); if (x == X - 1 && y == Y - 1 && z == Z - 1) - asm("ebreak"); + asm ("ebreak"); /* otherwise just loop */ while (1) {} -- cgit v1.3