📄 sportisr.c
字号:
///////////////////////////////////////////////////////////////////////////////////////
//NAME: SPORTisr.c (Block-based Talkthrough)
//DATE: 7/29/05
//PURPOSE: Talkthrough framework for sending and receiving samples to the AD1835.
//
//USAGE: This file contains SPORT0 Interrupt Service Routine. Three buffers are used
// for this example. One is filled by the ADC, another is sent to the DAC, and
// the final buffer is processed. Each buffer rotates between these functions
// upon each SP0 interrupt received.
///////////////////////////////////////////////////////////////////////////////////////
/*
Here is the mapping between the SPORTS and the SPDIF
SPDIF Rx -> DSP: SPORT0A : I2S
DSP -> SPDIF Tx: SPORT3A : I2S
*/
#include "tt.h"
#include <stdio.h>
extern unsigned int InBlock_A[NUM_SAMPLES] ;
extern unsigned int InBlock_B[NUM_SAMPLES] ;
extern unsigned int OutBlock_C[NUM_SAMPLES] ;
extern unsigned int OutBlock_D[NUM_SAMPLES] ;
extern unsigned int OFFSET ;
//Pointer to the blocks
unsigned int *insrc_pointer[2] = {InBlock_A,
InBlock_B};
unsigned int *outsrc_pointer[2] = {OutBlock_C,
OutBlock_D};
// Counter to choose which buffer to process
int int_cntr=1;
// Semaphore to indicate to main that a block is ready for processing
int blockReady=0;
// Semaphore to indicate to the isr that the processing has not completed before the
// buffer will be overwritten.
int isProcessing=0;
//If the processing takes too long, the program will be stuck in this infinite loop.
void ProcessingTooLong(void)
{
while(1);
}
void TalkThroughISR(int sig_int)
{
if(isProcessing)
ProcessingTooLong();
//Increment the block pointer
int_cntr++;
int_cntr %= 2;
blockReady = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -