Last change
on this file since 457 was
368,
checked in by cfuguet, 12 years ago
|
Modification in tsar/trunk/softs/tsar_boot
Writing the carriage return ('\r')character whenever the
line feed character ('\n') is written on the tty.
This modification has been implemented in the boot_putc
function.
Relocating the ldscript of the tsar_boot into each platform
conf directory.
|
File size:
1.7 KB
|
Line | |
---|
1 | #include <boot_tty.h> |
---|
2 | #include <defs.h> |
---|
3 | |
---|
4 | int boot_getc(char *c) |
---|
5 | { |
---|
6 | unsigned int* tty_address = (unsigned int*) TTY_BASE; |
---|
7 | if (ioread32(&tty_address[TTY_STATUS]) == 0) |
---|
8 | return 0; |
---|
9 | |
---|
10 | *c = ioread32(&tty_address[TTY_READ]); |
---|
11 | return 1; |
---|
12 | } |
---|
13 | |
---|
14 | void boot_putc(const char c) |
---|
15 | { |
---|
16 | unsigned int* tty_address = (unsigned int*) TTY_BASE; |
---|
17 | iowrite32(&tty_address[TTY_WRITE], (unsigned int)c); |
---|
18 | |
---|
19 | if (c == '\n') |
---|
20 | { |
---|
21 | iowrite32(&tty_address[TTY_WRITE], (unsigned int)'\r'); |
---|
22 | } |
---|
23 | } |
---|
24 | |
---|
25 | void boot_puts(const char *buffer) |
---|
26 | { |
---|
27 | unsigned int n; |
---|
28 | |
---|
29 | for ( n=0; n<100; n++) |
---|
30 | { |
---|
31 | if (buffer[n] == 0) break; |
---|
32 | |
---|
33 | boot_putc(buffer[n]); |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | void boot_putx(unsigned int val) |
---|
38 | { |
---|
39 | static const char HexaTab[] = "0123456789ABCDEF"; |
---|
40 | char buf[11]; |
---|
41 | unsigned int c; |
---|
42 | |
---|
43 | buf[0] = '0'; |
---|
44 | buf[1] = 'x'; |
---|
45 | buf[10] = 0; |
---|
46 | |
---|
47 | for ( c = 0 ; c < 8 ; c++ ) |
---|
48 | { |
---|
49 | buf[9-c] = HexaTab[val&0xF]; |
---|
50 | val = val >> 4; |
---|
51 | } |
---|
52 | boot_puts(buf); |
---|
53 | } |
---|
54 | |
---|
55 | void boot_putd(unsigned int val) |
---|
56 | { |
---|
57 | static const char DecTab[] = "0123456789"; |
---|
58 | char buf[11]; |
---|
59 | unsigned int i; |
---|
60 | unsigned int first = 0; |
---|
61 | |
---|
62 | buf[10] = 0; |
---|
63 | |
---|
64 | for ( i = 0 ; i < 10 ; i++ ) |
---|
65 | { |
---|
66 | if ((val != 0) || (i == 0)) |
---|
67 | { |
---|
68 | buf[9-i] = DecTab[val % 10]; |
---|
69 | first = 9-i; |
---|
70 | } |
---|
71 | else |
---|
72 | { |
---|
73 | break; |
---|
74 | } |
---|
75 | val /= 10; |
---|
76 | } |
---|
77 | boot_puts( &buf[first] ); |
---|
78 | } |
---|
79 | |
---|
80 | void boot_exit() |
---|
81 | { |
---|
82 | register int pid; |
---|
83 | asm volatile( "mfc0 %0, $15, 1": "=r"(pid) ); |
---|
84 | |
---|
85 | boot_puts("\n!!! Exit Processor "); |
---|
86 | boot_putx(pid); |
---|
87 | boot_puts(" !!!\n"); |
---|
88 | |
---|
89 | while(1) asm volatile("nop"); // infinite loop... |
---|
90 | } |
---|
91 | |
---|
Note: See
TracBrowser
for help on using the repository browser.