osAiGetStatus, osAiGetLength, osAiSetFrequency, osAiSetNextBuffer
Functions as AI (audio interface) function
#include <ultra64.h> /* ultra64.h */ u32 osAiGetStatus(void); u32 osAiGetLength(void); s32 osAiGetFrequency(u32 frequency); s32 osAiSetNextBuffer(void *vaddr, u32 nbytes);
These routines provide basic control for the AI (audio interface).
osAiGetStatus returns the hardware status of the audio interface. In this 32-bit value, only bits AI_STATUS_FIFO_FULL and AI_STATUS_DMA_BUSY contain useful information. AI_STATUS_FIFO_FULL is set when both audio DMA registers have been programmed. AI_STATUS_DMA_BUSY is set when DMA is in progress.
Based on the input requested frequency (in Hz), the osAiSetFrequency function calculates the correct values for the internal divisors and returns the actual frequency generated by these divisors. The requested frequency should fall between 3000 Hz and 368000 Hz on NTSC systems, or between 3050 Hz and 376000 Hz on PAL systems.
osAiSetNextBuffer sets up the next DMA transfer from RDRAM to the audio interface buffer. The vaddr argument points to the buffer in RDRAM, and the nbytes argument specifies the number of bytes to transfer. Note that the buffer address vaddr must be 64-bit aligned and that nbytes must be a multiple of 8 bytes. A maximum transfer size of 262144 bytes is supported. If the interface is busy (that is, AI_STATUS_FIFO_FULL is set), osAiSetNextBuffer returns -1 and stops the DMA operation.
osAiGetLength returns the number of bytes remaining in the current DMA buffer.
For hardware version 1.0, the audio DMA length register is only 15-bit long and thus supports a maximum transfer size of 32 Kbytes. In the final release, this register is extended to 18 bits to support a transfer of 256 Kbytes.
osAiGetStatus, osAiGetLength, osAiSetNextBuffer, and osTvType
1999/04/30 Changed Format