1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef SCUMMVM_IPC_INCLUDE
24 #define SCUMMVM_IPC_INCLUDE
25 
26 //////////////////////////////////////////////////////////////////////
27 
28 #include <nds/ndstypes.h>
29 #include <nds/ipc.h>
30 
31 //////////////////////////////////////////////////////////////////////
32 
33 
34 typedef struct {
35 	const void *data;
36 	u32 len;
37 	u32 rate;
38 	u8 vol;
39 	u8 pan;
40 	u8 format;
41 	u8 PADDING;
42 } TransferSoundData;
43 
44 
45 
46 
47 //---------------------------------------------------------------------------------
48 typedef struct {
49 	TransferSoundData data[16];
50 	u8 count;
51 	u8 PADDING[3];
52 } TransferSound;
53 
54 
55 
56 typedef struct {
57 	u8 *buffer[8];
58 	bool filled[8];
59 	u8 *arm7Buffer[8];
60 	bool arm7Dirty[8];
61 	bool semaphore;
62 } adpcmBuffer;
63 
64 //////////////////////////////////////////////////////////////////////
65 
66 typedef struct scummvmTransferRegion {
67   uint32 heartbeat;          // counts frames
68 
69    int16 touchX,   touchY;   // TSC X, Y
70    int16 touchXpx, touchYpx; // TSC X, Y pixel values
71    int16 touchZ1,  touchZ2;  // TSC x-panel measurements
72   uint16 tdiode1,  tdiode2;  // TSC temperature diodes
73   uint32 temperature;        // TSC computed temperature
74 
75   uint16 buttons;            // X, Y, /PENIRQ buttons
76 
77   union {
78     uint8 curtime[8];        // current time response from RTC
79 
80     struct {
81       u8 command;
82       u8 year;           //add 2000 to get 4 digit year
83       u8 month;          //1 to 12
84       u8 day;            //1 to (days in month)
85 
86       u8 incr;
87       u8 hours;          //0 to 11 for AM, 52 to 63 for PM
88       u8 minutes;        //0 to 59
89       u8 seconds;        //0 to 59
90     } rtc;
91   };
92 
93   uint16 battery;            // battery life ??  hopefully.  :)
94   uint16 aux;                // i have no idea...
95 
96   TransferSound *soundData;
97 
98   adpcmBuffer adpcm;
99 
100 
101   // Don't rely on these below, will change or be removed in the future
102   vuint32 mailAddr;
103   vuint32 mailData;
104   vuint8 mailRead;
105   vuint8 mailBusy;
106   vuint32 mailSize;
107 
108   bool performArm9SleepMode;
109 
110   u32 test;
111   int tweak;
112   bool tweakChanged;
113 
114 //  bool fillSoundFirstHalf;
115 //  bool fillSoundSecondHalf;
116 
117   // These are used for ScummVMs sound output
118   bool fillNeeded[4];
119   int playingSection;
120 
121   bool reset;
122 
123   // Streaming sound
124   bool streamFillNeeded[4];
125   int streamPlayingSection;
126 } scummTransferRegion;
127 
128 //////////////////////////////////////////////////////////////////////
129 
130 #undef IPC
131 #define IPC ((scummTransferRegion volatile *)(0x027FF000))
132 
133 
134 #endif
135