2 * Copyright (c) 2013 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
7 #ifndef __SANDBOX_SDL_H
8 #define __SANDBOX_SDL_H
12 #ifdef CONFIG_SANDBOX_SDL
15 * sandbox_sdl_init_display() - Set up SDL video ready for use
17 * @width: Window width in pixels
18 * @height Window height in pixels
19 * @log2_bpp: Log to base 2 of the number of bits per pixel. So a 32bpp
20 * display will pass 5, since 2*5 = 32
21 * @return 0 if OK, -ENODEV if no device, -EIO if SDL failed to initialize
22 * and -EPERM if the video failed to come up.
24 int sandbox_sdl_init_display(int width, int height, int log2_bpp);
27 * sandbox_sdl_sync() - Sync current U-Boot LCD frame buffer to SDL
29 * This must be called periodically to update the screen for SDL so that the
32 * @lcd_base: Base of frame buffer
33 * @return 0 if screen was updated, -ENODEV is there is no screen.
35 int sandbox_sdl_sync(void *lcd_base);
38 * sandbox_sdl_scan_keys() - scan for pressed keys
40 * Works out which keys are pressed and returns a list
42 * @key: Array to receive keycodes
43 * @max_keys: Size of array
44 * @return number of keycodes found, 0 if none, -ENODEV if no keyboard
46 int sandbox_sdl_scan_keys(int key[], int max_keys);
49 * sandbox_sdl_key_pressed() - check if a particular key is pressed
51 * @keycode: Keycode to check (KEY_... - see include/linux/input.h
52 * @return 0 if pressed, -ENOENT if not pressed. -ENODEV if keybord not
55 int sandbox_sdl_key_pressed(int keycode);
58 * sandbox_sdl_sound_start() - start playing a sound
60 * @frequency: Frequency of sounds in Hertz
61 * @return 0 if OK, -ENODEV if no sound is available
63 int sandbox_sdl_sound_start(uint frequency);
66 * sandbox_sdl_sound_stop() - stop playing a sound
68 * @return 0 if OK, -ENODEV if no sound is available
70 int sandbox_sdl_sound_stop(void);
73 * sandbox_sdl_sound_init() - set up the sound system
75 * @return 0 if OK, -ENODEV if no sound is available
77 int sandbox_sdl_sound_init(void);
80 static inline int sandbox_sdl_init_display(int width, int height,
86 static inline int sandbox_sdl_sync(void *lcd_base)
91 static inline int sandbox_sdl_scan_keys(int key[], int max_keys)
96 static inline int sandbox_sdl_key_pressed(int keycode)
101 static inline int sandbox_sdl_sound_start(uint frequency)
106 static inline int sandbox_sdl_sound_stop(void)
111 static inline int sandbox_sdl_sound_init(void)