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

📄 csl_tcp2.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
 *
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.
 *   ===========================================================================
 */

/** ============================================================================
 *   @file  csl_tcp2.h
 *
 *   @path  $(CSLPATH)\tcp2\inc
 *
 *   @desc  API header file for TCP2 CSL
 *
 */

/* =============================================================================
 *  Revision History
 *  ===============
 *  15-Mar-2005  sd File Created.
 *  21-Jul-2005  sd Updated for the requirement changes
 *  15-Sep-2005  sd Changed TCP to TCP2 in all the names
 *  30-Jan-2006  sd Minor changes in the descriptions
 * =============================================================================
 */

#ifndef _CSL_TCP2_H_
#define _CSL_TCP2_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <csl.h>
#include <tistdtypes.h>
#include <cslr_tcp2.h>
#include <soc.h>

/****************************************\
* TCP global typedef declarations
\****************************************/  
/** Address of the TCP2 registers */     
#define tcp2Regs ((CSL_Tcp2Regs*)CSL_TCP2_0_REGS) 

/** Address of the configuration registers */
#define tcp2CfgRegs ((CSL_Tcp2CfgRegs*)CSL_TCP2_CFG_REGS)

/****************************************\
* TCP global defines
\****************************************/
/** define for TCP2 code rate 3/4 */ 
#define TCP2_RATE_3_4           CSL_TCP2_TCPIC0_RATE_3_4
/** define for TCP2 code rate 1/2 */
#define TCP2_RATE_1_2           CSL_TCP2_TCPIC0_RATE_1_2
/** define for TCP2 code rate 1/3 */
#define TCP2_RATE_1_3           CSL_TCP2_TCPIC0_RATE_1_3
/** define for TCP2 code rate 1/4 */
#define TCP2_RATE_1_4           CSL_TCP2_TCPIC0_RATE_1_4
/** define for TCP2 code rate 1/5 */
#define TCP2_RATE_1_5           CSL_TCP2_TCPIC0_RATE_1_5

/** Number of sliding windows per block is <= 128 */
#define TCP2_SW_LEQ128          CSL_TCP2_TCPIC0_NUMSW_LEQ_128
/** Number of sliding windows per block is > 128 */
#define TCP2_SW_G128            CSL_TCP2_TCPIC0_NUMSW_G_128

/** TCP stand alone mode  */
#define TCP2_MODE_SA        CSL_TCP2_TCPIC0_OPMOD_SA
/** TCP shared processing, first sub frame */
#define TCP2_FIRST_SF       CSL_TCP2_TCPIC0_OPMOD_SP_FF
/** TCP shared processing, middle sub frame */
#define TCP2_MIDDLE_SF  CSL_TCP2_TCPIC0_OPMOD_SP_MF
/** TCP shared processing, last sub frame */
#define TCP2_LAST_SF        CSL_TCP2_TCPIC0_OPMOD_SP_LF
/** TCP shared processing mode  */
#define TCP2_MODE_SP        1

/** Decoder standard 3GPP */
#define TCP2_STANDARD_3GPP      0
/** Decoder standard IS2000 */
#define TCP2_STANDARD_IS2000    1

/** TCP maximum reliability length */
#define TCP2_RLEN_MAX         128

/** TCP maximum sub frame size */
#define TCP2_SUB_FRAME_SIZE_MAX    20480

/** TCP maximum standalone mode frame size */
#define TCP2_FLEN_MAX    20730

/** TCP shared processing non interleaved MAP*/
#define TCP2_MAP_MAP1           0

/** TCP shared processing interleaved MAP*/
#define TCP2_MAP_MAP2           1 

/* typedefs */

/** This data type is used to define the TCP standards */
typedef Uint8  TCP2_Standard;

/** This data type is used to define the TCP mode 
  * (stand alone or shared processing)
  */
typedef Uint8  TCP2_Mode;

/** This data type is used to define the TCP map (1,2) */
typedef Uint8   TCP2_Map;

/** This data type is used to define the number of sliding 
  * windows per block 
  */
