6 static char mw_logo
[] =
11 " ; .mw. ; Microwatt, it works.\n"
18 static inline uint32_t readl(unsigned long addr
)
21 __asm__
volatile("sync; lwzcix %0,0,%1" : "=r" (val
) : "r" (addr
) : "memory");
25 static inline void writel(uint32_t val
, unsigned long addr
)
27 __asm__
volatile("sync; stwcix %0,0,%1" : : "r" (val
), "r" (addr
) : "memory");
30 void uart_writeuint32(uint32_t val
) {
31 const char lut
[] = { '0', '1', '2', '3', '4', '5', '6', '7',
32 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
33 uint8_t *val_arr
= (uint8_t*)(&val
);
36 for (i
= 0; i
< 4; i
++) {
37 putchar(lut
[(val_arr
[3-i
] >> 4) & 0xF]);
38 putchar(lut
[val_arr
[3-i
] & 0xF]);
49 volatile uint32_t *sram
= 0x0;
52 for (int i
= 0; i
< count
; i
++) {
55 writel(0xBEEF0000+i
, &(sram
[1<<i
]));
58 for (int i
= 0; i
< count
; i
++) {
59 int val
= readl(&(sram
[1<<i
]));
62 uart_writeuint32(val
);
66 unsigned char c
= getchar();
68 if (c
== 13) // if CR send LF