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

Support more clock speeds

dds
PaulStoffregen преди 8 години
родител
ревизия
13d11c61a3
променени са 4 файла, в които са добавени 50 реда и са изтрити 1 реда
  1. +10
    -0
      output_i2s.cpp
  2. +10
    -0
      output_i2s_quad.cpp
  3. +10
    -0
      output_spdif.cpp
  4. +20
    -1
      utility/pdb.h

+ 10
- 0
output_i2s.cpp Целия файл

@@ -270,9 +270,17 @@ void AudioOutputI2S::update(void)
#elif F_CPU == 180000000
#define MCLK_MULT 16
#define MCLK_DIV 255
#define MCLK_SRC 0
#elif F_CPU == 192000000
#define MCLK_MULT 1
#define MCLK_DIV 17
#elif F_CPU == 216000000
#define MCLK_MULT 8
#define MCLK_DIV 153
#define MCLK_SRC 0
#elif F_CPU == 240000000
#define MCLK_MULT 4
#define MCLK_DIV 85
#elif F_CPU == 16000000
#define MCLK_MULT 12
#define MCLK_DIV 17
@@ -280,11 +288,13 @@ void AudioOutputI2S::update(void)
#error "This CPU Clock Speed is not supported by the Audio library";
#endif

#ifndef MCLK_SRC
#if F_CPU >= 20000000
#define MCLK_SRC 3 // the PLL
#else
#define MCLK_SRC 0 // system clock
#endif
#endif

void AudioOutputI2S::config_i2s(void)
{

+ 10
- 0
output_i2s_quad.cpp Целия файл

@@ -265,9 +265,17 @@ void AudioOutputI2SQuad::update(void)
#elif F_CPU == 180000000
#define MCLK_MULT 16
#define MCLK_DIV 255
#define MCLK_SRC 0
#elif F_CPU == 192000000
#define MCLK_MULT 1
#define MCLK_DIV 17
#elif F_CPU == 216000000
#define MCLK_MULT 8
#define MCLK_DIV 153
#define MCLK_SRC 0
#elif F_CPU == 240000000
#define MCLK_MULT 4
#define MCLK_DIV 85
#elif F_CPU == 16000000
#define MCLK_MULT 12
#define MCLK_DIV 17
@@ -275,11 +283,13 @@ void AudioOutputI2SQuad::update(void)
#error "This CPU Clock Speed is not supported by the Audio library";
#endif

#ifndef MCLK_SRC
#if F_CPU >= 20000000
#define MCLK_SRC 3 // the PLL
#else
#define MCLK_SRC 0 // system clock
#endif
#endif

void AudioOutputI2SQuad::config_i2s(void)
{

+ 10
- 0
output_spdif.cpp Целия файл

@@ -318,9 +318,17 @@ void AudioOutputSPDIF::update(void)
#elif F_CPU == 180000000
#define MCLK_MULT 16
#define MCLK_DIV 255
#define MCLK_SRC 0
#elif F_CPU == 192000000
#define MCLK_MULT 1
#define MCLK_DIV 17
#elif F_CPU == 216000000
#define MCLK_MULT 8
#define MCLK_DIV 153
#define MCLK_SRC 0
#elif F_CPU == 240000000
#define MCLK_MULT 4
#define MCLK_DIV 85
#elif F_CPU == 16000000
#define MCLK_MULT 12
#define MCLK_DIV 17
@@ -328,11 +336,13 @@ void AudioOutputSPDIF::update(void)
#error "This CPU Clock Speed is not supported by the Audio library";
#endif

#ifndef MCLK_SRC
#if F_CPU >= 20000000
#define MCLK_SRC 3 // the PLL
#else
#define MCLK_SRC 0 // system clock
#endif
#endif


void AudioOutputSPDIF::config_SPDIF(void)

+ 20
- 1
utility/pdb.h Целия файл

@@ -35,12 +35,31 @@

#define PDB_CONFIG (PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT | PDB_SC_PDBIE | PDB_SC_DMAEN)

#if F_BUS == 60000000

#if F_BUS == 120000000
#define PDB_PERIOD (2720-1)
#elif F_BUS == 108000000
#define PDB_PERIOD (2448-1)
#elif F_BUS == 96000000
#define PDB_PERIOD (2176-1)
#elif F_BUS == 90000000
#define PDB_PERIOD (2040-1)
#elif F_BUS == 80000000
#define PDB_PERIOD (1813-1) // small ?? error
#elif F_BUS == 72000000
#define PDB_PERIOD (1632-1)
#elif F_BUS == 64000000
#define PDB_PERIOD (1451-1) // small ?? error
#elif F_BUS == 60000000
#define PDB_PERIOD (1360-1)
#elif F_BUS == 56000000
#define PDB_PERIOD (1269-1) // 0.026% error
#elif F_BUS == 54000000
#define PDB_PERIOD (1224-1)
#elif F_BUS == 48000000
#define PDB_PERIOD (1088-1)
#elif F_BUS == 40000000
#define PDB_PERIOD (907-1) // small ?? error
#elif F_BUS == 36000000
#define PDB_PERIOD (816-1)
#elif F_BUS == 24000000

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