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

📄 csl_tcp.h

📁 DSP图象处理的基础入门程序,对于复杂的DSP操作系统.能够让你得到一些启示
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************\
*           Copyright (C) 2000 Texas Instruments Incorporated.
*                           All Rights Reserved
*------------------------------------------------------------------------------
* FILENAME...... csl_tcp.h
* DATE CREATED.. 02/22/2001 
* LAST MODIFIED. 09/17/2001 
*
\******************************************************************************/
#ifndef _CSL_TCP_H_
#define _CSL_TCP_H_

#include <csl_chip.h>   
#include <csl_stdinc.h>
#include <csl_irq.h>
#include "csl_tcphal.h"

#if (TCP_SUPPORT)
/****************************************\
* TCP scope and inline control macros
\****************************************/
#ifdef __cplusplus
#define CSLAPI extern "C" far
#else
#define CSLAPI extern far
#endif

#undef  USEDEFS
#undef  IDECL
#undef  IDEF

#ifdef  _TCP_MOD_
  #define IDECL extern far
  #define USEDEFS
  #define IDEF
#else
  #ifdef  _INLINE
    #define IDECL static inline
    #define USEDEFS
    #define IDEF  static inline
  #else
    #define IDECL extern far
  #endif
#endif

/****************************************\
* TCP global macro declarations
\****************************************/

/****************************************\
* TCP global typedef declarations
\****************************************/
typedef Uint8  TCP_Standard;
typedef Uint8  TCP_Mode;
typedef Uint8  TCP_Map;
typedef Uint8  TCP_Rate;
typedef Uint8  TCP_UserData;
typedef Uint8  TCP_ExtrinsicData;

typedef struct {
   Uint32 ic0;
   Uint32 ic1;
   Uint32 ic2;
   Uint32 ic3;
   Uint32 ic4;
   Uint32 ic5;
   Uint32 ic6;
   Uint32 ic7;
   Uint32 ic8;
   Uint32 ic9;
   Uint32 ic10;
   Uint32 ic11;
} TCP_ConfigIc;

typedef struct {
   TCP_Standard standard;
   TCP_Mode     mode;
   TCP_Map      map;
   TCP_Rate     rate;
   Uint32       intFlag;
   Uint32       outParmFlag;
   Uint32       frameLen;
   Uint32       subFrameLen;
   Uint32       relLen;
   Uint32       relLenLast;
   Uint32       prologSize;
   Uint32       numSubBlock;
   Uint32       numSubBlockLast;
   Uint32       maxIter;
   Uint32       snr;
   Uint32       numInter;
   Uint32       numSysPar;
   Uint32       numApriori;
   Uint32       numExt;
   Uint32       numHd;
} TCP_Params;

typedef struct {
   TCP_Standard standard;
   TCP_Rate     rate;
   Uint16       frameLen;
   Uint8        prologSize;
   Uint8        maxIter;
   Uint8        snr;
   Uint8        intFlag;
   Uint8        outParmFlag;
} TCP_BaseParams;

/************ New structure for Init ***************/
typedef struct {
   TCP_UserData *restrict xabData;
   TCP_Standard standard;
   TCP_Rate     rate;
   Uint16       frameLen;
   Uint8        prologSize;
   Uint8        maxIter;
   Uint8        snr;
   Uint8        intFlag;
   Uint8        outParmFlag;
} TCP_Init;

/****************************************\
* TCP global ants declarations
\****************************************/
#define TCP_RATE_1_2           2
#define TCP_RATE_1_3           3
#define TCP_RATE_1_4           4
#define TCP_MODE_SA            0
#define TCP_MODE_SP            1
#define TCP_MAP_MAP1A          0
#define TCP_MAP_MAP1B          1
#define TCP_MAP_MAP2           3 
#define TCP_STANDARD_3GPP      0
#define TCP_STANDARD_IS2000    1
#define TCP_RLEN_MAX         128
#define TCP_FLEN_MAX        5114
#define TCP_NUM_IC            12
#define TCP_NUM_OP             2

/****************************************\
* TCP global function declarations
\****************************************/

