1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-04 22:54:03 +02:00
iris/mips/nanonote/sdram-setup.ccp
2012-09-26 19:03:36 +02:00

67 lines
2.0 KiB
COBOL

#pypp 0
// Iris: micro-kernel for a capability-based operating system.
// mips/nanonote/sdram-setup.ccp: bootstrapping over usb.
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// This runs like the kernel. In particular, it doesn't want userspace declarations.
#define __KERNEL__
#define dbg_log_char(x) do {} while (0)
#define dbg_log(x) do {} while (0)
#define dbg_log_num(...) do {} while (0)
// Set up gp and sp, jump to start_cpp().
// This must be the first code in the file,
// so also before include jz4740.hh,
// because that defines some static functions which may not be inlined.
asm volatile (".set noreorder\n"
".globl __start\n"
".text\n"
"__start:\n"
"\tmove $t0, $ra\n" // 0
"\tnop\n" // 4
"\tbal 1f\n" // 8
"\tnop\n" // 12
"\t.word _gp\n" // 16
"\t.word 0\n" // 20: This is overwritten in software usbboot mode.
"1:\n"
"\tlw $gp, 0($ra)\n"
"\tlb $a0, 4($ra)\n"
"\tla $sp, stack + 0x40\n"
"\tla $t9, start_cpp\n"
"\tmove $ra, $t0\n"
"\tjr $t9\n"
"\tnop\n"
".set reorder")
#include "jz4740.hh"
void kdebug (unsigned ch):
while !(UART0_LSR & UARTLSR_TDRQ):
UART0_TDR = ch
while !(UART0_LSR & UARTLSR_TEMT):
extern "C":
void start_cpp (int skip_memsetup)
char stack[0x40]
void start_cpp (int skip_memsetup):
setup_uart ()
kdebug ('.')
if !skip_memsetup:
setup_sdram ()
kdebug ('!')
// everything is ok now: return to boot loader to load stage 2.