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

📄 tmmpprivate.h

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的设备库的源码
💻 H
字号:
/*
 * Copyright (c) 1998,1999 by TriMedia Technologies. 
 *
 * +------------------------------------------------------------------+
 * | This software is furnished under a license and may only be used  |
 * | and copied in accordance with the terms and conditions of  such  |
 * | a license and with the inclusion of this copyright notice. This  |
 * | software or any other copies of this software may not be provided|
 * | or otherwise made available to any other person.  The ownership  |
 * | and title of this software is not transferred.                   |
 * |                                                                  |
 * | The information in this software is subject  to change without   |
 * | any  prior notice and should not be consTrued as a commitment by |
 * | TriMedia Technologies.                                           |
 * |                                                                  |
 * | this code and information is provided "as is" without any        |
 * | warranty of any kind, either expressed or implied, including but |
 * | not limited to the implied warranties of merchantability and/or  |
 * | fitness for any particular purpose.                              |
 * +------------------------------------------------------------------+
 *
 *  Module name              : tmMPprivate.h    1.14
 *
 *  Last update              : 19:38:00 - 00/11/09
 *
 *  Description              :
 *
 *    Private defs and prototypes for MP device library
 *
 */


#ifndef _TMMPprivate_H_
#define _TMMPprivate_H_
#include <tmlib/dprintf.h>
/*
 * Local convenience
 */
#define RETURN_IF_NOT_OK(x) \
{ \
    if(TMLIBDEV_OK != (status = (x))) goto localExit; \
}

#define STD_ASSERTS(inst) \
{ \
    tmAssert((instance >= 0 && instance < MP_MAX_INSTANCES), TMLIBDEV_ERR_NOT_OWNER); \
    tmAssert((MpInfo[instance].used == 1), TMLIBDEV_ERR_NOT_OWNER); \
}

#ifdef DEBUG_MP
#ifdef TSS
#define MPENT(x) printf("tmMP.c: inst %08d enter %04d\n",x,__LINE__);
#define MPEXT(x) printf("tmMP.c: inst %08d exit  %04d\n",x,__LINE__);
#else
#define MPENT(x)     DP(("tmMP.c: inst %08d enter %04d\n",x,__LINE__));
#define MPEXT(x)     DP(("tmMP.c: inst %08d exit  %04d\n",x,__LINE__));
#define MPDBG(x,y,z) DP(("tmMP.c: %04d:  %d %d 0x%08x\n",__LINE__,x,y,z));
#endif
#else
#define MPENT(x)
#define MPEXT(x)
#define MPDBG(x,y,z) 
#endif
#ifdef __LITTLE_ENDIAN__
#define SWAP_INT(a)	FUNSHIFT2(((FUNSHIFT1(a, a) & 0xff00ff00) | (FUNSHIFT3(a, a) & 0x00ff00ff)),((FUNSHIFT1(a, a) & 0xff00ff00) | (FUNSHIFT3(a, a) & 0x00ff00ff)))
#else
#define SWAP_INT(a)	(a)
#endif


#ifdef APPMODEL
#define LOCK_MPEG_PIPE(i) \
{ \
    Int linst = i; \
    if(_mpOwner != linst){ \
      AppSem_P(&_mpMutex);  \
      _mpOwner = linst; \
    } \
    _mpLockCount ++; \
    if(_mpCurInstance != linst){ \
       mpSaveContext(_mpCurInstance); \
       mpRestoreContext(linst);  \
     } \
}
#define UNLOCK_MPEG_PIPE() \
{ \
    _mpLockCount -- ; \
    if(_mpLockCount == 0) { \
      AppSem_V(&_mpMutex);  \
      _mpOwner = -1; \
    } \
}


#define SUSPEND_SELF()           AppModel_suspend_self()
#define RESUME_TASK(x)           AppModel_resume((x))
#define SUSPEND_SCHEDULING()     AppModel_suspend_scheduling()
#define RESUME_SCHEDULING()      AppModel_resume_scheduling()
#define CHECK_VLD_EMPTY() 

#else

static volatile UInt32 _mpCmdPending = 0;


#define LOCK_MPEG_PIPE(i) 
#define UNLOCK_MPEG_PIPE()

#define SUSPEND_SELF() \
{ \
    _mpCmdPending = 1; \
    while(_mpCmdPending == 1){ \
    } \
}

