1 /*---------------------------------------------------------------------------* 2 Project: Audio Interface (AI) Device driver and API 3 File: ai.h 4 5 Copyright (C) Nintendo. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 *---------------------------------------------------------------------------* 14 15 Description 16 ----------- 17 This is the public API definition file for the Audio Interface device 18 driver. Applications or OS components which need access to the AI 19 hardware must include this file. 20 21 *---------------------------------------------------------------------------*/ 22 23 #ifndef __AI_H__ 24 #define __AI_H__ 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 /*---------------------------------------------------------------------------* 31 * Includes 32 *---------------------------------------------------------------------------*/ 33 #include <types.h> 34 35 /*---------------------------------------------------------------------------* 36 * Definitions 37 *---------------------------------------------------------------------------*/ 38 #define AI_SAMPLERATE_48KHZ 0x00000001 // SRC sample rates for DSP 39 #define AI_SAMPLERATE_32KHZ 0x00000000 40 41 /*---------------------------------------------------------------------------* 42 * Types/Declarations 43 *---------------------------------------------------------------------------*/ 44 typedef void (*AIDCallback)(void); 45 46 47 typedef enum _AI_EXADDR_STATE { 48 AI_EXADDR_NOT_SET = 0, 49 AI_EXADDR_SET = 1, 50 AI_EXADDR_INVALID =2 51 } AI_EXADDR_STATE; 52 53 54 typedef enum _AI_CHANNEL 55 { 56 AI_CHANNEL_STEREO, 57 AI_CHANNEL_MULTI_PCM, 58 AI_CHANNEL_BITSTREAM 59 }AI_CHANNEL; 60 61 /*---------------------------------------------------------------------------* 62 * Globals 63 *---------------------------------------------------------------------------*/ 64 extern AI_EXADDR_STATE ex_addr_reg_stat; 65 66 /*---------------------------------------------------------------------------* 67 * Function Prototypes 68 *---------------------------------------------------------------------------*/ 69 70 // AI-FIFO DMA --------------------------------------------------------------- 71 AIDCallback AIRegisterDMACallback (AIDCallback callback); 72 AIDCallback AIDRCRegisterDMACallback (AIDCallback callback); 73 74 void AIInitDMA (u32 start_addr, u32 length); 75 BOOL AIGetDMAEnableFlag (void); 76 void AIStartDMA (void); 77 void AIStopDMA (void); 78 void AIQuit (void); 79 u32 AIGetDMABytesLeft (void); 80 81 u32 AIGetDMAStartAddr (void); 82 u32 AIDRCGetDMAStartAddr (void); 83 u32 AIGetDMALength (void); 84 u32 AIDRCGetDMALength (void); 85 86 u32 AIGetDSPSampleRate (void); 87 void AISetDSPSampleRate (u32 rate); 88 89 // General/initialization ------------------------------------------------------ 90 void AIInit (u8* stack); 91 92 BOOL AICheckInit (void); 93 void AIReset (void); 94 void AISetChannel (AI_CHANNEL channel, BOOL stuffing); 95 96 u32 AIGetAudioFrameCount(void); 97 // Software workaround for extended dma memory support until A31 98 void AIGetDMARange( u32 start_addr, u32* addr_hi, u32* addr_low); 99 100 #ifdef __cplusplus 101 } 102 #endif 103 104 #endif // __AI_H__ 105