typedef Uint8  TCP2_NumSW;

/** This data type is used to define the TCP code rates 
  * (1/2, 1/3, 1/4, 1/5, 3/4)
  */
typedef Uint8  TCP2_Rate;

/** This data type is used to represent the TCP data */
typedef Uint8  TCP2_UserData;

/** This data type is used to represent the TCP tail data */
typedef Int8  TCP2_TailData;

/** This data type is used to represent the TCP extrinsic data */
typedef Uint8  TCP2_ExtrinsicData;

/** This data type is used to represent the TCP input data*/
typedef Uint32  TCP2_InputData;

/** Enum for the input sign values */
typedef enum {
    /** Multiply the channel input by +1 */
    TCP2_INPUT_SIGN_POSITIVE = CSL_TCP2_TCPIC3_INPUTSIGN_POSITIVE,
    /** Multiply the channel input by -1 */
    TCP2_INPUT_SIGN_NEGATIVE = CSL_TCP2_TCPIC3_INPUTSIGN_NEGATIVE
}TCP2_InputSign;

/** Enum for the output order values */
typedef enum {
    /** Order of the bits in the output data is  0-31 */
    TCP2_OUT_ORDER_0_31 = CSL_TCP2_TCPIC3_OUTORDER_0_31,
    /** Order of the bits in the output data is 31-0 */
    TCP2_OUT_ORDER_31_0 = CSL_TCP2_TCPIC3_OUTORDER_31_0
}TCP2_OutputOrder;

/** The TCP input configuration structure holds all the 
  * configuration values that are to be transferred to the 
  * TCP via the EDMA 
  */
typedef struct {
   Uint32 ic0; /**< TCP input configuration word 0 value */
   Uint32 ic1; /**< TCP input configuration word 1 value */
   Uint32 ic2; /**< TCP input configuration word 2 value */
   Uint32 ic3; /**< TCP input configuration word 3 value */
   Uint32 ic4; /**< TCP input configuration word 4 value */
   Uint32 ic5; /**< TCP input configuration word 5 value */
   Uint32 ic6; /**< TCP input configuration word 6 value */
   Uint32 ic7; /**< TCP input configuration word 7 value */
   Uint32 ic8; /**< TCP input configuration word 8 value */
   Uint32 ic9; /**< TCP input configuration word 9 value */
   Uint32 ic10; /**< TCP input configuration word 10 value */
   Uint32 ic11; /**< TCP input configuration word 11 value */
   Uint32 ic12; /**< TCP input configuration word 12 value */
   Uint32 ic13; /**< TCP input configuration word 13 value */
   Uint32 ic14; /**< TCP input configuration word 14 value */
   Uint32 ic15; /**< TCP input configuration word 15 value */ 
} TCP2_ConfigIc;

/** The TCP parameters structure holds all the information concerning 
  * the user channel. These values are used to generate the appropriate 
  * input configuration values for the TCP.
  */ 
typedef struct {
    TCP2_Standard standard; /**< TCP standard */ 
    /* IC0 parameters */
    TCP2_Mode     mode;  /**< TCP mode */
    TCP2_Map      map;   /**< TCP shared processing MAP */
    TCP2_Rate     rate;  /**< TCP code rate */
    TCP2_NumSW   numSlideWin; /**< Number of sliding window per sub block */
    Uint32       intFlag;     /**< Interleaver write flag     */
    Uint32       outParmFlag; /**< Output parameters read flag */
    Uint32       frameLen;    /**< Frame length               */

    /* IC1 parameters */
    Uint32       relLen;      /**< Reliability length */

    /* IC2 parameters */
    Uint32       prologSize;  /**< Prolog length       */   
    Uint32       numSubBlock; /**< Number of sub blocks */
    Uint32       maxIter;     /**< Maximum number of iterations            */
    Uint32       snr;         /**< SNR threshold used for stopping test */  

    /* IC3 parameters */
    Bool        maxStarEn;    /**< Enable/disable the max star        */
    Bool        prologRedEn;  /**< Enable/disable the prolog reduction */
    Uint8       minIter;     /**< Minimum number of iterations to be executed */    
    TCP2_InputSign  inputSign;/**< The sign of the input data (+/-)          */
    TCP2_OutputOrder    outputOrder; /**< The bit ordering of the output data */

    /* IC4 parameters */
    Uint8       numCrcPass;   /**< Number of passed CRC iterations required 
                                * before decoder termination              
                                */
    Uint8       crcLen;       /**< CRC polynomial length */ 

    /* IC5 parameters */
    Uint32      crcPoly;      /**< CRC polynomial       */

    /* IC12 - IC15 parameters */
    Uint8       extrScaling [16];  /**< Extrinsic scaling factors */

} TCP2_Params;

