Difference between revisions of "DSP Memory Region"

From 3dbrew
Jump to navigation Jump to search
Line 58: Line 58:
 
|-
 
|-
 
| 4
 
| 4
| 70 bytes
+
| f32[3][2][2]
| TODO
+
| Input Gain (Each input has 12 channels)
 +
|-
 +
| 52
 +
| f32
 +
| Rate multiplier (1.0x == native DSP rate)
 +
|-
 +
| 56
 +
| u8
 +
| Interpolation mode
 +
|-
 +
| 57
 +
| u8
 +
| Polyphase filter select
 +
|-
 +
| 58
 +
| u16
 +
| bit[0]: Simple Filter enabled, bit[1]: Biquadratic Filter enabled
 +
|-
 +
| 60
 +
| SimpleFilter
 +
| Simple Filter (One pole normalized recursive linear filter)
 +
|-
 +
| 64
 +
| BiquadFilter
 +
| Biquadratic Filter (Two poles two zeros normalized recursive linear filter)
 
|-
 
|-
 
| 74
 
| 74
Line 82: Line 106:
 
|-
 
|-
 
| 164
 
| 164
| 8
+
| u32
| TODO
+
| Play position
 +
|-
 +
| 168
 +
| 4
 +
| ?
 
|-
 
|-
 
| 172
 
| 172
 
| u32
 
| u32
| Physical address of current buffer
+
| Physical address of embedded buffer
 
|-
 
|-
 
| 176
 
| 176
 
| u32
 
| u32
| Number of samples in current buffer
+
| Number of samples in embedded buffer
 
|-
 
|-
 
| 180
 
| 180
Line 98: Line 126:
 
|-
 
|-
 
| 182
 
| 182
| u16
+
| AdpcmData
| ADPCM predictor/scale
+
| ADPCM data associated with embedded buffer
|-
 
| 184
 
| s16
 
| ADPCM y[n-1]
 
|-
 
| 186
 
| s16
 
| ADPCM y[n-2]
 
 
|-
 
|-
 
| 188
 
| 188
 
| u16
 
| u16
| bit[0]: ADPCM updated?; bit[1]: Is looping?
+
| bit[0]: ADPCM updated?; bit[1]: Is looping?r
 
|-
 
|-
 
| 190
 
| 190
 
| u16
 
| u16
| Buffer Id of this current buffer
+
| Buffer Id of embedded buffer
 
|}
 
|}
  
Line 135: Line 155:
 
|-
 
|-
 
| 8
 
| 8
| u16
+
| AdpcmData
| 4 bits: ADPCM Predictor, 4 bits: ADPCM Scale
+
| ADPCM data
|-
 
| 10
 
| s16
 
| ADPCM y[n-1]
 
|-
 
| 11
 
| s16
 
| ADPCM y[n-2]
 
 
|-
 
|-
 
| 14
 
| 14
 
| u8
 
| u8
| ADPCM dirty?
+
| ADPCM data dirty?
 
|-
 
|-
 
| 15
 
| 15
Line 162: Line 174:
 
| -
 
| -
 
|}
 
|}
 +
 +
=== Adpcm Data ===
 +
 +
{| class="wikitable"
 +
|-
 +
| 0
 +
| u8
 +
| ADPCM predictor/scale
 +
|-
 +
| 1
 +
| u8
 +
| -
 +
|-
 +
| 2
 +
| s16
 +
| ADPCM y[n-1]
 +
|-
 +
| 4
 +
| s16
 +
| ADPCM y[n-2]
 +
|}
 +
  
 
=== Simple Filter ===
 
=== Simple Filter ===

Revision as of 23:16, 17 February 2016

Some of this is known to be incorrect. I'll correct this in a few months after a bit more RE work. Merry (talk) 21:10, 28 January 2016 (CET)


  • Note that everything below will vary depending on the exact DSP firmware used and different variants have slightly different behaviours.*

The DSP communicates with the application through two shared memory areas 0x8000 bytes long each (at 0x1FF50000 and 0x1FF70000 respectively). The DSP alternates between the use of these two areas (much like a double-buffer). Each area has 15 structures within it. The location of these structures can be obtained by reading channel 2 of the DSP pipe. A list of structures in the order the DSP addresses are read from the pipe follows:

1. Frame count

2. Input configurations

3. Input status

4. Input ADPCM coefficients

5. DSP configuration

6. DSP status

7. Output samples

8. Intermediate mix samples

9. Compressor table

10. DSP debug statistics

11. Unknown Coefficients

12. Unknown Coefficients

13. Unknown Coefficients

14. Unknown Coefficients

15. Unknown Coefficients

The DSP has 24 inputs, each of which are individually configurable. These 24 inputs each produce three sets of 4 audio channels (two left, two right).

These four audio channels feed into three intermediate mixers. Two of these intermediate mixers are used for effects and aux.

Frame Count

Input Config

A 192 byte long structure. There are 24 of them.

Offset Type Description
0 u32 Dirty flags
4 f32[3][2][2] Input Gain (Each input has 12 channels)
52 f32 Rate multiplier (1.0x == native DSP rate)
56 u8 Interpolation mode
57 u8 Polyphase filter select
58 u16 bit[0]: Simple Filter enabled, bit[1]: Biquadratic Filter enabled
60 SimpleFilter Simple Filter (One pole normalized recursive linear filter)
64 BiquadFilter Biquadratic Filter (Two poles two zeros normalized recursive linear filter)
74 u16 Bitmap of which buffers in queue are dirty
76 Buffer[4] Buffer queue
156 u32 -
160 u16 Is Active
162 u16 Sync Count
164 u32 Play position
168 4 ?
172 u32 Physical address of embedded buffer
176 u32 Number of samples in embedded buffer
180 u16 bits[0:1]: 1 = mono, 2 = stereo; bits[2:3]: buffer format, bits[5]: fade in
182 AdpcmData ADPCM data associated with embedded buffer
188 u16 bit[0]: ADPCM updated?; bit[1]: Is looping?r
190 u16 Buffer Id of embedded buffer

Buffer

Offset Type Description
0 u32 Physical Address
4 u32 Sample Count
8 AdpcmData ADPCM data
14 u8 ADPCM data dirty?
15 u8 Looping?
16 u16 Buffer Id
18 u16 -

Adpcm Data

0 u8 ADPCM predictor/scale
1 u8 -
2 s16 ADPCM y[n-1]
4 s16 ADPCM y[n-2]


Simple Filter

This is a standard single-pole filter. The fall-off is 6dB per octave as you would expect.

Offset Type Description
0 s16 b0
0 s16 a1

Input status

Read only.

Input ADPCM coefficients

DSP configuration

Delay Effect

Delay with feedback.

Length of delay is a multiple of audio frames. There are 160 samples per audioframe.

Feedback arm only has a gain on it. Under the feedback arm is a single-pole filter with the delay.

Reverb Effect

DSP status

Read only.

Output samples

Read only.

PCM16.

Intermediate mix samples

Read/Write.

PCM32. Also serves an aux function, allowing the ARM11 to apply custom effects to audio.

Compressor table

A precomputed response curve lookup table for the compressor.