summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/include/asm/sdl.h
blob: 6edec1acfa39a2f26ddd6c3c52cdcf34522275b0 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright (c) 2013 Google, Inc
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */

#ifndef __SANDBOX_SDL_H
#define __SANDBOX_SDL_H

#include <errno.h>

#ifdef CONFIG_SANDBOX_SDL

/**
 * sandbox_sdl_init_display() - Set up SDL video ready for use
 *
 * @width:	Window width in pixels
 * @height	Window height in pixels
 * @log2_bpp:	Log to base 2 of the number of bits per pixel. So a 32bpp
 *		display will pass 5, since 2*5 = 32
 * @return 0 if OK, -ENODEV if no device, -EIO if SDL failed to initialize
 *		and -EPERM if the video failed to come up.
 */
int sandbox_sdl_init_display(int width, int height, int log2_bpp);

/**
 * sandbox_sdl_sync() - Sync current U-Boot LCD frame buffer to SDL
 *
 * This must be called periodically to update the screen for SDL so that the
 * user can see it.
 *
 * @lcd_base: Base of frame buffer
 * @return 0 if screen was updated, -ENODEV is there is no screen.
 */
int sandbox_sdl_sync(void *lcd_base);

/**
 * sandbox_sdl_scan_keys() - scan for pressed keys
 *
 * Works out which keys are pressed and returns a list
 *
 * @key:	Array to receive keycodes
 * @max_keys:	Size of array
 * @return number of keycodes found, 0 if none, -ENODEV if no keyboard
 */
int sandbox_sdl_scan_keys(int key[], int max_keys);

/**
 * sandbox_sdl_key_pressed() - check if a particular key is pressed
 *
 * @keycode:	Keycode to check (KEY_... - see include/linux/input.h
 * @return 0 if pressed, -ENOENT if not pressed. -ENODEV if keybord not
 * available,
 */
int sandbox_sdl_key_pressed(int keycode);

/**
 * sandbox_sdl_sound_start() - start playing a sound
 *
 * @frequency:	Frequency of sounds in Hertz
 * @return 0 if OK, -ENODEV if no sound is available
 */
int sandbox_sdl_sound_start(uint frequency);

/**
 * sandbox_sdl_sound_stop() - stop playing a sound
 *
 * @return 0 if OK, -ENODEV if no sound is available
 */
int sandbox_sdl_sound_stop(void);

/**
 * sandbox_sdl_sound_init() - set up the sound system
 *
 * @return 0 if OK, -ENODEV if no sound is available
 */
int sandbox_sdl_sound_init(void);

#else
static inline int sandbox_sdl_init_display(int width, int height,
					    int log2_bpp)
{
	return -ENODEV;
}

static inline int sandbox_sdl_sync(void *lcd_base)
{
	return -ENODEV;
}

static inline int sandbox_sdl_scan_keys(int key[], int max_keys)
{
	return -ENODEV;
}

static inline int sandbox_sdl_key_pressed(int keycode)
{
	return -ENODEV;
}

static inline int sandbox_sdl_sound_start(uint frequency)
{
	return -ENODEV;
}

static inline int sandbox_sdl_sound_stop(void)
{
	return -ENODEV;
}

static inline int sandbox_sdl_sound_init(void)
{
	return -ENODEV;
}

#endif

#endif
OpenPOWER on IntegriCloud