# How and differences SPORT AB channel interrupt?

Question asked by qian on Oct 26, 2010
Latest reply on Oct 27, 2010 by DeepV

SPORT has two channels A and B, when the two channels A and B simultaneously.
How can I distinguish between a channel which generated the interrupt.

Example code is as follows;

section ("seg_sdram") databuffer_A[1024][256];
section ("seg_sdram") databuffer_B[1024][256];
int Sp3A_cnt = 0;
int Sp3B_cnt = 0;

int main()
{
int SPORT3_Block_A[2][256];
int *SPORT3A_Block_A = SPORT3_Block[0];
int *SPORT3A_Block_B = SPORT3_Block[1];

int SPORT3_Block_B[2][256];
int *SPORT3B_Block_A = SPORT3_Block[0];
int *SPORT3B_Block_B = SPORT3_Block[1];

unsigned int SPORT3A_TCB_A[4] = {0, sizeof(SPORT3A_Block_A),1,0};
unsigned int SPORT3A_TCB_B[4] = {0, sizeof(SPORT3A_Block_B),1,0};
unsigned int SPORT3B_TCB_A[4] = {0, sizeof(SPORT3B_Block_A),1,0};
unsigned int SPORT3B_TCB_B[4] = {0, sizeof(SPORT3B_Block_B),1,0};

//-----SPORT3AB---------------------------------------------------------
//Proceed from Block A to Block B
SPORT3A_TCB_A[0] = (int) SPORT3A_TCB_B + 3 - OFFSET + PCI ;
SPORT3A_TCB_A[3] = (unsigned int) SPORT3A_Block_A - OFFSET ;

//Proceed from Block B to Block A
SPORT3A_TCB_B[0] = (int) SPORT3A_TCB_A + 3 - OFFSET + PCI ;
SPORT3A_TCB_B[3] = (unsigned int) SPORT3A_Block_B - OFFSET ;

//Proceed from Block A to Block B
SPORT3B_TCB_A[0] = (int) SPORT3B_TCB_B + 3 - OFFSET + PCI ;
SPORT3B_TCB_A[3] = (unsigned int) SPORT3B_Block_A - OFFSET ;

//Proceed from Block B to Block C
SPORT3B_TCB_B[0] = (int) SPORT3B_TCB_A + 3 - OFFSET + PCI ;
SPORT3B_TCB_B[3] = (unsigned int) SPORT3B_Block_B - OFFSET ;

(CLK and FS From the external )
*pSPCTL3 |= SPEN_A| SDEN_A| L_FIRST| SCHEN_A| SPEN_B| SDEN_B| SCHEN_B| SLEN24 | OPMODE;

interrupt(SIG_P4,Sport3Isr);

while(1)
{
asm("nop;");
}
}

void Sport3Isr()
{
//How to judge here?

if(//SPORT3A)
{
memcpy(databuffer_A[Sp3A_cnt & (1024 - 1)],SPORT3_Block_A[Sp3A_cnt & 0x1]);
Sp3A_cnt++;
}

if(//SPORT3B)
{
memcpy(databuffer_B[Sp3B_cnt & (1024 - 1)],SPORT3_Block_B[Sp3B_cnt & 0x1]);
Sp3B_cnt++;
}
}