u-boot/arch/sandbox/include/asm/sdl.h

128 lines
2.9 KiB
C
Raw Normal View History

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2013 Google, Inc
*/
#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
* @double_size: true to double the visible size in each direction for high-DPI
* displays
* @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,
bool double_size);
/**
* 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_play() - Play a sound
*
* @data: Data to play (typically 16-bit)
* @count: Number of bytes in data
*/
int sandbox_sdl_sound_play(const void *data, uint count);
/**
* 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
*
* @rate: Sample rate to use
* @channels: Number of channels to use (1=mono, 2=stereo)
* @return 0 if OK, -ENODEV if no sound is available
*/
int sandbox_sdl_sound_init(int rate, int channels);
#else
static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp,
bool double_size)
{
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;
}
dm: sound: make all functions static inline Fixes following compile problem: ➜ u-boot-mainline git:(master) ✗ make sandbox_defconfig all NO_SDL=1 scripts/kconfig/conf --syncconfig Kconfig CHK include/config.h CFG u-boot.cfg GEN include/autoconf.mk GEN include/autoconf.mk.dep CHK include/config/uboot.release CHK include/generated/version_autogenerated.h CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h CHK include/generated/generic-asm-offsets.h HOSTCC tools/mkenvimage.o HOSTLD tools/mkenvimage HOSTCC tools/fit_image.o HOSTCC tools/image-host.o HOSTCC tools/dumpimage.o HOSTLD tools/dumpimage HOSTCC tools/mkimage.o HOSTLD tools/mkimage HOSTLD tools/fit_info HOSTLD tools/fit_check_sign CC cmd/version.o GZIP cmd/config_data.gz CHK cmd/config_data_gz.h CHK cmd/config_data_size.h CHK cmd/license_data_gz.h CHK cmd/license_data_size.h LD cmd/built-in.o CC common/main.o LD common/built-in.o CC drivers/fastboot/fb_getvar.o LD drivers/fastboot/built-in.o LD drivers/video/built-in.o ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_play': /home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: multiple definition of `sandbox_sdl_sound_play'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: first defined here ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_init': /home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: multiple definition of `sandbox_sdl_sound_init'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: first defined here make[3]: *** [scripts/Makefile.build:355: drivers/video/built-in.o] Fehler 1 make[2]: *** [scripts/Makefile.build:432: drivers/video] Fehler 2 make[1]: *** [Makefile:1531: drivers] Fehler 2 make: *** [Makefile:485: __build_one_by_one] Fehler 2 Fixes: f2b25c9bf82 ("dm: sound: Complete migration to driver model") Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2019-04-09 09:27:00 +00:00
static inline int sandbox_sdl_sound_play(const void *data, uint count)
{
return -ENODEV;
}
static inline int sandbox_sdl_sound_stop(void)
{
return -ENODEV;
}
dm: sound: make all functions static inline Fixes following compile problem: ➜ u-boot-mainline git:(master) ✗ make sandbox_defconfig all NO_SDL=1 scripts/kconfig/conf --syncconfig Kconfig CHK include/config.h CFG u-boot.cfg GEN include/autoconf.mk GEN include/autoconf.mk.dep CHK include/config/uboot.release CHK include/generated/version_autogenerated.h CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h CHK include/generated/generic-asm-offsets.h HOSTCC tools/mkenvimage.o HOSTLD tools/mkenvimage HOSTCC tools/fit_image.o HOSTCC tools/image-host.o HOSTCC tools/dumpimage.o HOSTLD tools/dumpimage HOSTCC tools/mkimage.o HOSTLD tools/mkimage HOSTLD tools/fit_info HOSTLD tools/fit_check_sign CC cmd/version.o GZIP cmd/config_data.gz CHK cmd/config_data_gz.h CHK cmd/config_data_size.h CHK cmd/license_data_gz.h CHK cmd/license_data_size.h LD cmd/built-in.o CC common/main.o LD common/built-in.o CC drivers/fastboot/fb_getvar.o LD drivers/fastboot/built-in.o LD drivers/video/built-in.o ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_play': /home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: multiple definition of `sandbox_sdl_sound_play'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:110: first defined here ld.bfd: drivers/video/sandbox_sdl.o: in function `sandbox_sdl_sound_init': /home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: multiple definition of `sandbox_sdl_sound_init'; drivers/video/video-uclass.o:/home/christian/projects/u-boot-mainline/./arch/sandbox/include/asm/sdl.h:120: first defined here make[3]: *** [scripts/Makefile.build:355: drivers/video/built-in.o] Fehler 1 make[2]: *** [scripts/Makefile.build:432: drivers/video] Fehler 2 make[1]: *** [Makefile:1531: drivers] Fehler 2 make: *** [Makefile:485: __build_one_by_one] Fehler 2 Fixes: f2b25c9bf82 ("dm: sound: Complete migration to driver model") Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2019-04-09 09:27:00 +00:00
static inline int sandbox_sdl_sound_init(int rate, int channels)
{
return -ENODEV;
}
#endif
#endif