📄 csl_tcp2aux.h
字号:
/* ============================================================================
* 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_tcp2Aux.h
*
* @path $(CSLPATH)\tcp2\inc
*
* @desc Auxiliary API header file for TCP CSL
*
*/
/* =============================================================================
* Revision History
* ===============
* 26-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 Updated the descriptions for TCP2_normalCeil and TCP2_ceil
* and chnages for the bit field names TCPEND register
* =============================================================================
*/
#ifndef _CSL_TCP2AUX_H_
#define _CSL_TCP2AUX_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <tistdtypes.h>
#include <cslr_tcp2.h>
#include <csl_tcp2.h>
/** ============================================================================
* @n@b TCP2_normalCeil
*
* @b Description
* @n Returns the value rounded to the nearest integer greater than or
* equal to (val1/val2)
*
* @b Arguments
@verbatim
val1 Value to be augmented.
val2 Value by which val1 must be divisible.
@endverbatim
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 framelen = 51200;
Uint32 numSubFrame;
...
// to calculate the number of sub frames for SP mode
numSubFrame = TCP2_normalCeil (framelen, TCP2_SUB_FRAME_SIZE_MAX);
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_normalCeil (
Uint32 val1,
Uint32 val2
)
{
Uint32 x;
/* x = ceil(val1/val2) */
/* val1 is increased (if necessary) to be a multiple of val2 */
x = (((val1) % (val2)) != 0) ? (((val1) / (val2)) + 1) :
((val1) / (val2));
return(x);
}
/** ============================================================================
* @n@b TCP2_ceil
*
* @b Description
* @n Returns the value rounded to the nearest integer greater than or
* equal to (val/(2^pwr2)).
*
* @b Arguments
@verbatim
val Value to be augmented.
pwr2 The power of two by which val must be divisible.
@endverbatim
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
Uint32 val1 = 512;
Uint32 val2 = 4;
Uint32 val3;
val3 = TCP2_ceil(val1, val2);
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_ceil (
Uint32 val,
Uint32 pwr2
)
{
Uint32 x;
/* x = ceil(val/ (2^pwr2)) */
/* val is increased (if necessary) to be a multiple of 2^pwr2 */
x = (((val) - (((val) >> (pwr2)) << (pwr2))) == 0) ? \
((val) >> (pwr2)): (((val) >> (pwr2)) + 1);
return(x);
}
/** ============================================================================
* @n@b TCP2_setExtScaling
*
* @b Description
* @n This function formats individual bytes into a 32-bit word, which is
* used to set the extrinsic configuration registers.
*
* @b Arguments
@verbatim
extrVal1 extrinsic scaling value 1
extrVal2 extrinsic scaling value 2
extrVal3 extrinsic scaling value 3
extrVal4 extrinsic scaling value 4
@endverbatim
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
TCP2_Params configParams;
TCP2_IcConfig configIc
configIc->ic12 = TCP2_setExtScaling (configParams->extrScaling [0],
configParams->extrScaling [1],
configParams->extrScaling [2],
configParams->extrScaling [3]);
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_setExtScaling (
Uint8 extrVal1,
Uint8 extrVal2,
Uint8 extrVal3,
Uint8 extrVal4
)
{
Uint32 icConfigVal;
icConfigVal = (extrVal4 << 18) | (extrVal3 << 12) | (extrVal2 << 6) |
(extrVal1);
return icConfigVal;
}
/** ============================================================================
* @n@b TCP2_makeTailArgs
*
* @b Description
* @n This function formats individual bytes into a 32-bit word, which is
* used to set the tail bits configuration registers.
*
* @b Arguments
@verbatim
byte17_12 Byte to be placed in bits 17-12 of the 32-bit value
byte11_6 Byte to be placed in bits 11-6 of the 32-bit value
byte5_0 Byte to be placed in bits 5-0 of the 32-bit value
@endverbatim
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
TCP2_Params configParams;
TCP2_IcConfig configIc
configIc.ic6 = TCP2_makeTailArgs (xabData[10],
xabData[8], xabData[6]);
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_makeTailArgs (
Uint8 byte17_12,
Uint8 byte11_6,
Uint8 byte5_0
)
{
Uint32 x = 0;
x = (byte17_12 << 12) | (byte11_6 << 6) | byte5_0;
return(x);
}
/** ============================================================================
* @n@b TCP2_getAccessErr
*
* @b Description
* @n This function returns the ACC bit value of the TCPERR register
* indicating whether an invalid access has been made to the TCP during
* operation.
* @n 0 - no error
* @n 1 - TCP rams (syst, parities, hard decisions, extrinsics, aprioris)
* access is not allowed in state 1. This causes an error interrupt
* to occur
*
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getAccessErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getAccessErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_ACC);
}
/** ============================================================================
* @n@b TCP2_getErr
*
* @b Description
* @n This function returns the ERR bit value of the TCPERR register
* indicating whether an error has occurred during TCP operation.
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_ERR);
}
/** ============================================================================
* @n@b TCP2_getTcpErrors
*
* @b Description
* @n This function returns the TCPERR register value.
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getTcpErrors ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getTcpErrors (
void
)
{
return (tcp2Regs->TCPERR);
}
/** ============================================================================
* @n@b TCP2_getFrameLenErr
*
* @b Description
* @n This function returns a boolean value indicating whether an invalid
* frame length has been programmed in the TCP during operation.
* @n 0 - no error.
* @n 1 - (SA mode) frame length < 40 or frame length > 20730.
* - (SP mode) frame length < 256 or frame length > 20480 and f%256!=0
* for the first or middle subframes.
* - (SP mode) if f<128 or f>20480 for the last subframe.
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getFrameLenErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getFrameLenErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_F);
}
/** ============================================================================
* @n@b TCP2_getProlLenErr
*
* @b Description
* @n This function returns the P bit value indicating whether an invalid
* prolog length has been programmed into the TCP.
* 0 - no error
* 1 - Prolog length < 4 or > 48
*
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getProlLenErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getProlLenErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_P);
}
/** ============================================================================
* @n@b TCP2_getSubFrameErr
*
* @b Description
* @n This function returns a boolean value indicating whether the sub-frame
* length programmed into the TCP is invalid.
* 0 - no error
* 1 - sub-frame length > 20480 (SP mode)
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getSubFrameErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getSubFrameErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_SF);
}
/** ============================================================================
* @n@b TCP2_getRelLenErr
*
* @b Description
* @n This function returns the R bit value indicating whether an invalid
* reliability length has been programmed into the TCP. The reliability
* length must be 40 < RL < 128 for SA Mode, or
* SW_R must = 128 during First/Middle subframes of SP mode, and
* SW_R must be > 64 in the Last subframe.
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getRelLenErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getRelLenErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_R);
}
/** ============================================================================
* @n@b TCP2_getSnrErr
*
* @b Description
* @n This function returns the SNR bit value indicating whether the SNR
* threshold exceeded 100 (1) or not (0).
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getSnrErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getSnrErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_SNR);
}
/** ============================================================================
* @n@b TCP2_getInterleaveErr
*
* @b Description
* @n This function returns the INTER value bit indicating whether the TCP
* was incorrectly programmed to receive an interleaver table. An
* interleaver table can only be sent when operating in standalone mode.
* This bit(1) indicates if an interleaver table was sent when in shared
* processing mode.
*
* @b Arguments
* @n None
*
* <b> Return Value </b> Uint32
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
if (TCP2_getInterleaveErr ()){
...
}
@endverbatim
* =============================================================================
*/
CSL_IDEF_INLINE Uint32 TCP2_getInterleaveErr (
void
)
{
return CSL_FEXT (tcp2Regs->TCPERR, TCP2_TCPERR_INT);
}
/** ============================================================================
* @n@b TCP2_getOutParmErr
*
* @b Description
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -