> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 14:59:07 up 4 days, 10:04,  1 user,  load average: 0.58, 0.47, 0.52
This commit is contained in:
tracer-ics2023
2024-09-21 14:59:08 +08:00
committed by zzy
parent aea2db9304
commit a523267d02
2 changed files with 34 additions and 16 deletions

View File

@ -35,14 +35,21 @@ void __am_audio_status(AM_AUDIO_STATUS_T *stat) {
}
void __am_audio_play(AM_AUDIO_PLAY_T *ctl) {
for (int i = 0; i < ctl->buf.end - ctl->buf.start; i++) {
if (inl(AUDIO_COUNT_ADDR) == audio_sbuf_size) {
i--;
continue;
} else {
outb(AUDIO_SBUF_ADDR + audio_write, ((uint8_t*)ctl->buf.start)[i]);
audio_write = (audio_write + 1) % audio_sbuf_size;
outl(AUDIO_COUNT_ADDR, inl(AUDIO_COUNT_ADDR) + 1);
int cnt = ctl->buf.end - ctl->buf.start, i = 0;
while (cnt) {
// lock sbuf
outl(AUDIO_INIT_ADDR, 1 << 1);
for (; i < cnt; i++) {
if (inl(AUDIO_COUNT_ADDR) == audio_sbuf_size) {
i--;
break;
} else {
outb(AUDIO_SBUF_ADDR + audio_write, ((uint8_t*)ctl->buf.start)[i]);
audio_write = (audio_write + 1) % audio_sbuf_size;
outl(AUDIO_COUNT_ADDR, inl(AUDIO_COUNT_ADDR) + 1);
}
}
// unlock sbuf
outl(AUDIO_INIT_ADDR, 0);
}
}