adapted code to use the wintype.h types and the error codes
This commit is contained in:
34
src/fbinit.c
34
src/fbinit.c
@@ -8,35 +8,39 @@
|
||||
#include <linux/fb.h>
|
||||
#include "log.h"
|
||||
#include "fbinit.h"
|
||||
#include "scode.h"
|
||||
|
||||
static int fb_fd = -1;
|
||||
|
||||
static FBINFO local_info;
|
||||
PCFBINFO Fb_Info = &local_info;
|
||||
|
||||
uint16_t *Fb_Ptr = NULL;
|
||||
UINT16 *Fb_Ptr = NULL;
|
||||
|
||||
inline static unsigned makemask(unsigned offset, unsigned length)
|
||||
inline static UINT16 makemask(unsigned offset, unsigned length)
|
||||
{
|
||||
return ((1 << length) - 1) << offset;
|
||||
return (UINT16)(((1 << length) - 1) << offset);
|
||||
}
|
||||
|
||||
int Fb_setup(void)
|
||||
HRESULT Fb_setup(void)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
struct fb_fix_screeninfo fixed;
|
||||
struct fb_var_screeninfo var;
|
||||
|
||||
fb_fd = open("/dev/fb1", O_RDWR);
|
||||
if (fb_fd == -1)
|
||||
{
|
||||
Log(LFATAL, "Unable to open framebuffer (%d)", errno);
|
||||
return -1;
|
||||
hr = ERRNO_AS_SCODE;
|
||||
Log(LFATAL, "Unable to open framebuffer (%08X)", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &fixed))
|
||||
{
|
||||
Log(LFATAL, "Could not get fixed screen info (%d)", errno);
|
||||
return -1;
|
||||
hr = ERRNO_AS_SCODE;
|
||||
Log(LFATAL, "Could not get fixed screen info (%08X)", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
local_info.linebytes = fixed.line_length;
|
||||
@@ -44,8 +48,9 @@ int Fb_setup(void)
|
||||
|
||||
if (ioctl(fb_fd, FBIOGET_VSCREENINFO, &var))
|
||||
{
|
||||
Log(LFATAL, "Could not get variable screen info (%d)", errno);
|
||||
return -1;
|
||||
hr = ERRNO_AS_SCODE;
|
||||
Log(LFATAL, "Could not get variable screen info (%08X)", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
local_info.width = var.xres;
|
||||
@@ -63,19 +68,20 @@ int Fb_setup(void)
|
||||
local_info.blue_length = var.blue.length;
|
||||
local_info.blue_mask = makemask(var.blue.offset, var.blue.length);
|
||||
|
||||
Fb_Ptr = (uint16_t *)mmap(0, fixed.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, fb_fd, 0);
|
||||
Fb_Ptr = (UINT16 *)mmap(0, fixed.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, fb_fd, 0);
|
||||
if ((int)Fb_Ptr == -1)
|
||||
{
|
||||
Log(LFATAL, "Unable to memmap framebuffer (%d)", errno);
|
||||
hr = ERRNO_AS_SCODE;
|
||||
Log(LFATAL, "Unable to memmap framebuffer (%08X)", hr);
|
||||
Fb_Ptr = NULL;
|
||||
close(fb_fd);
|
||||
fb_fd = -1;
|
||||
return -1;
|
||||
return hr;
|
||||
}
|
||||
|
||||
/* additional setup here */
|
||||
|
||||
return 0;
|
||||
return hr;
|
||||
}
|
||||
|
||||
void Fb_cleanup(void)
|
||||
|
||||
Reference in New Issue
Block a user