added global configuration data block and our own "atexit" type mechanism
that doesn't depend on enough free slots in the C library
This commit is contained in:
30
src/fbinit.c
30
src/fbinit.c
@@ -6,6 +6,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <linux/fb.h>
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "fbinit.h"
|
||||
#include "scode.h"
|
||||
@@ -27,13 +28,25 @@ inline static UINT16 makemask(unsigned offset, unsigned length)
|
||||
return (UINT16)(((1 << length) - 1) << offset);
|
||||
}
|
||||
|
||||
static void do_cleanup(void)
|
||||
{
|
||||
/* additional cleanup here */
|
||||
|
||||
memset(Fb_Ptr, 0, local_info.screenbytes);
|
||||
munmap((void *)Fb_Ptr, local_info.screenbytes);
|
||||
Fb_Ptr = NULL;
|
||||
|
||||
close(fb_fd);
|
||||
fb_fd = -1;
|
||||
}
|
||||
|
||||
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);
|
||||
fb_fd = open(Gconfig.framebuffer_device, O_RDWR);
|
||||
if (fb_fd == -1)
|
||||
{
|
||||
hr = ERRNO_AS_SCODE;
|
||||
@@ -89,21 +102,12 @@ HRESULT Fb_setup(void)
|
||||
|
||||
/* additional setup here */
|
||||
|
||||
hr = Config_exitfunc(do_cleanup);
|
||||
if (FAILED(hr))
|
||||
do_cleanup();
|
||||
return hr;
|
||||
}
|
||||
|
||||
void Fb_cleanup(void)
|
||||
{
|
||||
/* additional cleanup here */
|
||||
|
||||
memset(Fb_Ptr, 0, local_info.screenbytes);
|
||||
munmap((void *)Fb_Ptr, local_info.screenbytes);
|
||||
Fb_Ptr = NULL;
|
||||
|
||||
close(fb_fd);
|
||||
fb_fd = -1;
|
||||
}
|
||||
|
||||
void Fb_clear(void)
|
||||
{
|
||||
memset(Fb_Ptr, 0, local_info.screenbytes);
|
||||
|
||||
Reference in New Issue
Block a user