added more documentation
This commit is contained in:
18
src/fbinit.c
18
src/fbinit.c
@@ -16,12 +16,13 @@ extern uint8_t _binary_splash_bin_start[];
|
||||
extern uint8_t _binary_splash_bin_end;
|
||||
extern uint8_t _binary_splash_bin_size;
|
||||
|
||||
static int fb_fd = -1;
|
||||
static int fb_fd = -1; /* framebuffer file descriptor */
|
||||
|
||||
/* frame buffer information */
|
||||
static FBINFO local_info;
|
||||
PCFBINFO Fb_Info = &local_info;
|
||||
|
||||
UINT16 *Fb_Ptr = NULL;
|
||||
UINT16 *Fb_Ptr = NULL; /* pointer to memory-mapped frame buffer */
|
||||
|
||||
inline static UINT16 makemask(unsigned offset, unsigned length)
|
||||
{
|
||||
@@ -30,12 +31,11 @@ inline static UINT16 makemask(unsigned offset, unsigned length)
|
||||
|
||||
static void do_cleanup(void)
|
||||
{
|
||||
/* additional cleanup here */
|
||||
|
||||
/* black out the display */
|
||||
memset(Fb_Ptr, 0, local_info.screenbytes);
|
||||
munmap((void *)Fb_Ptr, local_info.screenbytes);
|
||||
Fb_Ptr = NULL;
|
||||
|
||||
munmap((void *)Fb_Ptr, local_info.screenbytes);
|
||||
Fb_Ptr = NULL;
|
||||
close(fb_fd);
|
||||
fb_fd = -1;
|
||||
}
|
||||
@@ -50,10 +50,11 @@ HRESULT Fb_setup(void)
|
||||
if (fb_fd == -1)
|
||||
{
|
||||
hr = ERRNO_AS_SCODE;
|
||||
Log(LFATAL, "Unable to open framebuffer (%08X)", hr);
|
||||
Log(LFATAL, "Unable to open framebuffer device %s (%08X)", Gconfig.framebuffer_device, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
/* fixed info is needed to get the memory parameters for the display */
|
||||
if (ioctl(fb_fd, FBIOGET_FSCREENINFO, &fixed))
|
||||
{
|
||||
hr = ERRNO_AS_SCODE;
|
||||
@@ -64,6 +65,7 @@ HRESULT Fb_setup(void)
|
||||
local_info.linebytes = fixed.line_length;
|
||||
local_info.screenbytes = fixed.smem_len;
|
||||
|
||||
/* variable info is used to get scren geometry and color info */
|
||||
if (ioctl(fb_fd, FBIOGET_VSCREENINFO, &var))
|
||||
{
|
||||
hr = ERRNO_AS_SCODE;
|
||||
@@ -100,8 +102,6 @@ HRESULT Fb_setup(void)
|
||||
/* display the splash screen */
|
||||
memcpy(Fb_Ptr, _binary_splash_bin_start, (size_t)(&_binary_splash_bin_size));
|
||||
|
||||
/* additional setup here */
|
||||
|
||||
hr = Config_exitfunc(do_cleanup);
|
||||
if (FAILED(hr))
|
||||
do_cleanup();
|
||||
|
||||
Reference in New Issue
Block a user