From 89198167c185cd58a0ade311c8516e07d1f661f3 Mon Sep 17 00:00:00 2001 From: tracer-ics2023 Date: Thu, 19 Sep 2024 22:48:52 +0800 Subject: [PATCH] =?UTF-8?q?>=20=20compile=20NEMU=20221220000=20=E5=BC=A0?= =?UTF-8?q?=E4=B8=89=20Linux=20zzy=205.15.146.1-microsoft-standard-WSL2=20?= =?UTF-8?q?#1=20SMP=20Thu=20Jan=2011=2004:09:03=20UTC=202024=20x86=5F64=20?= =?UTF-8?q?x86=5F64=20x86=5F64=20GNU/Linux=20=2022:48:51=20up=202=20days,?= =?UTF-8?q?=2017:54,=20=201=20user,=20=20load=20average:=201.76,=201.45,?= =?UTF-8?q?=201.32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/src/device/audio.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nemu/src/device/audio.c b/nemu/src/device/audio.c index daf83f6..cd9fbc5 100644 --- a/nemu/src/device/audio.c +++ b/nemu/src/device/audio.c @@ -30,16 +30,26 @@ enum { static uint8_t *sbuf = NULL; static uint32_t *audio_base = NULL; +// static void init_sdl_audio() { +// SDL_AudioSpec s = {}; +// s.format = AUDIO_S16SYS; // 假设系统中音频数据的格式总是使用16位有符号数来表示 +// s.userdata = NULL; // 不使用 + +// SDL_InitSubSystem(SDL_INIT_AUDIO); +// SDL_OpenAudio(&s, NULL); +// SDL_PauseAudio(0); +// } + static void audio_io_handler(uint32_t offset, int len, bool is_write) { + } void init_audio() { - uint32_t space_size = sizeof(uint32_t) * nr_reg; - audio_base = (uint32_t *)new_space(space_size); + audio_base = (uint32_t *)new_space(24); #ifdef CONFIG_HAS_PORT_IO - add_pio_map ("audio", CONFIG_AUDIO_CTL_PORT, audio_base, space_size, audio_io_handler); + add_pio_map ("audio", CONFIG_AUDIO_CTL_PORT, audio_base, 24, audio_io_handler); #else - add_mmio_map("audio", CONFIG_AUDIO_CTL_MMIO, audio_base, space_size, audio_io_handler); + add_mmio_map("audio", CONFIG_AUDIO_CTL_MMIO, audio_base, 24, audio_io_handler); #endif sbuf = (uint8_t *)new_space(CONFIG_SB_SIZE);