| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003, 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: brsp_mbyte.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/4 $ |
|---|
| 12 | * $brcm_Date: 9/16/03 5:20p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/rsp/brsp_mbyte.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/4 9/16/03 5:20p dlwin |
|---|
| 21 | * Replace [output] with [out] on API comments. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/3 9/8/03 6:37p dlwin |
|---|
| 24 | * Updated API function parameter comment for DocJet. |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/2 9/8/03 1:21p dlwin |
|---|
| 27 | * Replaced Create/DestroyHandle with Open/Close. |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/1 9/3/03 3:33p dlwin |
|---|
| 30 | * Initial version |
|---|
| 31 | * |
|---|
| 32 | ***************************************************************************/ |
|---|
| 33 | |
|---|
| 34 | /*= Module Overview ********************************************************* |
|---|
| 35 | <verbatim> |
|---|
| 36 | |
|---|
| 37 | Overview |
|---|
| 38 | This common utility module is an extension of 'BRSP' common utility. This |
|---|
| 39 | common utility is specifically for multi-byte devices. A multi-byte device |
|---|
| 40 | is defined as a device like BQDS and BQOB. Since this common utility |
|---|
| 41 | is an extension of 'BRSP', it provides all the functional of 'BRSP'. |
|---|
| 42 | See 'BRSP' documentation for a more detail description. |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | Design |
|---|
| 46 | None |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | Usage |
|---|
| 50 | The usages of BRSP_MByte involves the following: |
|---|
| 51 | |
|---|
| 52 | * Create Register Script (statically or dynamically) |
|---|
| 53 | * Create BRSP_MByte Handle |
|---|
| 54 | * Call parse function to parse Register Script |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | Sample Code |
|---|
| 58 | // The following is simple example that writes to several registers |
|---|
| 59 | // in the Bcm3250 Qam InBand Downstream core. |
|---|
| 60 | static const BRSP_ScriptTbl regScript[] = |
|---|
| 61 | { |
|---|
| 62 | BRSP_ScriptType_eWrite8, SB_FRZ1, 0x000000FF, |
|---|
| 63 | BRSP_ScriptType_eWrite8, SB_FRZ2, 0x000000FF, |
|---|
| 64 | BRSP_ScriptType_eWrite8, SB_RST1, 0x0000007F, |
|---|
| 65 | BRSP_ScriptType_eWrite8, SB_RST2, 0x000000FF, |
|---|
| 66 | BRSP_ScriptType_eWrite8, SB_AGI, 0x0000000D, |
|---|
| 67 | BRSP_ScriptType_eWrite8, SB_AGT, 0x0000001D, |
|---|
| 68 | BRSP_ScriptType_eMbWrite32, MB_STPGA, 0x80000000, |
|---|
| 69 | BRSP_ScriptType_eMbWrite32, MB_STAGI, 0x40000000, |
|---|
| 70 | BRSP_ScriptType_eMbWrite32, MB_STAII, 0x3FFF0000, |
|---|
| 71 | BRSP_ScriptType_eMbWrite32, MB_STAGT, 0xFC000000, |
|---|
| 72 | BRSP_ScriptType_eMbWrite32, MB_STAIT, 0x80000000, |
|---|
| 73 | BRSP_ScriptType_eMbWrite32, MB_STABW, 0x00000D0B, |
|---|
| 74 | BRSP_ScriptType_eMbWrite32, MB_STATHR, 0x00000480, |
|---|
| 75 | BRSP_ScriptType_eMbWrite32, MB_STAFTHR, 0x080D0000, |
|---|
| 76 | BRSP_ScriptType_eEndOfScript, 0x00, 0x00000000 |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | static BCHP_Handle hChip3250; |
|---|
| 80 | static BREG_Handle hReg3250; |
|---|
| 81 | static BINT_Handle hInt7038; |
|---|
| 82 | |
|---|
| 83 | main( void ) |
|---|
| 84 | { |
|---|
| 85 | BRSP_MByte_Handle hRsp; |
|---|
| 86 | |
|---|
| 87 | // Initialize hChip3250, hReg3250, and hInt7038 . . . |
|---|
| 88 | |
|---|
| 89 | BRSP_ParseRegScript( hReg7038, regScript, NULL ); |
|---|
| 90 | |
|---|
| 91 | // Create BRSP_MByte_Handle. 0x200 = Qam InBand Downstream core offset |
|---|
| 92 | // 0xC8 = number of Qam InBand Downstream Multi-byte registers |
|---|
| 93 | BRSP_MByte_Open( &hRsp, hReg3250, 0x200, 0xC8 ); |
|---|
| 94 | BRSP_MByte_ParseRegScript( hRsp, regScript, NULL ); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | </verbatim> |
|---|
| 98 | ***************************************************************************/ |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | #ifndef BRSP_MBYTE_H__ |
|---|
| 102 | #define BRSP_MBYTE_H__ |
|---|
| 103 | |
|---|
| 104 | #include "brsp.h" |
|---|
| 105 | #include "breg_mem.h" |
|---|
| 106 | |
|---|
| 107 | #ifdef __cplusplus |
|---|
| 108 | extern "C" { |
|---|
| 109 | #endif |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | /*************************************************************************** |
|---|
| 113 | Summary: |
|---|
| 114 | The handles for BRSP_MByte module. |
|---|
| 115 | |
|---|
| 116 | Description: |
|---|
| 117 | An opaque handle for BRSP_MByte module. |
|---|
| 118 | |
|---|
| 119 | See Also: |
|---|
| 120 | BRSP_MByte_Open(), BRSP_MByte_Close() |
|---|
| 121 | |
|---|
| 122 | ****************************************************************************/ |
|---|
| 123 | typedef struct BRSP_P_MByte_Handle *BRSP_MByte_Handle; |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | /*************************************************************************** |
|---|
| 127 | Summary: |
|---|
| 128 | This function creates a BRSP_MByte handle. |
|---|
| 129 | |
|---|
| 130 | Description: |
|---|
| 131 | This function is responsible for creating BRSP_MByte handle. |
|---|
| 132 | Using the created handle, one can do Multi-Byte read/write function to |
|---|
| 133 | a device that is Multi-Byte compatible. |
|---|
| 134 | |
|---|
| 135 | Returns: |
|---|
| 136 | TODO: |
|---|
| 137 | |
|---|
| 138 | See Also: |
|---|
| 139 | BRSP_MByte_Close() |
|---|
| 140 | |
|---|
| 141 | ****************************************************************************/ |
|---|
| 142 | BERR_Code BRSP_MByte_Open( |
|---|
| 143 | BRSP_MByte_Handle *phRsp, /* [out] MBtye Register Handle */ |
|---|
| 144 | BREG_Handle hReg, /* [in] Register Handle to use */ |
|---|
| 145 | uint32_t coreOffset, /* [in] Core Offset */ |
|---|
| 146 | uint32_t nbrWriteOnlyShadowReg /* [in] Number of Write Only Register, 0 if none */ |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /*************************************************************************** |
|---|
| 150 | Summary: |
|---|
| 151 | This function destroys a BRSP_MByte handle. |
|---|
| 152 | |
|---|
| 153 | Description: |
|---|
| 154 | This function is responsible for destorying BRSP_MByte handle. |
|---|
| 155 | BRSP_MByte handle should be created using the create function. |
|---|
| 156 | |
|---|
| 157 | Returns: |
|---|
| 158 | TODO: |
|---|
| 159 | |
|---|
| 160 | See Also: |
|---|
| 161 | BRSP_MByte_Open() |
|---|
| 162 | |
|---|
| 163 | ****************************************************************************/ |
|---|
| 164 | BERR_Code BRSP_MByte_Close( |
|---|
| 165 | BRSP_MByte_Handle hRsp /* [in] MBtye Register Handle */ |
|---|
| 166 | ); |
|---|
| 167 | |
|---|
| 168 | /*************************************************************************** |
|---|
| 169 | Summary: |
|---|
| 170 | This function writes a 32bit value to a BRSP_MByte handle. |
|---|
| 171 | |
|---|
| 172 | Description: |
|---|
| 173 | This function is responsible for writing a 32bit value to a |
|---|
| 174 | BRSP_MByte handle. The BRSP_MByte handle must be created using |
|---|
| 175 | the create function. |
|---|
| 176 | |
|---|
| 177 | Returns: |
|---|
| 178 | TODO: |
|---|
| 179 | |
|---|
| 180 | See Also: |
|---|
| 181 | BRSP_MByte_Open() |
|---|
| 182 | |
|---|
| 183 | ****************************************************************************/ |
|---|
| 184 | void BRSP_MByte_Write32( |
|---|
| 185 | BRSP_MByte_Handle hRsp, /* [in] MBtye Register Handle */ |
|---|
| 186 | uint32_t opCode, /* [in] MByte Operation Code to write to (see chip doc.) */ |
|---|
| 187 | uint32_t value /* [in] Value to write to MByte Register */ |
|---|
| 188 | ); |
|---|
| 189 | |
|---|
| 190 | /*************************************************************************** |
|---|
| 191 | Summary: |
|---|
| 192 | This function reads a 32bit value from a BRSP_MByte handle. |
|---|
| 193 | |
|---|
| 194 | Description: |
|---|
| 195 | This function is responsible for reading a 32bit value from a |
|---|
| 196 | BRSP_MByte handle. The BRSP_MByte handle must be created using |
|---|
| 197 | the Open function. |
|---|
| 198 | |
|---|
| 199 | Returns: |
|---|
| 200 | TODO: |
|---|
| 201 | |
|---|
| 202 | See Also: |
|---|
| 203 | BRSP_MByte_Open() |
|---|
| 204 | |
|---|
| 205 | ****************************************************************************/ |
|---|
| 206 | uint32_t BRSP_MByte_Read32( |
|---|
| 207 | BRSP_MByte_Handle hRsp, /* [in] MByte Register Handle */ |
|---|
| 208 | uint32_t opCode /* [in] MByte Operation Code to read from (see chip doc.) */ |
|---|
| 209 | ); |
|---|
| 210 | |
|---|
| 211 | /*************************************************************************** |
|---|
| 212 | Summary: |
|---|
| 213 | This function reads a 32bit value from a BRSP_MByte handle of a |
|---|
| 214 | write-only register. |
|---|
| 215 | |
|---|
| 216 | Description: |
|---|
| 217 | This function is responsible for reading a 32bit value from a |
|---|
| 218 | BRSP_MByte handle of a write-only register. |
|---|
| 219 | The BRSP_MByte handle must be created using the Open function. |
|---|
| 220 | |
|---|
| 221 | Returns: |
|---|
| 222 | TODO: |
|---|
| 223 | |
|---|
| 224 | See Also: |
|---|
| 225 | BRSP_MByte_Read32() |
|---|
| 226 | |
|---|
| 227 | ****************************************************************************/ |
|---|
| 228 | uint32_t BRSP_MByte_Read32WriteOnly( |
|---|
| 229 | BRSP_MByte_Handle hRsp, /* [in] MByte Register Handle */ |
|---|
| 230 | uint32_t opCode /* [in] MByte Operation Code to read from (see chip doc.) */ |
|---|
| 231 | ); |
|---|
| 232 | |
|---|
| 233 | /*************************************************************************** |
|---|
| 234 | Summary: |
|---|
| 235 | This function parses a BRSP script with MByte registers. |
|---|
| 236 | |
|---|
| 237 | Description: |
|---|
| 238 | This function is responsible for parsing a BRSP script with MByte |
|---|
| 239 | registers. |
|---|
| 240 | |
|---|
| 241 | Returns: |
|---|
| 242 | TODO: |
|---|
| 243 | |
|---|
| 244 | See Also: |
|---|
| 245 | None |
|---|
| 246 | |
|---|
| 247 | ****************************************************************************/ |
|---|
| 248 | BERR_Code BRSP_MByte_ParseRegScript( |
|---|
| 249 | BRSP_MByte_Handle hRsp, /* [in] Handle to Register Script */ |
|---|
| 250 | const BRSP_ScriptTbl *pScriptTbl, /* [in] Pointer to Register Script Tbl */ |
|---|
| 251 | void *phDev /* [in] Handle of calling device */ |
|---|
| 252 | ); |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | #ifdef __cplusplus |
|---|
| 256 | } |
|---|
| 257 | #endif |
|---|
| 258 | |
|---|
| 259 | #endif |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | |
|---|