2 Copyright � 2013-2015, The AROS Development Team. All rights reserved.
5 Desc: VideoCore framebuffer routines
9 #include <hardware/bcm2708.h>
10 #include <hardware/bcm2708_boot.h>
13 #include <hardware/videocore.h>
15 #include "bootconsole.h"
20 #define ARM_PERIIOBASE (__arm_periiobase)
21 extern uint32_t __arm_periiobase
;
25 unsigned int fb_width
, fb_height
, fb_depth
, fb_pitch
;
27 volatile unsigned int *vcmb_msg
= (unsigned int *)BOOTMEMADDR(bm_mboxmsg
);
29 scr_Type
= SCR_UNKNOWN
;
31 /* query the display dimensions */
34 vcmb_msg
[1] = VCTAG_REQ
;
35 vcmb_msg
[2] = VCTAG_GETRES
;
40 vcmb_msg
[7] = 0; // terminate tag
42 vcmb_write((void *)VCMB_BASE
, VCMB_PROPCHAN
, (void *)vcmb_msg
);
43 vcmb_msg
= vcmb_read((void *)VCMB_BASE
, VCMB_PROPCHAN
);
45 if (!vcmb_msg
|| (vcmb_msg
[1] != VCTAG_RESP
))
48 if (((fb_width
= vcmb_msg
[5]) == 0) || ((fb_height
= vcmb_msg
[6]) == 0))
55 /* fill in our framebuffer configuration/allocation request */
58 vcmb_msg
[c
++] = VCTAG_REQ
;
60 vcmb_msg
[c
++] = VCTAG_SETRES
;
63 vcmb_msg
[c
++] = fb_width
;
64 vcmb_msg
[c
++] = fb_height
;
66 vcmb_msg
[c
++] = VCTAG_SETVRES
; // duplicate physical size...
69 vcmb_msg
[c
++] = fb_width
;
70 vcmb_msg
[c
++] = fb_height
;
72 vcmb_msg
[c
++] = VCTAG_SETDEPTH
;
78 vcmb_msg
[c
++] = fb_depth
;
80 vcmb_msg
[c
++] = VCTAG_FBALLOC
;
86 vcmb_msg
[c
++] = 0; // terminate tags
88 vcmb_msg
[0] = (c
<< 2); // fill in request size
90 vcmb_write((void *)VCMB_BASE
, VCMB_PROPCHAN
, (void *)vcmb_msg
);
91 vcmb_msg
= vcmb_read((void *)VCMB_BASE
, VCMB_PROPCHAN
);
93 if (!vcmb_msg
|| (vcmb_msg
[1] != VCTAG_RESP
))
96 count
= 2; // locate the allocation request
97 while((vcmb_msg
[count
]))
99 if (vcmb_msg
[count
] == VCTAG_FBALLOC
)
102 count
+= 3 + (vcmb_msg
[count
+ 1] >> 2);
108 if (vcmb_msg
[count
+ 2] != (VCTAG_RESP
+ 8))
111 if (((scr_FrameBuffer
= (void *)vcmb_msg
[count
+ 3]) == 0) || (vcmb_msg
[count
+ 4] == 0))
115 /* query the framebuffer pitch */
118 vcmb_msg
[1] = VCTAG_REQ
;
119 vcmb_msg
[2] = VCTAG_GETPITCH
;
123 vcmb_msg
[6] = 0; // terminate tag
125 vcmb_write((void *)VCMB_BASE
, VCMB_PROPCHAN
, (void *)vcmb_msg
);
126 vcmb_msg
= vcmb_read((void *)VCMB_BASE
, VCMB_PROPCHAN
);
128 if (!vcmb_msg
|| (vcmb_msg
[4] != (VCTAG_RESP
+ 4)))
131 if ((fb_pitch
= vcmb_msg
[5]) == 0)
137 fb_Init(fb_width
, fb_height
, fb_depth
, fb_pitch
);