Last change
on this file since 303 was
292,
checked in by cfuguet, 12 years ago
|
Changing directory structure of the TSAR boot loader.
A README.txt file has been included to explain the new structure
and the MAKEFILE parameters.
Erasing the heap segment for the boot elf loader. All the work space
is allocated in the stack.
The stack size is defined in the include/defs.h.
Important modification in the reset.S file. The non-boot
processors (processor id != 0) wait in a low comsumption energy
mode to be wake up by processor 0 using an IPI. Each processor
has a private mailbox in the local XICU. The value written in
the mailbox will be used as address to jump by the processors.
The waking up of non-boot processors is not done in this boot loader
so it must be done in the application loaded.
The boot_loader_elf function loads into memory an executable .elf file
which must be placed in the BOOT_LOADER_LBA block of the disk. This
constant can be defined in the include/defs.h file.
|
File size:
1.6 KB
|
Rev | Line | |
---|
[292] | 1 | #include <boot_tty.h> |
---|
| 2 | #include <defs.h> |
---|
| 3 | |
---|
| 4 | int boot_getc(int *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 | |
---|
| 20 | void boot_puts(const char *buffer) |
---|
| 21 | { |
---|
| 22 | unsigned int n; |
---|
| 23 | |
---|
| 24 | for ( n=0; n<100; n++) |
---|
| 25 | { |
---|
| 26 | if (buffer[n] == 0) break; |
---|
| 27 | boot_putc(buffer[n]); |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | void boot_putx(unsigned int val) |
---|
| 32 | { |
---|
| 33 | static const char HexaTab[] = "0123456789ABCDEF"; |
---|
| 34 | char buf[11]; |
---|
| 35 | unsigned int c; |
---|
| 36 | |
---|
| 37 | buf[0] = '0'; |
---|
| 38 | buf[1] = 'x'; |
---|
| 39 | buf[10] = 0; |
---|
| 40 | |
---|
| 41 | for ( c = 0 ; c < 8 ; c++ ) |
---|
| 42 | { |
---|
| 43 | buf[9-c] = HexaTab[val&0xF]; |
---|
| 44 | val = val >> 4; |
---|
| 45 | } |
---|
| 46 | boot_puts(buf); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | void boot_putd(unsigned int val) |
---|
| 50 | { |
---|
| 51 | static const char DecTab[] = "0123456789"; |
---|
| 52 | char buf[11]; |
---|
| 53 | unsigned int i; |
---|
| 54 | unsigned int first = 0; |
---|
| 55 | |
---|
| 56 | buf[10] = 0; |
---|
| 57 | |
---|
| 58 | for ( i = 0 ; i < 10 ; i++ ) |
---|
| 59 | { |
---|
| 60 | if ((val != 0) || (i == 0)) |
---|
| 61 | { |
---|
| 62 | buf[9-i] = DecTab[val % 10]; |
---|
| 63 | first = 9-i; |
---|
| 64 | } |
---|
| 65 | else |
---|
| 66 | { |
---|
| 67 | break; |
---|
| 68 | } |
---|
| 69 | val /= 10; |
---|
| 70 | } |
---|
| 71 | boot_puts( &buf[first] ); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | void boot_exit() |
---|
| 75 | { |
---|
| 76 | static const char exit_str[] = "\n\r!!! Exit Processor "; |
---|
| 77 | static const char eol_str[] = " !!!\n\r"; |
---|
| 78 | |
---|
| 79 | register int pid; |
---|
| 80 | asm volatile( "mfc0 %0, $15, 1": "=r"(pid) ); |
---|
| 81 | |
---|
| 82 | boot_puts(exit_str); |
---|
| 83 | boot_putx(pid); |
---|
| 84 | boot_puts(eol_str); |
---|
| 85 | |
---|
| 86 | while(1) asm volatile("nop"); // infinite loop... |
---|
| 87 | } |
---|
| 88 | |
---|
Note: See
TracBrowser
for help on using the repository browser.