| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2010, 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: bvdc_fgt_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 12 | * $brcm_Date: 6/18/10 4:20p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/vdc/7038/bvdc_fgt_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/5 6/18/10 4:20p rpan |
|---|
| 21 | * SW7400-2763: New BVN resource management. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/4 4/7/10 11:30a tdo |
|---|
| 24 | * SW3548-2814: Improvements to VDC ulBlackMagic. Rename TLA |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/3 4/5/10 4:06p tdo |
|---|
| 27 | * SW3548-2814: Improvements to VDC ulBlackMagic |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/2 9/11/08 11:27a yuxiaz |
|---|
| 30 | * PR46623: Add the code to enabe the endian swap bit for FGT. |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/1 10/23/07 11:16a yuxiaz |
|---|
| 33 | * PR29569, PR36290: Add FGT support on 7405. |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/PR29569/2 10/17/07 3:27p yuxiaz |
|---|
| 36 | * PR29569: More FGT work. |
|---|
| 37 | * |
|---|
| 38 | ***************************************************************************/ |
|---|
| 39 | #ifndef BVDC_FGT_PRIV_H__ |
|---|
| 40 | #define BVDC_FGT_PRIV_H__ |
|---|
| 41 | |
|---|
| 42 | #include "bvdc_common_priv.h" |
|---|
| 43 | #include "bvdc_subrul_priv.h" |
|---|
| 44 | #include "bvdc_window_priv.h" |
|---|
| 45 | |
|---|
| 46 | #ifdef __cplusplus |
|---|
| 47 | extern "C" { |
|---|
| 48 | #endif |
|---|
| 49 | |
|---|
| 50 | /*************************************************************************** |
|---|
| 51 | * Private defines |
|---|
| 52 | ***************************************************************************/ |
|---|
| 53 | /* 7400Dx, 7405Ax, 7325Ax, 7335Ax: basic FGT support */ |
|---|
| 54 | #define BVDC_P_FGT_VER_0 (0) |
|---|
| 55 | /* 7400E0, 7325Bx, 7335Bx: basic FGT support + ENDIAN_SWAP bit */ |
|---|
| 56 | #define BVDC_P_FGT_VER_1 (1) |
|---|
| 57 | |
|---|
| 58 | /*************************************************************************** |
|---|
| 59 | * Private macros |
|---|
| 60 | ***************************************************************************/ |
|---|
| 61 | #define BVDC_P_FGT_GET_REG_IDX(reg) \ |
|---|
| 62 | ((BCHP##_##reg - BCHP_FGT_0_REG_START) / sizeof(uint32_t)) |
|---|
| 63 | |
|---|
| 64 | /* Get register data */ |
|---|
| 65 | #define BVDC_P_FGT_GET_REG_DATA(reg) \ |
|---|
| 66 | (hFgt->aulRegs[BVDC_P_FGT_GET_REG_IDX(reg)]) |
|---|
| 67 | |
|---|
| 68 | /* Set register data */ |
|---|
| 69 | #define BVDC_P_FGT_SET_REG_DATA(reg, data) \ |
|---|
| 70 | (BVDC_P_FGT_GET_REG_DATA(reg) = (uint32_t)(data)) |
|---|
| 71 | |
|---|
| 72 | /* Get field */ |
|---|
| 73 | #define BVDC_P_FGT_GET_FIELD_NAME(reg, field) \ |
|---|
| 74 | ((BVDC_P_FGT_GET_REG_DATA(reg) & BCHP##_##reg##_##field##_MASK) >> \ |
|---|
| 75 | BCHP##_##reg##_##field##_SHIFT) |
|---|
| 76 | |
|---|
| 77 | /* Compare field */ |
|---|
| 78 | #define BVDC_P_FGT_COMPARE_FIELD_DATA(reg, field, data) \ |
|---|
| 79 | (BVDC_P_FGT_GET_FIELD_NAME(reg, field)==(data)) |
|---|
| 80 | |
|---|
| 81 | #define BVDC_P_FGT_COMPARE_FIELD_NAME(reg, field, name) \ |
|---|
| 82 | (BVDC_P_FGT_GET_FIELD_NAME(reg, field)==BCHP##_##reg##_##field##_##name) |
|---|
| 83 | |
|---|
| 84 | #define BVDC_P_FGT_WRITE_TO_RUL(reg, addr_ptr) \ |
|---|
| 85 | { \ |
|---|
| 86 | *addr_ptr++ = BRDC_OP_IMM_TO_REG(); \ |
|---|
| 87 | *addr_ptr++ = BRDC_REGISTER(BCHP##_##reg + hFgt->ulRegOffset); \ |
|---|
| 88 | *addr_ptr++ = BVDC_P_FGT_GET_REG_DATA(reg); \ |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | /* This macro does a block write into RUL */ |
|---|
| 92 | #define BVDC_P_FGT_BLOCK_WRITE_TO_RUL(from, to, pulCurrent) do { \ |
|---|
| 93 | uint32_t ulBlockSize = \ |
|---|
| 94 | BVDC_P_REGS_ENTRIES(from, to);\ |
|---|
| 95 | *pulCurrent++ = BRDC_OP_IMMS_TO_REGS( ulBlockSize ); \ |
|---|
| 96 | *pulCurrent++ = BRDC_REGISTER(BCHP##_##from + hFgt->ulRegOffset); \ |
|---|
| 97 | BKNI_Memcpy((void*)pulCurrent, \ |
|---|
| 98 | (void*)&(hFgt->aulRegs[BVDC_P_FGT_GET_REG_IDX(from)]), \ |
|---|
| 99 | ulBlockSize * sizeof(uint32_t)); \ |
|---|
| 100 | pulCurrent += ulBlockSize; \ |
|---|
| 101 | } while (0) |
|---|
| 102 | |
|---|
| 103 | #if (BVDC_P_SUPPORT_FGT) |
|---|
| 104 | /* number of registers in one block. */ |
|---|
| 105 | #define BVDC_P_FGT_REGS_COUNT \ |
|---|
| 106 | BVDC_P_REGS_ENTRIES(FGT_0_REG_START, FGT_0_REG_END) |
|---|
| 107 | #else |
|---|
| 108 | #define BVDC_P_FGT_REGS_COUNT 1 |
|---|
| 109 | #endif |
|---|
| 110 | |
|---|
| 111 | /*************************************************************************** |
|---|
| 112 | * Private data structures |
|---|
| 113 | ***************************************************************************/ |
|---|
| 114 | typedef struct BVDC_P_FgtContext |
|---|
| 115 | { |
|---|
| 116 | BDBG_OBJECT(BVDC_FGT) |
|---|
| 117 | |
|---|
| 118 | /* fgt Id */ |
|---|
| 119 | BVDC_P_FgtId eId; |
|---|
| 120 | uint32_t ulRegOffset; |
|---|
| 121 | uint32_t aulRegs[BVDC_P_FGT_REGS_COUNT]; |
|---|
| 122 | |
|---|
| 123 | bool bInitial; |
|---|
| 124 | uint32_t ulResetRegAddr; |
|---|
| 125 | uint32_t ulResetMask; |
|---|
| 126 | |
|---|
| 127 | /* static info from creating */ |
|---|
| 128 | BREG_Handle hRegister; |
|---|
| 129 | BMEM_Handle hMem; |
|---|
| 130 | BVDC_Handle hVdc; |
|---|
| 131 | |
|---|
| 132 | /* Which window it connect to */ |
|---|
| 133 | BVDC_Window_Handle hWindow; |
|---|
| 134 | |
|---|
| 135 | /* Noise pattern table address */ |
|---|
| 136 | uint32_t ulPatTableAddrOffset; |
|---|
| 137 | |
|---|
| 138 | /* user config */ |
|---|
| 139 | BVDC_Fgt_Settings *pUserSettings; |
|---|
| 140 | |
|---|
| 141 | /* sub-struct to manage vnet and rul build opreations */ |
|---|
| 142 | BVDC_P_SubRulContext SubRul; |
|---|
| 143 | |
|---|
| 144 | } BVDC_P_FgtContext; |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | /*************************************************************************** |
|---|
| 148 | * private functions |
|---|
| 149 | ***************************************************************************/ |
|---|
| 150 | #define BVDC_P_Fgt_MuxAddr(hFgt) (BCHP_VNET_F_FGT_0_SRC + (hFgt)->eId * sizeof(uint32_t)) |
|---|
| 151 | #define BVDC_P_Fgt_PostMuxValue(hFgt) (BCHP_VNET_B_CAP_0_SRC_SOURCE_FGT_0 + (hFgt)->eId) |
|---|
| 152 | |
|---|
| 153 | #define BVDC_P_Fgt_SetVnet_isr(hFgt, ulSrcMuxValue, eVnetPatchMode) \ |
|---|
| 154 | BVDC_P_SubRul_SetVnet_isr(&((hFgt)->SubRul), ulSrcMuxValue, eVnetPatchMode) |
|---|
| 155 | |
|---|
| 156 | #define BVDC_P_Fgt_UnsetVnet_isr(hFgt) \ |
|---|
| 157 | BVDC_P_SubRul_UnsetVnet_isr(&((hFgt)->SubRul)) |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | BERR_Code BVDC_P_Fgt_Create |
|---|
| 161 | ( BVDC_P_Fgt_Handle * phFgt, |
|---|
| 162 | BVDC_P_FgtId eFgtId, |
|---|
| 163 | BREG_Handle hRegister, |
|---|
| 164 | BMEM_Handle hMem, |
|---|
| 165 | BVDC_Handle hVdc, |
|---|
| 166 | BVDC_P_Resource_Handle hResource ); |
|---|
| 167 | |
|---|
| 168 | BERR_Code BVDC_P_Fgt_Destroy |
|---|
| 169 | ( BVDC_P_Fgt_Handle hFgt ); |
|---|
| 170 | |
|---|
| 171 | BERR_Code BVDC_P_Fgt_AcquireConnect |
|---|
| 172 | ( BVDC_P_Fgt_Handle hFgt, |
|---|
| 173 | BVDC_Window_Handle hWindow, |
|---|
| 174 | const BVDC_P_Window_Info *pCurInfo ); |
|---|
| 175 | |
|---|
| 176 | BERR_Code BVDC_P_Fgt_ReleaseConnect_isr |
|---|
| 177 | ( BVDC_P_Fgt_Handle *phFgt ); |
|---|
| 178 | |
|---|
| 179 | BERR_Code BVDC_P_Fgt_SetInfo_isr |
|---|
| 180 | ( BVDC_P_Fgt_Handle hFgt, |
|---|
| 181 | const BVDC_P_PictureNodePtr pPicture ); |
|---|
| 182 | |
|---|
| 183 | void BVDC_P_Fgt_BuildRul_isr |
|---|
| 184 | ( BVDC_P_Fgt_Handle hFgt, |
|---|
| 185 | BVDC_P_ListInfo *pList, |
|---|
| 186 | BVDC_P_State eVnetState, |
|---|
| 187 | BVDC_P_PicComRulInfo *pPicComRulInfo ); |
|---|
| 188 | |
|---|
| 189 | void BVDC_P_Fgt_LoadPatTable |
|---|
| 190 | ( uint8_t *pucFgtPatTblAddr ); |
|---|
| 191 | |
|---|
| 192 | #ifdef __cplusplus |
|---|
| 193 | } |
|---|
| 194 | #endif |
|---|
| 195 | |
|---|
| 196 | #endif /* #ifndef BVDC_FGT_PRIV_H__ */ |
|---|
| 197 | /* End of file. */ |
|---|