N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential





osAiSetNextBuffer

Syntax
#include <ultra64.h>
s32 osAiSetNextBuffer(void *vaddr, u32 nbytes);


Explanation
The osAiGetStatus, osAiGetLength, osAiSetFrequency, and osAiSetNextBuffer routines provide basic control for the AI (audio interface).

This function (osAiSetNextBuffer) sets up the next DMA transfer from DRAM to the audio interface buffer. The vaddr argument points to the buffer in DRAM, 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.

Comments
It is worth noting that a previous hardware bug has been fixed by a software patch in osAiSetNextBuffer. This bug occurred when the address of the end of the buffer specified by osAiSetNextBuffer was at a specific value. This value occurred when the following was true:

(vaddr + nbytes) 0x00003FFF == 0x00002000

In other words, when the end of the buffer is a number ending in a set bit followed by 13 clear bits, the bug occurs. In this case, the DMA transfer does not complete successfully. This can cause clicks and pops in the audio output. This bug no longer requires special handling by the application because it is now patched by osAiSetNextBuffer.

Notes
For hardware version 1.0, the audio DMA length register is only 15 bits 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.

See Also
osAiGetStatus
osAiGetLength
osAiSetFrequency
osTvType


Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998