rvc/test.c
pi 134e85e485 add rng, rtc, networking, more CSR paravirt exts and fixes
honestly forgot what I added all over the last year or so, but here you
go, enjoy more cursed code
2022-11-25 23:11:56 +01:00

24 lines
585 B
C

#include <stdio.h>
#define OFFSET_UINT2_POS(x, y, w, h, n) uint2((x + n) % w, y + ((n + x) / h))
#define RAM_L1_ARRAY_IDX(a) (((a >> 2) & 127) | (((a >> 11) & 0x3) << 7))
void uint2(int x, int y) {
printf("x=%d y=%d\n", x, y);
}
int main() {
OFFSET_UINT2_POS(20, 0, 128, 128, 10);
OFFSET_UINT2_POS(120, 0, 128, 128, 10);
OFFSET_UINT2_POS(20, 3, 128, 128, 140);
OFFSET_UINT2_POS(120, 0, 128, 128, (128*8 + 4));
printf("\n");
for (unsigned int i = 0; i < 128*128*16; i+=4) {
printf("%03d: %d\n", i/4, RAM_L1_ARRAY_IDX(i));
}
return 0;
}