aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/galileo-boards/ev96100/puts.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/galileo-boards/ev96100/puts.c')
-rw-r--r--arch/mips/galileo-boards/ev96100/puts.c138
1 files changed, 0 insertions, 138 deletions
diff --git a/arch/mips/galileo-boards/ev96100/puts.c b/arch/mips/galileo-boards/ev96100/puts.c
deleted file mode 100644
index 49dc6d137b9c..000000000000
--- a/arch/mips/galileo-boards/ev96100/puts.c
+++ /dev/null
@@ -1,138 +0,0 @@
1
2/*
3 * Debug routines which directly access the uart.
4 */
5
6#include <linux/types.h>
7#include <asm/gt64120.h>
8
9
10//#define SERIAL_BASE EV96100_UART0_REGS_BASE
11#define SERIAL_BASE 0xBD000020
12#define NS16550_BASE SERIAL_BASE
13
14#define SERA_CMD 0x0D
15#define SERA_DATA 0x08
16//#define SERB_CMD 0x05
17#define SERB_CMD 20
18#define SERB_DATA 0x00
19#define TX_BUSY 0x20
20
21#define TIMEOUT 0xffff
22#undef SLOW_DOWN
23
24static const char digits[16] = "0123456789abcdef";
25static volatile unsigned char *const com1 = (unsigned char *) SERIAL_BASE;
26
27
28#ifdef SLOW_DOWN
29static inline void slow_down()
30{
31 int k;
32 for (k = 0; k < 10000; k++);
33}
34#else
35#define slow_down()
36#endif
37
38void putch(const unsigned char c)
39{
40 unsigned char ch;
41 int i = 0;
42
43 do {
44 ch = com1[SERB_CMD];
45 slow_down();
46 i++;
47 if (i > TIMEOUT) {
48 break;
49 }
50 } while (0 == (ch & TX_BUSY));
51 com1[SERB_DATA] = c;
52}
53
54void putchar(const unsigned char c)
55{
56 unsigned char ch;
57 int i = 0;
58
59 do {
60 ch = com1[SERB_CMD];
61 slow_down();
62 i++;
63 if (i > TIMEOUT) {
64 break;
65 }
66 } while (0 == (ch & TX_BUSY));
67 com1[SERB_DATA] = c;
68}
69
70void puts(unsigned char *cp)
71{
72 unsigned char ch;
73 int i = 0;
74
75 while (*cp) {
76 do {
77 ch = com1[SERB_CMD];
78 slow_down();
79 i++;
80 if (i > TIMEOUT) {
81 break;
82 }
83 } while (0 == (ch & TX_BUSY));
84 com1[SERB_DATA] = *cp++;
85 }
86 putch('\r');
87 putch('\n');
88}
89
90void fputs(unsigned char *cp)
91{
92 unsigned char ch;
93 int i = 0;
94
95 while (*cp) {
96
97 do {
98 ch = com1[SERB_CMD];
99 slow_down();
100 i++;
101 if (i > TIMEOUT) {
102 break;
103 }
104 } while (0 == (ch & TX_BUSY));
105 com1[SERB_DATA] = *cp++;
106 }
107}
108
109
110void put64(uint64_t ul)
111{
112 int cnt;
113 unsigned ch;
114
115 cnt = 16; /* 16 nibbles in a 64 bit long */
116 putch('0');
117 putch('x');
118 do {
119 cnt--;
120 ch = (unsigned char) (ul >> cnt * 4) & 0x0F;
121 putch(digits[ch]);
122 } while (cnt > 0);
123}
124
125void put32(unsigned u)
126{
127 int cnt;
128 unsigned ch;
129
130 cnt = 8; /* 8 nibbles in a 32 bit long */
131 putch('0');
132 putch('x');
133 do {
134 cnt--;
135 ch = (unsigned char) (u >> cnt * 4) & 0x0F;
136 putch(digits[ch]);
137 } while (cnt > 0);
138}