diff --git a/reactos/boot/armllb/armllb.rbuild b/reactos/boot/armllb/armllb.rbuild new file mode 100644 index 00000000000..482e1c4a120 --- /dev/null +++ b/reactos/boot/armllb/armllb.rbuild @@ -0,0 +1,60 @@ + + + + + + libcntpr + rtl + ./inc + + + + -Wl,--image-base=0x401FEFF8 + + + + + + -Wl,--image-base=0xF000 + + + boot.s + main.c + crtsupp.c + + serial.c + video.c + + + hwdata.c + hwdss.c + hwuart.c + hwinfo.c + + + + + + hwclcd.c + hwuart.c + hwinfo.c + hwinit.c + + + + + loader.c + + + -fms-extensions + -ffreestanding + -fno-builtin + -fno-inline + -fno-zero-initialized-in-bss + -Os + + + -lgcc + + + diff --git a/reactos/boot/armllb/boot.s b/reactos/boot/armllb/boot.s new file mode 100644 index 00000000000..6b0f35bcd5c --- /dev/null +++ b/reactos/boot/armllb/boot.s @@ -0,0 +1,39 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/boot.s + * PURPOSE: Implements the entry point for ARM machines + * PROGRAMMERS: ReactOS Portable Systems Group + */ + + .title "ARM LLB Entry Point" + .include "ntoskrnl/include/internal/arm/kxarm.h" + .include "ntoskrnl/include/internal/arm/ksarm.h" + + NESTED_ENTRY _start + PROLOG_END _start + +#ifdef _OMAP3_ + /* + * On OMAP3, the boot is directly from TI BootROM that reads NAND flash. + * First word is size of program to load. + * Second word is load address of program. Since DDR is not initialized, + * we load to SDRAM at 40200000h. Max 64K. + */ + .word 0x8000 + .word 0x40200000 +#endif + + /* Load C entrypoint and setup LLB stack */ + ldr lr, L_LlbStartup + ldr sp, L_BootStackEnd + bx lr + ENTRY_END _start + +L_BootStackEnd: + .long 0x2000000 + +L_LlbStartup: + .long LlbStartup + +/* EOF */ diff --git a/reactos/boot/armllb/crtsupp.c b/reactos/boot/armllb/crtsupp.c new file mode 100644 index 00000000000..b5a7723a262 --- /dev/null +++ b/reactos/boot/armllb/crtsupp.c @@ -0,0 +1,47 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/crtsupp.c + * PURPOSE: CRT Support Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +int +putchar(int c) +{ + /* Write to the serial port */ +// LlbSerialPutChar(c); + + /* Write to the screen too */ + LlbVideoPutChar(c); + return 0; +} + +int +puts(const char* string) +{ + while (*string) putchar(*string++); + return 0; +} + +int printf(const char *fmt, ...) +{ + va_list args; + unsigned int i; + char printbuffer[1024]; + + va_start (args, fmt); + + /* For this to work, printbuffer must be larger than + * anything we ever want to print. + */ + i = vsprintf (printbuffer, fmt, args); + va_end (args); + + /* Print the string */ + return puts(printbuffer); +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/omap3/hwinfo.c b/reactos/boot/armllb/hw/omap3/hwinfo.c new file mode 100755 index 00000000000..a1bd1cdbbae --- /dev/null +++ b/reactos/boot/armllb/hw/omap3/hwinfo.c @@ -0,0 +1,78 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/omap3/hwinfo.c + * PURPOSE: LLB Hardware Info Routines for OMAP3 + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +ULONG +NTAPI +LlbHwGetScreenWidth(VOID) +{ + return 1280; +} + +ULONG +NTAPI +LlbHwGetScreenHeight(VOID) +{ + return 720; +} + +PVOID +NTAPI +LlbHwGetFrameBuffer(VOID) +{ + return (PVOID)0x80500000; +} + +ULONG +NTAPI +LlbHwGetBoardType(VOID) +{ + return MACH_TYPE_OMAP3_BEAGLE; +} + +ULONG +NTAPI +LlbHwGetPClk(VOID) +{ + return 48000000; +} + +ULONG +NTAPI +LlbHwGetTmr0Base(VOID) +{ + return 0x48318000; +} + +ULONG +NTAPI +LlbHwGetUartBase(IN ULONG Port) +{ + if (Port == 1) + { + return 0x4806A000; + } + else if (Port == 2) + { + return 0x4806C000; + } + else if (Port == 3) + { + return 0x49020000; + } +} + +ULONG +NTAPI +LlbHwGetSerialUart(VOID) +{ + return 3; +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/omap3/hwinit.c b/reactos/boot/armllb/hw/omap3/hwinit.c new file mode 100755 index 00000000000..85ee0556096 --- /dev/null +++ b/reactos/boot/armllb/hw/omap3/hwinit.c @@ -0,0 +1,18 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/omap3/hwinit.c + * PURPOSE: LLB Hardware Initialization Routines for OMAP3 + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +VOID +NTAPI +LlbHwInitialize(VOID) +{ + +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/serial.c b/reactos/boot/armllb/hw/serial.c new file mode 100755 index 00000000000..7bb09cf744d --- /dev/null +++ b/reactos/boot/armllb/hw/serial.c @@ -0,0 +1,25 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/serial.c + * PURPOSE: LLB Serial Port Routines + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +VOID +NTAPI +LlbSerialPutChar(IN CHAR c) +{ + /* Properly support new-lines */ + if (c == '\n') LlbSerialPutChar('\r'); + + /* Wait for ready */ + while (!LlbHwUartTxReady()); + + /* Send character */ + LlbHwUartSendChar(c); +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/versatile/hwclcd.c b/reactos/boot/armllb/hw/versatile/hwclcd.c new file mode 100755 index 00000000000..15fc62905a5 --- /dev/null +++ b/reactos/boot/armllb/hw/versatile/hwclcd.c @@ -0,0 +1,77 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/versatile/hwclcd.c + * PURPOSE: LLB CLCD Routines for Versatile + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2) +#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1) +#define LCDCONTROL_LCDPWR (1 << 11) +#define LCDCONTROL_LCDEN (1) +#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1) +#define LCDCONTROL_LCDTFT (1 << 5) + +#define PL110_LCDTIMING0 (PVOID)0x10120000 +#define PL110_LCDTIMING1 (PVOID)0x10120004 +#define PL110_LCDTIMING2 (PVOID)0x10120008 +#define PL110_LCDUPBASE (PVOID)0x10120010 +#define PL110_LCDLPBASE (PVOID)0x10120014 +#define PL110_LCDCONTROL (PVOID)0x10120018 + +PUSHORT LlbHwVideoBuffer; + +VOID +NTAPI +LlbHwVersaClcdInitialize(VOID) +{ + /* Set framebuffer address */ + WRITE_REGISTER_ULONG(PL110_LCDUPBASE, (ULONG)LlbHwGetFrameBuffer()); + WRITE_REGISTER_ULONG(PL110_LCDLPBASE, (ULONG)LlbHwGetFrameBuffer()); + + /* Initialize timings to 1024x720 */ + WRITE_REGISTER_ULONG(PL110_LCDTIMING0, LCDTIMING0_PPL(LlbHwGetScreenWidth())); + WRITE_REGISTER_ULONG(PL110_LCDTIMING1, LCDTIMING1_LPP(LlbHwGetScreenHeight())); + + /* Enable the TFT/LCD Display */ + WRITE_REGISTER_ULONG(PL110_LCDCONTROL, + LCDCONTROL_LCDEN | + LCDCONTROL_LCDTFT | + LCDCONTROL_LCDPWR | + LCDCONTROL_LCDBPP(4)); +} + +ULONG +NTAPI +LlbHwGetScreenWidth(VOID) +{ + return 640; +} + +ULONG +NTAPI +LlbHwGetScreenHeight(VOID) +{ + return 480; +} + +PVOID +NTAPI +LlbHwGetFrameBuffer(VOID) +{ + return (PVOID)0x1000000; +} + +ULONG +NTAPI +LlbHwVideoCreateColor(IN ULONG Red, + IN ULONG Green, + IN ULONG Blue) +{ + return (((Blue >> 3) << 11)| ((Green >> 2) << 5)| ((Red >> 3) << 0)); +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/versatile/hwinfo.c b/reactos/boot/armllb/hw/versatile/hwinfo.c new file mode 100755 index 00000000000..c7eb76bb77b --- /dev/null +++ b/reactos/boot/armllb/hw/versatile/hwinfo.c @@ -0,0 +1,39 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/versatile/hwinfo.c + * PURPOSE: LLB Hardware Info Routines + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +ULONG +NTAPI +LlbHwGetBoardType(VOID) +{ + return MACH_TYPE_VERSATILE_PB; +} + +ULONG +NTAPI +LlbHwGetPClk(VOID) +{ + return 0x24000000; +} + +ULONG +NTAPI +LlbHwGetTmr0Base(VOID) +{ + return 0x101E2000; +} + +ULONG +NTAPI +LlbHwGetSerialUart(VOID) +{ + return 0; +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/versatile/hwinit.c b/reactos/boot/armllb/hw/versatile/hwinit.c new file mode 100755 index 00000000000..c420e4c3943 --- /dev/null +++ b/reactos/boot/armllb/hw/versatile/hwinit.c @@ -0,0 +1,22 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/versatile/hwinit.c + * PURPOSE: LLB Hardware Initialization Routines for Versatile + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +VOID +NTAPI +LlbHwInitialize(VOID) +{ + /* Setup the CLCD (PL110) */ + LlbHwVersaClcdInitialize(); + + /* Setup the UART (PL011) */ + LlbHwVersaUartInitialize(); +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/versatile/hwuart.c b/reactos/boot/armllb/hw/versatile/hwuart.c new file mode 100755 index 00000000000..f2aa6f114be --- /dev/null +++ b/reactos/boot/armllb/hw/versatile/hwuart.c @@ -0,0 +1,114 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/versatile/hwuart.c + * PURPOSE: LLB UART Initialization Routines for Versatile + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +// +// UART Registers +// +#define UART_PL01x_DR (LlbHwVersaUartBase + 0x00) +#define UART_PL01x_RSR (LlbHwVersaUartBase + 0x04) +#define UART_PL01x_ECR (LlbHwVersaUartBase + 0x04) +#define UART_PL01x_FR (LlbHwVersaUartBase + 0x18) +#define UART_PL011_IBRD (LlbHwVersaUartBase + 0x24) +#define UART_PL011_FBRD (LlbHwVersaUartBase + 0x28) +#define UART_PL011_LCRH (LlbHwVersaUartBase + 0x2C) +#define UART_PL011_CR (LlbHwVersaUartBase + 0x30) +#define UART_PL011_IMSC (LlbHwVersaUartBase + 0x38) + +// +// LCR Values +// +#define UART_PL011_LCRH_WLEN_8 0x60 +#define UART_PL011_LCRH_FEN 0x10 + +// +// FCR Values +// +#define UART_PL011_CR_UARTEN 0x01 +#define UART_PL011_CR_TXE 0x100 +#define UART_PL011_CR_RXE 0x200 + +// +// LSR Values +// +#define UART_PL01x_FR_RXFE 0x10 +#define UART_PL01x_FR_TXFF 0x20 + +static const ULONG LlbHwVersaUartBase = 0x101F1000; + +/* FUNCTIONS ******************************************************************/ + +VOID +LlbHwVersaUartInitialize(VOID) +{ + ULONG Divider, Remainder, Fraction, ClockRate, Baudrate; + + /* Query peripheral rate, hardcore baudrate */ + ClockRate = LlbHwGetPClk(); + Baudrate = 115200; + + /* Calculate baudrate clock divider and remainder */ + Divider = ClockRate / (16 * Baudrate); + Remainder = ClockRate % (16 * Baudrate); + + /* Calculate the fractional part */ + Fraction = (8 * Remainder / Baudrate) >> 1; + Fraction += (8 * Remainder / Baudrate) & 1; + + /* Disable interrupts */ + WRITE_REGISTER_ULONG(UART_PL011_CR, 0); + + /* Set the baud rate to 115200 bps */ + WRITE_REGISTER_ULONG(UART_PL011_IBRD, Divider); + WRITE_REGISTER_ULONG(UART_PL011_FBRD, Fraction); + + /* Set 8 bits for data, 1 stop bit, no parity, FIFO enabled */ + WRITE_REGISTER_ULONG(UART_PL011_LCRH, + UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN); + + /* Clear and enable FIFO */ + WRITE_REGISTER_ULONG(UART_PL011_CR, + UART_PL011_CR_UARTEN | + UART_PL011_CR_TXE | + UART_PL011_CR_RXE); +} + +VOID +NTAPI +LlbHwUartSendChar(IN CHAR Char) +{ + /* Send the character */ + WRITE_REGISTER_ULONG(UART_PL01x_DR, Char); +} + +BOOLEAN +NTAPI +LlbHwUartTxReady(VOID) +{ + /* TX output buffer is ready? */ + return (READ_REGISTER_ULONG(UART_PL01x_FR) & UART_PL01x_FR_TXFF); +} + +ULONG +NTAPI +LlbHwGetUartBase(IN ULONG Port) +{ + if (Port == 0) + { + return 0x101F1000; + } + else if (Port == 1) + { + return 0x101F2000; + } + + return 0; +} + +/* EOF */ diff --git a/reactos/boot/armllb/hw/video.c b/reactos/boot/armllb/hw/video.c new file mode 100644 index 00000000000..2835e6ff9c5 --- /dev/null +++ b/reactos/boot/armllb/hw/video.c @@ -0,0 +1,370 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/hw/video.c + * PURPOSE: LLB Video Output Routines + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +CHAR LlbHwBootFont[] = +{ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x7e,0x81,0xa5,0x81,0xbd,0x99,0x81,0x7e, + 0x7e,0xff,0xdb,0xff,0xc3,0xe7,0xff,0x7e, + 0x6c,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00, + 0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00, + 0x38,0x7c,0x38,0xfe,0xfe,0x7c,0x38,0x7c, + 0x10,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x7c, + 0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00, + 0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff, + 0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00, + 0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff, + 0x0f,0x07,0x0f,0x7d,0xcc,0xcc,0xcc,0x78, + 0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18, + 0x3f,0x33,0x3f,0x30,0x30,0x70,0xf0,0xe0, + 0x7f,0x63,0x7f,0x63,0x63,0x67,0xe6,0xc0, + 0x99,0x5a,0x3c,0xe7,0xe7,0x3c,0x5a,0x99, + 0x80,0xe0,0xf8,0xfe,0xf8,0xe0,0x80,0x00, + 0x02,0x0e,0x3e,0xfe,0x3e,0x0e,0x02,0x00, + 0x18,0x3c,0x7e,0x18,0x18,0x7e,0x3c,0x18, + 0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00, + 0x7f,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x00, + 0x3e,0x63,0x38,0x6c,0x6c,0x38,0xcc,0x78, + 0x00,0x00,0x00,0x00,0x7e,0x7e,0x7e,0x00, + 0x18,0x3c,0x7e,0x18,0x7e,0x3c,0x18,0xff, + 0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x00, + 0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00, + 0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00, + 0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00, + 0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00, + 0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00, + 0x00,0x18,0x3c,0x7e,0xff,0xff,0x00,0x00, + 0x00,0xff,0xff,0x7e,0x3c,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x30,0x78,0x78,0x30,0x30,0x00,0x30,0x00, + 0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00, + 0x6c,0x6c,0xfe,0x6c,0xfe,0x6c,0x6c,0x00, + 0x30,0x7c,0xc0,0x78,0x0c,0xf8,0x30,0x00, + 0x00,0xc6,0xcc,0x18,0x30,0x66,0xc6,0x00, + 0x38,0x6c,0x38,0x76,0xdc,0xcc,0x76,0x00, + 0x60,0x60,0xc0,0x00,0x00,0x00,0x00,0x00, + 0x18,0x30,0x60,0x60,0x60,0x30,0x18,0x00, + 0x60,0x30,0x18,0x18,0x18,0x30,0x60,0x00, + 0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00, + 0x00,0x30,0x30,0xfc,0x30,0x30,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60, + 0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00, + 0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00, + 0x7c,0xc6,0xce,0xde,0xf6,0xe6,0x7c,0x00, + 0x30,0x70,0x30,0x30,0x30,0x30,0xfc,0x00, + 0x78,0xcc,0x0c,0x38,0x60,0xcc,0xfc,0x00, + 0x78,0xcc,0x0c,0x38,0x0c,0xcc,0x78,0x00, + 0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x1e,0x00, + 0xfc,0xc0,0xf8,0x0c,0x0c,0xcc,0x78,0x00, + 0x38,0x60,0xc0,0xf8,0xcc,0xcc,0x78,0x00, + 0xfc,0xcc,0x0c,0x18,0x30,0x30,0x30,0x00, + 0x78,0xcc,0xcc,0x78,0xcc,0xcc,0x78,0x00, + 0x78,0xcc,0xcc,0x7c,0x0c,0x18,0x70,0x00, + 0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00, + 0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x60, + 0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x00, + 0x00,0x00,0xfc,0x00,0x00,0xfc,0x00,0x00, + 0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00, + 0x78,0xcc,0x0c,0x18,0x30,0x00,0x30,0x00, + 0x7c,0xc6,0xde,0xde,0xde,0xc0,0x78,0x00, + 0x30,0x78,0xcc,0xcc,0xfc,0xcc,0xcc,0x00, + 0xfc,0x66,0x66,0x7c,0x66,0x66,0xfc,0x00, + 0x3c,0x66,0xc0,0xc0,0xc0,0x66,0x3c,0x00, + 0xf8,0x6c,0x66,0x66,0x66,0x6c,0xf8,0x00, + 0xfe,0x62,0x68,0x78,0x68,0x62,0xfe,0x00, + 0xfe,0x62,0x68,0x78,0x68,0x60,0xf0,0x00, + 0x3c,0x66,0xc0,0xc0,0xce,0x66,0x3e,0x00, + 0xcc,0xcc,0xcc,0xfc,0xcc,0xcc,0xcc,0x00, + 0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00, + 0x1e,0x0c,0x0c,0x0c,0xcc,0xcc,0x78,0x00, + 0xe6,0x66,0x6c,0x78,0x6c,0x66,0xe6,0x00, + 0xf0,0x60,0x60,0x60,0x62,0x66,0xfe,0x00, + 0xc6,0xee,0xfe,0xfe,0xd6,0xc6,0xc6,0x00, + 0xc6,0xe6,0xf6,0xde,0xce,0xc6,0xc6,0x00, + 0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x38,0x00, + 0xfc,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00, + 0x78,0xcc,0xcc,0xcc,0xdc,0x78,0x1c,0x00, + 0xfc,0x66,0x66,0x7c,0x6c,0x66,0xe6,0x00, + 0x78,0xcc,0xe0,0x70,0x1c,0xcc,0x78,0x00, + 0xfc,0xb4,0x30,0x30,0x30,0x30,0x78,0x00, + 0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xfc,0x00, + 0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x00, + 0xc6,0xc6,0xc6,0xd6,0xfe,0xee,0xc6,0x00, + 0xc6,0xc6,0x6c,0x38,0x38,0x6c,0xc6,0x00, + 0xcc,0xcc,0xcc,0x78,0x30,0x30,0x78,0x00, + 0xfe,0xc6,0x8c,0x18,0x32,0x66,0xfe,0x00, + 0x78,0x60,0x60,0x60,0x60,0x60,0x78,0x00, + 0xc0,0x60,0x30,0x18,0x0c,0x06,0x02,0x00, + 0x78,0x18,0x18,0x18,0x18,0x18,0x78,0x00, + 0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff, + 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x78,0x0c,0x7c,0xcc,0x76,0x00, + 0xe0,0x60,0x60,0x7c,0x66,0x66,0xdc,0x00, + 0x00,0x00,0x78,0xcc,0xc0,0xcc,0x78,0x00, + 0x1c,0x0c,0x0c,0x7c,0xcc,0xcc,0x76,0x00, + 0x00,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00, + 0x38,0x6c,0x60,0xf0,0x60,0x60,0xf0,0x00, + 0x00,0x00,0x76,0xcc,0xcc,0x7c,0x0c,0xf8, + 0xe0,0x60,0x6c,0x76,0x66,0x66,0xe6,0x00, + 0x30,0x00,0x70,0x30,0x30,0x30,0x78,0x00, + 0x0c,0x00,0x0c,0x0c,0x0c,0xcc,0xcc,0x78, + 0xe0,0x60,0x66,0x6c,0x78,0x6c,0xe6,0x00, + 0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00, + 0x00,0x00,0xcc,0xfe,0xfe,0xd6,0xc6,0x00, + 0x00,0x00,0xf8,0xcc,0xcc,0xcc,0xcc,0x00, + 0x00,0x00,0x78,0xcc,0xcc,0xcc,0x78,0x00, + 0x00,0x00,0xdc,0x66,0x66,0x7c,0x60,0xf0, + 0x00,0x00,0x76,0xcc,0xcc,0x7c,0x0c,0x1e, + 0x00,0x00,0xdc,0x76,0x66,0x60,0xf0,0x00, + 0x00,0x00,0x7c,0xc0,0x78,0x0c,0xf8,0x00, + 0x10,0x30,0x7c,0x30,0x30,0x34,0x18,0x00, + 0x00,0x00,0xcc,0xcc,0xcc,0xcc,0x76,0x00, + 0x00,0x00,0xcc,0xcc,0xcc,0x78,0x30,0x00, + 0x00,0x00,0xc6,0xd6,0xfe,0xfe,0x6c,0x00, + 0x00,0x00,0xc6,0x6c,0x38,0x6c,0xc6,0x00, + 0x00,0x00,0xcc,0xcc,0xcc,0x7c,0x0c,0xf8, + 0x00,0x00,0xfc,0x98,0x30,0x64,0xfc,0x00, + 0x1c,0x30,0x30,0xe0,0x30,0x30,0x1c,0x00, + 0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00, + 0xe0,0x30,0x30,0x1c,0x30,0x30,0xe0,0x00, + 0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0x00, + 0x78,0xcc,0xc0,0xcc,0x78,0x18,0x0c,0x78, + 0x00,0xcc,0x00,0xcc,0xcc,0xcc,0x7e,0x00, + 0x1c,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00, + 0x7e,0xc3,0x3c,0x06,0x3e,0x66,0x3f,0x00, + 0xcc,0x00,0x78,0x0c,0x7c,0xcc,0x7e,0x00, + 0xe0,0x00,0x78,0x0c,0x7c,0xcc,0x7e,0x00, + 0x30,0x30,0x78,0x0c,0x7c,0xcc,0x7e,0x00, + 0x00,0x00,0x78,0xc0,0xc0,0x78,0x0c,0x38, + 0x7e,0xc3,0x3c,0x66,0x7e,0x60,0x3c,0x00, + 0xcc,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00, + 0xe0,0x00,0x78,0xcc,0xfc,0xc0,0x78,0x00, + 0xcc,0x00,0x70,0x30,0x30,0x30,0x78,0x00, + 0x7c,0xc6,0x38,0x18,0x18,0x18,0x3c,0x00, + 0xe0,0x00,0x70,0x30,0x30,0x30,0x78,0x00, + 0xc6,0x38,0x6c,0xc6,0xfe,0xc6,0xc6,0x00, + 0x30,0x30,0x00,0x78,0xcc,0xfc,0xcc,0x00, + 0x1c,0x00,0xfc,0x60,0x78,0x60,0xfc,0x00, + 0x00,0x00,0x7f,0x0c,0x7f,0xcc,0x7f,0x00, + 0x3e,0x6c,0xcc,0xfe,0xcc,0xcc,0xce,0x00, + 0x78,0xcc,0x00,0x78,0xcc,0xcc,0x78,0x00, + 0x00,0xcc,0x00,0x78,0xcc,0xcc,0x78,0x00, + 0x00,0xe0,0x00,0x78,0xcc,0xcc,0x78,0x00, + 0x78,0xcc,0x00,0xcc,0xcc,0xcc,0x7e,0x00, + 0x00,0xe0,0x00,0xcc,0xcc,0xcc,0x7e,0x00, + 0x00,0xcc,0x00,0xcc,0xcc,0x7c,0x0c,0xf8, + 0xc3,0x18,0x3c,0x66,0x66,0x3c,0x18,0x00, + 0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0x78,0x00, + 0x18,0x18,0x7e,0xc0,0xc0,0x7e,0x18,0x18, + 0x38,0x6c,0x64,0xf0,0x60,0xe6,0xfc,0x00, + 0xcc,0xcc,0x78,0xfc,0x30,0xfc,0x30,0x30, + 0xf8,0xcc,0xcc,0xfa,0xc6,0xcf,0xc6,0xc7, + 0x0e,0x1b,0x18,0x3c,0x18,0x18,0xd8,0x70, + 0x1c,0x00,0x78,0x0c,0x7c,0xcc,0x7e,0x00, + 0x38,0x00,0x70,0x30,0x30,0x30,0x78,0x00, + 0x00,0x1c,0x00,0x78,0xcc,0xcc,0x78,0x00, + 0x00,0x1c,0x00,0xcc,0xcc,0xcc,0x7e,0x00, + 0x00,0xf8,0x00,0xf8,0xcc,0xcc,0xcc,0x00, + 0xfc,0x00,0xcc,0xec,0xfc,0xdc,0xcc,0x00, + 0x3c,0x6c,0x6c,0x3e,0x00,0x7e,0x00,0x00, + 0x38,0x6c,0x6c,0x38,0x00,0x7c,0x00,0x00, + 0x30,0x00,0x30,0x60,0xc0,0xcc,0x78,0x00, + 0x00,0x00,0x00,0xfc,0xc0,0xc0,0x00,0x00, + 0x00,0x00,0x00,0xfc,0x0c,0x0c,0x00,0x00, + 0xc3,0xc6,0xcc,0xde,0x33,0x66,0xcc,0x0f, + 0xc3,0xc6,0xcc,0xdb,0x37,0x6f,0xcf,0x03, + 0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00, + 0x00,0x33,0x66,0xcc,0x66,0x33,0x00,0x00, + 0x00,0xcc,0x66,0x33,0x66,0xcc,0x00,0x00, + 0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88, + 0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, + 0xdb,0x77,0xdb,0xee,0xdb,0x77,0xdb,0xee, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18, + 0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18, + 0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36, + 0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36, + 0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18, + 0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36, + 0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00, + 0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00, + 0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00, + 0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18, + 0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00, + 0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18, + 0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18, + 0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36, + 0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00, + 0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36, + 0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00, + 0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36, + 0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36, + 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00, + 0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36, + 0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00, + 0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00, + 0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18, + 0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00, + 0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00, + 0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18, + 0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36, + 0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36, + 0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff, + 0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, + 0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f, + 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00, + 0x00,0x00,0x76,0xdc,0xc8,0xdc,0x76,0x00, + 0x00,0x78,0xcc,0xf8,0xcc,0xf8,0xc0,0xc0, + 0x00,0xfc,0xcc,0xc0,0xc0,0xc0,0xc0,0x00, + 0x00,0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x00, + 0xfc,0xcc,0x60,0x30,0x60,0xcc,0xfc,0x00, + 0x00,0x00,0x7e,0xd8,0xd8,0xd8,0x70,0x00, + 0x00,0x66,0x66,0x66,0x66,0x7c,0x60,0xc0, + 0x00,0x76,0xdc,0x18,0x18,0x18,0x18,0x00, + 0xfc,0x30,0x78,0xcc,0xcc,0x78,0x30,0xfc, + 0x38,0x6c,0xc6,0xfe,0xc6,0x6c,0x38,0x00, + 0x38,0x6c,0xc6,0xc6,0x6c,0x6c,0xee,0x00, + 0x1c,0x30,0x18,0x7c,0xcc,0xcc,0x78,0x00, + 0x00,0x00,0x7e,0xdb,0xdb,0x7e,0x00,0x00, + 0x06,0x0c,0x7e,0xdb,0xdb,0x7e,0x60,0xc0, + 0x38,0x60,0xc0,0xf8,0xc0,0x60,0x38,0x00, + 0x78,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00, + 0x00,0xfc,0x00,0xfc,0x00,0xfc,0x00,0x00, + 0x30,0x30,0xfc,0x30,0x30,0x00,0xfc,0x00, + 0x60,0x30,0x18,0x30,0x60,0x00,0xfc,0x00, + 0x18,0x30,0x60,0x30,0x18,0x00,0xfc,0x00, + 0x0e,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0x70, + 0x30,0x30,0x00,0xfc,0x00,0x30,0x30,0x00, + 0x00,0x76,0xdc,0x00,0x76,0xdc,0x00,0x00, + 0x38,0x6c,0x6c,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00, + 0x0f,0x0c,0x0c,0x0c,0xec,0x6c,0x3c,0x1c, + 0x78,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00, + 0x70,0x18,0x30,0x60,0x78,0x00,0x00,0x00, + 0x00,0x00,0x3c,0x3c,0x3c,0x3c,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +}; + +ULONG ScreenCursor; + +VOID +NTAPI +LlbVideoDrawChar(IN CHAR c, + IN ULONG cx, + IN ULONG cy, + IN USHORT Color, + IN USHORT BackColor) +{ + PUSHORT Buffer; + PCHAR Pixels; + CHAR Line; + ULONG x, y, ScreenWidth; + PUSHORT VideoBuffer; + + /* Get screen width and frame buffer */ + ScreenWidth = LlbHwGetScreenWidth(); + VideoBuffer = LlbHwGetFrameBuffer(); + + /* Compute starting address on-screen and in the character-array */ + buffer = VideoBuffer + ScreenWidth * cy + cx; + pixels = LlbHwBootFont + c * 8; + + /* Loop y pixels */ + for (y = 0; y < 8; y++) + { + /* Loop x pixels */ + Line = *Pixels++; + for (x = 7; x >= 0; x--) + { + /* Draw either a character or background pixel */ + Buffer[x] = (Line & 1) ? Color : BackColor; + Line >>= 1; + } + + /* Next line */ + Buffer += ScreenWidth; + } +} + +VOID +NTAPI +LlbVideoClearScreen(VOID) +{ + ULONG ScreenSize, p; + ULONG BackColor; + PUSHORT VideoBuffer; + + /* Get frame buffer and reset cursor position */ + VideoBuffer = LlbHwGetFrameBuffer(); + ScreenCursor = 0; + + /* Backcolor on this machine */ + BackColor = LlbHwVideoCreateColor(14, 0, 82); + BackColor = (BackColor << 16) | BackColor; + + /* Screen size on this machine */ + ScreenSize = LlbHwGetScreenWidth() * LlbHwGetScreenHeight(); + + /* Clear the screen with the given color */ + for (p = 0; p < ScreenSize * 2; p += 4) + { + *(PULONG)((PCHAR)VideoBuffer + p) = BackColor; + } +} + +VOID +NTAPI +LlbVideoPutChar(IN CHAR c) +{ + ULONG cx, cy, CharsPerLine, BackColor; + + /* Forecolor on this machine */ + BackColor = LlbHwVideoCreateColor(14, 0, 82); + + /* Amount of characters in a line */ + CharsPerLine = LlbHwGetScreenWidth() / 8; + + /* Handle new line and scrolling */ + if (c == '\n') + { + /* Move a line down */ + ScreenCursor += CharsPerLine - (ScreenCursor % CharsPerLine); + + /* FIXME: Scrolling */ + } + else + { + /* Calculate character position from pixel position */ + cy = (ScreenCursor / CharsPerLine) * 8; + cx = (ScreenCursor % CharsPerLine) * 8; + + /* Draw the character and increment the cursor */ + LlbVideoDrawChar(c, cx, cy, 0xFFFF, BackColor); + ScreenCursor++; + } +} + +/* EOF */ diff --git a/reactos/boot/armllb/inc/hw.h b/reactos/boot/armllb/inc/hw.h new file mode 100755 index 00000000000..f4e24c2d9cf --- /dev/null +++ b/reactos/boot/armllb/inc/hw.h @@ -0,0 +1,89 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/hw.h + * PURPOSE: LLB Hardware Functions + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +VOID +NTAPI +LlbHwInitialize( + VOID +); + +ULONG +NTAPI +LlbHwGetScreenWidth( + VOID +); + +ULONG +NTAPI +LlbHwGetScreenHeight( + VOID +); + +ULONG +NTAPI +LlbHwVideoCreateColor( + IN ULONG Red, + IN ULONG Green, + IN ULONG Blue +); + +PVOID +NTAPI +LlbHwGetFrameBuffer( + VOID +); + +ULONG +NTAPI +LlbHwGetBoardType( + VOID +); + +ULONG +NTAPI +LlbHwGetPClk( + VOID +); + +ULONG +NTAPI +LlbHwGetTmr0Base( + VOID +); + +ULONG +NTAPI +LlbHwGetUartBase( + IN ULONG Port +); + +ULONG +NTAPI +LlbHwGetSerialUart( + VOID +); + +VOID +NTAPI +LlbHwUartSendChar( + IN CHAR Char +); + +BOOLEAN +NTAPI +LlbHwUartTxReady( + VOID +); + +#ifdef _VERSATILE_ +#include "versa.h" +#elif _OMAP3_ +#include "omap3.h" +#endif + +/* EOF */ diff --git a/reactos/boot/armllb/inc/machtype.h b/reactos/boot/armllb/inc/machtype.h new file mode 100644 index 00000000000..10ecfafeffb --- /dev/null +++ b/reactos/boot/armllb/inc/machtype.h @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/machtype.h + * PURPOSE: Standard machine type definitions defined by Linux/U-boot + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +// +// Marvell Feroceon-based SoC: +// Buffalo Linkstation, KuroBox Pro, D-Link DS323 and others +// +#define MACH_TYPE_FEROCEON 526 + +// +// ARM Versatile PB: +// qemu-system-arm -M versatilepb, RealView Development Boards and others +// +#define MACH_TYPE_VERSATILE_PB 387 + +// +// TI Beagle Board, OMAP3530 SoC +// qemu-system-arm -M beagle, Beagle Board +// +#define MACH_TYPE_OMAP3_BEAGLE 1546 + +/* EOF */ \ No newline at end of file diff --git a/reactos/boot/armllb/inc/osloader.h b/reactos/boot/armllb/inc/osloader.h new file mode 100644 index 00000000000..0e38e373281 --- /dev/null +++ b/reactos/boot/armllb/inc/osloader.h @@ -0,0 +1,57 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/osloader.h + * PURPOSE: Shared header between LLB and OS Loader + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +// +// OS Loader Main Routine +// +typedef +VOID (*OSLOADER_INIT)( + IN PVOID BoardInit +); + +// +// Type of memory detected by LLB +// +typedef enum +{ + BiosMemoryUsable = 1, + BiosMemoryBootLoader, + BiosMemoryBootStrap, + BiosMemoryReserved +} BIOS_MEMORY_TYPE; + +// +// Firmware Memory Map +// +typedef struct +{ + LONGLONG BaseAddress; + LONGLONG Length; + ULONG Type; + ULONG Reserved; +} BIOS_MEMORY_MAP, *PBIOS_MEMORY_MAP; + +// +// Information sent from LLB to OS Loader +// +#define ARM_BOARD_CONFIGURATION_MAJOR_VERSION 1 +#define ARM_BOARD_CONFIGURATION_MINOR_VERSION 1 +typedef struct _ARM_BOARD_CONFIGURATION_BLOCK +{ + ULONG MajorVersion; + ULONG MinorVersion; + ULONG BoardType; + ULONG ClockRate; + ULONG TimerRegisterBase; + ULONG UartRegisterBase; + ULONG MemoryMapEntryCount; + PBIOS_MEMORY_MAP MemoryMap; + CHAR CommandLine[256]; +} ARM_BOARD_CONFIGURATION_BLOCK, *PARM_BOARD_CONFIGURATION_BLOCK; + +/* EOF */ diff --git a/reactos/boot/armllb/inc/precomp.h b/reactos/boot/armllb/inc/precomp.h new file mode 100755 index 00000000000..57e46d6ad94 --- /dev/null +++ b/reactos/boot/armllb/inc/precomp.h @@ -0,0 +1,18 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/precomp.h + * PURPOSE: Precompiled header for LLB + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "ntdef.h" +#include "stdio.h" +#include "ioaccess.h" +#include "machtype.h" +#include "osloader.h" +#include "hw.h" +#include "serial.h" +#include "video.h" + +/* EOF */ diff --git a/reactos/boot/armllb/inc/serial.h b/reactos/boot/armllb/inc/serial.h new file mode 100755 index 00000000000..317cfe32a45 --- /dev/null +++ b/reactos/boot/armllb/inc/serial.h @@ -0,0 +1,15 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/serial.h + * PURPOSE: LLB Serial Port Functions + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +VOID +NTAPI +LlbSerialPutChar( + IN CHAR c +); + +/* EOF */ diff --git a/reactos/boot/armllb/inc/versa.h b/reactos/boot/armllb/inc/versa.h new file mode 100755 index 00000000000..3de745a2fe5 --- /dev/null +++ b/reactos/boot/armllb/inc/versa.h @@ -0,0 +1,21 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/versa.h + * PURPOSE: LLB Board-Specific Hardware Functions for Versatile + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +VOID +NTAPI +LlbHwVersaUartInitialize( + VOID +); + +VOID +NTAPI +LlbHwVersaClcdInitialize( + VOID +); + +/* EOF */ diff --git a/reactos/boot/armllb/inc/video.h b/reactos/boot/armllb/inc/video.h new file mode 100755 index 00000000000..7f9f118333a --- /dev/null +++ b/reactos/boot/armllb/inc/video.h @@ -0,0 +1,21 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/inc/video.h + * PURPOSE: LLB Videl Output Functions + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +VOID +NTAPI +LlbVideoClearScreen( + VOID +); + +VOID +NTAPI +LlbVideoPutChar( + IN CHAR c +); + +/* EOF */ diff --git a/reactos/boot/armllb/main.c b/reactos/boot/armllb/main.c new file mode 100755 index 00000000000..80fc05aafb5 --- /dev/null +++ b/reactos/boot/armllb/main.c @@ -0,0 +1,25 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/main.c + * PURPOSE: Main LLB Code + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +VOID +LlbStartup(VOID) +{ + /* Initialize hardware components */ + LlbHwInitialize(); + + /* Clean up the screen */ + LlbVideoClearScreen(); + + /* Print header */ + printf("ReactOS ARM Low-Level Boot Loader [" __DATE__ " "__TIME__ "]\n\n"); + while (TRUE); +} + +/* EOF */ diff --git a/reactos/boot/armllb/os/loader.c b/reactos/boot/armllb/os/loader.c new file mode 100755 index 00000000000..b595219b9b0 --- /dev/null +++ b/reactos/boot/armllb/os/loader.c @@ -0,0 +1,65 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: boot/armllb/os/loader.c + * PURPOSE: OS Loader Code for LLB + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +#include "precomp.h" + +BIOS_MEMORY_MAP MemoryMap[32]; +ARM_BOARD_CONFIGURATION_BLOCK ArmBlock; + +VOID +NTAPI +AllocateMemoryEntry(IN BIOS_MEMORY_TYPE Type, + IN ULONG BaseAddress, + IN ULONG Length) +{ + PBIOS_MEMORY_MAP Entry; + + /* Get the next memory entry */ + Entry = MemoryMap; + while (Entry->Length) Entry++; + + /* Fill it out */ + Entry->Length = Length; + Entry->BaseAddress = BaseAddress; + Entry->Type = Type; + + /* Block count */ + ArmBlock.MemoryMapEntryCount++; +} + +VOID +NTAPI +LlbSetCommandLine(IN PCHAR CommandLine) +{ + /* Copy the command line in the ARM block */ + strcpy(ArmBlock.CommandLine, CommandLine); +} + +VOID +NTAPI +LlbBuildArmBlock(VOID) +{ + /* Write version number */ + ArmBlock.MajorVersion = ARM_BOARD_CONFIGURATION_MAJOR_VERSION; + ArmBlock.MinorVersion = ARM_BOARD_CONFIGURATION_MINOR_VERSION; + + /* Get arch type */ + ArmBlock.BoardType = LlbHwGetBoardType(); + + /* Get peripheral clock rate */ + ArmBlock.ClockRate = LlbHwGetPClk(); + + /* Get timer and serial port base addresses */ + ArmBlock.TimerRegisterBase = LlbHwGetTmr0Base(); + ArmBlock.UartRegisterBase = LlbHwGetUartBase(LlbHwGetSerialUart()); + + /* Now load the memory map */ + ArmBlock.MemoryMap = MemoryMap; +} + +/* EOF */ diff --git a/reactos/boot/boot.rbuild b/reactos/boot/boot.rbuild index 2b1f0422aac..ff2421c0b8a 100644 --- a/reactos/boot/boot.rbuild +++ b/reactos/boot/boot.rbuild @@ -4,6 +4,11 @@ + + + + +