1 /*---------------------------------------------------------------------------*
2   Project:  Revolution OS - Audio Interface (AI) Device driver and API
3   File:     ai.h
4 
5   Copyright (C)1999-2006 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   $Log: ai.h,v $
14   Revision 1.4  02/09/2006 04:41:11  aka
15   Changed copyright.
16 
17   Revision 1.3  2006/02/04 11:56:44  hashida
18   (none)
19 
20   Revision 1.2  01/11/2006 06:07:37  aka
21   Removed HW audio streaming functions.
22 
23   Revision 1.1.1.1  2005/12/29 06:53:27  hiratsu
24   Initial import.
25 
26   Revision 1.1.1.1  2005/05/12 02:41:06  yasuh-to
27   Imported from Dolphin tree.
28 
29     10     5/01/01 6:44p Eugene
30     Added XXXReset() functions to clear respective init flags.
31     All XXXInit() functions modified to return safely if respective init
32     flags are asserted.
33 
34     9     4/30/01 6:38p Eugene
35     removed AISetStreamSampleRate() from public view. Added AICheckInit().
36 
37     8     3/25/01 9:38p Eugene
38     Added AIGetDMAStartAddr() and AIGetDMALength() to retrieve most recent
39     parameters programmed into AI-FIFO DMA engine.
40 
41     7     12/08/00 10:51p Eugene
42     Callback registration functions now return old callback (if any).
43 
44     6     11/23/00 8:05p Eugene
45     Added support for RevB features (hardware SRC for DSP).
46     Specifically, AIGetDSPSampleRate() and AISetDSPSampleRate().
47     These functions exist for RevA/HW1 builds, but don't do anything.
48 
49     5     5/27/00 3:55a Eugene
50 
51     4     5/01/00 6:23p Eugene
52     Added prototype for AIInitDMA().
53 
54     3     4/11/00 5:33p Eugene
55 
56     2     3/08/00 2:54p Tian
57     Added stack argument to AIInit
58 
59     1     3/07/00 7:08p Eugene
60     Public header file for AI driver/API.
61 
62   $NoKeywords: $
63 
64  *---------------------------------------------------------------------------*
65 
66   Description
67   -----------
68   This is the public API definition file for the Audio Interface device
69   driver. Applications or OS components which need access to the AI
70   hardware must include this file.
71 
72  *---------------------------------------------------------------------------*/
73 
74 #ifndef __AI_H__
75 #define __AI_H__
76 
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 /*---------------------------------------------------------------------------*
82  * Includes
83  *---------------------------------------------------------------------------*/
84 #include <revolution/types.h>
85 
86 /*---------------------------------------------------------------------------*
87  * Definitions
88  *---------------------------------------------------------------------------*/
89 #define AI_SAMPLERATE_48KHZ  0x00000001   // SRC sample rates for DSP
90 #define AI_SAMPLERATE_32KHZ  0x00000000
91 
92 /*---------------------------------------------------------------------------*
93  * Types/Declarations
94  *---------------------------------------------------------------------------*/
95 typedef void (*AIDCallback)(void);
96 
97 /*---------------------------------------------------------------------------*
98  * Globals
99  *---------------------------------------------------------------------------*/
100 
101 /*---------------------------------------------------------------------------*
102  * Function Prototypes
103  *---------------------------------------------------------------------------*/
104 
105 // AI-FIFO DMA ---------------------------------------------------------------
106 AIDCallback AIRegisterDMACallback       (AIDCallback callback);
107 
108 void        AIInitDMA                   (u32 start_addr, u32 length);
109 BOOL        AIGetDMAEnableFlag          (void);
110 void        AIStartDMA                  (void);
111 void        AIStopDMA                   (void);
112 u32         AIGetDMABytesLeft           (void);
113 
114 u32         AIGetDMAStartAddr           (void);
115 u32         AIGetDMALength              (void);
116 
117 u32         AIGetDSPSampleRate          (void);
118 void        AISetDSPSampleRate          (u32 rate);
119 
120 // General/initialization ------------------------------------------------------
121 void        AIInit                      (u8*  stack);
122 BOOL        AICheckInit                 (void);
123 void        AIReset                     (void);
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif // __AI_H__
130