📄 csl_vcp2aux.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_vcp2Aux.h
*
* @path $(CSLPATH)\inc
*
* @desc API header for VCP2
*
*/
/* ============================================================================
* Revision History
* ================
* 24-March-2004 SPrasad File Created.
* 27-May-2005 SPrasad Updated with new requirements' specification.
* 03-Aug-2005 Chandra A few minor changes in documentation and to
* beautify.
* 8-dec-2005 sd changed the maxSm and minSm to be signed
* integers
* ============================================================================
*/
#ifndef _CSL_VCP2AUX_H_
#define _CSL_VCP2AUX_H_
#include <csl_vcp2.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* ============================================================================
* @n@b VCP2_ceil
*
* @b Description
* @n This function calculates the ceiling for a given value and a power of 2.
* The arguments follow the formula: ceilVal * 2^pwr2 = ceiling
* (val, 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> Value
* @li Value The smallest number which when multiplied by 2^pwr2 is
* greater than val.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Uint32 numSysPar;
numSysPar = VCP2_ceil ((frameLen * rate), 4);
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint32 VCP2_ceil (
Uint32 val,
Uint32 pwr2
)
{
Uint32 value;
value = ( ((val) - ( ((val) >> (pwr2)) << (pwr2)) ) == 0) ? \
((val) >> (pwr2)) : (((val) >> (pwr2)) + 1);
return value;
}
/**
* ============================================================================
* @n@b VCP2_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 = VCP2_normalCeil (framelen, TCP2_SUB_FRAME_SIZE_MAX);
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint32 VCP2_normalCeil (
Uint32 val1,
Uint32 val2
)
{
Uint32 value;
value = ( ((val1) % (val2)) != 0 ) ? ( ((val1) / (val2)) + 1 ) : \
((val1) / (val2));
return value;
}
/**
* ============================================================================
* @n@b VCP2_getBmEndian
*
* @b Description
* @n This function returns the value programmed into the VCPEND register for
* the branch metrics data for Big Endian mode indicating whether the data
* is in its native 8-bit format ('1') or 32-bit word packed ('0').
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Branch metric memory format.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n The returned value indicates
* @li 0 - 32-bit word packed.
* @li 1 - Native (8 bits).
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
If (VCP2_getBmEndian ()) {
...
} // end if //
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint32 VCP2_getBmEndian (
void
)
{
return CSL_FEXT (hVcp2->VCPEND, VCP2_VCPEND_BM);
}
/**
* ============================================================================
* @n@b VCP2_getIcConfig
*
* @b Description
* @n This function gets the current VCPIC register values and puts them in a
* structure of type VCP2_ConfigIc.
*
* @b Arguments
@verbatim
pConfigIc Pointer to the structure of type VCP2_ConfigIc to hold
the values of VCPIC registers.
@endverbatim
*
* <b>Return Value </b> Value
* @n None.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n The structure of type VCP2_ConfigIc passed as arguement contains the
* values of the VCP configuration registers.
*
* @b Modifies
* @n Input structure of type VCP2_ConfigIc.
*
* @b Example
* @verbatim
VCP2_ConfigIc configIc;
...
VCP2_getIcConfig (&configIc);
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
void VCP2_getIcConfig (
VCP2_ConfigIc *configIc
)
{
register int x0, x1, x2, x3, x4, x5;
x0 = hVcp2Vbus->VCPIC0;
x1 = hVcp2Vbus->VCPIC1;
x2 = hVcp2Vbus->VCPIC2;
x3 = hVcp2Vbus->VCPIC3;
x4 = hVcp2Vbus->VCPIC4;
x5 = hVcp2Vbus->VCPIC5;
configIc->ic0 = x0;
configIc->ic1 = x1;
configIc->ic2 = x2;
configIc->ic3 = x3;
configIc->ic4 = x4;
configIc->ic5 = x5;
}
/**
* ============================================================================
* @n@b VCP2_getNumInFifo
*
* @b Description
* @n This function returns the count, number of symbols currently in the
* input FIFO.
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Number of symbols in the branch metric input FIFO
* buffer.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Uint32 numSym;
numSym = VCP2_getNumInFifo ();
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint32 VCP2_getNumInFifo (
void
)
{
return CSL_FEXT (hVcp2->VCPSTAT1, VCP2_VCPSTAT1_NSYMIF);
}
/**
* ============================================================================
* @n@b VCP2_getNumOutFifo
*
* @b Description
* @n This function returns the count, number of symbols currently in the
* output FIFO.
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Number of symbols present in the output FIFO buffer.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Uint32 numSym;
numSym = VCP2_getNumOutFifo ();
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint32 VCP2_getNumOutFifo (
void
)
{
return CSL_FEXT (hVcp2->VCPSTAT1, VCP2_VCPSTAT1_NSYMOF);
}
/**
* ============================================================================
* @n@b VCP2_getSdEndian
*
* @b Description
* @n This function returns the value programmed into the VCPEND register for
* the soft decision data for Big Endian mode indicating whether the data
* is in its native 8-bit format ('1') or 32-bit word packed ('0').
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Soft decisions memory format.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n The returned value indicates
* @li 0 - 32-bit word packed.
* @li 1 - Native (8 bits).
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
If (VCP2_getSdEndian ()) {
...
} // end if
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint32 VCP2_getSdEndian (
void
)
{
return CSL_FEXT (hVcp2->VCPEND, VCP2_VCPEND_SD);
}
/**
* ============================================================================
* @n@b VCP2_getStateIndex
*
* @b Description
* @n This function returns an index for the final maximum state metric.
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Final maximum state metric index.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Uint8 index
index = VCP2_getStateIndex();
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint8 VCP2_getStateIndex (
void
)
{
return CSL_FEXT (hVcp2Vbus->VCPOUT1, VCP2_VCPOUT1_FMAXI);
}
/**
* ============================================================================
* @n@b VCP2_getYamBit
*
* @b Description
* @n This function returns the value of the Yamamoto bit after the VCP
* decoding.
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Yamamoto bit result. This bit is a quality indicator
* bit and is only used if the Yamamoto logic is enabled.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n The return bit value indicates,
* @li 0 - at least one trellis stage had an absolute difference less than
* the Yamamoto threshold and the decoded frame has poor quality.
* @li 1 - no trellis stage had an absolute difference less than the
* Yamamoto threshold and the frame has good quality.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Uint8 yamBit
yamBit = VCP2_getYamBit();
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Uint8 VCP2_getYamBit (
void
)
{
return CSL_FEXT (hVcp2Vbus->VCPOUT1, VCP2_VCPOUT1_YAM);
}
/**
* ============================================================================
* @n@b VCP2_getMaxSm
*
* @b Description
* @n This function returns the final maximum state metric after the VCP has
* completed its decoding.
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Maximum state metric value for the final trellis stage.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Int16 maxSm
maxSm = VCP2_getMaxSm();
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Int16 VCP2_getMaxSm (
void
)
{
return CSL_FEXT (hVcp2Vbus->VCPOUT0, VCP2_VCPOUT0_FMAXS);
}
/**
* ============================================================================
* @n@b VCP2_getMinSm
*
* @b Description
* @n This function returns the final minimum state metric after the VCP has
* completed its decoding.
*
* @b Arguments
@verbatim
None.
@endverbatim
*
* <b>Return Value </b> Value
* @li Value Minimum state metric value for the final trellis stage.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n None.
*
* @b Example
* @verbatim
Int16 minSm
minSm = VCP2_getMinSm();
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
Int16 VCP2_getMinSm (
void
)
{
return CSL_FEXT (hVcp2Vbus->VCPOUT0, VCP2_VCPOUT0_FMINS);
}
/**
* ============================================================================
* @n@b VCP2_icConfig
*
* @b Description
* @n This function programs the VCP input configuration registers with the
* values provided through the VCP2_ConfigIc structure.
*
* @b Arguments
@verbatim
pVcpConfigIc Pointer to VCP2_ConfigIc structure instance
containing the input configuration register values.
@endverbatim
*
* <b>Return Value </b>
* @n None.
*
* <b>Pre Condition </b>
* @n None.
*
* <b>Post Condition </b>
* @n None.
*
* @b Modifies
* @n VCP input configuration registers.
*
* @b Example
* @verbatim
VCP2_ConfigIc configIc;
configIc.ic0 = 0xf0b07050;
configIc.ic1 = 0x10320000;
configIc.ic2 = 0x000007fa;
configIc.ic3 = 0x00000054;
configIc.ic4 = 0x00800800;
configIc.ic5 = 0x51f3000c;
...
VCP2_icConfig (&configIc);
@endverbatim
* ============================================================================
*/
CSL_IDEF_INLINE
void VCP2_icConfig (
VCP2_ConfigIc *vcpConfigIc
)
{
register int x0, x1, x2, x3, x4, x5;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -