From 700377afe01dab774d82c2fa7d121d76fb347d12 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Sun, 20 Jan 2013 14:32:14 +0800 Subject: [PATCH] Modules/RPiDisplay - Commiting non-compiled code --- KernelLand/Modules/Display/RPi/main.c | 61 +++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 KernelLand/Modules/Display/RPi/main.c diff --git a/KernelLand/Modules/Display/RPi/main.c b/KernelLand/Modules/Display/RPi/main.c new file mode 100644 index 00000000..a0df9031 --- /dev/null +++ b/KernelLand/Modules/Display/RPi/main.c @@ -0,0 +1,61 @@ +/** + * Acess2 Raspberry Pi (BCM2835) + * - By John Hodge (thePowersGang) + * + * main.c + * - Driver core + * + * http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/os/screen01.html + */ +#define DEBUG 0 +#define VERSION ((0<<8)|1) +#include +#include +#include +#include +#include +#include +#include + +// === PROTOCOLS === + int RPiVid_Install(const char **Arguments); +// - GPU Communication + int RPiVid_int_MBoxCheck(Uint8 Box); +Uint32 RPiVid_int_MBoxRecv(Uint8 Box); +void RPiVid_int_MBoxSend(Uint8 Box, Uint32 Message); + +// === GLOBALS === +MODULE_DEFINE(0, VERSION, RPiVid, RPiVid_Install, NULL, NULL); + +// === CODE === +int RPiVid_Install(const char **Arguments) +{ + return 0; +} + + +// --- GPU Comms --- +int RPiVid_int_MBoxCheck(Uint8 Box) +{ + return 0; +} + +Uint32 RPiVid_int_MBoxRecv(Uint8 Box) +{ + Uint32 val; + do { + while( gRPiVid_Mbox->Status & (1 << 30) ) + ; + val = gRPiVid_Mbox->Read; + } while( (val & 0xF) != Box ); + + return 0; +} + +void RPiVid_int_MBoxSend(Uint8 Box, Uint32 Message) +{ + while( gRPiVid_Mbox.Status & (1 << 31) ) + ; + gRPiVid_Mbox.Write = (Message << 4) | (Box & 0xF); +} + -- 2.20.1