/* Set the ic6-ic9 registers (tails) based on the user data          */
/* TCP_tailConfig calls TCP_tailConfig3GPP() or TCP_tailConfigIs2000 */
/* based on the "standard" parameter value                           */
CSLAPI void TCP_tailConfig(TCP_Standard standard,
                          TCP_Mode mode,
                          TCP_Map map,
                          TCP_Rate rate,
                          TCP_UserData *restrict xabData,
                          TCP_ConfigIc *restrict configIc);
CSLAPI void TCP_tailConfig3GPP(TCP_Mode mode,
                          TCP_Map map,
                          TCP_UserData *restrict xabData,
                          TCP_ConfigIc *restrict configIc);
CSLAPI void TCP_tailConfigIs2000(TCP_Mode mode,
                          TCP_Map map,
                          TCP_Rate rate,
                          TCP_UserData *restrict xabData,
                          TCP_ConfigIc *restrict configIc);

/* Set the Parameters passed via Param structure to ic0-ic5 registers */
/* configIc is the returned config structure of the icx registers */
CSLAPI void TCP_setParams(TCP_Params *restrict configParms,
                          TCP_ConfigIc *restrict configIc);

/* Set all icx registers :                                     */ 
/* configPrams input parameters dedicated to ic0-ic5 registers */
/* xabData input parameters dedicated to set ic6-ic11 registers (tails */
/* configIc is the returned config structure of the icx registers */
CSLAPI void TCP_genIc(TCP_Params *restrict configParms,
                          TCP_UserData *restrict xabData,
                          TCP_ConfigIc *restrict configIc);

/* Divide the data frames into subframes and subblocks.                     */
/* The values calculated in these routines are entered into the configParms */
/* struct and are used in programming the TCP IC values and the EDMA        */
/* parameters. Either TCP_calcSubBlocks3GPP or TCP_calcSubBlocksIs2000 is   */
/* used depending on the standard.                                          */
CSLAPI void TCP_calcSubBlocksSA(TCP_Params *configParms);

CSLAPI Uint32 TCP_calcSubBlocksSP(TCP_Params *configParms);

/* Fill out the necessary TCP parameters.                                   */
CSLAPI Uint32 TCP_genParams(TCP_BaseParams *configBase,
                          TCP_Params *configParms);


/*** Init parameters and set registers **********/
void TCP_init(TCP_Init *Init);
void TCP_tailInit3GPP(TCP_Mode mode, TCP_Map map,TCP_UserData *restrict xabData);
void TCP_tailInitIs2000(TCP_Mode mode,TCP_Map map,TCP_Rate rate,TCP_UserData *restrict xabData);

/* Calculate the count values (number of 32-bit words) required for the     */
/* programming of the EDMA for all data buffers. The counts calculated      */
/* using either TCP_calcCounts3GPP or TCP_calcCountsIs2000 depending on the */
/* standard.                                                                */
CSLAPI void TCP_calcCountsSA(TCP_Params *configParms);

CSLAPI void TCP_calcCountsSP(TCP_Params *configParms);

/* Interleave the extrinsics data to give the apriori data required for the */
/* subsequent MAP decoding. TCP_interleaveExt is performed by the CPU       */
/* following a MAP1 decoding by the TCP. This function is used in shared    */
/* processing mode only.                                                    */
CSLAPI void TCP_interleaveExt(TCP_ExtrinsicData *restrict aprioriMap2, 
                          const TCP_ExtrinsicData *restrict extrinsicsMap1, 
                          const Uint16 *restrict interleaverTable, 
                          Uint32  numExt);

/* De-interleave the extrinsics data to give the apriori data required for  */
/* the subsequent MAP decoding. TCP_deinterleaveExt is performed by the CPU */
/* following a MAP2 decoding by the TCP. This function is used in shared    */
/* processing mode only.                                                    */
CSLAPI void TCP_deinterleaveExt(TCP_ExtrinsicData *restrict aprioriMap1, 
                          const TCP_ExtrinsicData *restrict extrinsicsMap2, 
                          const Uint16 *restrict interleaverTable, 
                          Uint32  numExt);

/* Calculate hard decisions following all MAP decodings in shared processing*/
/* mode.                                                                    */
CSLAPI void TCP_calculateHd(const TCP_ExtrinsicData *restrict extrinsicsMap1, 
                          const TCP_ExtrinsicData *restrict apriori, 
                          const TCP_UserData *restrict channel_data, 
                          Uint32 *restrict hardDecisions,
                          Uint16 numExt,
                          Uint8  rate);

