?? initdai.asm
字號(hào):
#include <def21262.h>
// The following definition allows the SRU macro to check for errors. Once the routings have
// been verified, this definition can be removed to save some program memory space.
// The preprocessor will issue a warning stating this when using the SRU macro without this
// definition
#define SRUDEBUG // Check SRU Routings for errors.
#include <SRU.h>
.section /pm seg_pmco;
.global _initDAI;
/*-----------------------------------------------------------------------------
*** EZ-KIT DIGITAL-IN ROUTING OVERVIEW ***
..............................................
:SHARC
:
:
SPDIF DAI_P02: o-DAI_PB02_O-----+
MCLK >---------------->#--o- |
OUT : o PBEN02_I=LOW |
: |
DAC DAI_P06: o- |
MCLK <----------------<#--o-DAI_PB02_O-----+
IN : o PBEN02_I=HIGH
:
SPDIF DAI_P03: o-DAI_PB03_O--------*---------->o-SPORT0_CLK_I
BCLK >---------------->#--o- | +------->o-SPORT0_FS_I
OUT : o-PBEN03_I=LOW | | +->o-SPORT0_DA_I
: | | |
SPDIF DAI_P04: o-DAI_PB04_O-----------* |
FS >---------------->#--o- | | |
OUT : o-PBEN04_I=LOW | | |
: | | |
SPDIF DAI_P01: o-DAI_PB01_O-----------------+
DATA >---------------->#--o- | |
OUT : o PBEN01_I=LOW | |
: | |
DAC1 DAI_P13: o- | |
BCLK <----------------<#--o-DAI_PB12_I<-------*--------+
IN : o-PBEN13_I=HIGH | | |
: | | |
DAC1 DAI_P14: o- | | +->o-SPORT1_CLK_I
FS <----------------<#--o-DAI_PB14_I<----------*------->o-SPORT1_FS_I
IN : o PBEN14_I=HIGH | | +-----o-SPORT1_DA_O
: | | | +--o-SPORT1_DB_O
DAC1 DAI_P12: o | | | |
DATA <----------------<#--o-DAI_PB12_I<-------------+ |
IN : o PBEN12_I=HIGH | | |
: | | |
DAC2 DAI_P11: o- | | |
DATA <----------------<#--o-DAI_PB11_I<----------------+
IN : o PBEN11_I=HIGH | |
: +---------->o-SPORT2_CLK_I
DAC3 DAI_P10: o- +------->o-SPORT2_FS_I
DATA <----------------<#--o-DAI_PB10_I<-------------------o-SPORT2_DA_O
IN : o PBEN10_I=HIGH +--o-SPORT2_DB_O
: |
DAC4 DAI_P09: o- |
DATA <----------------<#--o-DAI_PB09_I<----------------+
IN : o PBEN09_I=HIGH
:
..............................................
-----------------------------------------------------------------------------*/
_initDAI:
// Disable the pull-up resistors on all 20 pins
r0 = 0x000FFFFF;
dm(DAI_PIN_PULLUP) = r0;
//-----------------------------------------------------------------------------
//
// Connect the SPDIF receiver: It drives a BCLK output to DAI pin 3,
// a LRCLK (a.k.a. frame sync) to DAI pin 4 and data to DAI pin 1.
//
// Connect to the SPDIF receiver using SPORT0, data input A
//
// For this example, we're not going to use MCLK, but we still need
// to ensure that we don't drive that line.as an output.
// connected to DAI pin 2.
//
// All three lines are always inputs to the SHARC so tie the pin
// buffer inputs and pin buffer enable inputs all low.
//------------------------------------------------------------------------
// Connect the SPDIF receiver to SPORT0, using data input A
// Data in on pin 1
SRU(DAI_PB01_O,SPORT0_DA_I);
// Bit clock in on pin 3
SRU(DAI_PB03_O,SPORT0_CLK_I);
// Frame sync in on pin 4
SRU(DAI_PB04_O,SPORT0_FS_I);
//------------------------------------------------------------------------
// Tie the pin buffer inputs LOW for DAI pins 1, 2 3 and 4. Even though
// these pins are inputs to the SHARC, tying unused pin buffer inputs
// LOW is "good coding style" to eliminate the possibility of
// termination artifacts internal to the IC. Note that signal
// integrity is degraded only with a few specific SRU combinations.
// In practice, this occurs VERY rarely, and these connections are
// typically unnecessary.
SRU(LOW,DAI_PB01_I);
SRU(LOW,DAI_PB02_I);
SRU(LOW,DAI_PB03_I);
SRU(LOW,DAI_PB04_I);
//------------------------------------------------------------------------
// Tie the pin buffer enable inputs LOW for DAI pins 1, 2 3 and 4 so
// that they are always input pins.
SRU(LOW,PBEN01_I);
SRU(LOW,PBEN02_I);
SRU(LOW,PBEN03_I);
SRU(LOW,PBEN04_I);
//-----------------------------------------------------------------------------
//
// Connect the DACs: The codec accepts a BCLK input from DAI pin 13 and
// a LRCLK (a.k.a. frame sync) from DAI pin 14 and has four
// serial data outputs to DAI pins 12, 11, 10 and 9
//
// Connect DAC1 to SPORT1, using data output A
// Connect DAC2 to SPORT1, using data output B
// Connect DAC3 to SPORT2, using data output A
// Connect DAC4 to SPORT2, using data output B
//
// Connect the clock and frame sync inputs to SPORT1 and SPORT2
// should come from the SPDIF on DAI pins 3 and 4, respectively
//
// Connect the ADC BCLK and LRCLK back out to the DAC on DAI
// pins 13 and 14, respectively.
//
// All six DAC connections are always outputs from the SHARC
// so tie the pin buffer enable inputs all high.
//
//------------------------------------------------------------------------
// Connect the output of the SPORT data lines to the pin buffers.
SRU(SPORT2_DB_O,DAI_PB09_I);
SRU(SPORT2_DA_O,DAI_PB10_I);
SRU(SPORT1_DB_O,DAI_PB11_I);
SRU(SPORT1_DA_O,DAI_PB12_I);
//------------------------------------------------------------------------
// Connect the clock and frame sync input from the SPDIF receiver
// directly to the output pins driving the DACs. Also, tie the
// recovered MCLK to the MCLK out to the codec for the DAC on pin 6
// MCLK in on pin 2
SRU(DAI_PB02_O,DAI_PB06_I);
SRU(DAI_PB03_O,DAI_PB13_I);
SRU(DAI_PB04_O,DAI_PB14_I);
//------------------------------------------------------------------------
// Connect the SPORT clocks and frame syncs to the clock and
// frame sync from the SPDIF receiver
SRU(DAI_PB03_O,SPORT1_CLK_I);
SRU(DAI_PB03_O,SPORT2_CLK_I);
SRU(DAI_PB04_O,SPORT1_FS_I);
SRU(DAI_PB04_O,SPORT2_FS_I);
//------------------------------------------------------------------------
// Tie the pin buffer enable inputs HIGH to make DAI pins 6 & 9-14 outputs.
SRU(HIGH,PBEN06_I);
SRU(HIGH,PBEN09_I);
SRU(HIGH,PBEN10_I);
SRU(HIGH,PBEN11_I);
SRU(HIGH,PBEN12_I);
SRU(HIGH,PBEN13_I);
SRU(HIGH,PBEN14_I);
rts;
_initDAI.end:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -