2 BootMii - a Free Software replacement for the Nintendo/BroadOn bootloader.
5 Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
6 Copyright (C) 2009 Andre Heider "dhewg" <dhewg@wiibrew.org>
7 Copyright (C) 2008, 2009 Hector Martin "marcan" <marcan@marcansoft.com>
8 Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
9 Copyright (C) 2009 John Kelley <wiidev@kelley.ca>
11 # This code is licensed to you under the terms of the GNU GPL, version 2;
12 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
15 #include "bootmii_ppc.h"
24 #include "video_low.h"
28 #include "usb/core/core.h"
30 #define MINIMUM_MINI_VERSION 0x00010001
35 static void dsp_reset(void)
37 write16(0x0c00500a, read16(0x0c00500a) & ~0x01f8);
38 write16(0x0c00500a, read16(0x0c00500a) | 0x0010);
39 write16(0x0c005036, 0);
42 static char ascii(char s) {
43 if(s < 0x20) return '.';
44 if(s > 0x7E) return '.';
48 void hexdump(void *d, int len) {
52 for (off=0; off<len; off += 16) {
55 if((i+off)>=len) printf(" ");
56 else printf("%02x ",data[off+i]);
60 if((i+off)>=len) printf(" ");
61 else printf("%c",ascii(data[off+i]));
68 printf("reading OTP...\n");
70 printf("read OTP!\n");
72 hexdump(&otp, sizeof(otp));
74 printf("reading SEEPROM...\n");
76 printf("read SEEPROM!\n");
78 hexdump(&seeprom, sizeof(seeprom));
88 irq_bw_enable(BW_PI_IRQ_RESET);
89 irq_bw_enable(BW_PI_IRQ_HW); //hollywood pic
90 irq_hw_enable(IRQ_OHCI0);
100 VIDEO_SetFrameBuffer(get_xfb());
105 u32 version = ipc_getvers();
106 u16 mini_version_major = version >> 16 & 0xFFFF;
107 u16 mini_version_minor = version & 0xFFFF;
108 printf("Mini version: %d.%0d\n", mini_version_major, mini_version_minor);
110 if (version < MINIMUM_MINI_VERSION) {
111 printf("Sorry, this version of MINI (armboot.bin)\n"
112 "is too old, please update to at least %d.%0d.\n",
113 (MINIMUM_MINI_VERSION >> 16), (MINIMUM_MINI_VERSION & 0xFFFF));
115 ; // better ideas welcome!
119 print_str_noscroll(112, 112, "ohai, world!\n");
121 printf("bye, world!\n");
124 (void) usb_add_device();
127 // just to get sure we are still in this loop
128 //_CPU_ISR_Enable() // don't know why this is needed...