aboutsummaryrefslogtreecommitdiffstats
path: root/boards/base/Altera-MAX10-Neek/board_framebuffer.h
blob: 4943b1877c1069cca9f496b164453fd4db38cf77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * This file is subject to the terms of the GFX License. If a copy of
 * the license was not distributed with this file, you can obtain one at:
 *
 *              http://ugfx.org/license.html
 */
#include <system.h>
#include <io.h>

#define SCREEN_WIDTH			800
#define SCREEN_HEIGHT			480
#define GDISP_LLD_PIXELFORMAT	GDISP_PIXELFORMAT_RGB888

#ifdef GDISP_DRIVER_VMT

	static void board_init(GDisplay* g, fbInfo* fbi)
	{
		g->g.Width = SCREEN_WIDTH;
		g->g.Height = SCREEN_HEIGHT;
		g->g.Backlight = 100;
		g->g.Contrast = 50;
		fbi->linelen = g->g.Width * sizeof(LLDCOLOR_TYPE);									// bytes per row
		fbi->pixels = gfxAlloc(SCREEN_WIDTH * SCREEN_HEIGHT * sizeof(LLDCOLOR_TYPE));		// pointer to the memory frame buffer
		if (!fbi->pixels) {
			gfxHalt("Couldn't allocate memory for framebuffer\r\n");
		}

		// Let the framebuffer reader know where to find the framebuffer
		IOWR(FRAMEBUFFER_READER_BASE, 0, (alt_u32*)fbi->pixels);

		// Make sure the MSB is set so we bypass the data cache
		fbi->pixels = (void*)((char*)fbi->pixels + 0x80000000);
	}

	#if GDISP_HARDWARE_FLUSH
		static void board_flush(GDisplay* g)
		{
			(void) g;
		}
	#endif

	#if GDISP_NEED_CONTROL
		static void board_backlight(GDisplay* g, uint8_t percent)
		{
			(void) g;
			(void) percent;
		}

		static void board_contrast(GDisplay* g, uint8_t percent)
		{
			(void) g;
			(void) percent;
		}

		static void board_power(GDisplay* g, powermode_t pwr)
		{
			(void) g;
			(void) pwr;
		}
	#endif

#endif /* GDISP_LLD_BOARD_IMPLEMENTATION */