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

📄 mpeg2dma.h

📁 DM642EVM MPEG2编解码例程
💻 H
字号:
/* ======================================================================== */
/*                                                                          */
/*  TEXAS INSTRUMENTS, INC.                                                 */
/*                                                                          */
/*  NAME                                                                    */
/*   mpeg2dma.h                                                             */
/*                                                                          */
/*  DESCRIPTION                                                             */
/*                                                                          */
/*  COPYRIGHT NOTICES                                                       */
/*   Copyright (c) 2001 Texas Instruments Inc.  All rights reserved.        */
/*   Exclusive property of the Video & Imaging Products, Emerging End       */
/*   Equipment group of Texas Instruments India Limited. Any handling,      */
/*   use, disclosure, reproduction, duplication, transmission, or storage   */
/*   of any part of this work by any means is subject to restrictions and   */
/*   prior written permission set forth in TI's program license agreements  */
/*   and associated software documentation.                                 */
/*                                                                          */
/*   This copyright notice, restricted rights legend, or other proprietary  */
/*   markings must be reproduced without modification in any authorized     */
/*   copies of any part of this work.  Removal or modification of any part  */
/*   of this notice is prohibited.                                          */
/* ------------------------------------------------------------------------ */
/*            Copyright (c) 2001 Texas Instruments, Incorporated.           */
/*                           All Rights Reserved.                           */
/* ======================================================================== */

#define DIR_QDMA

#ifndef DIR_QDMA
#include "fake_dma.h"

#else /* DIR_QDMA definitions */

/* ---------------------------------------------------------- */
/* To pick up definition for standard macros like             */
/* EDMA_OPT_PRI_*, EDMA_MK_OPT,  EDMA_MK_IDX, EDMA_MK_CNT etc */
/* ---------------------------------------------------------- */
#include "csl_dat.h"
#include "csl_legacy.h"


typedef unsigned int uint;

/* --------------------------------------------- */
/*  To wait for the corresponding channel Xfr    */
/*                                               */
/*   0-15 :  USE CIPRL, QDMA_WAIT_LOW            */
/*  16-31 :  USE CIPRL, QDMA_WAIT_LOW            */
/*  32-47 :  USE CIPRH, QDMA_WAIT_HIGH           */
/*  48-63 :  USE CIPRH, QDMA_WAIT_HIGH           */
/* --------------------------------------------- */

#define TCCM(id) ((id>>4) << 13)

/*Channel no to TCC mappings */   
#define CHANNEL2       32  /* Currently used in color conversion */
#define CHANNEL3       33
#define CHANNEL4       34
#define CHANNEL5       35 
#define CHANNEL6       36
#define CHANNEL7       37
#define CHANNEL8       38
#define CHANNEL9       39
#define CHANNEL10      40
#define CHANNEL11      41
#define CHANNEL12      42
#define CHANNEL13      43
#define CHANNEL14      44
#define CHANNEL15      45
#define CHANNEL16      46
#define CHANNEL17      47


#define PRIORITY_Q0       (*(volatile unsigned int *)0x01842000)
#define PRIORITY_Q1       (*(volatile unsigned int *)0x01842004)
#define PRIORITY_Q2       (*(volatile unsigned int *)0x01842008)
#define PRIORITY_Q3       (*(volatile unsigned int *)0x0184200C)

#define SET_PRIORITY_QLENGTH(x,y) { (x) = (y); }

#define PQSR    (*(volatile unsigned int *)0x01A0FFE0)
#define CIPRH	(*(volatile unsigned int *)0x01A0FFA4)  /*For C64x*/
#define CIPRL 	(*(volatile unsigned int *)0x01A0FFE4)  /*For C64x*/
#define CIPR 	(*(volatile unsigned int *)0x01A0FFE4)  /*For C6211/C6711*/
 
#define QDMA_OPT	0x02000000
#define QDMA_SRC	0x02000004
#define QDMA_CNT	0x02000008
#define QDMA_DST	0x0200000C
#define QDMA_IDX	0x02000010
#define QDMA_S_OPT	0x02000020
#define QDMA_S_SRC	0x02000024
#define QDMA_S_CNT	0x02000028
#define QDMA_S_DST	0x0200002C
#define QDMA_S_IDX	0x02000030


#ifdef PROFILE_DMA_WAITS

#define Timer_Begin(z) ( (z) = *(volatile unsigned int *)0x1980008 )
#define Timer_Acc( x, s )  ( (x) += (*(volatile unsigned int *)0x1980008 - (s)) )

#define QDMA_START(o,s,c,d,i) { extern int dmaSubmissionTime; \
								extern int countTransfers ;\
								int subInterval;\
								Timer_Begin(subInterval);\
								*(volatile uint *)QDMA_SRC   = (uint)s; \
                                *(volatile uint *)QDMA_CNT   = (uint)c; \
                                *(volatile uint *)QDMA_DST   = (uint)d; \
                                *(volatile uint *)QDMA_IDX   = (uint)i; \
                                *(volatile uint *)QDMA_S_OPT = (uint)o;\
                                Timer_Acc(dmaSubmissionTime,subInterval);\
                                dmaSubmissionTime-=5;\
                                }
#else
#define QDMA_START(o,s,c,d,i) { *(volatile uint *)QDMA_SRC   = (uint)s; \
                                *(volatile uint *)QDMA_CNT   = (uint)c; \
                                *(volatile uint *)QDMA_DST   = (uint)d; \
                                *(volatile uint *)QDMA_IDX   = (uint)i; \
                                *(volatile uint *)QDMA_S_OPT = (uint)o; }

#endif

/*For C64x*/
#define INIT_CHANNEL_LOW(id) { CIPRL =  (1 << id); }
#define INIT_CHANNEL_HIGH(id) { CIPRH = (1 << (id-32)); }

/*For C64x*/
#define QDMA_WAIT_NOSET_LOW(id) { while(! (CIPRL & (1 << id))  ) ; }  
#define QDMA_WAIT_NOSET_HIGH(id) { while(! (CIPRH & (1 << (id-32)))  ) ; }  


/*For C64x*/
#define QDMA_WAIT_LOW(id) { while(! (CIPRL & (1 << id))  ) ;  \
							CIPRL = (1 << id) ;  }  
#define QDMA_WAIT_HIGH(id) {while(!(CIPRH & (1 << (id-32))) )  ;  \
							CIPRH =  (1 << (id-32)) ; }


/*For C6211/C6711 */
#define QDMA_WAIT(id){while(!(CIPR & (1 << id)) ) ; \
					  CIPR =  (1 << id) ;}

#ifdef PROFILE_DMA_WAITS					  
#define QDMA_WAIT_ON_PQSR(id){  extern int dmaWaitTime; \
								int waitInterval;\
								Timer_Begin(waitInterval);\
								while (!(PQSR & (1<<id))); \
								Timer_Acc(dmaWaitTime,waitInterval);\
								dmaWaitTime-=5;}
#else
#define QDMA_WAIT_ON_PQSR(id){ while (!(PQSR & (1<<id))); }
#endif

#endif /* DIR_QDMA*/

⌨️ 快捷键说明

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