Merge branch 'master' into sam460ex
This commit is contained in:
@@ -27,10 +27,9 @@ KernelMergeObject boot_arch_$(TARGET_ARCH).o :
|
||||
arch_uart_8250.cpp
|
||||
arch_uart_pl011.cpp
|
||||
arch_elf.cpp
|
||||
arch_video.cpp
|
||||
arch_video_920.cpp
|
||||
arch_video_pxa.cpp
|
||||
arch_video_omap3.cpp
|
||||
arch_framebuffer_920.cpp
|
||||
arch_framebuffer_pxa.cpp
|
||||
arch_framebuffer_omap3.cpp
|
||||
$(librootArchObjects)
|
||||
: -fno-pic
|
||||
:
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander von Gluck IV, [email protected]
|
||||
*/
|
||||
#ifndef _ARCH_FRAMEBUFFER_H
|
||||
#define _ARCH_FRAMEBUFFER_H
|
||||
|
||||
|
||||
#include <boot/platform.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x...) dprintf(x)
|
||||
# define CALLED() dprintf("%s()\n", __func__);
|
||||
#else
|
||||
# define TRACE(x...) ;
|
||||
# define CALLED() ;
|
||||
#endif
|
||||
#define ERROR(x...) dprintf(x)
|
||||
|
||||
|
||||
class ArchFramebuffer {
|
||||
public:
|
||||
ArchFramebuffer(addr_t base)
|
||||
:
|
||||
fBase(base) {};
|
||||
~ArchFramebuffer() {};
|
||||
|
||||
virtual status_t Init() { return B_OK; };
|
||||
virtual status_t Probe() { return B_OK; };
|
||||
virtual status_t SetDefaultMode() { return B_OK; };
|
||||
virtual status_t SetVideoMode(int width, int height, int depth)
|
||||
{ return B_OK; };
|
||||
|
||||
virtual addr_t Base() { return fBase; };
|
||||
|
||||
protected:
|
||||
addr_t fBase;
|
||||
private:
|
||||
int fCurrentWidth;
|
||||
int fCurrentHeight;
|
||||
int fCurrentDepth;
|
||||
};
|
||||
|
||||
|
||||
#endif /* _ARCH_FRAMEBUFFER_H */
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright 2009-2012 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* François Revol, [email protected]
|
||||
* Alexander von Gluck IV, [email protected]
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_framebuffer.h"
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/menu.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <boot/platform/generic/video.h>
|
||||
#include <drivers/driver_settings.h>
|
||||
|
||||
|
||||
class ArchFBArm920 : public ArchFramebuffer {
|
||||
public:
|
||||
ArchFBArm920(addr_t base);
|
||||
~ArchFBArm920();
|
||||
status_t Init();
|
||||
status_t Probe();
|
||||
status_t SetDefaultMode();
|
||||
status_t SetVideoMode(int width, int height, int depth);
|
||||
};
|
||||
|
||||
ArchFBArm920 *arch_get_fb_arm_920(addr_t base);
|
||||
|
||||
|
||||
status_t
|
||||
ArchFBArm920::Init()
|
||||
{
|
||||
gKernelArgs.frame_buffer.enabled = true;
|
||||
|
||||
#warning TODO: ARM920 init
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ArchFBArm920::Probe()
|
||||
{
|
||||
#if 0
|
||||
// TODO: More dynamic framebuffer base?
|
||||
if (!fBase) {
|
||||
int err = platform_allocate_region(&gFrameBufferBase,
|
||||
gKernelArgs.frame_buffer.physical_buffer.size, 0, false);
|
||||
if (err < B_OK)
|
||||
return err;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start
|
||||
= (addr_t)gFrameBufferBase;
|
||||
dprintf("video framebuffer: %p\n", gFrameBufferBase);
|
||||
}
|
||||
#else
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = fBase;
|
||||
#endif
|
||||
|
||||
gKernelArgs.frame_buffer.depth = 16;
|
||||
gKernelArgs.frame_buffer.width = 1024;
|
||||
gKernelArgs.frame_buffer.height = 768;
|
||||
gKernelArgs.frame_buffer.bytes_per_row = gKernelArgs.frame_buffer.width * 2;
|
||||
gKernelArgs.frame_buffer.physical_buffer.size
|
||||
= gKernelArgs.frame_buffer.width
|
||||
* gKernelArgs.frame_buffer.height
|
||||
* gKernelArgs.frame_buffer.depth / 8;
|
||||
|
||||
dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ArchFBArm920::SetDefaultMode()
|
||||
{
|
||||
return SetVideoMode(gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height,
|
||||
gKernelArgs.frame_buffer.depth);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ArchFBArm920::SetVideoMode(int width, int height, int depth)
|
||||
{
|
||||
#warning TODO: ArchFBArm920 SetVideoMode
|
||||
return B_OK;
|
||||
}
|
||||
+99
-79
@@ -1,11 +1,16 @@
|
||||
/*
|
||||
* Copyright 2009, François Revol, revol@free.fr.
|
||||
* Copyright 2009-2012 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* François Revol, revol@free.fr
|
||||
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_video.h"
|
||||
#include "arch_framebuffer.h"
|
||||
|
||||
#include <arch/arm/omap3.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/platform.h>
|
||||
@@ -20,30 +25,35 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "graphics/omap/omap3_regs.h"
|
||||
|
||||
|
||||
//XXX
|
||||
extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags);
|
||||
extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size,
|
||||
uint32 flags);
|
||||
|
||||
|
||||
#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define write_io_32(a, v) ((*(vuint32 *)a) = v)
|
||||
#define read_io_32(a) (*(vuint32 *)a)
|
||||
|
||||
#define dumpr(a) dprintf("LCC:%s:0x%lx\n", #a, read_io_32(a))
|
||||
|
||||
|
||||
class ArchFBArmOmap3 : public ArchFramebuffer {
|
||||
public:
|
||||
ArchFBArmOmap3(addr_t base);
|
||||
~ArchFBArmOmap3();
|
||||
status_t Init();
|
||||
status_t Probe();
|
||||
status_t SetDefaultMode();
|
||||
status_t SetVideoMode(int width, int height, int depth);
|
||||
};
|
||||
|
||||
ArchFBArmOmap3 *arch_get_fb_arm_omap3(addr_t base);
|
||||
|
||||
|
||||
#if BOARD_CPU_OMAP3
|
||||
// #pragma mark -
|
||||
|
||||
#include "graphics/omap/omap3_regs.h"
|
||||
|
||||
extern void *gFrameBufferBase;
|
||||
|
||||
struct video_mode {
|
||||
short width, height;
|
||||
@@ -87,13 +97,15 @@ struct video_mode modes[] = {
|
||||
};
|
||||
|
||||
|
||||
static inline void setaddr(uint32 reg, unsigned int v)
|
||||
static inline void
|
||||
setaddr(uint32 reg, unsigned int v)
|
||||
{
|
||||
*((volatile uint32 *)(reg)) = v;
|
||||
}
|
||||
|
||||
|
||||
static inline void modaddr(unsigned int reg, unsigned int m, unsigned int v)
|
||||
static inline void
|
||||
modaddr(unsigned int reg, unsigned int m, unsigned int v)
|
||||
{
|
||||
uint32 o;
|
||||
|
||||
@@ -104,31 +116,35 @@ static inline void modaddr(unsigned int reg, unsigned int m, unsigned int v)
|
||||
}
|
||||
|
||||
|
||||
static inline void setreg(uint32 base, unsigned int reg, unsigned int v)
|
||||
static inline
|
||||
void setreg(uint32 base, unsigned int reg, unsigned int v)
|
||||
{
|
||||
*((volatile uint32 *)(base+reg)) = v;
|
||||
*((volatile uint32 *)(base + reg)) = v;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32 readreg(uint32 base, unsigned int reg)
|
||||
static inline
|
||||
uint32 readreg(uint32 base, unsigned int reg)
|
||||
{
|
||||
return *((volatile uint32 *)(base+reg));
|
||||
return *((volatile uint32 *)(base + reg));
|
||||
}
|
||||
|
||||
|
||||
static inline void modreg(uint32 base, unsigned int reg, unsigned int m, unsigned int v)
|
||||
static inline void
|
||||
modreg(uint32 base, unsigned int reg, unsigned int m, unsigned int v)
|
||||
{
|
||||
uint32 o;
|
||||
|
||||
o = *((volatile uint32 *)(base+reg));
|
||||
o = *((volatile uint32 *)(base + reg));
|
||||
o &= ~m;
|
||||
o |= v;
|
||||
*((volatile uint32 *)(base+reg)) = o;
|
||||
*((volatile uint32 *)(base + reg)) = o;
|
||||
}
|
||||
|
||||
|
||||
// init beagle gpio for video
|
||||
static void omap_beagle_init(void)
|
||||
static void
|
||||
omap_beagle_init(void)
|
||||
{
|
||||
// setup GPIO stuff, i can't find any references to these
|
||||
setreg(GPIO1_BASE, GPIO_OE, 0xfefffedf);
|
||||
@@ -137,7 +153,8 @@ static void omap_beagle_init(void)
|
||||
}
|
||||
|
||||
|
||||
static void omap_clock_init(void)
|
||||
static void
|
||||
omap_clock_init(void)
|
||||
{
|
||||
// sets pixel clock to 72MHz
|
||||
|
||||
@@ -159,15 +176,18 @@ static void omap_clock_init(void)
|
||||
}
|
||||
|
||||
|
||||
static void omap_dss_init(void)
|
||||
static void
|
||||
omap_dss_init(void)
|
||||
{
|
||||
setreg(DSS_BASE, DSS_SYSCONFIG, DSS_AUTOIDLE);
|
||||
// Select DSS1 ALWON as clock source
|
||||
setreg(DSS_BASE, DSS_CONTROL, DSS_VENC_OUT_SEL | DSS_DAC_POWERDN_BGZ | DSS_DAC_DEMEN | DSS_VENC_CLOCK_4X_ENABLE);
|
||||
setreg(DSS_BASE, DSS_CONTROL, DSS_VENC_OUT_SEL | DSS_DAC_POWERDN_BGZ
|
||||
| DSS_DAC_DEMEN | DSS_VENC_CLOCK_4X_ENABLE);
|
||||
}
|
||||
|
||||
|
||||
static void omap_dispc_init(void)
|
||||
static void
|
||||
omap_dispc_init(void)
|
||||
{
|
||||
uint32 DISPC = DISPC_BASE;
|
||||
|
||||
@@ -213,25 +233,27 @@ static void omap_dispc_init(void)
|
||||
}
|
||||
|
||||
|
||||
static void omap_set_lcd_mode(int w, int h) {
|
||||
static void
|
||||
omap_set_lcd_mode(int w, int h)
|
||||
{
|
||||
uint32 DISPC = DISPC_BASE;
|
||||
unsigned int i;
|
||||
struct video_mode *m;
|
||||
|
||||
dprintf("omap3: set_lcd_mode %d,%d\n", w, h);
|
||||
|
||||
for (i=0;i<sizeof(modes)/sizeof(modes[0]);i++) {
|
||||
if (w <= modes[i].width
|
||||
&& h <= modes[i].height)
|
||||
for (i = 0; i < sizeof(modes) / sizeof(modes[0]); i++) {
|
||||
if (w <= modes[i].width
|
||||
&& h <= modes[i].height)
|
||||
goto found;
|
||||
}
|
||||
i -= 1;
|
||||
found:
|
||||
m = &modes[i];
|
||||
|
||||
|
||||
dprintf("omap3: found mode[%s]\n", m->name);
|
||||
|
||||
setreg(DISPC, DISPC_SIZE_LCD, (m->width - 1) | ((m->height-1) << 16));
|
||||
setreg(DISPC, DISPC_SIZE_LCD, (m->width - 1) | ((m->height - 1) << 16));
|
||||
setreg(DISPC, DISPC_TIMING_H, m->dispc_timing_h);
|
||||
setreg(DISPC, DISPC_TIMING_V, m->dispc_timing_v);
|
||||
|
||||
@@ -240,20 +262,21 @@ found:
|
||||
|
||||
// Tell hardware to update, and wait for it
|
||||
modreg(DISPC, DISPC_CONTROL,
|
||||
DISPC_GOLCD,
|
||||
DISPC_GOLCD);
|
||||
DISPC_GOLCD,
|
||||
DISPC_GOLCD);
|
||||
|
||||
while ((readreg(DISPC, DISPC_CONTROL) & DISPC_GOLCD))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
static void omap_attach_framebuffer(void *data, int width, int height, int depth)
|
||||
static void
|
||||
omap_attach_framebuffer(addr_t data, int width, int height, int depth)
|
||||
{
|
||||
uint32 DISPC = DISPC_BASE;
|
||||
uint32 gsize = ((height-1)<<16) | (width-1);
|
||||
uint32 gsize = ((height - 1) << 16) | (width - 1);
|
||||
|
||||
dprintf("omap3: attach bitmap (%d,%d) %p to screen\n", width, height, data);
|
||||
dprintf("omap3: attach bitmap (%d,%d) to screen\n", width, height);
|
||||
|
||||
setreg(DISPC, DISPC_GFX_BA0, (uint32)data);
|
||||
setreg(DISPC, DISPC_GFX_BA1, (uint32)data);
|
||||
@@ -263,23 +286,21 @@ static void omap_attach_framebuffer(void *data, int width, int height, int depth
|
||||
setreg(DISPC, DISPC_GFX_ROW_INC, 1);
|
||||
setreg(DISPC, DISPC_GFX_PIXEL_INC, 1);
|
||||
setreg(DISPC, DISPC_GFX_WINDOW_SKIP, 0);
|
||||
setreg(DISPC, DISPC_GFX_ATTRIBUTES,
|
||||
DISPC_GFXFORMAT_RGB16
|
||||
| DISPC_GFXBURSTSIZE_16x32
|
||||
| DISPC_GFXENABLE);
|
||||
setreg(DISPC, DISPC_GFX_ATTRIBUTES, DISPC_GFXFORMAT_RGB16
|
||||
| DISPC_GFXBURSTSIZE_16x32 | DISPC_GFXENABLE);
|
||||
|
||||
// Tell hardware to update, and wait for it
|
||||
modreg(DISPC, DISPC_CONTROL,
|
||||
DISPC_GOLCD,
|
||||
DISPC_GOLCD);
|
||||
|
||||
modreg(DISPC, DISPC_CONTROL, DISPC_GOLCD, DISPC_GOLCD);
|
||||
|
||||
while ((readreg(DISPC, DISPC_CONTROL) & DISPC_GOLCD))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
static void omap_init(void) {
|
||||
dprintf("omap3: video_init()\n");
|
||||
status_t
|
||||
ArchFBArmOmap3::Init()
|
||||
{
|
||||
gKernelArgs.frame_buffer.enabled = true;
|
||||
|
||||
setreg(DISPC_BASE, DISPC_IRQENABLE, 0x00000);
|
||||
setreg(DISPC_BASE, DISPC_IRQSTATUS, 0x1ffff);
|
||||
@@ -288,64 +309,63 @@ static void omap_init(void) {
|
||||
omap_clock_init();
|
||||
omap_dss_init();
|
||||
omap_dispc_init();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_probe_video_mode(void)
|
||||
ArchFBArmOmap3::Probe()
|
||||
{
|
||||
|
||||
#if 0
|
||||
// TODO: More dynamic framebuffer base?
|
||||
if (!fBase) {
|
||||
int err = platform_allocate_region(&gFrameBufferBase,
|
||||
gKernelArgs.frame_buffer.physical_buffer.size, 0, false);
|
||||
if (err < B_OK) return err;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start
|
||||
= (addr_t)gFrameBufferBase;
|
||||
dprintf("video framebuffer: %p\n", gFrameBufferBase);
|
||||
}
|
||||
#else
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = fBase;
|
||||
#endif
|
||||
|
||||
gKernelArgs.frame_buffer.depth = 16;
|
||||
gKernelArgs.frame_buffer.width = 1024;
|
||||
gKernelArgs.frame_buffer.height = 768;
|
||||
gKernelArgs.frame_buffer.bytes_per_row = gKernelArgs.frame_buffer.width * 2;
|
||||
gKernelArgs.frame_buffer.physical_buffer.size = gKernelArgs.frame_buffer.width
|
||||
gKernelArgs.frame_buffer.physical_buffer.size
|
||||
= gKernelArgs.frame_buffer.width
|
||||
* gKernelArgs.frame_buffer.height
|
||||
* gKernelArgs.frame_buffer.depth / 8;
|
||||
|
||||
#if 0
|
||||
if (!gFrameBufferBase) {
|
||||
int err = platform_allocate_region(&gFrameBufferBase, gKernelArgs.frame_buffer.physical_buffer.size, 0, false);
|
||||
if (err < B_OK) return err;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;
|
||||
dprintf("video framebuffer: %p\n", gFrameBufferBase);
|
||||
}
|
||||
#else
|
||||
gFrameBufferBase = (void *)0x88000000;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;
|
||||
#endif
|
||||
|
||||
dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
|
||||
TRACE("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth);
|
||||
|
||||
gKernelArgs.frame_buffer.enabled = true;
|
||||
|
||||
omap_init();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_video_mode(int width, int height, int depth)
|
||||
ArchFBArmOmap3::SetVideoMode(int width, int height, int depth)
|
||||
{
|
||||
dprintf("arch_set_video_mode %d,%d @ %d\n", width, height, depth);
|
||||
TRACE("%s: %dx%d@%d\n", __func__, width, height, depth);
|
||||
|
||||
omap_set_lcd_mode(width, height);
|
||||
omap_attach_framebuffer(gFrameBufferBase, width, height, depth);
|
||||
omap_attach_framebuffer(fBase, width, height, depth);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_default_video_mode()
|
||||
ArchFBArmOmap3::SetDefaultMode()
|
||||
{
|
||||
dprintf("arch_set_default_video_mode()\n");
|
||||
CALLED();
|
||||
|
||||
return arch_set_video_mode(1024, 768, 16);
|
||||
return SetVideoMode(gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height,
|
||||
gKernelArgs.frame_buffer.depth);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+78
-62
@@ -1,10 +1,14 @@
|
||||
/*
|
||||
* Copyright 2009, François Revol, revol@free.fr.
|
||||
* Copyright 2009-2012 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* François Revol, revol@free.fr
|
||||
* Alexander von Gluck IV, kallisti5@unixzen.com
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_video.h"
|
||||
#include "arch_framebuffer.h"
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
@@ -20,16 +24,27 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//XXX
|
||||
extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags);
|
||||
extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size,
|
||||
uint32 flags);
|
||||
|
||||
|
||||
#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
class ArchFBArmPxa270 : public ArchFramebuffer {
|
||||
public:
|
||||
ArchFBArmPxa270(addr_t base);
|
||||
~ArchFBArmPxa270();
|
||||
status_t Init();
|
||||
status_t Probe();
|
||||
status_t SetDefaultMode();
|
||||
status_t SetVideoMode(int width, int height, int depth);
|
||||
};
|
||||
|
||||
ArchFBArmPxa270 *arch_get_fb_arm_pxa270(addr_t base);
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
#define write_io_32(a, v) ((*(vuint32 *)a) = v)
|
||||
#define read_io_32(a) (*(vuint32 *)a)
|
||||
@@ -37,21 +52,48 @@ extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, u
|
||||
#define dumpr(a) dprintf("LCC:%s:0x%lx\n", #a, read_io_32(a))
|
||||
|
||||
|
||||
|
||||
#if BOARD_CPU_PXA270
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern void *gFrameBufferBase;
|
||||
static struct pxa27x_lcd_dma_descriptor sVideoDMADesc;
|
||||
static uint32 scratch[128] __attribute__((aligned(16)));
|
||||
|
||||
|
||||
status_t
|
||||
arch_probe_video_mode(void)
|
||||
ArchFBArmPxa270::Init()
|
||||
{
|
||||
dprintf("%s()\n", __FUNCTION__);
|
||||
uint32 bppCode, pixelFormat;
|
||||
gKernelArgs.frame_buffer.enabled = true;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ArchFBArmPxa270::Probe()
|
||||
{
|
||||
CALLED();
|
||||
|
||||
#if 0
|
||||
// TODO: More dynamic framebuffer base?
|
||||
if (!fBase) {
|
||||
// XXX: realloc if larger !!!
|
||||
err = platform_allocate_region(&gFrameBufferBase, fbSize, 0, false);
|
||||
dprintf("error %08x\n", err);
|
||||
if (err < B_OK)
|
||||
return err;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start
|
||||
= (addr_t)gFrameBufferBase;
|
||||
/*
|
||||
gFrameBufferBase = (void *)mmu_map_physical_memory(
|
||||
0xa8000000, fbSize, 0);
|
||||
if (gFrameBufferBase == NULL)
|
||||
return B_NO_MEMORY;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start
|
||||
= (addr_t)gFrameBufferBase; // 0xa8000000;
|
||||
*/
|
||||
}
|
||||
#else
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = fBase;
|
||||
#endif
|
||||
|
||||
uint32 bppCode;
|
||||
uint32 pixelFormat;
|
||||
struct pxa27x_lcd_dma_descriptor *dma;
|
||||
|
||||
// check if LCD controller is enabled
|
||||
@@ -80,7 +122,7 @@ arch_probe_video_mode(void)
|
||||
case 10:
|
||||
gKernelArgs.frame_buffer.depth = 32; // RGB888
|
||||
break;
|
||||
defaut:
|
||||
default:
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -89,60 +131,36 @@ arch_probe_video_mode(void)
|
||||
gKernelArgs.frame_buffer.height = (read_io_32(LCCR2) & ((1 << 10) - 1)) + 1;
|
||||
gKernelArgs.frame_buffer.bytes_per_row = gKernelArgs.frame_buffer.width
|
||||
* sizeof(uint32);
|
||||
gKernelArgs.frame_buffer.physical_buffer.size = gKernelArgs.frame_buffer.width
|
||||
gKernelArgs.frame_buffer.physical_buffer.size
|
||||
= gKernelArgs.frame_buffer.width
|
||||
* gKernelArgs.frame_buffer.height
|
||||
* gKernelArgs.frame_buffer.depth / 8;
|
||||
|
||||
dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth);
|
||||
|
||||
gKernelArgs.frame_buffer.enabled = true;
|
||||
|
||||
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_video_mode(int width, int height, int depth)
|
||||
ArchFBArmPxa270::SetVideoMode(int width, int height, int depth)
|
||||
{
|
||||
dprintf("%s(%d, %d, %d)\n", __FUNCTION__, width, height, depth);
|
||||
status_t err;
|
||||
void *fb;
|
||||
uint32 fbSize = width * height * depth / 8;
|
||||
//fb = malloc(800*600*4 + 16 - 1);
|
||||
//fb = malloc(800 * 600 * 4 + 16 - 1);
|
||||
//fb = (void *)(((uint32)fb) & ~(0x0f));
|
||||
//fb = scratch - 800;
|
||||
//fb = (void *)0xa0000000;
|
||||
|
||||
// gFrameBufferBase = scratch - 800;
|
||||
// fBase = scratch - 800;
|
||||
|
||||
#if 1
|
||||
gFrameBufferBase = (void *)0xa4000000;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;
|
||||
#endif
|
||||
#if 0
|
||||
if (!gFrameBufferBase) {
|
||||
//XXX: realloc if larger !!!
|
||||
err = platform_allocate_region(&gFrameBufferBase, fbSize, 0, false);
|
||||
dprintf("error %08x\n", err);
|
||||
if (err < B_OK)
|
||||
return err;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;
|
||||
/*
|
||||
gFrameBufferBase = (void *)mmu_map_physical_memory(
|
||||
0xa8000000, fbSize, 0);
|
||||
if (gFrameBufferBase == NULL)
|
||||
return B_NO_MEMORY;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;//0xa8000000;
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
fb = gFrameBufferBase;
|
||||
fb = (void*)fBase;
|
||||
|
||||
dprintf("fb @ %p\n", fb);
|
||||
|
||||
|
||||
sVideoDMADesc.fdadr = ((uint32)&sVideoDMADesc & ~0x0f) | 0x01;
|
||||
sVideoDMADesc.fsadr = (uint32)(fb) & ~0x0f;
|
||||
sVideoDMADesc.fidr = 0;
|
||||
@@ -172,7 +190,8 @@ dprintf("error %08x\n", err);
|
||||
}
|
||||
write_io_32(LCCR1, (0 << 0) | (width - 1));
|
||||
write_io_32(LCCR2, (0 << 0) | (height - 1));
|
||||
write_io_32(LCCR3, (pdfor << 30) | ((bpp >> 3) << 29) | ((bpp & 0x07) << 24));
|
||||
write_io_32(LCCR3, (pdfor << 30) | ((bpp >> 3) << 29)
|
||||
| ((bpp & 0x07) << 24));
|
||||
write_io_32(FDADR0, sVideoDMADesc.fdadr);
|
||||
write_io_32(LCCR0, read_io_32(LCCR0) | 0x01800001); // no ints +ENB
|
||||
write_io_32(FBR0, sVideoDMADesc.fdadr);
|
||||
@@ -183,29 +202,26 @@ dprintf("error %08x\n", err);
|
||||
dumpr(LCCR4);
|
||||
} else
|
||||
return EALREADY; // for now
|
||||
|
||||
|
||||
// clear the video memory
|
||||
memset((void *)fb, 0, fbSize);
|
||||
|
||||
// XXX test pattern
|
||||
for (int i = 0; i < 128; i++) {
|
||||
((uint32 *)fb)[i+16] = 0x000000ff << ((i%4) * 8);
|
||||
((uint32 *)fb)[i + 16] = 0x000000ff << ((i%4) * 8);
|
||||
scratch[i] = 0x000000ff << ((i%4) * 8);
|
||||
}
|
||||
|
||||
// update framebuffer descriptor
|
||||
return arch_probe_video_mode();
|
||||
return Probe();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_default_video_mode()
|
||||
ArchFBArmPxa270::SetDefaultMode()
|
||||
{
|
||||
dprintf("%s()\n", __FUNCTION__);
|
||||
return arch_set_video_mode(800, 600, 32);
|
||||
CALLED();
|
||||
return SetVideoMode(gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height,
|
||||
gKernelArgs.frame_buffer.depth);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, François Revol, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_video.h"
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/menu.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <boot/platform/generic/video.h>
|
||||
#include <board_config.h>
|
||||
#include <util/list.h>
|
||||
#include <drivers/driver_settings.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//XXX
|
||||
extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags);
|
||||
|
||||
|
||||
#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define write_io_32(a, v) ((*(vuint32 *)a) = v)
|
||||
#define read_io_32(a) (*(vuint32 *)a)
|
||||
|
||||
#define dumpr(a) dprintf("LCC:%s:0x%lx\n", #a, read_io_32(a))
|
||||
|
||||
|
||||
|
||||
#if !BOARD_CPU_PXA270 && !BOARD_CPU_OMAP3 && !BOARD_CPU_ARM920T
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
status_t
|
||||
arch_probe_video_mode(void)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_video_mode(int width, int height, int depth)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_default_video_mode()
|
||||
{
|
||||
return arch_set_video_mode(800, 600, 32);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku Inc.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ARCH_VIDEO_H
|
||||
#define _ARCH_VIDEO_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/* try to detect current video mode and set gFrameBuffer accordingly */
|
||||
extern status_t arch_probe_video_mode();
|
||||
/* try to set a video mode */
|
||||
extern status_t arch_set_video_mode(int width, int height, int depth);
|
||||
extern status_t arch_set_default_video_mode();
|
||||
|
||||
|
||||
#endif /* _ARCH_VIDEO_H */
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, François Revol, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "arch_video.h"
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <boot/platform.h>
|
||||
#include <boot/menu.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <boot/platform/generic/video.h>
|
||||
#include <board_config.h>
|
||||
#include <util/list.h>
|
||||
#include <drivers/driver_settings.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//XXX
|
||||
extern "C" addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags);
|
||||
|
||||
|
||||
#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define write_io_32(a, v) ((*(vuint32 *)a) = v)
|
||||
#define read_io_32(a) (*(vuint32 *)a)
|
||||
|
||||
#define dumpr(a) dprintf("LCC:%s:0x%lx\n", #a, read_io_32(a))
|
||||
|
||||
|
||||
|
||||
#if BOARD_CPU_ARM920T
|
||||
// #pragma mark -
|
||||
|
||||
extern void *gFrameBufferBase;
|
||||
|
||||
status_t
|
||||
arch_probe_video_mode(void)
|
||||
{
|
||||
gKernelArgs.frame_buffer.depth = 16;
|
||||
gKernelArgs.frame_buffer.width = 1024;
|
||||
gKernelArgs.frame_buffer.height = 768;
|
||||
gKernelArgs.frame_buffer.bytes_per_row = gKernelArgs.frame_buffer.width * 2;
|
||||
gKernelArgs.frame_buffer.physical_buffer.size = gKernelArgs.frame_buffer.width
|
||||
* gKernelArgs.frame_buffer.height
|
||||
* gKernelArgs.frame_buffer.depth / 8;
|
||||
|
||||
#if 0
|
||||
if (!gFrameBufferBase) {
|
||||
int err = platform_allocate_region(&gFrameBufferBase, gKernelArgs.frame_buffer.physical_buffer.size, 0, false);
|
||||
if (err < B_OK) return err;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;
|
||||
dprintf("video framebuffer: %p\n", gFrameBufferBase);
|
||||
}
|
||||
#else
|
||||
gFrameBufferBase = (void *)0x88000000;
|
||||
gKernelArgs.frame_buffer.physical_buffer.start = (addr_t)gFrameBufferBase;
|
||||
#endif
|
||||
|
||||
dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width,
|
||||
gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth);
|
||||
|
||||
gKernelArgs.frame_buffer.enabled = true;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_video_mode(int width, int height, int depth)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_default_video_mode()
|
||||
{
|
||||
return arch_set_video_mode(800, 600, 32);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ spin(bigtime_t microseconds)
|
||||
extern "C" void
|
||||
cpu_init()
|
||||
{
|
||||
gKernelArgs.num_cpus = 1;
|
||||
// this will eventually be corrected later on
|
||||
|
||||
#warning IMPLEMENT cpu_init
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
|
||||
|
||||
#include "video.h"
|
||||
//XXX
|
||||
#ifdef __ARM__
|
||||
#include "arch_video.h"
|
||||
#endif
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/stage2.h>
|
||||
@@ -23,15 +19,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "arch_framebuffer.h"
|
||||
|
||||
#define TRACE_VIDEO
|
||||
#ifdef TRACE_VIDEO
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
void *gFrameBufferBase = NULL;
|
||||
ArchFramebuffer *gFramebuffer = NULL;
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
@@ -66,7 +57,6 @@ video_mode_menu()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
@@ -77,15 +67,16 @@ platform_set_palette(const uint8 *palette)
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_blit4(addr_t frameBuffer, const uint8 *data, uint16 width, uint16 height,
|
||||
uint16 imageWidth, uint16 left, uint16 top)
|
||||
platform_blit4(addr_t frameBuffer, const uint8 *data, uint16 width,
|
||||
uint16 height, uint16 imageWidth, uint16 left, uint16 top)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
extern "C" void
|
||||
platform_switch_to_logo(void)
|
||||
{
|
||||
TRACE(("%s()\n", __FUNCTION__));
|
||||
CALLED();
|
||||
// in debug mode, we'll never show the logo
|
||||
if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0)
|
||||
return;
|
||||
@@ -95,15 +86,15 @@ platform_switch_to_logo(void)
|
||||
|
||||
status_t err;
|
||||
|
||||
#ifdef __ARM__
|
||||
err = arch_set_default_video_mode();
|
||||
dprintf("set video mode: 0x%08x\n", err);
|
||||
if (err < B_OK)
|
||||
return;
|
||||
#endif
|
||||
if (gFramebuffer != NULL) {
|
||||
err = gFramebuffer->SetDefaultMode();
|
||||
if (err < B_OK) {
|
||||
ERROR("Framebuffer SetDefaultMode failed!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
err = video_display_splash((addr_t)gFrameBufferBase);
|
||||
dprintf("video_display_splash: 0x%08x\n", err);
|
||||
err = video_display_splash(gFramebuffer->Base());
|
||||
}
|
||||
#warning U-Boot:TODO
|
||||
}
|
||||
|
||||
@@ -111,7 +102,7 @@ platform_switch_to_logo(void)
|
||||
extern "C" void
|
||||
platform_switch_to_text_mode(void)
|
||||
{
|
||||
TRACE(("%s()\n", __FUNCTION__));
|
||||
CALLED();
|
||||
#warning U-Boot:TODO
|
||||
}
|
||||
|
||||
@@ -119,14 +110,26 @@ platform_switch_to_text_mode(void)
|
||||
extern "C" status_t
|
||||
platform_init_video(void)
|
||||
{
|
||||
TRACE(("%s()\n", __FUNCTION__));
|
||||
#warning U-Boot:TODO
|
||||
CALLED();
|
||||
|
||||
#ifdef __ARM__
|
||||
arch_probe_video_mode();
|
||||
#if defined(BOARD_CPU_ARM920T)
|
||||
gFramebuffer = arch_get_fb_arm_920(0x88000000);
|
||||
#elif defined(BOARD_CPU_OMAP3)
|
||||
gFramebuffer = arch_get_fb_arm_omap3(0x88000000);
|
||||
#elif defined(BOARD_CPU_PXA270)
|
||||
gFramebuffer = arch_get_fb_arm_pxa270(0xA4000000);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (gFramebuffer != NULL) {
|
||||
gFramebuffer->Probe();
|
||||
gFramebuffer->Init();
|
||||
}
|
||||
|
||||
//XXX for testing
|
||||
//platform_switch_to_logo();
|
||||
//return arch_probe_video_mode();
|
||||
//return B_OK;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
* François Revol, [email protected]
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/arm/reg.h>
|
||||
#include <arch/generic/debug_uart_8250.h>
|
||||
#include <new>
|
||||
#include <board_config.h>
|
||||
#include <debug.h>
|
||||
#include <new>
|
||||
|
||||
|
||||
class ArchUART8250 : public DebugUART8250 {
|
||||
|
||||
Reference in New Issue
Block a user