/** The TCP base parameters structure is used to set up the TCP programmable 
  * parameters. You create the object and pass it to the TCP2_genParams() 
  * function which returns the TCP2_Params structure.
  */
typedef struct {
    TCP2_Standard standard;   /**< TCP decoder standards */ 
    TCP2_Rate   rate;       /**< TCP code rate */
    TCP2_Map    map;        /**< TCP shared processing MAP */ 
    Uint32      intFlag;     /**< Interleaver write flag     */
    Uint32      outParmFlag; /**< Output parameters read flag */
    Uint32      frameLen;    /**< Frame length               */
    Uint32      prologSize;  /**< Prolog length       */   
    Uint32      maxIter;     /**< Maximum number of iterations            */
    Uint32      snr;         /**< SNR threshold used for stopping test */  
    Bool        maxStarEn;    /**< Enable/disable the max star        */
    Bool        prologRedEn;  /**< Enable/disable the prolog reduction */
    Uint8       minIter;      /**< Minimum number of iterations to be executed*/   
    TCP2_InputSign  inputSign;/**< The sign of the input data (+/-)          */
    TCP2_OutputOrder    outputOrder; /**< The bit ordering of the output data */
    Uint8       numCrcPass;   /**< Number of passed CRC iterations required 
                                * before decoder termination              
                                */
    Uint8       crcLen;       /**< CRC polynomial length */ 
    Uint32      crcPoly;      /**< CRC polynomial       */
    Uint8       extrScaling [16];  /**< Extrinsic scaling factors */
} TCP2_BaseParams;


/* function declarations */

/* ============================================================================
 *   @n@b TCP2_setParams 
 *
 *   @b Description
 *   @n This function sets up the TCP2 input configuration parameters in the
 *      TCP2_ConfigIc structure. The configuration values are passed in the 
 *      configParms input argument.
 *
 *   @b Arguments
     @verbatim
            configParms     Pointer to the structure holding the TCP 
                            configuration parameters.
                            
            configIc        Pointer to the TCP2_ConfigIc structure to be filled.

     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None 
 *
 *   @b Modifies
 *   @n The configIc argument passed.   
 *
 *   @b Example
 *   @verbatim 
        extern TCP2_Params *configParms;
        TCP2_ConfigIc *configIc;
        ...
        TCP2_setParams(configParms, configIc);
     @endverbatim
 * ===========================================================================
 */
void TCP2_setParams (
    TCP2_Params     *restrict configParms,
    TCP2_ConfigIc   *restrict configIc
);

/* ============================================================================
 *   @n@b TCP2_tailConfig 
 *
 *   @b Description
 *   @n This function generates the input control values IC6-IC11 based on the 
 *      processing to be performed by the TCP. These values consist of the tail 
 *      data following the systematics and parities data. This function 
 *      calls specific tail generation functions depending on the
 *      standard followed.
 *
 *   @b Arguments
     @verbatim
            standard        3G standard to be decoded.

            mode            TCP processing mode (SA or SP)

            map             TCP shared processing MAP 

            rate            Code rate of the TCP

            xabData         Pointer to the tail data

            configIc        Pointer to the TCP2_ConfigIc structure to be filled.

     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None 
 *
 *   @b Modifies
 *   @n The configIc argument passed.   
 *
 *   @b Example
 *   @verbatim
        extern TCP2_Params *configParms;
        TCP2_ConfigIc *configIc;
        TCP2_UserData *xabData = &userData[fraemLen];       
        
        ...
        TCP2_tailConfig (configParms->mode, configParms->map,
                    configParms->standard, configParms->rate,
                    userData, configIc);
     @endverbatim
 * ===========================================================================
 */
