diff options
author | vetch <vetch97@gmail.com> | 2020-01-13 12:40:38 +0100 |
---|---|---|
committer | vetch <vetch97@gmail.com> | 2020-01-13 12:40:38 +0100 |
commit | 1af7591e37d09ddcd734ea07d0e999cf61c8bc5e (patch) | |
tree | a56c73c9eddeb148baffc3a31bf50edbbeb31074 /src/arm/common/io.c | |
parent | 300cf770698142b636da867b7e04bf2d6ae9baa4 (diff) | |
download | rpi-MMU-example-1af7591e37d09ddcd734ea07d0e999cf61c8bc5e.tar.gz rpi-MMU-example-1af7591e37d09ddcd734ea07d0e999cf61c8bc5e.zip |
Great Reorganisation, modify structure and makefile
Diffstat (limited to 'src/arm/common/io.c')
-rw-r--r-- | src/arm/common/io.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/arm/common/io.c b/src/arm/common/io.c new file mode 100644 index 0000000..bf9e0e3 --- /dev/null +++ b/src/arm/common/io.c @@ -0,0 +1,71 @@ +#include <stddef.h> + +#include "io.h" +#include "strings.h" + +void puts(char string[]) +{ + prints(string); + + putchar('\n'); + putchar('\r'); +} + +void prints(char string[]) +{ + for (size_t i = 0; string[i]; i++) + putchar(string[i]); +} + +void error(char string[]) +{ + prints("ERROR! "); + puts(string); + while (1); +} + +void printdec(uint32_t number) +{ + char buf[11]; + + uint32_to_decstring(number, buf); + + prints(buf); +} + +void printhex(uint32_t number) +{ + char buf[9]; + + uint32_to_hexstring(number, buf); + + prints(buf); +} + +void printbin(uint32_t number) +{ + char buf[33]; + + uint32_to_binstring(number, buf); + + prints(buf); +} + +void printdect(uint32_t number) +{ + char buf[11]; + + uint32_to_decstringt(number, buf); + + prints(buf); +} + +void printhext(uint32_t number) +{ + char buf[9]; + + uint32_to_hexstringt(number, buf); + + prints(buf); +} + |