📄 initsport.asm
字号:
////////////////////////////////////////////////////////////////////////////////////////////
//NAME: initSPORT.asm
//DATE: 7/29/05
//USAGE: This file initializes the transmit and receive serial ports (SPORTS). It uses
// SPORT0 to receive data from the SPDIF Rx and transmits the data to SRC1 Input
// via SPORT1A, then uses SPORT2A to receive data from SRC1 Output and transmits
// to the DAC's via SPORT3A, SPORT3B, SPORT4A and SPORT4B.
////////////////////////////////////////////////////////////////////////////////////////////
#include <def21369.h>
.global _initSPORT;
.section/pm seg_pmco;
_initSPORT:
//============================================================
//
// Make sure that the multichannel mode registers are cleared
//
//============================================================
r0 = 0;
dm(SPMCTL0) = r0;
dm(SPMCTL1) = r0;
dm(SPMCTL2) = r0;
dm(SPMCTL3) = r0;
dm(SPMCTL4) = r0;
dm(SPCTL0) = r0;
dm(SPCTL1) = r0;
dm(SPCTL2) = r0;
dm(SPCTL3) = r0;
dm(SPCTL4) = r0;
//============================================================
//
// Configure SPORT 0 for input from ADC
// OPMODE = I2S mode
// L_FIRST = Send the Left word first (per I2S requirement)
// SLEN24 = 24 bit of data in each 32-bit word
// SPEN_A = Enable data channel A
//------------------------------------------------------------
r0 = OPMODE | L_FIRST | SLEN24 | SPEN_A;
dm(SPCTL0) = r0;
//============================================================
// Configure SPORT 1 as a transmitter
//
// SPTRAN = Transmit on serial port
// OPMODE = I2S mode
// L_FIRST = Send the Left word first (per I2S requirement)
// SLEN24 = 24 bit of data in each 32-bit word
// SPEN_A = Enable data channel A
//------------------------------------------------------------
r0 = SPTRAN | OPMODE | L_FIRST | SLEN24 | SPEN_A;
dm(SPCTL1) = r0;
//============================================================
// Configure SPORT 2 as a receiver
//
// OPMODE = I2S mode
// L_FIRST = Send the Left word first (per I2S requirement)
// SLEN24 = 24 bit of data in each 32-bit word
// SPEN_A = Enable data channel A
//------------------------------------------------------------
r0 = OPMODE | L_FIRST | SLEN24 | SPEN_A | SPEN_B;
dm(SPCTL2) = r0;
//============================================================
// Configure SPORTs 3 & 4 as transmiters to DACs 1-4
//
// SPTRAN = Transmit on serial port
// OPMODE = I2S mode
// L_FIRST = Send the Left word first (per I2S requirement)
// SLEN24 = 24 bit of data in each 32-bit word
// SPEN_A = Enable data channel A
//------------------------------------------------------------
r0 = SPTRAN | OPMODE | L_FIRST | SLEN24 | SPEN_A | SPEN_B;
dm(SPCTL3) = r0;
dm(SPCTL4) = r0;
_initSPORT.end:
rts;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -