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

📄 config.h

📁 使用ti6713芯片
💻 H
字号:
/********************************************************************************/
#define BUFF_SZ     1
#define TCCINTNUM   10
#define Ture 1
/********************************************************************************/



/********************************************************************************/
extern far void vectors();
/********************************************************************************/


/********************************************************************************/
 EDMA_Handle  hEdma;     /*    Handle for the EDMA channel */
 MCBSP_Handle hMcbsp;
 EDMA_Handle hEdmaPing; /* Handle for the ping EDMA reload parameters  */
 EDMA_Handle hEdmaPong; /* Handle for the pong EDMA reload parameters  */
 EDMA_Config cfgEdma;   /* EDMA configuration structure                */
/********************************************************************************/




/********************************************************************************/
static int ping_data[4];
static int pong_data[4];
Uint32 gblctl;
static int pingpong;
/********************************************************************************/


/********************************************************************************/
	/* Configure MCASP. */
 MCASP_ConfigGbl MyMCASPcfgGbl = {
		0x00000000, /* PFUNC -     All pins as McASP */
    	0x00000000, /* PDIR  -     XMT DATA output, rest are inputs */
    	0x00000000, /* DITCTL -    DIT mode disable */
    	0x00000000, /* DLBCTL -    Loopback disabled */
    	0x00000000  /* AMUTE  -    Never drive AMUTE */
	};
	
	//Set receive registers.
	MCASP_ConfigRcv MyMCASPcfgRcv = {
		/* RMASK */
		0xffffffff, /* RMASK -     Use all 32 bits */
    	0x000180f8, /* RFMT -      MSB first, 32-bit slots, CPU bus, 0 bit delay */
    	0x00000000, /* AFSRCTL -   burst, single bit frame sync, ext FS */
    	0x00000080, /* ACLKRCTL -  Sample on rising CLK, divide by 1, ext CLK */
    	0x00000000, /* AHCLKRCTL - External HCLK */
    	0x00000001, /* RTDM -      Slots 0-31 are active */
    	0x00000000, /* RINTCTL -   No interrupts */
    	0x00000000  /* RCLKCHK -   Not used */ 
	};
	//Set serial control.
	/****************/  //change
	MCASP_ConfigSrctl MyMCASPcfgSrctl = {
		0x0000000E, /* SRCTL0 -    Receive, active high */
    	0x00000000, /* SRCTL1 -    Inactive */
    	0x00000000, /* SRCTL2 -    Inactive */
    	0x00000000, /* SRCTL3 -    Inactive */
    	0x00000000, /* SRCTL4 -    Inactive */
    	0x00000000, /* SRCTL5 -    Inactive */
    	0x00000000, /* SRCTL6 -    Inactive */
    	0x00000000  /* SRCTL7 -    Transmit, active high */
	};
	
	//Set transmit registers.
	MCASP_ConfigXmt MyMCASPcfgXmt = {
		/* XMASK */
		0x00000000, /* XMASK -     Use all 32 bits */
    	0x00000000, /* XFMT -      MSB first, 32-bit slots, CPU bus, 0 bit delay */
    	0x00000000, /* AFSXCTL -   burst, single bit frame sync, ext FS */
    	0x00000000, /* ACLKXCTL -  Sample on falling CLK, divide by 1, ext CLK */
    	0x00000000, /* AHCLKXCTL - External HCLK */
    	0x00000000, /* XTDM -      Slots 0-31 are active */
    	0x00000000, /* XINTCTL -   No interrupts */
    	0x00000000  /* XCLKCHK -   Not used */
	};
 MCBSP_Config MyMCBSPConfig = {
		&MyMCASPcfgGbl,
		&MyMCASPcfgRcv,
		&MyMCASPcfgXmt,
		&MyMCASPcfgSrctl,
	};
/********************************************************************************/





/********************************************************************************/
 EDMA_Config cfgEdmaPing = {  
  EDMA_OPT_RMK(          /* Making Options parameter register - EDMA_OPT    */ 
  
   EDMA_OPT_PRI_LOW,    /* Priority levels for EDMA events:-
                             EDMA_OPT_PRI_LOW  - Low priority EDMA transfer
                             EDMA_OPT_PRI_HIGH - High priority EDMA transfer*/
   
   EDMA_OPT_ESIZE_32BIT,/* Element size :-
                             EDMA_OPT_ESIZE_32BIT - 32 bit word 
                             EDMA_OPT_ESIZE_16BIT - 16 bit word 
                             EDMA_OPT_ESIZE_8BIT  -  8 bit word              */
   
   EDMA_OPT_2DS_NO,     /* Source dimension :-
                             EDMA_OPT_2DS_NO  - 1-dimensional source    
                             EDMA_OPT_2DS_YES - 2-dimensional source         */  
   
   EDMA_OPT_SUM_NONE,   /* Source address update mode :-           
                             EDMA_OPT_SUM_NONE - Fixed address mode 
                             EDMA_OPT_SUM_INC  - Increment address mode
                             EDMA_OPT_SUM_DEC  - Decrement address mode
                             EDMA_OPT_SUM_IDX  - Address modified by element 
                                                 index or frame Index        */
    EDMA_OPT_2DD_NO,     /* Destination dimension :-  
                             EDMA_OPT_2DD_NO   - 1-dimensional source            
                             EDMA_OPT_2DD_YES  - 2-dimensional source        */
   
    EDMA_OPT_DUM_INC,    /* Destination address update mode :-                       
                             EDMA_OPT_DUM_NONE - Fixed address mode            
                             EDMA_OPT_DUM_INC  - Increment address mode        
                             EDMA_OPT_DUM_DEC  - Decrement address mode        
                             EDMA_OPT_DUM_IDX  - Address modified by element   
                                                 index or frame Index        */
    
    EDMA_OPT_TCINT_YES,  /* Transfer complete interrupt :-
                             EDMA_OPT_TCINT_NO  - Indication disabled      
                             EDMA_OPT_TCINT_YES - Indication enabled         */  
    
    EDMA_OPT_TCC_OF(TCCINTNUM),/* Transfer complete code                     */
    
    EDMA_OPT_LINK_YES,   /* Linking of event parameters
                             EDMA_OPT_LINK_NO   -  Disabled 
                             EDMA_OPT_LINK_YES  -  Enabled                   */    
    
    EDMA_OPT_FS_NO       /* Frame synchronization
                             EDMA_OPT_FS_NO  - Channel is element/array 
                                                synchronized 
                             EDMA_OPT_FS_YES -  Channel is frame synchronized*/
  ),
  EDMA_SRC_OF(_MCASP_RBUF00_ADDR),/* Source address register 
                                 &ping_data    - source address                */
  
  EDMA_CNT_OF(BUFF_SZ),   /* Transfer count parameter
                                BUFF_SZ      - buffer sizes in # of ints     */      
  
  EDMA_DST_OF(ping_data),      /* Destination address parameter
                                 ping - destination address                  */ 
  
  EDMA_IDX_OF(0x00000004),/* Index parameter                                 */
  
  EDMA_RLD_OF(0x00000000) /* Count reload/link parameter                     */
};                         
/********************************************************************************/
 EDMA_Config cfgEdmaPong = {  
  EDMA_OPT_RMK(          /* Making Options parameter register - EDMA_OPT    */ 
  
   EDMA_OPT_PRI_LOW,    /* Priority levels for EDMA events:-
                             EDMA_OPT_PRI_LOW  - Low priority EDMA transfer
                             EDMA_OPT_PRI_HIGH - High priority EDMA transfer*/
   
   EDMA_OPT_ESIZE_32BIT,/* Element size :-
                             EDMA_OPT_ESIZE_32BIT - 32 bit word 
                             EDMA_OPT_ESIZE_16BIT - 16 bit word 
                             EDMA_OPT_ESIZE_8BIT  -  8 bit word              */
   
   EDMA_OPT_2DS_NO,     /* Source dimension :-
                             EDMA_OPT_2DS_NO  - 1-dimensional source    
                             EDMA_OPT_2DS_YES - 2-dimensional source         */  
   
   EDMA_OPT_SUM_NONE,   /* Source address update mode :-           
                             EDMA_OPT_SUM_NONE - Fixed address mode 
                             EDMA_OPT_SUM_INC  - Increment address mode
                             EDMA_OPT_SUM_DEC  - Decrement address mode
                             EDMA_OPT_SUM_IDX  - Address modified by element 
                                                 index or frame Index        */
    EDMA_OPT_2DD_NO,     /* Destination dimension :-  
                             EDMA_OPT_2DD_NO   - 1-dimensional source            
                             EDMA_OPT_2DD_YES  - 2-dimensional source        */
   
    EDMA_OPT_DUM_INC,    /* Destination address update mode :-                       
                             EDMA_OPT_DUM_NONE - Fixed address mode            
                             EDMA_OPT_DUM_INC  - Increment address mode        
                             EDMA_OPT_DUM_DEC  - Decrement address mode        
                             EDMA_OPT_DUM_IDX  - Address modified by element   
                                                 index or frame Index        */
    
    EDMA_OPT_TCINT_YES,  /* Transfer complete interrupt :-
                             EDMA_OPT_TCINT_NO  - Indication disabled      
                             EDMA_OPT_TCINT_YES - Indication enabled         */  
    
    EDMA_OPT_TCC_OF(TCCINTNUM),/* Transfer complete code                     */
    
    EDMA_OPT_LINK_YES,   /* Linking of event parameters
                             EDMA_OPT_LINK_NO   -  Disabled 
                             EDMA_OPT_LINK_YES  -  Enabled                   */    
    
    EDMA_OPT_FS_NO       /* Frame synchronization
                             EDMA_OPT_FS_NO  - Channel is element/array 
                                                synchronized 
                             EDMA_OPT_FS_YES -  Channel is frame synchronized*/
  ),
  EDMA_SRC_OF(_MCASP_RBUF00_ADDR),/* Source address register 
                                 &ping_data    - source address                */
  
  EDMA_CNT_OF(BUFF_SZ),   /* Transfer count parameter
                                BUFF_SZ      - buffer sizes in # of ints     */      
  
  EDMA_DST_OF(pong_data),      /* Destination address parameter
                                 ping - destination address                  */ 
  
  EDMA_IDX_OF(0x00000004),/* Index parameter                                 */
  
  EDMA_RLD_OF(0x00000000) /* Count reload/link parameter                     */
}; 



⌨️ 快捷键说明

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