]> git.ipfire.org Git - thirdparty/u-boot.git/blame - arch/sandbox/include/asm/sdl.h
arm: mach-omap2: cache: Explicitly enable I cache
[thirdparty/u-boot.git] / arch / sandbox / include / asm / sdl.h
CommitLineData
bbc09bf2
SG
1/*
2 * Copyright (c) 2013 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef __SANDBOX_SDL_H
8#define __SANDBOX_SDL_H
9
10#include <errno.h>
11
12#ifdef CONFIG_SANDBOX_SDL
13
14/**
15 * sandbox_sdl_init_display() - Set up SDL video ready for use
16 *
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.
23 */
24int sandbox_sdl_init_display(int width, int height, int log2_bpp);
25
26/**
27 * sandbox_sdl_sync() - Sync current U-Boot LCD frame buffer to SDL
28 *
29 * This must be called periodically to update the screen for SDL so that the
30 * user can see it.
31 *
32 * @lcd_base: Base of frame buffer
33 * @return 0 if screen was updated, -ENODEV is there is no screen.
34 */
35int sandbox_sdl_sync(void *lcd_base);
36
37/**
38 * sandbox_sdl_scan_keys() - scan for pressed keys
39 *
40 * Works out which keys are pressed and returns a list
41 *
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
45 */
46int sandbox_sdl_scan_keys(int key[], int max_keys);
47
48/**
49 * sandbox_sdl_key_pressed() - check if a particular key is pressed
50 *
51 * @keycode: Keycode to check (KEY_... - see include/linux/input.h
52 * @return 0 if pressed, -ENOENT if not pressed. -ENODEV if keybord not
53 * available,
54 */
55int sandbox_sdl_key_pressed(int keycode);
56
57/**
58 * sandbox_sdl_sound_start() - start playing a sound
59 *
60 * @frequency: Frequency of sounds in Hertz
61 * @return 0 if OK, -ENODEV if no sound is available
62 */
63int sandbox_sdl_sound_start(uint frequency);
64
65/**
66 * sandbox_sdl_sound_stop() - stop playing a sound
67 *
68 * @return 0 if OK, -ENODEV if no sound is available
69 */
70int sandbox_sdl_sound_stop(void);
71
72/**
73 * sandbox_sdl_sound_init() - set up the sound system
74 *
75 * @return 0 if OK, -ENODEV if no sound is available
76 */
77int sandbox_sdl_sound_init(void);
78
79#else
80static inline int sandbox_sdl_init_display(int width, int height,
81 int log2_bpp)
82{
83 return -ENODEV;
84}
85
86static inline int sandbox_sdl_sync(void *lcd_base)
87{
88 return -ENODEV;
89}
90
91static inline int sandbox_sdl_scan_keys(int key[], int max_keys)
92{
93 return -ENODEV;
94}
95
96static inline int sandbox_sdl_key_pressed(int keycode)
97{
98 return -ENODEV;
99}
100
101static inline int sandbox_sdl_sound_start(uint frequency)
102{
103 return -ENODEV;
104}
105
106static inline int sandbox_sdl_sound_stop(void)
107{
108 return -ENODEV;
109}
110
111static inline int sandbox_sdl_sound_init(void)
112{
113 return -ENODEV;
114}
115
116#endif
117
118#endif