sound: HDA support with PCM and wav playback
- Implemented HDA driver in src/sound/hda.c, providing initialization, codec enumeration, and playback functionality. - Defined HDA register offsets and structures in src/sound/hda.h. - Added WAV file parsing and playback capabilities in src/sound/pcm.c, supporting both WAV and raw PCM formats. - Created header file src/sound/pcm.h for PCM playback functions and WAV header structures. - Integrated memory management for DMA buffers during audio playback. Yes we played Charlie Charlie Kirky as the first sound on KirkOS Signed-off-by: kaguya <vpshinomiya@protonmail.com>
This commit is contained in:
+6
-1
@@ -25,6 +25,8 @@
|
||||
#include <uacpi/event.h>
|
||||
#include <uacpi/sleep.h>
|
||||
#include "arch/x86_64/pci.h"
|
||||
#include "sound/hda.h"
|
||||
#include "sound/pcm.h"
|
||||
|
||||
|
||||
uintptr_t g_hhdm_offset;
|
||||
@@ -427,10 +429,13 @@ void kmain(void) {
|
||||
|
||||
pci_device_t hda;
|
||||
if (pci_find_hda(&hda)) {
|
||||
|
||||
printf("[PCI] Found HDA controller at %02x:%02x.%x %04x:%04x\n",
|
||||
hda.addr.bus, hda.addr.device, hda.addr.function,
|
||||
hda.vendor_id, hda.device_id);
|
||||
// BAR0 is usually at hda.bar[0] & ~0xF (MMIO)
|
||||
if (hda_init(&hda)) {
|
||||
pcm_play_file("kirky.wav");
|
||||
}
|
||||
} else {
|
||||
printf("[PCI] No HDA controller found!\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user