| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2011, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bxdm_pp_fp.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/4 $ |
|---|
| 12 | * $brcm_Date: 4/26/11 1:00p $ |
|---|
| 13 | * |
|---|
| 14 | * [File Description:] |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/xdm/bxdm_pp_fp.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/4 4/26/11 1:00p btosi |
|---|
| 21 | * SW7405-4736: tweaked the base 10 conversion code |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/3 4/25/11 1:12p btosi |
|---|
| 24 | * SW7405-4736: for BXDM_PPDBG, print fractional part of average STC delta |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/2 4/19/11 12:00p btosi |
|---|
| 27 | * SW7405-4736: print parsed fields instead of raw data |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/1 2/16/10 10:51a nilesh |
|---|
| 30 | * SW7405-2993: Initial XDM version |
|---|
| 31 | * |
|---|
| 32 | ***************************************************************************/ |
|---|
| 33 | |
|---|
| 34 | #ifndef bxdm_pp_FP_H__ |
|---|
| 35 | #define bxdm_pp_FP_H__ |
|---|
| 36 | |
|---|
| 37 | #ifdef __cplusplus |
|---|
| 38 | extern "C" { |
|---|
| 39 | #endif |
|---|
| 40 | |
|---|
| 41 | #if 0 |
|---|
| 42 | } |
|---|
| 43 | #endif |
|---|
| 44 | |
|---|
| 45 | #define BXDM_PictureProvider_P_FixedPoint_FractionalOverflow 0x10000L |
|---|
| 46 | #define BXDM_PictureProvider_P_FixedPoint_FractionalShift 16 |
|---|
| 47 | #define BXDM_PictureProvider_P_FixedPoint_FractionalMask 0xFFFF |
|---|
| 48 | |
|---|
| 49 | /* |
|---|
| 50 | * These constants are used to extract the digits to the right of the decimal point. |
|---|
| 51 | */ |
|---|
| 52 | #define BXDM_PictureProvider_P_FixedPoint_FractionalMsbMask 0x8000 |
|---|
| 53 | #define BXDM_PictureProvider_P_FixedPoint_FractionalBitsOfPrecision 16 |
|---|
| 54 | |
|---|
| 55 | /* Fixed Point Artitmetic */ |
|---|
| 56 | typedef struct BXDM_PPFP_P_DataType |
|---|
| 57 | { |
|---|
| 58 | uint32_t uiWhole; |
|---|
| 59 | uint32_t uiFractional; |
|---|
| 60 | } BXDM_PPFP_P_DataType; |
|---|
| 61 | |
|---|
| 62 | void BXDM_PPFP_P_FixPtAdd( |
|---|
| 63 | const BXDM_PPFP_P_DataType *pstOperandA, |
|---|
| 64 | const BXDM_PPFP_P_DataType *pstOperandB, |
|---|
| 65 | BXDM_PPFP_P_DataType *pstResult |
|---|
| 66 | ); |
|---|
| 67 | |
|---|
| 68 | void BXDM_PPFP_P_FixPtSub( |
|---|
| 69 | const BXDM_PPFP_P_DataType *pstOperandA, |
|---|
| 70 | const BXDM_PPFP_P_DataType *pstOperandB, |
|---|
| 71 | BXDM_PPFP_P_DataType *pstResult |
|---|
| 72 | ); |
|---|
| 73 | |
|---|
| 74 | void BXDM_PPFP_P_FixPtDiv( |
|---|
| 75 | const BXDM_PPFP_P_DataType *pstOperand, |
|---|
| 76 | const uint32_t uiDivisor, |
|---|
| 77 | BXDM_PPFP_P_DataType *pstResult |
|---|
| 78 | ); |
|---|
| 79 | |
|---|
| 80 | void BXDM_PPFP_P_FixPtMult( |
|---|
| 81 | const BXDM_PPFP_P_DataType* pstOperand, |
|---|
| 82 | const uint32_t uiMultiplier, |
|---|
| 83 | BXDM_PPFP_P_DataType* pstResult |
|---|
| 84 | ); |
|---|
| 85 | |
|---|
| 86 | void BXDM_PPFP_P_FixPtFractionalMul( |
|---|
| 87 | const BXDM_PPFP_P_DataType* pstOperand, |
|---|
| 88 | const uint16_t uiNumerator, |
|---|
| 89 | const uint16_t uiDenominator, |
|---|
| 90 | BXDM_PPFP_P_DataType* pstResult |
|---|
| 91 | ); |
|---|
| 92 | |
|---|
| 93 | void BXDM_PPFP_P_FixPtBinaryFractionToBase10( |
|---|
| 94 | BXDM_PPFP_P_DataType* pstOperand, |
|---|
| 95 | uint32_t uiDstPrecision, |
|---|
| 96 | uint32_t * puiBase10Fraction |
|---|
| 97 | ); |
|---|
| 98 | |
|---|
| 99 | #ifdef __cplusplus |
|---|
| 100 | } |
|---|
| 101 | #endif |
|---|
| 102 | |
|---|
| 103 | #endif /* #ifndef bxdm_pp_FP_H__ */ |
|---|