Преглед на файлове

Merge pull request #120 from FrankBoesing/master

added mute_PCM() - sets or unsets VALID in VUCP (and adjusts PARITY)
dds
Paul Stoffregen преди 9 години
родител
ревизия
d536e9e37e
променени са 2 файла, в които са добавени 23 реда и са изтрити 9 реда
  1. +21
    -9
      output_spdif.cpp
  2. +2
    -0
      output_spdif.h

+ 21
- 9
output_spdif.cpp Целия файл

@@ -21,8 +21,17 @@
* THE SOFTWARE.
*/

// 2015/08/23: (FB) added mute_PCM() - sets or unsets VALID in VUCP (and adjusts PARITY)

#include "output_spdif.h"

#define PREAMBLE_B (0xE8) //11101000
#define PREAMBLE_M (0xE2) //11100010
#define PREAMBLE_W (0xE4) //11100100

#define VUCP_VALID ((0xCC) << 24)
#define VUCP_INVALID ((0xD4) << 24)// To mute PCM, set VUCP = invalid.

audio_block_t * AudioOutputSPDIF::block_left_1st = NULL;
audio_block_t * AudioOutputSPDIF::block_right_1st = NULL;
audio_block_t * AudioOutputSPDIF::block_left_2nd = NULL;
@@ -30,6 +39,7 @@ audio_block_t * AudioOutputSPDIF::block_right_2nd = NULL;
uint16_t AudioOutputSPDIF::block_left_offset = 0;
uint16_t AudioOutputSPDIF::block_right_offset = 0;
bool AudioOutputSPDIF::update_responsibility = false;
uint32_t AudioOutputSPDIF::vucp = VUCP_VALID;

DMAMEM static uint32_t SPDIF_tx_buffer[AUDIO_BLOCK_SAMPLES * 4]; //2 KB

@@ -71,9 +81,6 @@ uint16_t bmclookup[256] = { //biphase mark encoded values (least significant bit
0x32aa, 0xb2aa, 0xd2aa, 0x52aa, 0xcaaa, 0x4aaa, 0x2aaa, 0xaaaa
};

#define PREAMBLE_B (0xE8) //11101000
#define PREAMBLE_M (0xE2) //11100010
#define PREAMBLE_W (0xE4) //11100100

void AudioOutputSPDIF::begin(void)
{
@@ -165,10 +172,10 @@ void AudioOutputSPDIF::isr(void)

if (++frame > 191) {
// VUCP-Bits ("Valid, Subcode, Channelstatus, Parity) = 0 (0xcc) | Preamble (depends on Framno.) | Auxillary
*(dest+0) = 0xcc000000 | (PREAMBLE_B << 16 ) | aux; //special preamble for one of 192 frames
*(dest+0) = vucp | (PREAMBLE_B << 16 ) | aux; //special preamble for one of 192 frames
frame = 0;
} else {
*(dest+0) = 0xcc000000 | (PREAMBLE_M << 16 ) | aux;
*(dest+0) = vucp | (PREAMBLE_M << 16 ) | aux;
}
dest += 4;

@@ -185,10 +192,10 @@ void AudioOutputSPDIF::isr(void)
} else {
do {
if ( ++frame > 191 ) {
*(dest+0) = 0xcce8cccc;
*(dest+0) = vucp | 0x00e8cccc;
frame = 0;
} else {
*(dest+0) = 0xcce2cccc;
*(dest+0) = vucp | 0x00e2cccc;
}
*(dest+1) = 0xccccccccUL;

@@ -214,7 +221,7 @@ void AudioOutputSPDIF::isr(void)
*(dest+1) = ( ((uint32_t)lo << 16) | hi );

aux = (0xB333 ^ (((uint32_t)((int16_t)lo)) >> 17));
*(dest+0) = 0xcc000000 | (PREAMBLE_W << 16 ) | aux;
*(dest+0) = vucp | (PREAMBLE_W << 16 ) | aux;

dest += 4;
} while (dest < end);
@@ -230,7 +237,7 @@ void AudioOutputSPDIF::isr(void)
}
} else {
do {
*dest = 0xcce4ccccUL;
*dest = vucp | 0x00e4ccccUL;
*(dest+1) = 0xccccccccUL;
dest += 4 ;
} while (dest < end);
@@ -238,6 +245,11 @@ void AudioOutputSPDIF::isr(void)

}

void AudioOutputSPDIF::mute_PCM(const bool mute)
{
vucp = mute?VUCP_INVALID:VUCP_VALID;
}

void AudioOutputSPDIF::update(void)
{


+ 2
- 0
output_spdif.h Целия файл

@@ -34,6 +34,7 @@ public:
virtual void update(void);
void begin(void);
friend class AudioInputSPDIF;
static void mute_PCM(const bool mute);
protected:
AudioOutputSPDIF(int dummy): AudioStream(2, inputQueueArray) {}
static void config_SPDIF(void);
@@ -43,6 +44,7 @@ protected:
static DMAChannel dma;
static void isr(void);
private:
static uint32_t vucp;
static audio_block_t *block_left_2nd;
static audio_block_t *block_right_2nd;
static uint16_t block_left_offset;

Loading…
Отказ
Запис