void TCP2_tailConfig (
    TCP2_Standard   standard,
    TCP2_Mode       mode,
    TCP2_Map        map,
    TCP2_Rate       rate,
    TCP2_TailData   *restrict tailData,
    TCP2_ConfigIc   *restrict configIc
);

/* ============================================================================
 *   @n@b TCP2_genIc 
 *
 *   @b Description
 *   @n This function sets up the TCP2 input configuration parameters in the
 *      TCP2_ConfigIc structure. The configuration values are passed in the 
 *      configParms input argument.
 *
 *   @b Arguments
     @verbatim
            configParms     Pointer to the structure holding the TCP 
                            configuration parameters.
    
            tailData        Tail data

            configIc        Pointer to the TCP2_ConfigIc structure to be filled.

     @endverbatim
 *
 *   <b> Return Value </b>  
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None 
 *
 *   @b Modifies
 *   @n The configIc argument passed.   
 *
 *   @b Example
 *   @verbatim
        extern TCP2_UserData *userData;
        
        TCP2_BaseParams configBase;
        TCP2_Params     configParams;
        TCP2_TailData   *xabData;
        Uint32          frameLen = 40;

        xabData = &userData [frameLen];
        
        // assign the configuration parameters 
        configBase.frameLen     = frameLen;
        configBase.inputSign    = TCP2_INPUT_SIGN_POSITIVE;
        configBase.intFlag      = 1;
        configBase.maxIter      = 8;
        configBase.maxStarEn    = TRUE;
        configBase.standard     = TCP2_STANDARD_3GPP;
        configBase.crcLen       = 0;
        configBase.crcPoly      = 0;
        configBase.minIter      = 1;
        configBase.numCrcPass   = 1;
        configBase.outParmFlag  = 0;
        configBase.outputOrder  = TCP2_OUT_ORDER_0_31;
        configBase.prologRedEn  = FALSE;
        configBase.prologSize   = 24;
        configBase.rate         = TCP2_RATE_1_3;
        configBase.snr          = 0;

        for (cnt = 0; cnt < 16; cnt++)
            configBase.extrScaling [cnt] = 32;

        // setup the TCP configuration registers parmeters 
        TCP2_genParams (&configBase, &configParams);

        // generate the configuration register values 
        TCP2_genIc (&configParams, xabData, &configIc); 

     @endverbatim
 * ===========================================================================
 */
void TCP2_genIc (
    TCP2_Params      *restrict configParms,
    TCP2_TailData    *restrict tailData,
    TCP2_ConfigIc    *restrict configIc
);

/* ============================================================================
 *   @n@b TCP2_genParams  
 *
 *   @b Description
 *   @n This function copies the basic parameters, to the configParams 
 *      parameters structure.
 *
 *   @b Arguments
     @verbatim
            configBase      Pointer to the TCP2_BaseParams structure 
            
            configParams    Pointer to the TCP configuration parameters 
                            structure.

     @endverbatim
 *
 *   <b> Return Value </b>  Uint32
 *   @n                     The number sub frames for shared processing mode                       
 *
 *   <b> Pre Condition </b>
 *   @n  configBase is populated with all the configurtaion parameters
 *
 *   <b> Post Condition </b>
 *   @n  None 
 *
 *   @b Modifies
 *   @n The configParams argument passed.   
 *
 *   @b Example
 *   @verbatim
        extern TCP2_UserData *userData;
        
        TCP2_BaseParams configBase;
        TCP2_Params     configParams;
        TCP2_TailData   *xabData;
        Uint32          frameLen = 40;

        xabData = &userData [frameLen];
        
        // assign the configuration parameters 

⌨️ 快捷键说明

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