aboutsummaryrefslogtreecommitdiff
path: root/src/arm/common/io.c
blob: bf9e0e3df0adf78cd93d9b990962c5965da8e036 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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);
}