#define RESUME_TASK(x) _mpCmdPending = 0;
#define SUSPEND_SCHEDULING()
#define RESUME_SCHEDULING()

#endif


typedef struct
{
   UInt32 status;
   UInt32 imask;
}  mpIsrInfo_t;
/* 
 * MP context consists of
 *   MP_CTL
 *   MP_IMASK
 *   MP_BIT_ADR
 *   MP_BIT_CNT
 *   unused portion of MP input FIFO content
 * unused portion of MP input FIFO content is represented by
 *   - offset from byte boundary to the start of unused portion
 *     (we make context switch at a place where this is known)
 *   - unused bytes
 */
typedef struct
{
    Bool    valid;              /* is this a valid context */
    UInt32  *inputAddr;         /* MP_INP_ADR */
    UInt32  inputCnt;           /* MP_INP_CNT */
    UInt32  *prevInputAddr;
    UInt32  prevInputCnt;
    UInt32  prevVldOcc;         /* #; bits in VLD fifos and shift reg */
    UInt32  prevBitCnt;         /* previous value in MP_VLD_BIT_CNT */
    UInt32  control;            /* MP_CTL */
    UInt32  imask;              /* MP_IMASK */
    UInt32  quantScale;         /* QS */
    pFnMpCallback_t     mpEmptyFunc;      /* shadow copy of mpEmptyFunc for ctx save/rest */
    UInt32  fifoLength;
    UInt8   *fifo;              /* points to a 64 byte aligned addr in fifoBuf */
    UInt32  fifoBuf[64+64+4];   /* enough to store 132 bytes from aligned addr */
}  mpContext_t;
 
/*
 * All the info for one instance is stored here
 */
typedef struct
{
    Bool                used;
    UInt32              mpPictInfo;
    UInt32              mpIQPictInfo;
    UInt32              mpMCPictInfo0;
    UInt32              mpMCPictInfo1;
    UInt32              mpIQIntraQuantMatrix[16];
    UInt32              mpIQNonIntraQuantMatrix[16];
    UInt32              mpIQSel0;
    UInt32              mpIQSel1;
    UInt32              mpLineSize;
    UInt32              endRow;        /* signifies end of parse comm */
    Bool                aSyncPending;
    Bool                suspended;    /* indicated self-suspend */
#ifdef APPMODEL
    AppModel_AppId      CurrThread;
#else
    UInt32              CurrThread;
#endif
    tmLibdevErr_t       callBackStatus;
    mpRefPtrs_t         MC_Info;    
    mpInstanceSetup_t   mpSetup;
    mpContext_t         mpContext;
#ifdef _DVP_
    tmosalIntHandle_t  mpIntHandle;
	tmbslModuleInfo_t  mpModuleInfo;
#else
    UInt32             mpIntNumber;
    boardMPConfig_t    *boardMPConfig;
#endif
} mpInstanceInfo_t;


#define SLICE_START_CODE_MIN    0x01
#define SLICE_START_CODE_MAX    0xAF
#define SEQUENCE_END_CODE       0xB7

static Int getNextInstance(void);
#ifdef _DVP_
static void _mpISR(void*);
#else
static void _mpISR(void);
#endif
static tmMpCallbackStat_t _mpSliceHeader(Int instance);
static tmLibdevErr_t _mpIntReset(void);
/*
 * Function         : Return the number of bits inside VLD fifos and shift reg
 * Parameters       : instance  (I) instance value
 *                    numBits   (0) the number of bits currently in VLD
 * Function Result  : TMLIBDEV_OK
 *
 * Side Effects     : none
 */
static tmLibdevErr_t mpGetVldOcc(Int instance, UInt32 *numBits);
static tmLibdevErr_t _mpIntNotifyCaller(void);
static tmLibdevErr_t _mpSaveFifoData(Int instance);
static tmLibdevErr_t _mpRestoreFifoData(Int instance);
static tmLibdevErr_t _mpGetBits(Int instance, Int32 numBits, UInt32 * bits);
static tmLibdevErr_t mpRestoreContext(Int instance);
static tmLibdevErr_t mpSaveContext(Int instance);

static tmMpCallbackStat_t  _mpRestoreInputAddr(Int nothing);



#endif

⌨️ 快捷键说明

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