1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - include - snd - common
3   File:     command.h
4 
5   Copyright 2004-2008 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   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_SND_COMMON_COMMAND_H_
19 #define NITRO_SND_COMMON_COMMAND_H_
20 
21 #include <nitro/types.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /******************************************************************************
28 	macro definition
29  ******************************************************************************/
30 
31 #define SND_COMMAND_NOBLOCK     0
32 #define SND_COMMAND_BLOCK     ( 1 << 0 )
33 #define SND_COMMAND_IMMEDIATE ( 1 << 1 )
34 
35 /******************************************************************************
36 	enum definition
37  ******************************************************************************/
38 
39 typedef enum SNDCommandID
40 {
41     SND_COMMAND_START_SEQ,
42     SND_COMMAND_STOP_SEQ,
43     SND_COMMAND_PREPARE_SEQ,
44     SND_COMMAND_START_PREPARED_SEQ,
45     SND_COMMAND_PAUSE_SEQ,
46     SND_COMMAND_SKIP_SEQ,
47     SND_COMMAND_PLAYER_PARAM,
48     SND_COMMAND_TRACK_PARAM,
49     SND_COMMAND_MUTE_TRACK,
50     SND_COMMAND_ALLOCATABLE_CHANNEL,
51     SND_COMMAND_PLAYER_LOCAL_VAR,
52     SND_COMMAND_PLAYER_GLOBAL_VAR,
53     SND_COMMAND_START_TIMER,
54     SND_COMMAND_STOP_TIMER,
55     SND_COMMAND_SETUP_CHANNEL_PCM,
56     SND_COMMAND_SETUP_CHANNEL_PSG,
57     SND_COMMAND_SETUP_CHANNEL_NOISE,
58     SND_COMMAND_SETUP_CAPTURE,
59     SND_COMMAND_SETUP_ALARM,
60     SND_COMMAND_CHANNEL_TIMER,
61     SND_COMMAND_CHANNEL_VOLUME,
62     SND_COMMAND_CHANNEL_PAN,
63     SND_COMMAND_SURROUND_DECAY,
64     SND_COMMAND_MASTER_VOLUME,
65     SND_COMMAND_MASTER_PAN,
66     SND_COMMAND_OUTPUT_SELECTOR,
67     SND_COMMAND_LOCK_CHANNEL,
68     SND_COMMAND_UNLOCK_CHANNEL,
69     SND_COMMAND_STOP_UNLOCKED_CHANNEL,
70     SND_COMMAND_SHARED_WORK,
71     SND_COMMAND_INVALIDATE_SEQ,
72     SND_COMMAND_INVALIDATE_BANK,
73     SND_COMMAND_INVALIDATE_WAVE,
74     SND_COMMAND_READ_DRIVER_INFO
75 }
76 SNDCommandID;
77 
78 /******************************************************************************
79 	structure definition
80  ******************************************************************************/
81 
82 typedef struct SNDCommand
83 {
84     struct SNDCommand *next;
85     SNDCommandID id;
86     u32     arg[4];
87 }
88 SNDCommand;
89 
90 /******************************************************************************
91 	public function declaration
92  ******************************************************************************/
93 
94 void    SND_CommandInit(void);
95 
96 #ifdef SDK_ARM9
97 
98 struct SNDCommand *SND_AllocCommand(u32 flags);
99 void    SND_PushCommand(struct SNDCommand *command);
100 
101 const SNDCommand *SND_RecvCommandReply(u32 flags);
102 
103 BOOL    SND_FlushCommand(u32 flags);
104 
105 void    SND_WaitForCommandProc(u32 tag);
106 void    SND_WaitForFreeCommand(int count);
107 
108 u32     SND_GetCurrentCommandTag(void);
109 BOOL    SND_IsFinishedCommandTag(u32 tag);
110 
111 
112 int     SND_CountFreeCommand(void);
113 int     SND_CountReservedCommand(void);
114 int     SND_CountWaitingCommand(void);
115 
116 #else  /* SDK_ARM7 */
117 
118 void    SND_CommandProc(void);
119 
120 #endif /* SDK_ARM9 */
121 
122 #ifdef __cplusplus
123 } /* extern "C" */
124 #endif
125 
126 #endif /* NITRO_SND_COMMON_COMMAND_H_ */
127