Some atari boot code
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23205 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
921eba6e4d
commit
6152d8f58b
53
src/system/boot/platform/atari_m68k/Jamfile
Normal file
53
src/system/boot/platform/atari_m68k/Jamfile
Normal file
@ -0,0 +1,53 @@
|
||||
SubDir HAIKU_TOP src system boot platform atari_m68k ;
|
||||
|
||||
SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform $(TARGET_BOOT_PLATFORM) ;
|
||||
|
||||
UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
|
||||
UsePrivateHeaders [ FDirName graphics common ] ;
|
||||
#UsePrivateHeaders [ FDirName graphics vesa ] ;
|
||||
UsePrivateHeaders [ FDirName storage ] ;
|
||||
|
||||
{
|
||||
local defines = _BOOT_MODE ;
|
||||
|
||||
defines = [ FDefines $(defines) ] ;
|
||||
SubDirCcFlags $(defines) -Wall -Wno-multichar ;
|
||||
SubDirC++Flags $(defines) -Wall -Wno-multichar -fno-rtti ;
|
||||
}
|
||||
|
||||
#SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons accelerants common ] ;
|
||||
|
||||
KernelMergeObject boot_platform_atari_m68k.o :
|
||||
shell.S
|
||||
start.c
|
||||
debug.c
|
||||
bios.S
|
||||
console.cpp
|
||||
serial.cpp
|
||||
devices.cpp
|
||||
keyboard.cpp
|
||||
menu.cpp
|
||||
mmu.cpp
|
||||
cpu.cpp
|
||||
smp.cpp
|
||||
smp_trampoline.S
|
||||
support.S
|
||||
video.cpp
|
||||
apm.cpp
|
||||
|
||||
# generic
|
||||
text_menu.cpp
|
||||
|
||||
# VESA/DDC EDID
|
||||
#decode_edid.c
|
||||
#dump_edid.c
|
||||
|
||||
: -fno-pic
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles text_menu.cpp ]
|
||||
= [ FDirName $(HAIKU_TOP) src system boot platform generic ] ;
|
||||
|
||||
# Tell the build system to where stage1.bin can be found, so it can be used
|
||||
# elsewhere.
|
||||
SEARCH on stage1.bin = $(SUBDIR) ;
|
42
src/system/boot/platform/atari_m68k/bios.h
Normal file
42
src/system/boot/platform/atari_m68k/bios.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author:
|
||||
* François Revol, revol@free.fr.
|
||||
*/
|
||||
#ifndef _BIOS_H
|
||||
#define _BIOS_H
|
||||
|
||||
/*
|
||||
* Atari BIOS calls
|
||||
*/
|
||||
|
||||
#define BIOS_TRAP XXX
|
||||
|
||||
// BIOSxxx...: x: param type {W|L}
|
||||
|
||||
#define BIOS(nr) \
|
||||
({ uint32 ret; \
|
||||
asm volatile ( \
|
||||
" move #%0,-(sp)\n" \
|
||||
" trap #" #BIOS_TRAP "\n" \
|
||||
" add.l #2,sp" \
|
||||
:: "=r"(ret)); \
|
||||
ret; })
|
||||
|
||||
#define BIOSW(nr, w0) \
|
||||
({ uint32 ret; \
|
||||
asm volatile ( \
|
||||
" move.w %1,-(sp)\n" \
|
||||
" move #" #nr ",-(sp)\n" \
|
||||
" trap #" #BIOS_TRAP "\n" \
|
||||
" add.l #2,sp" \
|
||||
:: "=r"(ret)); \
|
||||
ret; })
|
||||
|
||||
#define Bconin(p0) (uint32)BIOSW(2, p0)
|
||||
//XXX nparams ?
|
||||
#define Kbshift(p0) (uint32)BIOSW(11, p0)
|
||||
|
||||
#endif /* _BIOS_H */
|
54
src/system/boot/platform/atari_m68k/debug.c
Normal file
54
src/system/boot/platform/atari_m68k/debug.c
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "serial.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
/*! This works only after console_init() was called.
|
||||
*/
|
||||
void
|
||||
panic(const char *format, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
platform_switch_to_text_mode();
|
||||
|
||||
puts("*** PANIC ***");
|
||||
|
||||
va_start(list, format);
|
||||
vprintf(format, list);
|
||||
va_end(list);
|
||||
|
||||
puts("\nPress key to reboot.");
|
||||
|
||||
clear_key_buffer();
|
||||
wait_for_key();
|
||||
platform_exit();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dprintf(const char *format, ...)
|
||||
{
|
||||
char buffer[512];
|
||||
va_list list;
|
||||
int length;
|
||||
|
||||
va_start(list, format);
|
||||
length = vsnprintf(buffer, sizeof(buffer), format, list);
|
||||
va_end(list);
|
||||
|
||||
serial_puts(buffer, length);
|
||||
|
||||
if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT)
|
||||
fprintf(stderr, "%s", buffer);
|
||||
}
|
||||
|
24
src/system/boot/platform/atari_m68k/gemdos.h
Normal file
24
src/system/boot/platform/atari_m68k/gemdos.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author:
|
||||
* François Revol, revol@free.fr.
|
||||
*/
|
||||
#ifndef _GEMDOS_H
|
||||
#define _GEMDOS_H
|
||||
|
||||
/*
|
||||
* Atari GEMDOS calls
|
||||
*/
|
||||
|
||||
#define GEMDOS_TRAP 1
|
||||
|
||||
// official names
|
||||
#define Cconin() GEMDOS(1)
|
||||
|
||||
// check for names
|
||||
#define supexec() GEMDOS(0x20)
|
||||
#define terminate() GEMDOS(0)
|
||||
|
||||
#endif /* _GEMDOS_H */
|
78
src/system/boot/platform/atari_m68k/keyboard.cpp
Normal file
78
src/system/boot/platform/atari_m68k/keyboard.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "bios.h"
|
||||
|
||||
#include <boot/platform.h>
|
||||
|
||||
|
||||
static uint16
|
||||
check_for_key(void)
|
||||
{
|
||||
//XXX: non blocking in ?
|
||||
#if 0
|
||||
bios_regs regs;
|
||||
regs.eax = 0x0100;
|
||||
call_bios(0x16, ®s);
|
||||
|
||||
// the zero flag is set when there is no key stroke waiting for us
|
||||
if (regs.flags & ZERO_FLAG)
|
||||
return 0;
|
||||
|
||||
// remove the key from the buffer
|
||||
regs.eax = 0;
|
||||
call_bios(0x16, ®s);
|
||||
|
||||
return regs.eax & 0xffff;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
clear_key_buffer(void)
|
||||
{
|
||||
while (check_for_key() != 0)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
extern "C" union key
|
||||
wait_for_key(void)
|
||||
{
|
||||
union key key;
|
||||
key.d0 = Bconin(2);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
|
||||
extern "C" uint32
|
||||
check_for_boot_keys(void)
|
||||
{
|
||||
union key key;
|
||||
uint32 options = 0;
|
||||
|
||||
while ((key.ax = check_for_key()) != 0) {
|
||||
switch (key.code.ascii) {
|
||||
case ' ':
|
||||
options |= BOOT_OPTION_MENU;
|
||||
break;
|
||||
case 0x1b: // escape
|
||||
options |= BOOT_OPTION_DEBUG_OUTPUT;
|
||||
break;
|
||||
case 0:
|
||||
// evaluate BIOS scan codes
|
||||
// ...
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dprintf("options = %ld\n", options);
|
||||
return options;
|
||||
}
|
||||
|
38
src/system/boot/platform/atari_m68k/keyboard.h
Normal file
38
src/system/boot/platform/atari_m68k/keyboard.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef KEYBOARD_H
|
||||
#define KEYBOARD_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
union key {
|
||||
uint32 d0;
|
||||
struct {
|
||||
uint16 bios; // scan code
|
||||
uint16 ascii;
|
||||
} code;
|
||||
};
|
||||
|
||||
#define BIOS_KEY_UP 0x48
|
||||
#define BIOS_KEY_DOWN 0x50
|
||||
#define BIOS_KEY_LEFT 0x4b
|
||||
#define BIOS_KEY_RIGHT 0x4d
|
||||
// XXX: FIXME
|
||||
#define BIOS_KEY_HOME 0x47
|
||||
#define BIOS_KEY_END 0x4f
|
||||
#define BIOS_KEY_PAGE_UP 0x49
|
||||
#define BIOS_KEY_PAGE_DOWN 0x51
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void clear_key_buffer(void);
|
||||
extern union key wait_for_key(void);
|
||||
extern uint32 check_for_boot_keys(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* KEYBOARD_H */
|
66
src/system/boot/platform/atari_m68k/menu.cpp
Normal file
66
src/system/boot/platform/atari_m68k/menu.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "smp.h"
|
||||
#include "video.h"
|
||||
|
||||
#include <boot/menu.h>
|
||||
#include <boot/platform/generic/text_menu.h>
|
||||
#include <safemode.h>
|
||||
|
||||
|
||||
void
|
||||
platform_add_menus(Menu *menu)
|
||||
{
|
||||
MenuItem *item;
|
||||
|
||||
switch (menu->Type()) {
|
||||
case MAIN_MENU:
|
||||
menu->AddItem(item = new(nothrow) MenuItem("Select fail-safe video mode", video_mode_menu()));
|
||||
item->SetTarget(video_mode_hook);
|
||||
break;
|
||||
case SAFE_MODE_MENU:
|
||||
menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe video mode"));
|
||||
item->SetType(MENU_ITEM_MARKABLE);
|
||||
item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
|
||||
item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver");
|
||||
|
||||
smp_add_safemode_menus(menu);
|
||||
|
||||
#if 0
|
||||
menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));
|
||||
item->SetType(MENU_ITEM_MARKABLE);
|
||||
|
||||
menu->AddItem(item = new(nothrow) MenuItem("Disable APM"));
|
||||
item->SetType(MENU_ITEM_MARKABLE);
|
||||
item->SetData("disable_apm");
|
||||
item->SetHelpText("This overrides the APM setting in the kernel settings file");
|
||||
|
||||
menu->AddItem(item = new(nothrow) MenuItem("Disable ACPI"));
|
||||
item->SetType(MENU_ITEM_MARKABLE);
|
||||
item->SetData(B_SAFEMODE_DISABLE_ACPI);
|
||||
item->SetHelpText("This overrides the ACPI setting in the kernel settings file");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
platform_update_menu_item(Menu *menu, MenuItem *item)
|
||||
{
|
||||
platform_generic_update_text_menu_item(menu, item);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
platform_run_menu(Menu *menu)
|
||||
{
|
||||
platform_generic_run_text_menu(menu);
|
||||
}
|
||||
|
18
src/system/boot/platform/atari_m68k/xbios.h
Normal file
18
src/system/boot/platform/atari_m68k/xbios.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author:
|
||||
* François Revol, revol@free.fr.
|
||||
*/
|
||||
#ifndef _XBIOS_H
|
||||
#define _XBIOS_H
|
||||
|
||||
/*
|
||||
* Atari XBIOS calls
|
||||
*/
|
||||
|
||||
#define BIOS_TRAP 14
|
||||
//#define GEMDOS_TRAP 1
|
||||
|
||||
#endif /* _XBIOS_H */
|
Loading…
Reference in New Issue
Block a user