From ba0f154cba55096a2342375df3375f4626b15866 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Mon, 11 Nov 2024 19:08:27 +0800 Subject: [PATCH] remove audio and gpu init from ioe_init --- am/src/platform/nemu/ioe/ioe.c | 52 ++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/am/src/platform/nemu/ioe/ioe.c b/am/src/platform/nemu/ioe/ioe.c index cdf35d1..5970e20 100644 --- a/am/src/platform/nemu/ioe/ioe.c +++ b/am/src/platform/nemu/ioe/ioe.c @@ -18,42 +18,44 @@ void __am_disk_config(AM_DISK_CONFIG_T *cfg); void __am_disk_status(AM_DISK_STATUS_T *stat); void __am_disk_blkio(AM_DISK_BLKIO_T *io); -static void __am_timer_config(AM_TIMER_CONFIG_T *cfg) { cfg->present = true; cfg->has_rtc = true; } -static void __am_input_config(AM_INPUT_CONFIG_T *cfg) { cfg->present = true; } -static void __am_uart_config(AM_UART_CONFIG_T *cfg) { cfg->present = false; } -static void __am_net_config (AM_NET_CONFIG_T *cfg) { cfg->present = false; } +static void __am_timer_config(AM_TIMER_CONFIG_T *cfg) { + cfg->present = true; + cfg->has_rtc = true; +} +static void __am_input_config(AM_INPUT_CONFIG_T *cfg) { cfg->present = true; } +static void __am_uart_config(AM_UART_CONFIG_T *cfg) { cfg->present = false; } +static void __am_net_config(AM_NET_CONFIG_T *cfg) { cfg->present = false; } typedef void (*handler_t)(void *buf); static void *lut[128] = { - [AM_TIMER_CONFIG] = __am_timer_config, - [AM_TIMER_RTC ] = __am_timer_rtc, - [AM_TIMER_UPTIME] = __am_timer_uptime, - [AM_INPUT_CONFIG] = __am_input_config, - [AM_INPUT_KEYBRD] = __am_input_keybrd, - [AM_GPU_CONFIG ] = __am_gpu_config, - [AM_GPU_FBDRAW ] = __am_gpu_fbdraw, - [AM_GPU_STATUS ] = __am_gpu_status, - [AM_UART_CONFIG ] = __am_uart_config, - [AM_AUDIO_CONFIG] = __am_audio_config, - [AM_AUDIO_CTRL ] = __am_audio_ctrl, - [AM_AUDIO_STATUS] = __am_audio_status, - [AM_AUDIO_PLAY ] = __am_audio_play, - [AM_DISK_CONFIG ] = __am_disk_config, - [AM_DISK_STATUS ] = __am_disk_status, - [AM_DISK_BLKIO ] = __am_disk_blkio, - [AM_NET_CONFIG ] = __am_net_config, + [AM_TIMER_CONFIG] = __am_timer_config, + [AM_TIMER_RTC] = __am_timer_rtc, + [AM_TIMER_UPTIME] = __am_timer_uptime, + [AM_INPUT_CONFIG] = __am_input_config, + [AM_INPUT_KEYBRD] = __am_input_keybrd, + [AM_GPU_CONFIG] = __am_gpu_config, + [AM_GPU_FBDRAW] = __am_gpu_fbdraw, + [AM_GPU_STATUS] = __am_gpu_status, + [AM_UART_CONFIG] = __am_uart_config, + [AM_AUDIO_CONFIG] = __am_audio_config, + [AM_AUDIO_CTRL] = __am_audio_ctrl, + [AM_AUDIO_STATUS] = __am_audio_status, + [AM_AUDIO_PLAY] = __am_audio_play, + [AM_DISK_CONFIG] = __am_disk_config, + [AM_DISK_STATUS] = __am_disk_status, + [AM_DISK_BLKIO] = __am_disk_blkio, + [AM_NET_CONFIG] = __am_net_config, }; static void fail(void *buf) { panic("access nonexist register"); } bool ioe_init() { for (int i = 0; i < LENGTH(lut); i++) - if (!lut[i]) lut[i] = fail; - __am_gpu_init(); + if (!lut[i]) + lut[i] = fail; __am_timer_init(); - __am_audio_init(); return true; } -void ioe_read (int reg, void *buf) { ((handler_t)lut[reg])(buf); } +void ioe_read(int reg, void *buf) { ((handler_t)lut[reg])(buf); } void ioe_write(int reg, void *buf) { ((handler_t)lut[reg])(buf); }