⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spi01.c

📁 s3c24a0固件测试代码 ? ? ? ? ?啊 
💻 C
📖 第 1 页 / 共 2 页
字号:
	
	Uart_Printf("tx_dma1Done=%x, rx_dma3Done=%x\n",tx_dma1Done,rx_dma3Done);
		
    #if FORMAT1_A
	rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	#else
	rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
	rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
    #endif
	
    Uart_Printf("\nDMA1 data\n");
    for(i=0; i<spitx_count; i++)
		Uart_Printf("0x%02x,",*tx0_ptr++);

	//SPI0_Port_Return();	
	
    Uart_Printf("\n\nDMA3 data\n");
    *(rx1_ptr+spirx_count)=rSPRDAT1;
    rx1_ptr=(unsigned char *) DMA3_RxBUFFER1;
    for(i=1;i<(spirx_count+1);i++)		
		Uart_Printf("0x%02x,",*(rx1_ptr+i));
    SPI0_Port_Return();	


}
///////////////////////////////////////////////////////////////////////////

void Test_SPI01_MS_DMA_RxTx(void)// SPI0=Master(Rx), SPI1=Slave(Tx)
{
	int i;
	SPI0_Port_Init(1); // SPI0=Master, SPI1=Slave
	Master_nSS_Con(1);
	Uart_Printf("[SPI0(Slave Rx), SPI1(Master Tx) DMA test]\n");
	Uart_Printf("Connect J37: (1-2) and CON21: (1-20),(2-19),(3-18),(4-17)\n");

	Uart_Printf("Slave setting press enter\n");
	
	tx_dma3Done=0;
	rx_dma1Done=0;

    tx1_ptr=(unsigned char *) DMA3_TxBUFFER1;
    for(i=0;i<spitx_count;i++)
		*(tx1_ptr+i)=i+0x50; // Zero Initialize
	
    pISR_DMA = (unsigned)DmaTx_Int;
	rINTSUBMSK&=~(BIT_SUB_DMA3);
	rINTMSK&=~(BIT_DMA);	
	
	rSPPRE1=0x00;	//if PCLK=50Mhz,SPICLK=25Mhz
    #if FORMAT1_A
		rSPCON1=(2<<5)|(0<<4)|(0<<3)|(0<<2)|(1<<1)|(1<<0);//DMA1,dis-SCK,slave,low,A,TAGD
    #else
		rSPCON1=(2<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(1<<0);//DMA1,dis-SCK,slave,low,B,TAGD
	#endif
       rSPPIN1=(0<<2)|(1<<1)|(0<<0);//dis-ENMUL,SBO,release
	
	//Test_Spi1_S_Tx_DMA3_Set();//Slave DMA3setting
	
	rDISRC3=(unsigned)tx1_ptr;  //Address of Memory
	rDISRCC3=(0<<1)|(0); 	   //AHB(Memory), inc
	rDIDST3=(unsigned)0x44500030;//Address of SPTDAT Register
	rDIDSTC3=(1<<1)|(1); 	   //APB(SPI), fix
	rDCON3=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(2<<24)|(1<<23)|(1<<22)|(0<<20)|(spirx_count);
	rDMASKTRIG3=(0<<2)|(1<<1)|(0);	 //run, DMA1 channel on, no-sw trigger 
	

	Uart_Printf("Slave setting end...Press enter\n");
	Uart_Getch();
			
	Test_Spi0_M_Rx_DMA1_Set();//Master DMA1 setting

	rSPPRE0=0xf;	//
	#if FORMAT0_A
	rSPCON0=(2<<5)|(1<<4)|(1<<3)|(0<<2)|(1<<1)|(1<<0);//DMA1,en-SCK,master,low,A,normal
	#else
	rSPCON0=(2<<5)|(1<<4)|(1<<3)|(1<<2)|(0<<1)|(1<<0);//DMA1,en-SCK,master,low,B,normal    
	#endif
    rSPPIN0=(0<<2)|(1<<1)|(0<<0);//dis-ENMUL,SBO,release
	//Uart_Printf("1. TC1=%x,  TC3=%x\n",rDSTAT1,rDSTAT3);

	Master_nSS_Con(0); // Activate nSS	
    //rx0_ptr=(unsigned char *) DMA1_RxBUFFER0;
	
	rDISRC1=(unsigned)0x44500014;//Address of SPRDAT Register
    rDISRCC1=(1<<1)|(1);		//APB(SPI), fix
    rDIDST1=(unsigned)rx0_ptr;	//Address of Memory
    rDIDSTC1=(0<<1)|(0);		//AHB(Memory), inc
    rDCON1=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(3<<24)|(1<<23)|(1<<22)|(0<<20)|(spitx_count);
    rDMASKTRIG1=(0<<2)|(1<<1)|(0);    //run, DMA1 channel on, no-sw trigger 
	
//	Uart_Printf("#########\n");
	 
    while((rx_dma1Done==0)||(tx_dma3Done==0))
		{
    	if(Uart_GetKey())
			break;
		}
	Uart_Printf("Check TC1=%x,  TC3=%x\n",rDSTAT1,rDSTAT3);

	while(!(rSPSTA0&0x1)||!(rSPSTA1&0x1))// Tx/Rx is done
		{
    	if(Uart_GetKey())
			break;
    	}
	
	Master_nSS_Con(1);

	Uart_Printf("tx_dma3Done=%x, rx_dma1Done=%x\n",tx_dma3Done,rx_dma1Done);
		
    #if FORMAT1_A
	rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	#else
	rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
	rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
    #endif
	
	

    Uart_Printf("\nDMA1 data\n");
    for(i=0; i<spitx_count; i++)
		Uart_Printf("0x%02x,",*tx1_ptr++);

    Uart_Printf("\n\nDMA3 data\n");
    *(rx0_ptr+spirx_count)=rSPRDAT0;
    rx0_ptr=(unsigned char *) DMA1_RxBUFFER0;
    for(i=1;i<(spirx_count+1);i++)		
		Uart_Printf("0x%02x,",*(rx0_ptr+i));
	
    SPI0_Port_Return();	


}

void Test_Spi0_M_Tx_DMA1_Set(void)
{

    int i;
    tx0_ptr=(unsigned char *) DMA1_TxBUFFER0;
    for(i=0; i<spitx_count; i++)
		*(tx0_ptr+i)=i; 

    tx_dma1Done=0;
    
    pISR_DMA = (unsigned)Dma1Tx_Int;
	rINTSUBMSK&=~(BIT_SUB_DMA1);
	rINTMSK&=~(BIT_DMA);    	
    rDISRC1=(unsigned)tx0_ptr;	//Address of Memory
	rDISRCC1=(0<<1)|(0);		//AHB(Memory), inc
	rDIDST1=(unsigned)0x44500010;//Address of SPTDAT Register
	rDIDSTC1=(1<<1)|(1);		//APB(SPI), fix
    rDCON1=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(3<<24)|(1<<23)|(1<<22)|(0<<20)|(spitx_count);
	rDMASKTRIG1=(0<<2)|(1<<1)|(0);    //run, DMA1 channel on, no-sw trigger 
    Uart_Printf("Check TC1=%x\n",rDSTAT1);
   	Uart_Printf("**DMA1 setting end**\n");
}

//////////////////////////////////////////////
void Test_Spi0_M_Rx_DMA1_Set(void)
{

    int i;
    rx0_ptr=(unsigned char *) DMA1_RxBUFFER0;
    for(i=0; i<spirx_count+10; i++)
		*(rx0_ptr+i)=0x0; 
    pISR_DMA = (unsigned)DmaTx_Int;
	rINTSUBMSK&=~(BIT_SUB_DMA1);
	rINTMSK&=~(BIT_DMA);    
}

void Test_Spi1_S_Tx_DMA3_Set(void)
{
/*
    int i;
    tx1_ptr=(unsigned char *) DMA3_TxBUFFER1;
    for(i=0;i<spitx_count;i++)
		*(tx1_ptr+i)=i; // Zero Initialize
	
    tx_dma3Done=0;
    pISR_DMA = (unsigned)DmaTx_Int;
	rINTSUBMSK&=~(BIT_SUB_DMA3);
	rINTMSK&=~(BIT_DMA);	
*/
	rDISRC3=(unsigned)tx1_ptr;//Address of SPRDAT Register
    rDISRCC3=(1<<1)|(1);		//APB(SPI), fix
    rDIDST3=(unsigned)0x44500030;	//Address of Memory
    rDIDSTC3=(0<<1)|(0);		//AHB(Memory), inc
    rDCON3=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(2<<24)|(1<<23)|(1<<22)|(0<<20)|(spirx_count);
    rDMASKTRIG3=(0<<2)|(1<<1)|(0);    //run, DMA1 channel on, no-sw trigger 
    Uart_Printf("Check TC3=%x\n",rDSTAT3);
	Uart_Printf("\n**DMA3 setting end**\n");
}
////////////////////////////////////////////////
void Test_Spi1_S_Rx_DMA3_Set(void)
{
    int i;
    rx1_ptr=(unsigned char *) DMA3_RxBUFFER1;
    for(i=0;i<spirx_count+10;i++)
		*(rx1_ptr+i)=0x0; // Zero Initialize
	
    rx_dma3Done=0;
    pISR_DMA = (unsigned)Dma1Tx_Int;
	rINTSUBMSK&=~(BIT_SUB_DMA3);
	rINTMSK&=~(BIT_DMA);	
	rDISRC3=(unsigned)0x44500034;//Address of SPRDAT Register
    rDISRCC3=(1<<1)|(1);		//APB(SPI), fix
    rDIDST3=(unsigned)rx1_ptr;	//Address of Memory
    rDIDSTC3=(0<<1)|(0);		//AHB(Memory), inc
    rDCON3=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(2<<24)|(1<<23)|(1<<22)|(0<<20)|(spirx_count);
    rDMASKTRIG3=(0<<2)|(1<<1)|(0);    //run, DMA1 channel on, no-sw trigger 
    Uart_Printf("TC3=%x\n",rDSTAT3);
   	Uart_Printf("\n**DMA3 setting end**\n");
}


///////////////////////////SPI0: Slave, SPI1: Master/////////////////////////
void Test_Spi01_SM_DMA_RxTx(void)
{
    int i;
    
    SPI0_Port_Init(1); // Slave(nSS) 
    
	Uart_Printf("[SPI0(Master Tx), SPI1(Slave Rx) DMA test]\n");
	Uart_Printf("Connect J36: (1-2) and CON21: (1-20),(2-19),(3-18),(4-17)\n");
    

	tx1_ptr=(unsigned char *) DMA3_TxBUFFER1;
		for(i=0; i<spitx_count; i++)
			*(tx1_ptr+i)=i; 
		
    rx0_ptr=(unsigned char *) DMA1_RxBUFFER0;
    for(i=0;i<spirx_count;i++)
		*(rx0_ptr+i)=0x0; // Zero Initialize
		
    rx_dma1Done=0;
	tx_dma3Done=0;

    pISR_DMA = (unsigned)DmaTx_Int;
    rINTMSK=~(BIT_DMA);
    rINTSUBMSK=~(BIT_SUB_DMA1);

    //Step1. SPI init
    rSPPRE0=0x0;	//if PCLK=50Mhz,SPICLK=25Mhz
    #if FORMAT0_A
		rSPCON0=(2<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(1<<0);//DMA1,dis-SCK,slave,low,A,TAGD
    #else
		rSPCON0=(2<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(1<<0);//DMA1,dis-SCK,slave,low,B,TAGD
		//When you use [Slave Rx with DMA] function you should have to set TAGD bit
    #endif

    //When you use [Slave Rx with DMA] function you should have to set TAGD bit
    rSPPIN0=(0<<2)|(1<<1)|(0<<0);//dis-ENMUL,SBO,release

    //Step2. DMA1 init 
    rDISRC1=(unsigned)0x44500014;//Address of SPRDAT Register
    rDISRCC1=(1<<1)|(1);		//APB(SPI), fix
    rDIDST1=(unsigned)rx0_ptr;	//Address of Memory
    rDIDSTC1=(0<<1)|(0);		//AHB(Memory), inc
    rDCON1=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(3<<24)|(1<<23)|(1<<22)|(0<<20)|(spirx_count);
    rDMASKTRIG1=(0<<2)|(1<<1)|(0);    //run, DMA1 channel on, no-sw trigger 
	Uart_Printf("Slave setting......end\n");
	Uart_Getch();

	pISR_DMA = (unsigned)DmaTx_Int;
	rINTMSK=~(BIT_DMA);
	rINTSUBMSK=~(BIT_SUB_DMA3);
		
	//Step1. SPI init
	rSPPRE1=0x0;	//
    #if FORMAT1_A
		rSPCON1=(2<<5)|(1<<4)|(1<<3)|(1<<2)|(0<<1)|(0<<0);//DMA1,en-SCK,master,low,A,normal
    #else
		rSPCON1=(2<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|(0<<0);//DMA1,en-SCK,master,low,B,normal    
    #endif
		rSPPIN1=(0<<2)|(1<<1)|(0<<0);//dis-ENMUL,SBO,release
	
	 Master_nSS_Con(0); // Activate nSS
		//Step2. DMA1 init 
	rDISRC3=(unsigned)tx1_ptr;	//Address of Memory
	rDISRCC3=(0<<1)|(0);		//AHB(Memory), inc
	rDIDST3=(unsigned)0x44500030;//Address of SPTDAT Register
	rDIDSTC3=(1<<1)|(1);		//APB(SPI), fix
	rDCON3=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(2<<24)|(1<<23)|(1<<22)|(0<<20)|(spitx_count);
	rDMASKTRIG3=(0<<2)|(1<<1)|(0);	  //run, DMA1 channel on, no-sw trigger 

	
    while((rx_dma1Done==0)||(tx_dma3Done==0))
		{
    	if(Uart_GetKey())
			break;
		}
	Uart_Printf("Check TC1=%x,  TC3=%x\n",rDSTAT1,rDSTAT3);

	while(!(rSPSTA0&0x1)||!(rSPSTA1&0x1))// Tx/Rx is done
		{
    	if(Uart_GetKey())
			break;
    	}
	
	Master_nSS_Con(1);

	Uart_Printf("tx_dma3Done=%x, rx_dma1Done=%x\n",tx_dma3Done,rx_dma1Done);
  	
    #if FORMAT1_A
	rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	#else
	rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
	rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
    #endif

	*(rx0_ptr+spirx_count)=rSPRDAT0;

	Uart_Printf("\nDMA3 data\n");
	for(i=0; i<spitx_count; i++)
		Uart_Printf("0x%02x,",*tx1_ptr++);

	Uart_Printf("\n\n");

	Uart_Printf("\nDMA1 data\n");
    
    rx0_ptr=(unsigned char *) DMA1_RxBUFFER0;
    for(i=1;i<(spirx_count+1);i++)
		Uart_Printf("0x%02x,",*(rx0_ptr+i));
    SPI0_Port_Return();
}

void Test_Spi01_SM_DMA_TxRx(void)
{
    int i;
    SPI0_Port_Init(1); // Slave (nSS)
    Uart_Printf("[SPI0(Master Rx), SPI1(Slave Tx) DMA test]\n");
	Uart_Printf("Connect J36: (1-2) and CON21: (1-20),(2-19),(3-18),(4-17)\n");

	tx0_ptr=(U8 *) DMA1_TxBUFFER0;
    for(i=0; i<spitx_count; i++)
		*(tx0_ptr+i)=i+0x50;

	rx1_ptr=(unsigned char *)DMA3_RxBUFFER1;
    for(i=0;i<spirx_count;i++)
		*(rx1_ptr+i)=0x0; // Zero Initialize
		
    rx_dma3Done=0;
    tx_dma1Done=0;
	
    pISR_DMA = (unsigned)DmaTx_Int;
    rINTMSK=~(BIT_DMA);
    rINTSUBMSK=~(BIT_SUB_DMA1);

    //Step1. SPI init
    rSPPRE0=0x0;	//if PCLK=50Mhz,SPICLK=25Mhz
    #if FORMAT0_A
	rSPCON0=(2<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//DMA1,dis-SCK,slave,low,A,normal
    #else
	rSPCON0=(2<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//DMA1,dis-SCK,slave,low,B,normal
    #endif
    rSPPIN0=(0<<2)|(1<<1)|(0<<0);//dis-ENMUL,SBO,release

    //Step2. DMA1 init 
    rDISRC1=(unsigned)tx0_ptr;	//Address of Memory
    rDISRCC1=(0<<1)|(0);		//AHB(Memory), inc
    rDIDST1=(unsigned)0x44500010;//Address of SPTDAT Register
    rDIDSTC1=(1<<1)|(1);		//APB(SPI), fix
    rDCON1=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(3<<24)|(1<<23)|(1<<22)|(0<<20)|(spitx_count);
    rDMASKTRIG1=(0<<2)|(1<<1)|(0);    //run, DMA1 channel on, no-sw trigger 

	Uart_Printf("Slave setting......end\n");
	Uart_Getch();
	
	pISR_DMA = (unsigned)DmaTx_Int;
	rINTMSK=~(BIT_DMA);
	rINTSUBMSK=~(BIT_SUB_DMA3);
	   //Step1. SPI init
	rSPPRE1=0xff;   //if PCLK=50Mhz,SPICLK=25Mhz
    #if FORMAT1_A
	rSPCON1=(2<<5)|(1<<4)|(1<<3)|(1<<2)|(0<<1)|(1<<0);//DMA1,en-SCK,master,low,A,TAGD	
    #else
	rSPCON1=(2<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|(1<<0);//DMA1,en-SCK,master,low,B,TAGD
    #endif
	   //When you use [Master Rx with DMA] function you should have to set TAGD bit
	rSPPIN1=(0<<2)|(1<<1)|(0<<0);//dis-ENMUL,SBO,release
	
    Master_nSS_Con(0);
	  
	   //Step2. DMA3 init 
	rDISRC3=(unsigned)0x44500034;//Address of SPRDAT Register
	rDISRCC3=(1<<1)|(1); 	   //APB(SPI), fix
	rDIDST3=(unsigned)rx1_ptr;   //Address of Memory
	rDIDSTC3=(0<<1)|(0); 	   //AHB(Memory), inc
	rDCON3=(1<<31)|(0<<30)|(1<<29)|(0<<28)|(0<<27)|(2<<24)|(1<<23)|(1<<22)|(0<<20)|(spirx_count);
	rDMASKTRIG3=(0<<2)|(1<<1)|(0);	 //run, DMA1 channel on, no-sw trigger 

	while((rx_dma1Done==0)||(tx_dma3Done==0))
		{
		if(Uart_GetKey())
			break;
		}
	Uart_Printf("Check TC1=%x,	TC3=%x\n",rDSTAT1,rDSTAT3);

	while(!(rSPSTA0&0x1)||!(rSPSTA1&0x1))// Tx/Rx is done
		{
		if(Uart_GetKey())
			break;
		}
	
	Master_nSS_Con(1);
	
	Uart_Printf("tx_dma3Done=%x, rx_dma1Done=%x\n",tx_dma3Done,rx_dma1Done);
		
    #if FORMAT1_A
		rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
		rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(0<<1)|(0<<0);//poll,dis-SCK,slave,low,A,normal
	#else
		rSPCON0=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
		rSPCON1=(0<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(0<<0);//poll,dis-SCK,slave,low,B,normal
    #endif
    
    *(rx1_ptr+spirx_count)=rSPRDAT1;

	Uart_Printf("\nDMA1 data\n");
	for(i=0; i<spitx_count; i++)
		Uart_Printf("0x%02x,",*tx0_ptr++);

	Uart_Printf("\n\n");

	Uart_Printf("\nDMA1 data\n");
    
    rx1_ptr=(unsigned char *) DMA3_RxBUFFER1;
    for(i=1;i<(spirx_count+1);i++)
	Uart_Printf("0x%02x,",*(rx1_ptr+i));
    SPI0_Port_Return();
}

void __irq Dma1Tx_Int(void)
{
	Uart_Printf("Entered ISR_1\n");
	rINTSUBMSK|=(BIT_SUB_DMA1|BIT_SUB_DMA3);
	rINTMSK|=(BIT_DMA);
	if(rSUBSRCPND&(1<<26))
		{
		rx_dma1Done=1;
		tx_dma1Done=1;
		rSUBSRCPND=BIT_SUB_DMA1;
	    //Uart_Printf("##Tx DMA1 is done##\n");
		}
	else if(rSUBSRCPND&(1<<28))
		{
		rx_dma3Done=1;
		tx_dma3Done=1;
		rSUBSRCPND=BIT_SUB_DMA3;
		//Uart_Printf("##Rx DMA3 is done##\n");
		}
	else
    	{
    	Uart_Printf("DMA SUB INT Fail\n");
    	}
	ClearPending(BIT_DMA);
    rINTMSK &= ~(BIT_DMA);
    rINTSUBMSK &= ~(BIT_SUB_DMA1|BIT_SUB_DMA3);	
	//*(rx1_ptr+spirx_count)=rSPRDAT1;
}

void __irq DmaTx_Int(void)
{
	Uart_Printf("Entered ISR_2\n");
	rINTSUBMSK|=(BIT_SUB_DMA1|BIT_SUB_DMA3);
	rINTMSK|=(BIT_DMA);
	if(rSUBSRCPND&(1<<26))
		{		
		rx_dma1Done=1;
		tx_dma1Done=1;
		rSUBSRCPND=BIT_SUB_DMA1;
	    Uart_Printf("##DMA1 is done##\n");
		}
	else if(rSUBSRCPND&(1<<28))
		{
		rx_dma3Done=1;
		tx_dma3Done=1;
		rSUBSRCPND=BIT_SUB_DMA3;
		Uart_Printf("##DMA3 is done##\n");
		}
	else
    	{
    	Uart_Printf("DMA SUB INT Fail\n");
    	}
	ClearPending(BIT_DMA);
    rINTMSK &= ~(BIT_DMA);
    rINTSUBMSK &= ~(BIT_SUB_DMA1|BIT_SUB_DMA3);	
	//*(rx1_ptr+spirx_count)=rSPRDAT1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -