Stub out some more of the platform code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38921 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author:
|
||||
* François Revol, [email protected].
|
||||
*/
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <string.h>
|
||||
#include "toscalls.h"
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
#include "Handle.h"
|
||||
#include "console.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
|
||||
FILE *stdin, *stdout, *stderr;
|
||||
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
console_init(void)
|
||||
{
|
||||
//TODO
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
void
|
||||
console_clear_screen(void)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
console_width(void)
|
||||
{
|
||||
int columnCount = 80; //XXX: check video mode
|
||||
return columnCount;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
console_height(void)
|
||||
{
|
||||
int lineCount = 25; //XXX: check video mode
|
||||
return lineCount;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
console_set_cursor(int32 x, int32 y)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
console_set_color(int32 foreground, int32 background)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
console_wait_for_key(void)
|
||||
{
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Author:
|
||||
* François Revol, [email protected].
|
||||
*/
|
||||
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
#include <boot/platform/generic/text_console.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t console_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONSOLE_H */
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* calculate_cpu_conversion_factor() was written by Travis Geiselbrecht and
|
||||
* licensed under the NewOS license.
|
||||
*/
|
||||
|
||||
|
||||
#include "cpu.h"
|
||||
#include "amicalls.h"
|
||||
|
||||
#include <OS.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stdio.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <arch_kernel.h>
|
||||
#include <arch_platform.h>
|
||||
#include <arch_system_info.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//#define TRACE_CPU
|
||||
#ifdef TRACE_CPU
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#warning M68K: add set_vbr()
|
||||
|
||||
|
||||
static status_t
|
||||
check_cpu_features()
|
||||
{
|
||||
//TODO
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
#warning M68K: move and implement system_time()
|
||||
static bigtime_t gSystemTimeCounter = 0; //HACK
|
||||
extern "C" bigtime_t
|
||||
system_time(void)
|
||||
{
|
||||
return gSystemTimeCounter++;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C" void
|
||||
spin(bigtime_t microseconds)
|
||||
{
|
||||
bigtime_t time = system_time();
|
||||
while ((system_time() - time) < microseconds)
|
||||
asm volatile ("nop;");
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
cpu_init()
|
||||
{
|
||||
if (check_cpu_features() != B_OK)
|
||||
panic("You need a 68020 or higher in order to boot!\n");
|
||||
|
||||
gKernelArgs.num_cpus = 1;
|
||||
// this will eventually be corrected later on
|
||||
// ...or not!
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef CPU_H
|
||||
#define CPU_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void cpu_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CPU_H */
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "amicalls.h"
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <boot/stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <Errors.h>
|
||||
|
||||
/*! This works only after console_init() was called.
|
||||
*/
|
||||
void
|
||||
panic(const char *format, ...)
|
||||
{
|
||||
struct AlertMessage {
|
||||
UWORD column;
|
||||
UBYTE line;
|
||||
char messages[14+512];
|
||||
} alert = {
|
||||
10, 12,
|
||||
"*** PANIC ***"
|
||||
}
|
||||
|
||||
const char greetings[] = "\n*** PANIC ***";
|
||||
char *buffer = &alert.messages[14];
|
||||
va_list list;
|
||||
|
||||
//platform_switch_to_text_mode();
|
||||
|
||||
memset(buffer, 512);
|
||||
|
||||
va_start(list, format);
|
||||
vsnprintf(buffer, 512-1, format, list);
|
||||
va_end(list);
|
||||
|
||||
DisplayAlert(DEADEND_ALERT, &alert, 30);
|
||||
|
||||
clear_key_buffer();
|
||||
wait_for_key();
|
||||
platform_exit();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dprintf(const char *format, ...)
|
||||
{
|
||||
char buffer[512];
|
||||
va_list list;
|
||||
|
||||
va_start(list, format);
|
||||
vsnprintf(buffer, sizeof(buffer), format, list);
|
||||
va_end(list);
|
||||
|
||||
// Bconput(DEV_AUX, buffer);
|
||||
|
||||
//if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT)
|
||||
// Bconput(DEV_CONSOLE, buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright 2003-2006, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/partitions.h>
|
||||
#include <boot/stdio.h>
|
||||
#include <boot/stage2.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Handle.h"
|
||||
#include "amicalls.h"
|
||||
|
||||
//#define TRACE_DEVICES
|
||||
#ifdef TRACE_DEVICES
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
|
||||
// exported from shell.S
|
||||
extern uint8 gBootedFromImage;
|
||||
extern uint8 gBootDriveAPI; // ATARI_BOOT_DRIVE_API_*
|
||||
extern uint8 gBootDriveID;
|
||||
extern uint32 gBootPartitionOffset;
|
||||
|
||||
#define SCRATCH_SIZE (2*4096)
|
||||
static uint8 gScratchBuffer[SCRATCH_SIZE];
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
|
||||
{
|
||||
TRACE(("boot drive ID: %x\n", gBootDriveID));
|
||||
|
||||
//TODO
|
||||
gKernelArgs.boot_volume.SetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE,
|
||||
gBootedFromImage);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
|
||||
NodeList *list, boot::Partition **_partition)
|
||||
{
|
||||
|
||||
//TODO
|
||||
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_add_block_devices(stage2_args *args, NodeList *devicesList)
|
||||
{
|
||||
//TODO
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
platform_register_boot_device(Node *device)
|
||||
{
|
||||
//TODO
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2004-2007, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "amicalls.h"
|
||||
#include "video.h"
|
||||
//#include "mmu.h"
|
||||
//#include "images.h"
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/menu.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <util/list.h>
|
||||
#include <drivers/driver_settings.h>
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
bool
|
||||
video_mode_hook(Menu *menu, MenuItem *item)
|
||||
{
|
||||
// nothing yet
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Menu *
|
||||
video_mode_menu()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_switch_to_logo(void)
|
||||
{
|
||||
// TODO: implement me
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_switch_to_text_mode(void)
|
||||
{
|
||||
// TODO: implement me
|
||||
}
|
||||
|
||||
|
||||
extern "C" status_t
|
||||
platform_init_video(void)
|
||||
{
|
||||
// TODO: implement me
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
#ifndef VIDEO_H
|
||||
#define VIDEO_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class Menu;
|
||||
class MenuItem;
|
||||
|
||||
bool video_mode_hook(Menu *menu, MenuItem *item);
|
||||
Menu *video_mode_menu();
|
||||
|
||||
#endif /* VIDEO_H */
|
||||
Reference in New Issue
Block a user