head 1.1; branch 1.1.1; access ; symbols start:1.1.1.1 PAlibDoc:1.1.1; locks ; strict; comment @# @; 1.1 date 2005.11.02.08.30.22; author jandujar; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2005.11.02.08.30.22; author jandujar; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @ PA_lib: PA_Micro.h Source File

PA_Micro.h

00001 #if !defined(COMMAND_H)
00002 #define COMMAND_H
00003 /* 
00004    Thanks to Chris Double and Neimod
00005    http://www.double.co.nz/nintendo_ds
00006 */
00007 /*
00008   Structures and functions to allow the ARM9 to send commands to the
00009   ARM7. Based on code from the MOD player example posted to the GBADEV
00010   forums.
00011 */
00012 
00013 /* Enumeration of commands that the ARM9 can send to the ARM7 */
00014 enum CommandType {PLAY_ONE_SHOT_SAMPLE,START_RECORDING,STOP_RECORDING};
00015 
00016 /* Command parameters for playing a sound sample */
00017 struct PlaySampleSoundCommand
00018 {
00019   int channel;
00020   int frequency;
00021   void* data;
00022   int length;
00023   int volume;
00024 };
00025 
00026 /* Command parameters for starting to record from the microphone */
00027 struct StartRecordingCommand
00028 {
00029   u8* buffer;  
00030   int length;
00031 };
00032 
00033 /* The ARM9 fills out values in this structure to tell the ARM7 what
00034    to do. */
00035 struct Command {
00036   enum CommandType commandType;
00037   union {
00038     void* data;  
00039      struct PlaySampleSoundCommand playSample;    
00040      struct StartRecordingCommand  startRecording;
00041   };
00042 };
00043 
00044 /* Maximum number of commands */
00045 #define MAX_COMMANDS 20
00046 
00047 /* A structure shared between the ARM7 and ARM9. The ARM9
00048    places commands here and the ARM7 reads and acts upon them.
00049 */
00050 typedef struct CommandControl {
00051   struct Command command[MAX_COMMANDS];
00052   int currentCommand;
00053   int return_data;
00054 }CommandControl;
00055 
00056 /* Address of the shared CommandControl structure */
00057 #define commandControl ((CommandControl*)((uint32)(IPC) + sizeof(TransferRegion)))
00058 
00059 #if defined(ARM9)
00060 void PA_MicInit();
00061 void PA_PlaySample(int channel, int frequency, void* data, int length, int volume);
00062 void PA_StartRecording(u8* buffer, int length);
00063 int PA_StopRecording();
00064 int PA_GetMicVol();
00065 #endif
00066 
00067 #if defined(ARM7)
00068 void CommandProcessCommands();
00069 #endif
00070 
00071 #endif

Generated on Fri Oct 28 23:16:50 2005 for PA_lib by  doxygen 1.3.9.1
@ 1.1.1.1 log @Initial import of PalibDoc, begin on PAlib0.64b @ text @@