/* Demultiplex the input data into two "working data" buffers. The two new  */
/* data buffers are used separately for MAP 1 and MAP 2 decodings in shared */
/* processing mode.                                                         */
CSLAPI void TCP_demuxInput(Uint32 rate,
                          Uint32 frameLen,
                          const TCP_UserData *restrict input,
                          const Uint16 *restrict interleaver,
                          TCP_ExtrinsicData *restrict nonInterleaved,
                          TCP_ExtrinsicData *restrict interleaved);
                          
/****************************************\
* TCP inline function declarations
\****************************************/

/* Master transfer functions */
IDECL void   TCP_start();
IDECL void   TCP_pause();
IDECL void   TCP_unpause();

IDECL Uint32 TCP_getNumIt();
IDECL Uint32 TCP_getSysParEndian();
IDECL Uint32 TCP_getIinterEndian();
IDECL Uint32 TCP_getAaprioriEndian();
IDECL Uint32 TCP_getExtEndian();

IDECL void   TCP_setNativeEndian();
IDECL void   TCP_setPacked32Endian();
IDECL void   TCP_setSysParEndian(Uint32 sysParEnd);
IDECL void   TCP_setInterEndian(Uint32 interEnd);
IDECL void   TCP_setAprioriEndian(Uint32 aprioriEnd);
IDECL void   TCP_setExtEndian(Uint32 extEnd);

IDECL Uint32 TCP_statPause();
IDECL Uint32 TCP_statRun();
IDECL Uint32 TCP_statError();
IDECL Uint32 TCP_statWaitIC();
IDECL Uint32 TCP_statWaitInter();
IDECL Uint32 TCP_statWaitSysPar();
IDECL Uint32 TCP_statWaitApriori();
IDECL Uint32 TCP_statWaitExt();
IDECL Uint32 TCP_statWaitHardDec();
IDECL Uint32 TCP_statWaitOutParm();

IDECL Uint32 TCP_errTest();
IDECL Uint32 TCP_getFrameLenErr();
IDECL Uint32 TCP_getProlLenErr();
IDECL Uint32 TCP_getRateErr();
IDECL Uint32 TCP_getSubFrameErr();
IDECL Uint32 TCP_getModeErr();
IDECL Uint32 TCP_getRelLenErr();
IDECL Uint32 TCP_getLastRelLenErr();
IDECL Uint32 TCP_getInterleaveErr();
IDECL Uint32 TCP_getOutParmErr();
IDECL Uint32 TCP_getAccessErr();


/* Set all the TCP registers : ic0-ic11 using a configuration structure  */
IDECL void TCP_icConfig(TCP_ConfigIc *config);

/* Set all the TCP registers : ic0-ic11 with register values   */
IDECL void TCP_icConfigArgs(Uint32 ic0, Uint32 ic1, Uint32 ic2,  Uint32 ic3,
                            Uint32 ic4, Uint32 ic5, Uint32 ic6,  Uint32 ic7,
                            Uint32 ic8, Uint32 ic9, Uint32 ic10, Uint32 ic11);
/* Get TCP registers : ic0-ic11 returned into a configuration structure  */
IDECL void TCP_getIcConfig(TCP_ConfigIc *config);

/* Build the tail value */
IDECL Uint32 TCP_makeTailArgs(Uint8 byte31_24, Uint8 byte23_16,
                              Uint8 byte15_8,  Uint8 byte7_0);

/* Ceiling functions */
IDECL Uint32 TCP_ceil(Uint32 a, Uint32 b);

IDECL Uint32 TCP_normalCeil(Uint32 a, Uint32 b);

/****************************************\
* TCP inline function definitions
\****************************************/
#ifdef USEDEFS
/*----------------------------------------------------------------------------*/
IDEF void TCP_start(){
   TCP_FSET(EXE,START,1);  
}
/*----------------------------------------------------------------------------*/
IDEF void TCP_pause(){
  TCP_FSET(EXE,PAUSE,1);
}

⌨️ 快捷键说明

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