osAiGetStatus osAiGetStatus (function)

osAiGetStatus, osAiGetLength, osAiSetFrequency, osAiSetNextBuffer

AI (audio interface) function

Syntax

#include <ultra64.h>     /* ultra64.h */

u32 osAiGetStatus(void);
u32 osAiGetLength(void);
s32 osAiGetFrequency(u32 frequency);
s32 osAiSetNextBuffer(void *vaddr, u32 nbytes);

Description

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.

Note

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.

Known Issue

The issue found in the old RCP hardware version 1.0 has been fixed with a patch in osAiSetNextBuffer. However, the old hardware has been recalled already within Japan, so it is not necessary to pay attention to this issue.

See Also

osAiGetLength, osAiSetFrequency, osAiSetNextBuffer, and osTvType

Revision History

1999/04/30 Changed Format