2022-03-15 23:37:20 +01:00
|
|
|
#include "fb.h"
|
2022-03-15 23:09:55 +01:00
|
|
|
#include "mbox.h"
|
2022-03-15 23:37:20 +01:00
|
|
|
#include "uart.h"
|
|
|
|
#include "utils.h"
|
2022-03-14 07:46:32 +01:00
|
|
|
|
2022-03-15 23:37:20 +01:00
|
|
|
struct fbst fb;
|
|
|
|
int kernelmain(void)
|
|
|
|
{
|
2022-03-14 07:46:32 +01:00
|
|
|
init_uart();
|
2022-03-15 23:37:20 +01:00
|
|
|
if (init_fb(&fb) == 0){
|
|
|
|
puts("Fail to init framebuffer");
|
|
|
|
}
|
2022-03-15 23:09:55 +01:00
|
|
|
mbox[0] = 8 * 4;
|
|
|
|
mbox[1] = MBOX_REQUEST;
|
|
|
|
mbox[2] = MBOX_TAG_GETVCOREMEM;
|
|
|
|
mbox[3] = 8;
|
|
|
|
mbox[4] = 0;
|
|
|
|
mbox[5] = 0;
|
|
|
|
mbox[6] = 0;
|
|
|
|
mbox[7] = MBOX_TAG_LAST;
|
|
|
|
|
2022-03-15 23:37:20 +01:00
|
|
|
if (mbox_call(MBOX_CH_PROP, mbox)) {
|
2022-03-15 23:09:55 +01:00
|
|
|
puts("videocore start at 0x");
|
|
|
|
printhex(mbox[5]);
|
|
|
|
puts(" - ");
|
2022-03-15 23:37:20 +01:00
|
|
|
int mem = mbox[6] / 1024 / 1024;
|
2022-03-15 23:09:55 +01:00
|
|
|
printdec(mem);
|
|
|
|
puts(" Mo\n");
|
2022-03-15 23:37:20 +01:00
|
|
|
} else {
|
2022-03-15 23:09:55 +01:00
|
|
|
puts("Error getting videocore mem\n");
|
|
|
|
}
|
|
|
|
|
2022-03-15 23:37:20 +01:00
|
|
|
unsigned char *ptr=fb.fbp;
|
|
|
|
|
|
|
|
for(int y=0; y<fb.height; y++) {
|
|
|
|
for(int x=0; x<fb.width; x++) {
|
|
|
|
if(y%60==0)
|
|
|
|
*((unsigned int*)ptr)=0x00FF0000;
|
|
|
|
else if (y%40==0)
|
|
|
|
*((unsigned int*)ptr)=0x0000FF00;
|
|
|
|
else if (y%20==0)
|
|
|
|
*((unsigned int*)ptr)=0x000000FF;
|
|
|
|
else
|
|
|
|
*((unsigned int*)ptr)=0x00000000;
|
|
|
|
ptr+=4;
|
|
|
|
}
|
|
|
|
}
|
2022-03-14 07:46:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|