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

📄 mcsi1.c

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 C
字号:
#include "mcsiw.h"
#include "ssw.h"
#include "interrupt_mapping.h"
#include "inth2.h"
#include "UART_IrDA.h"


extern FUNC PE_InterruptArray [200];

volatile static UWORD8 MCSI_port = 1;
volatile static UWORD16 mcsi_tx_irq_counter = 0;
volatile static UWORD16 mcsi_rx_irq_counter = 0;
volatile static UWORD16 mcsi_tx_dma_counter = 0;

void mcsi_tx_isr()
{
	UWORD16 stat_reg=0;

	stat_reg = MCSI_STATUS_REG(MCSI_port);

    if ( stat_reg & (0x0001 << 4))   // MCSI_STATUS_REG_TX_READY_POS) )
    {
    	if(mcsi_tx_irq_counter & 1)
  		{
        	// write data into transmit register
        	MCSI_TX0_REG(MCSI_port) = 0; 
        }
        else
        {
        	// write data into transmit register
        	MCSI_TX0_REG((MCSI_port)) =0xffff;
        }
		// acknowledge tx interrupt
        MCSI_STATUS_REG(MCSI_port) |= 0x0001 << 4;  //MCSI_STATUS_REG_TX_READY_POS;               		
    }
    mcsi_tx_irq_counter++;        	
}



void MCSI_Tx_without_DMA(port)
{
	U16 i, MCSI_INT;
	UWORD16 error_code;	
	MCSI_port = port;
	ULPD_SoftReqEnable(MCSI);
	if(port ==1)
	{	
	   	error_code = SSW_Grab(MCSI1);
		MCSI_INT = MCSI1_TX_RX_RST_FRAMEERROR_INT;
	}
	else
	{
	   	error_code = SSW_Grab(MCSI2);
		MCSI_INT = MCSI2_TX_RX_RST_FRAMEERROR_INT;
	}
	
	MCSI_CONTROL_REG(port) = 0x0;           //disable mcsi
  	MCSI_MAIN_PARAM_REG(port) = 0x014f;     
  	//main parameter register:no dma, single, master mode, 16 bits data
  	MCSI_OVER_CLOCK_REG(port)=0x03;        //over clock register
  	MCSI_CLOCK_FREQUENCY_REG(port)=0x00bb; //12MHz/187 = 64KHz
  	MCSI_INTERRUPTS_REG(port)=0x0700;     // tx and rx for ch 0

/* Configure and enable the MCSI interrupts */
  	PE_InterruptArray[MCSI_INT] =  &mcsi_tx_isr;
  	INTH2_InitLevel(MCSI_INT,
                     (BOOL)INTH_IRQ,
                     MCSI_INT,
                     (BOOL)INTH_LOW_LEVEL_SENSITIVE);
  	INTH2_EnableOneIt(MCSI_INT,(BOOL)INTH_IRQ);
   
  	// write the fisrt data in the transmit0 register  	
  	MCSI_TX0_REG(port) = 0x5555;
	mcsi_tx_irq_counter=0;
 	
  	// write the first data in the transmit0 register  	         
  	MCSI_CONTROL_REG(port)=0x1; //enable mcsi

  	//stop MCSI
  	while(mcsi_tx_irq_counter != 1000);
  	
	MCSI_CONTROL_REG(port)=0x0; //disable mcsi2
  	MCSI_CONTROL_REG(port)=0x2; //reset mcsi2  	
  	
  	//disable MCSI interrupt
  	INTH_DisableOneIt(MCSI_INT);
}




void MCSI_test_menu()
{
	U16 val = 1;
	
	while(val)
    {     	
    	UART_Printf(UART2,"\n");
    	UART_Printf(UART2,"==========================================\n");
    	UART_Printf(UART2,"    DSP BENCH ----- MCSI Test Menu\n");
    	UART_Printf(UART2,"==========================================\n");    	
    	UART_Printf(UART2,"0 :  Back to upper menu\n");
    	UART_Printf(UART2,"1 :  MCSI1 Tx without DMA\n");		
		UART_Printf(UART2,"2 :  MCSI1 Rx without DMA\n");
		UART_Printf(UART2,"3 :  MCSI1 Tx with DMA\n");
		UART_Printf(UART2,"4 :  MCSI1 Rx with DMA\n");
 		UART_Printf(UART2,"5 :  MCSI2 Tx without DMA\n");		
		UART_Printf(UART2,"6 :  MCSI2 Rx without DMA\n");
		UART_Printf(UART2,"7 :  MCSI2 Tx with DMA\n");
		UART_Printf(UART2,"8 :  MCSI2 Rx with DMA\n"); 		
 		UART_Printf(UART2,"------------------------------------------\n");  
  		UART_Printf(UART2,"Please Enter your choice: \n ");   
		val = UART_GetNum(UART2);
    	UART_Printf(UART2,"\n\r");
    	
    	switch (val)
    	{     		
    		case 0:
    			break;
    		case 1:
    		{
    			MCSI_Tx_without_DMA(1);
    			break;
    		}
    		case 2:
    		{
    			//;												
    			break;	
    		}
			case 3:
    		{
    		//	MCSI_Tx_with_DMA(1);												
    			break;	
    		}    		
    		case 4:
    		{
    			//(2);												
    			break;	
    		}
    		case 5:
    		{
    			MCSI_Tx_without_DMA(2);
    			break;
    		}
    		case 6:
    		{
    			//;												
    			break;	
    		}
			case 7:
    		{
    		//CSI_Tx_with_DMA(1);												
    			break;	
    		}    		
    		case 8:
    		{
    			//(2);												
    			break;	
    		}														
			default:
				UART_Printf(UART2,"You have select the wrong choice\n\r");						
		}		
   	}	
}



/********************************************************************************
					The end of this file
********************************************************************************/

⌨️ 快捷键说明

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