Modules/RPiDisplay - Commiting non-compiled code
[tpg/acess2.git] / KernelLand / Modules / Display / RPi / main.c
1 /**
2  * Acess2 Raspberry Pi (BCM2835)
3  * - By John Hodge (thePowersGang)
4  *
5  * main.c
6  * - Driver core
7  *
8  * http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/os/screen01.html
9  */
10 #define DEBUG   0
11 #define VERSION ((0<<8)|1)
12 #include <acess.h>
13 #include <errno.h>
14 #include <modules.h>
15 #include <vfs.h>
16 #include <fs_devfs.h>
17 #include <drv_pci.h>
18 #include <api_drv_video.h>
19
20 // === PROTOCOLS ===
21  int    RPiVid_Install(const char **Arguments);
22 // - GPU Communication
23  int    RPiVid_int_MBoxCheck(Uint8 Box);
24 Uint32  RPiVid_int_MBoxRecv(Uint8 Box);
25 void    RPiVid_int_MBoxSend(Uint8 Box, Uint32 Message);
26
27 // === GLOBALS ===
28 MODULE_DEFINE(0, VERSION, RPiVid, RPiVid_Install, NULL, NULL);
29
30 // === CODE ===
31 int RPiVid_Install(const char **Arguments)
32 {
33         return 0;
34 }
35
36
37 // --- GPU Comms ---
38 int RPiVid_int_MBoxCheck(Uint8 Box)
39 {
40         return 0;
41 }
42
43 Uint32 RPiVid_int_MBoxRecv(Uint8 Box)
44 {
45         Uint32  val;
46         do {
47                 while( gRPiVid_Mbox->Status & (1 << 30) )
48                         ;
49                 val = gRPiVid_Mbox->Read;
50         } while( (val & 0xF) != Box );
51         
52         return 0;
53 }
54
55 void RPiVid_int_MBoxSend(Uint8 Box, Uint32 Message)
56 {
57         while( gRPiVid_Mbox.Status & (1 << 31) )
58                 ;
59         gRPiVid_Mbox.Write = (Message << 4) | (Box & 0xF);
60 }
61

UCC git Repository :: git.ucc.asn.au