From 180ffdeaa4b04f39706a1d92a4d14fe78fd31da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 20 Nov 2010 18:25:51 +0000 Subject: [PATCH] Cleanup. Try to exit ARAnyM from platform_exit(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39547 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/atari_m68k/start.cpp | 8 +- .../boot/platform/atari_m68k/toscalls.h | 2 +- src/system/boot/platform/atari_m68k/video.cpp | 109 +++++++----------- 3 files changed, 47 insertions(+), 72 deletions(-) diff --git a/src/system/boot/platform/atari_m68k/start.cpp b/src/system/boot/platform/atari_m68k/start.cpp index d221770f85..c06964a490 100644 --- a/src/system/boot/platform/atari_m68k/start.cpp +++ b/src/system/boot/platform/atari_m68k/start.cpp @@ -112,7 +112,12 @@ platform_start_kernel(void) extern "C" void platform_exit(void) { - // Terminate + // Terminate if running under ARAnyM + int32 nfShutdownId = nat_feat_getid("NF_SHUTDOWN"); + if (nfShutdownId) + nat_feat_call(nfShutdownId, 0); + + // This crashes... // TODO: Puntaes() instead ? Pterm0(); } @@ -143,6 +148,7 @@ _start(void) Bconout(DEV_CON, 'K'); console_init(); Bconout(DEV_CON, 'U'); + Bconout(DEV_CON, '\n'); dprintf("membot = %p\n", (void*)*TOSVAR_membot); dprintf("memtop = %p\n", (void*)*TOSVAR_memtop); dprintf("v_bas_ad = %p\n", *TOSVAR_v_bas_ad); diff --git a/src/system/boot/platform/atari_m68k/toscalls.h b/src/system/boot/platform/atari_m68k/toscalls.h index b9299f772e..41bafda4a5 100644 --- a/src/system/boot/platform/atari_m68k/toscalls.h +++ b/src/system/boot/platform/atari_m68k/toscalls.h @@ -420,7 +420,7 @@ static inline int Bconputs(int16 handle, const char *string) #define Jdisint(intno) toscallW(XBIOS_TRAP, 26, (int16)intno) #define Jenabint(intno) toscallW(XBIOS_TRAP, 27, (int16)intno) #define Supexec(func) toscallP(XBIOS_TRAP, 38, (void *)func) -//#define Puntaes() toscallV(XBIOS_TRAP, 39) +#define Puntaes() toscallV(XBIOS_TRAP, 39) #define DMAread(sect, count, buf, dev) toscallLWPW(XBIOS_TRAP, 42, (int32)sect, (int16)count, (void *)buf, (int16)dev) #define DMAwrite(sect, count, buf, dev) toscallWPLW(XBIOS_TRAP, 43, (int32)sect, (int16)count, (void *)buf, (int16)dev) #define NVMaccess(op, start, count, buffer) toscallWWWP(XBIOS_TRAP, 46, (int16)op, (int16)start, (int16)count, (char *)buffer) diff --git a/src/system/boot/platform/atari_m68k/video.cpp b/src/system/boot/platform/atari_m68k/video.cpp index 7861425a9d..41dc1e90ee 100644 --- a/src/system/boot/platform/atari_m68k/video.cpp +++ b/src/system/boot/platform/atari_m68k/video.cpp @@ -32,22 +32,6 @@ #endif -// XXX: use falcon video monitor detection and build possible mode list there... - -// which API to use to handle this mode -// cf. http://toshyp.atari.org/en/004.html -/* -enum { - MODETYPE_XBIOS_ST, - MODETYPE_XBIOS_TT, - MODETYPE_XBIOS_FALCON, - MODETYPE_CENTSCREEN, - MODETYPE_CRAZYDOTS, - MODETYPE_CT60, - MODETYPE_NATFEAT -}; -*/ - static void dump_vars() { dprintf("v_bas_ad: %d\n", *TOSVAR_v_bas_ad); @@ -56,6 +40,8 @@ dump_vars() { } +// There are several API available to set video modes on atari platforms, +// cf. http://toshyp.atari.org/en/004.html class ModeOps { public: @@ -139,7 +125,6 @@ compare_video_modes(video_mode *a, video_mode *b) static void add_video_mode(video_mode *videoMode) { -dprintf("add_video_mode(%d x %d %s)\n", videoMode->width, videoMode->height, videoMode->ops->Name()); video_mode *mode = NULL; while ((mode = (video_mode *)list_get_next_item(&sModeList, mode)) != NULL) { @@ -222,7 +207,7 @@ ModeOps::MakeLabel(const struct video_mode *mode, char *label, size_t len) class FalconModeOps : public ModeOps { public: - FalconModeOps() : ModeOps("Falcon XBIOS") {}; + FalconModeOps() : ModeOps("Falcon") {}; ~FalconModeOps() {}; virtual status_t Init(); @@ -254,7 +239,6 @@ FalconModeOps::Init() if (c->ivalue < 0x00030000) return ENODEV; fInitStatus = B_OK; - dprintf("FalconModeOps::Init() ok\n"); return fInitStatus; } @@ -266,7 +250,12 @@ FalconModeOps::Enumerate() if (fInitStatus < B_OK) return fInitStatus; - int16 modes[] = { 0x001b, 0x001c, 0x002b, 0x002c, 0x003a, 0x003b, 0x003c, 0x000c, 0x0034, 0x0004/*0x003a, 0x003b, 0x0003, 0x000c, 0x000b, 0x0033, 0x000c, 0x001c*/ }; + static int16 modes[] = { + 0x001b, 0x001c, 0x002b, 0x002c, + 0x003a, 0x003b, 0x003c, 0x000c, + 0x0034, 0x0004 + /*0x003a, 0x003b, 0x0003, 0x000c, + 0x000b, 0x0033, 0x000c, 0x001c*/ }; for (int i = 0; i < sizeof(modes) / sizeof(int16); i++) { video_mode *videoMode = AllocMode(); if (videoMode == NULL) @@ -279,6 +268,8 @@ FalconModeOps::Enumerate() } return B_OK; +#if 0 + // TODO: use falcon video monitor detection and build possible mode list there... int16 monitor; bool vga = false; bool tv = false; @@ -300,6 +291,7 @@ FalconModeOps::Enumerate() break; } return ENODEV; +#endif } @@ -336,19 +328,7 @@ FalconModeOps::Get(struct video_mode *mode) return fInitStatus; int16 m = VsetMode(VM_INQUIRE); - int bpp; - int width = 320; - if (m < 0) - return B_ERROR; - bpp = 1 << (m & 0x0007); - if (m & 0x0008) - width *= 2; - bool vga = (m & 0x0010) != 0; - bool pal = (m & 0x0020) != 0; - bool overscan = (m & 0x0040) != 0; - bool st = (m & 0x0080) != 0; - bool interlace = (m & 0x0100) != 0; - return ENODEV; + return Decode(m, mode); } @@ -361,11 +341,9 @@ FalconModeOps::Set(const struct video_mode *mode) return B_BAD_VALUE; fPreviousMode = VsetMode(VM_INQUIRE); - // XXX this crashes #warning M68K: FIXME: allocate framebuffer dprintf("Switching to mode 0x%04x\n", mode->mode); - //VsetScreen(((uint32)-1), ((uint32)-1), 3, mode->mode); VsetScreen(((uint32)0x00d00000), ((uint32)0x00d00000), 3, mode->mode); return B_OK; @@ -380,11 +358,7 @@ FalconModeOps::Unset(const struct video_mode *mode) if (fPreviousMode != -1) { dprintf("Reverting to mode 0x%04x\n", fPreviousMode); - //VsetScreen((uint32)-1, (uint32)-1, 3, fPreviousMode); - VsetScreen(((uint32)0x00d00000), ((uint32)0x00d00000), 3, fPreviousMode); - // avoid black screen on ARAnyM (bug ?) - //forcepal(); - // VsetMode(fPreviousMode); + VsetScreen(-1, -1, 3, fPreviousMode); fPreviousMode = -1; } @@ -395,10 +369,8 @@ FalconModeOps::Unset(const struct video_mode *mode) status_t FalconModeOps::SetPalette(const struct video_mode *mode, const uint8 *palette) { - //dprintf("%s([%d], %p)\n", __FUNCTION__, mode->bits_per_pixel, palette); switch (mode->bits_per_pixel) { case 4: - //vga_set_palette((const uint8 *)kPalette16, 0, 16); VsetRGB(0, 16, palette); break; case 8: @@ -414,13 +386,13 @@ addr_t FalconModeOps::Framebuffer() { addr_t fb = (addr_t)Physbase(); - dprintf("fb 0x%08lx\n", fb); return fb; } void -FalconModeOps::MakeLabel(const struct video_mode *mode, char *label, size_t len) +FalconModeOps::MakeLabel(const struct video_mode *mode, char *label, + size_t len) { ModeOps::MakeLabel(mode, label, len); label += strlen(label); @@ -497,36 +469,36 @@ NFVDIModeOps::Enumerate() if (fNatFeatId == 0) return B_NO_INIT; - video_mode * videoMode; + video_mode * mode; - videoMode = AllocMode(); - if (videoMode == NULL) + mode = AllocMode(); + if (mode == NULL) return B_ERROR; - Get(videoMode); - //videoMode->space = ; - videoMode->mode = 0; - videoMode->width = 800; - videoMode->height = 600; - videoMode->bits_per_pixel = 8; - videoMode->bytes_per_row = videoMode->width * videoMode->bits_per_pixel / 8; + Get(mode); + //mode->space = ; + mode->mode = 0; + mode->width = 800; + mode->height = 600; + mode->bits_per_pixel = 8; + mode->bytes_per_row = mode->width * mode->bits_per_pixel / 8; - add_video_mode(videoMode); + add_video_mode(mode); - videoMode = AllocMode(); - if (videoMode == NULL) + mode = AllocMode(); + if (mode == NULL) return B_ERROR; - Get(videoMode); - //videoMode->space = ; - videoMode->mode = 0; - videoMode->width = 1024; - videoMode->height = 768; - videoMode->bits_per_pixel = 16; - videoMode->bytes_per_row = videoMode->width * videoMode->bits_per_pixel / 8; + Get(mode); + //mode->space = ; + mode->mode = 0; + mode->width = 1024; + mode->height = 768; + mode->bits_per_pixel = 16; + mode->bytes_per_row = mode->width * mode->bits_per_pixel / 8; - add_video_mode(videoMode); + add_video_mode(mode); return B_OK; @@ -557,7 +529,8 @@ NFVDIModeOps::Set(const struct video_mode *mode) if (fNatFeatId == 0) return B_NOT_SUPPORTED; status_t err; -dprintf("fVDI::Set(%ldx%ld %ld)\n", (int32)Width(mode), (int32)Height(mode), (int32)Depth(mode)); + dprintf("fVDI::Set(%ldx%ld %ld)\n", + (int32)Width(mode), (int32)Height(mode), (int32)Depth(mode)); err = nat_feat_call(fNatFeatId, FVDI_SET_RESOLUTION, (int32)Width(mode), (int32)Height(mode), (int32)Depth(mode)); err = toserror(err); @@ -729,7 +702,6 @@ platform_switch_to_logo(void) addr_t lastBase = gKernelArgs.frame_buffer.physical_buffer.start; size_t lastSize = gKernelArgs.frame_buffer.physical_buffer.size; - // TODO: implement me if (sMode != NULL) { sMode->Set(); @@ -779,7 +751,6 @@ platform_switch_to_logo(void) extern "C" void platform_switch_to_text_mode(void) { - // TODO: implement me if (!gKernelArgs.frame_buffer.enabled) { return; } @@ -797,8 +768,6 @@ platform_init_video(void) gKernelArgs.frame_buffer.enabled = 0; list_init(&sModeList); - - // ToDo: implement me dprintf("current video mode: \n"); dprintf("Vsetmode(-1): 0x%08x\n", VsetMode(VM_INQUIRE)); dump_vars();