mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
use automake
This commit is contained in:
@@ -31,7 +31,7 @@ unbrick_boot_programs = nand sd+mmc usb-mass-storage
|
||||
standard_boot_programs = bootinit
|
||||
|
||||
# use sort to remove duplicates.
|
||||
programs = $(sort init gpio lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs))
|
||||
programs = $(sort init gpio font lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs))
|
||||
|
||||
ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
|
||||
CROSS = mipsel-linux-gnu-
|
||||
|
||||
@@ -84,22 +84,39 @@ void arch_reboot ():
|
||||
while true:
|
||||
|
||||
void arch_poweroff ():
|
||||
sync_serial ()
|
||||
// Power off.
|
||||
// First enable interrupts, so it can be awoken.
|
||||
// Disable all interrupts which shouldn't wake it (only an issue while powering down, really).
|
||||
INTC_IMSR = ~0
|
||||
intc_unmask_irq (IRQ_RTC)
|
||||
intc_unmask_irq (IRQ_GPIO3)
|
||||
GPIO_PXIMS (3) = ~0
|
||||
gpio_unmask_irq (3, 29)
|
||||
// Clear interrupt flags.
|
||||
gpio_ack_irq (3, 29)
|
||||
intc_ack_irq (IRQ_GPIO3)
|
||||
intc_ack_irq (IRQ_RTC)
|
||||
// Clear pending interrupts and enable interrupts.
|
||||
cp0_set (CP0_STATUS, 0x1000ff01)
|
||||
|
||||
// Make sure the rtc is running.
|
||||
cpm_start_rtc ()
|
||||
while !rtc_write_ready ():
|
||||
rtc_enabled ()
|
||||
while !rtc_write_ready ():
|
||||
kdebug ("Power down.\n")
|
||||
sync_serial ()
|
||||
rtc_power_down ()
|
||||
// Wait for power down to work.
|
||||
while !rtc_write_ready ():
|
||||
// Delay a bit more.
|
||||
for unsigned i = 0; i < 1000; ++i:
|
||||
gpio_set (0, 0)
|
||||
// Fall back to reboot.
|
||||
kdebug ("Power down failed! Rebooting instead.\n")
|
||||
arch_reboot ()
|
||||
while true:
|
||||
asm ("wait")
|
||||
|
||||
void arch_suspend ():
|
||||
sync_serial ()
|
||||
// Suspend the system: go into SLEEP mode.
|
||||
cpm_sleep_mode ()
|
||||
asm ("wait")
|
||||
cpm_idle_mode ()
|
||||
|
||||
// Boot into another kernel.
|
||||
void arch_boot (unsigned address, unsigned arg):
|
||||
|
||||
@@ -3532,6 +3532,7 @@ static void cim_enable_nongated_clock_mode ():
|
||||
#define rtc_disabled() ( RTC_RCR &= ~RTC_RCR_RTCE )
|
||||
#define rtc_enable_alarm() ( RTC_RCR |= RTC_RCR_AE )
|
||||
#define rtc_disable_alarm() ( RTC_RCR &= ~RTC_RCR_AE )
|
||||
#define rtc_alarm_is_enabled() ( RTC_RCR & RTC_RCR_AE )
|
||||
#define rtc_enable_alarm_irq() ( RTC_RCR |= RTC_RCR_AIE )
|
||||
#define rtc_disable_alarm_irq() ( RTC_RCR &= ~RTC_RCR_AIE )
|
||||
#define rtc_enable_1Hz_irq() ( RTC_RCR |= RTC_RCR_1HZIE )
|
||||
|
||||
@@ -33,8 +33,8 @@ asm volatile (".section .rodata\n"
|
||||
extern char stage1[1]
|
||||
extern char stage1_end[1]
|
||||
|
||||
unsigned const stage1_load = 0x80002000
|
||||
unsigned const stage1_start = 0x80002000
|
||||
unsigned const stage1_load = 0x80003000
|
||||
unsigned const stage1_start = 0x80003000
|
||||
unsigned const stage1_size = stage1_end - stage1
|
||||
|
||||
class nanonote:
|
||||
|
||||
@@ -30,17 +30,18 @@ asm volatile (".set noreorder\n"
|
||||
".globl __start\n"
|
||||
".text\n"
|
||||
"__start:\n"
|
||||
"\tnop\n"
|
||||
"__hack_label:\n"
|
||||
"\tmove $k0, $ra\n"
|
||||
"\tbal 1f\n"
|
||||
"\tnop\n"
|
||||
"\t.word _gp\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"
|
||||
"\tla $sp, stack + 0x100\n"
|
||||
"\tlb $a0, 4($ra)\n"
|
||||
"\tla $sp, stack + 0x40\n"
|
||||
"\tla $t9, start_cpp\n"
|
||||
"\tmove $ra, $k0\n"
|
||||
"\tmove $ra, $t0\n"
|
||||
"\tjr $t9\n"
|
||||
"\tnop\n"
|
||||
".set reorder")
|
||||
@@ -53,12 +54,13 @@ void kdebug (unsigned ch):
|
||||
while !(UART0_LSR & UARTLSR_TEMT):
|
||||
|
||||
extern "C":
|
||||
void start_cpp ()
|
||||
char stack[0x100]
|
||||
void start_cpp (int skip_memsetup)
|
||||
char stack[0x40]
|
||||
|
||||
void start_cpp ():
|
||||
void start_cpp (int skip_memsetup):
|
||||
setup_uart ()
|
||||
kdebug ('.')
|
||||
setup_sdram ()
|
||||
if !skip_memsetup:
|
||||
setup_sdram ()
|
||||
kdebug ('!')
|
||||
// everything is ok now: return to boot loader to load stage 2.
|
||||
|
||||
@@ -2,7 +2,7 @@ OUTPUT_ARCH(mips)
|
||||
ENTRY(__start)
|
||||
MEMORY
|
||||
{
|
||||
ram : ORIGIN = 0x80002000 , LENGTH = 0x2000
|
||||
ram : ORIGIN = 0x80003000 , LENGTH = 0x800
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
|
||||
@@ -48,7 +48,7 @@ struct data:
|
||||
server->open (port)
|
||||
|
||||
private:
|
||||
static unsigned const STAGE1_LOAD = 0x80002000
|
||||
static unsigned const STAGE1_LOAD = 0x80003000
|
||||
static unsigned const STAGE1_ENTRY = STAGE1_LOAD
|
||||
enum requests:
|
||||
VR_GET_CPU_INFO = 0
|
||||
@@ -245,6 +245,7 @@ void data::send_file (unsigned address, unsigned size, char const *data):
|
||||
handle = NULL
|
||||
return
|
||||
ptr += ret
|
||||
std::cerr << shevek::ostring ("sent %d bytes\n", size)
|
||||
|
||||
void data::get_device (unsigned vendor, unsigned product, unsigned tries):
|
||||
for unsigned i = 0; i < tries; ++i:
|
||||
@@ -314,16 +315,23 @@ void data::boot (std::string const &filename, unsigned load, unsigned entry):
|
||||
|
||||
static void dump_devices ():
|
||||
std::cerr << std::hex << "String: " << Iris::String::ID
|
||||
std::cerr << "\nBlock: " << Iris::Block::ID
|
||||
std::cerr << "\nWString: " << Iris::WString::ID
|
||||
std::cerr << "\nWBlock: " << Iris::WBlock::ID
|
||||
std::cerr << "\nBoot: " << Iris::Boot::ID
|
||||
std::cerr << "\nDevice: " << Iris::Device::ID
|
||||
std::cerr << "\nEvent: " << Iris::Event::ID
|
||||
std::cerr << "\nElfrun: " << Iris::Elfrun::ID
|
||||
std::cerr << "\nParent: " << Iris::Parent::ID
|
||||
std::cerr << "\nKeyboard: " << Iris::Keyboard::ID
|
||||
std::cerr << "\nBuzzer: " << Iris::Buzzer::ID
|
||||
std::cerr << "\nDisplay: " << Iris::Display::ID
|
||||
std::cerr << "\nFont: " << Iris::Display::ID
|
||||
std::cerr << "\nSetting: " << Iris::Setting::ID
|
||||
std::cerr << "\nDirectory: " << Iris::Directory::ID
|
||||
std::cerr << "\nWDirectory: " << Iris::WDirectory::ID
|
||||
std::cerr << "\nStream: " << Iris::Stream::ID
|
||||
std::cerr << "\nUI: " << Iris::UI::ID
|
||||
std::cerr << "\n"
|
||||
|
||||
int main (int argc, char **argv):
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
// Iris: micro-kernel for a capability-based operating system.
|
||||
// mips/nanonote/threadlist.S: List of initial threads.
|
||||
// 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/>.
|
||||
|
||||
.globl init_start
|
||||
.globl thread_start
|
||||
.set noreorder
|
||||
|
||||
#if defined (UDCBOOT)
|
||||
.balign 0x1000
|
||||
thread0:
|
||||
.incbin "fs/bootinit.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread1:
|
||||
.incbin "fs/udc.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread2:
|
||||
|
||||
// Everything from here may be freed after kernel initialization.
|
||||
init_start:
|
||||
|
||||
thread_start:
|
||||
.word thread0
|
||||
.word thread1
|
||||
.word thread2
|
||||
|
||||
#elif defined (SDBOOT)
|
||||
.balign 0x1000
|
||||
thread0:
|
||||
.incbin "fs/bootinit.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread1:
|
||||
.incbin "fs/sd+mmc.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread2:
|
||||
.incbin "fs/partition.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread3:
|
||||
.incbin "fs/fat.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread4:
|
||||
|
||||
// Everything from here may be freed after kernel initialization.
|
||||
init_start:
|
||||
|
||||
thread_start:
|
||||
.word thread0
|
||||
.word thread1
|
||||
.word thread2
|
||||
.word thread3
|
||||
#elif defined (UNBRICK)
|
||||
.balign 0x1000
|
||||
thread0:
|
||||
.incbin "fs/bootinit.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread1:
|
||||
.incbin "fs/sd+mmc.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread2:
|
||||
.incbin "fs/usb-mass-storage.elf"
|
||||
|
||||
.balign 0x1000
|
||||
thread3:
|
||||
|
||||
// Everything from here may be freed after kernel initialization.
|
||||
init_start:
|
||||
|
||||
thread_start:
|
||||
.word thread0
|
||||
.word thread1
|
||||
.word thread2
|
||||
.word thread3
|
||||
|
||||
#else
|
||||
#error "boot method not defined"
|
||||
#endif
|
||||
@@ -35,7 +35,7 @@ static int const run_vendor = 0xfffe
|
||||
static int const run_product = 0x0002
|
||||
static unsigned const timeout = 10000
|
||||
void boot (std::string const &filename, unsigned load, unsigned entry)
|
||||
static unsigned const STAGE1_LOAD = 0x80002000
|
||||
static unsigned const STAGE1_LOAD = 0x80003000
|
||||
static unsigned const STAGE1_ENTRY = STAGE1_LOAD
|
||||
enum requests:
|
||||
VR_GET_CPU_INFO = 0
|
||||
|
||||
Reference in New Issue
Block a user