| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2009, 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: bvsb_3520_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/7 $ |
|---|
| 12 | * $brcm_Date: 5/19/09 11:10a $ |
|---|
| 13 | * |
|---|
| 14 | * [File Description:] |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/vsb/3520/bvsb_3520_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/7 5/19/09 11:10a dliu |
|---|
| 21 | * PR55183: Add OOB lock interrupts |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/6 3/24/09 3:39p dliu |
|---|
| 24 | * PR53219: Add OOB control for 3520 |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/5 2/13/07 12:04p dliu |
|---|
| 27 | * PR27857: Add Set_IFFreq function |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/4 11/14/06 11:32a dliu |
|---|
| 30 | * PR 25214: Add BVSB_3520_P_GetChipRevision() function header |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/3 2/1/05 9:43a enavarro |
|---|
| 33 | * PR 14005: pass in BINT_Handle to BVSB_Open() |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/2 10/1/04 3:25p brianlee |
|---|
| 36 | * PR12857: Modified code to comform to magnum coding convention. |
|---|
| 37 | * |
|---|
| 38 | ***************************************************************************/ |
|---|
| 39 | |
|---|
| 40 | #ifndef _BVSB_3520_PRIV_H__ |
|---|
| 41 | #define _BVSB_3520_PRIV_H__ |
|---|
| 42 | |
|---|
| 43 | #include "bvsb_3520.h" |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | #define BVSB_CHK_RETCODE(x) \ |
|---|
| 47 | { if ((retCode = (x)) != BERR_SUCCESS){ BDBG_ERR(("%s:%d failed %d\n",__FUNCTION__,__LINE__,retCode)); goto done; } } |
|---|
| 48 | |
|---|
| 49 | #define BVSB_WriteHostRegister(h, offset, val) \ |
|---|
| 50 | BREG_I2C_Write(((BVSB_3520_P_Handle *)(h->pImpl))->hRegister, h->settings.i2c.chipAddr, offset, val, 1) |
|---|
| 51 | |
|---|
| 52 | #define BVSB_ReadHostRegister(h, offset, val) \ |
|---|
| 53 | BREG_I2C_Read(((BVSB_3520_P_Handle *)(h->pImpl))->hRegister, h->settings.i2c.chipAddr, offset, val, 1) |
|---|
| 54 | |
|---|
| 55 | /* window addresses passed to BVSB_P_SetApWindow() */ |
|---|
| 56 | #define BVSB_WINDOW_IRAM 0x00000000 |
|---|
| 57 | #define BVSB_WINDOW_IROM 0x00008000 |
|---|
| 58 | #define BVSB_WINDOW_HAB 0x00010000 |
|---|
| 59 | #define BVSB_WINDOW_IDATA 0x00010400 |
|---|
| 60 | |
|---|
| 61 | /* bit definitions used in audio HAB commands */ |
|---|
| 62 | #define BVSB_AUDIO_CONFIG_DECODE_MODE_MASK 0x03 |
|---|
| 63 | #define BVSB_AUDIO_CONFIG_DECODE_MODE_MONO 0x00 |
|---|
| 64 | #define BVSB_AUDIO_CONFIG_DECODE_MODE_STEREO 0x01 |
|---|
| 65 | #define BVSB_AUDIO_CONFIG_DECODE_MODE_SAP 0x02 |
|---|
| 66 | #define BVSB_AUDIO_CONFIG_DECODE_MODE_SAP_MONO 0x03 |
|---|
| 67 | #define BVSB_AUDIO_CONFIG_SR_MASK 0x0C |
|---|
| 68 | #define BVSB_AUDIO_CONFIG_SR_32KHZ 0x00 |
|---|
| 69 | #define BVSB_AUDIO_CONFIG_SR_44_1KHZ 0x04 |
|---|
| 70 | #define BVSB_AUDIO_CONFIG_SR_48KHZ 0x08 |
|---|
| 71 | #define BVSB_AUDIO_CONFIG_DAC_SELECT_MASK 0x20 |
|---|
| 72 | #define BVSB_AUDIO_CONFIG_DAC_SELECT_JDA 0x00 |
|---|
| 73 | #define BVSB_AUDIO_CONFIG_DAC_SELECT_HIFIDAC 0x20 |
|---|
| 74 | #define BVSB_AUDIO_CONFIG_SEL_MASK 0x40 |
|---|
| 75 | #define BVSB_AUDIO_CONFIG_SEL_AUDIO_DAC 0x00 |
|---|
| 76 | #define BVSB_AUDIO_CONFIG_SEL_I2S 0x40 |
|---|
| 77 | #define BVSB_AUDIO_CONFIG_MUTE 0x80 |
|---|
| 78 | #define BVSB_AUDIO_SAP_DETECTED 0x01 |
|---|
| 79 | #define BVSB_AUDIO_STEREO_DETECTED 0x02 |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | /*************************************************************************** |
|---|
| 83 | Summary: |
|---|
| 84 | Structure for chip-specific VSB handle |
|---|
| 85 | |
|---|
| 86 | Description: |
|---|
| 87 | This is the chip-specific component of the BVSB_Handle. |
|---|
| 88 | |
|---|
| 89 | See Also: |
|---|
| 90 | None. |
|---|
| 91 | |
|---|
| 92 | ****************************************************************************/ |
|---|
| 93 | typedef struct BVSB_3520_P_Handle |
|---|
| 94 | { |
|---|
| 95 | BREG_I2C_Handle hRegister; /* handle to the master I2C device used to access registers */ |
|---|
| 96 | BKNI_EventHandle hInterruptEvent; /* interrupt event handle */ |
|---|
| 97 | BKNI_EventHandle hApiEvent; /* API event handle */ |
|---|
| 98 | BKNI_EventHandle hLockChangeEvent; /* change of lock status event handle */ |
|---|
| 99 | BKNI_EventHandle hOobLockChangeEvent; /* change of lock status event handle */ |
|---|
| 100 | BKNI_EventHandle hInitDoneEvent; /* AP initialization done event handle */ |
|---|
| 101 | BKNI_EventHandle hHabDoneEvent; /* HAB done event handle */ |
|---|
| 102 | BKNI_EventHandle hAntennaEvent; /* Antenna event handle */ |
|---|
| 103 | BKNI_EventHandle hBscEvent; /* BSC event handle */ |
|---|
| 104 | uint8_t last_page_16_15; /* most recent position of the 128 byte window into the AP address space */ |
|---|
| 105 | uint8_t last_page_14_7; /* most recent position of the 128 byte window into the AP address space */ |
|---|
| 106 | uint8_t last_mbox_15_8; /* most recent position of the IO MBOX window */ |
|---|
| 107 | uint8_t last_bsc_slave_addr; /* last BSC slave addr */ |
|---|
| 108 | } BVSB_3520_P_Handle; |
|---|
| 109 | |
|---|
| 110 | /*************************************************************************** |
|---|
| 111 | Summary: |
|---|
| 112 | Enum for pad drive strength |
|---|
| 113 | |
|---|
| 114 | Description: |
|---|
| 115 | This enum specifies the pad drive strength. |
|---|
| 116 | |
|---|
| 117 | See Also: |
|---|
| 118 | None. |
|---|
| 119 | |
|---|
| 120 | ****************************************************************************/ |
|---|
| 121 | typedef enum BVSB_3520_PadDriveStrength |
|---|
| 122 | { |
|---|
| 123 | BVSB_3520_PadDriveStrength_e6mA = 0, /* 6 mA */ |
|---|
| 124 | BVSB_3520_PadDriveStrength_e4mA, /* 4 mA */ |
|---|
| 125 | BVSB_3520_PadDriveStrength_e2mA, /* 2 mA */ |
|---|
| 126 | BVSB_3520_PadDriveStrength_eTRISTATE /* tristate */ |
|---|
| 127 | } BVSB_3520_PadDriveStrength; |
|---|
| 128 | |
|---|
| 129 | /*************************************************************************** |
|---|
| 130 | Summary: |
|---|
| 131 | Enum for audio pad drive strength |
|---|
| 132 | |
|---|
| 133 | Description: |
|---|
| 134 | This enum specifies the audio pad drive strength. |
|---|
| 135 | |
|---|
| 136 | See Also: |
|---|
| 137 | None. |
|---|
| 138 | |
|---|
| 139 | ****************************************************************************/ |
|---|
| 140 | typedef enum BVSB_3520_AudioPadDriveStrength |
|---|
| 141 | { |
|---|
| 142 | BVSB_3520_AudioPadDriveStrength_e12mA = 0, /* 12 mA */ |
|---|
| 143 | BVSB_3520_AudioPadDriveStrength_e8mA, /* 8 mA */ |
|---|
| 144 | BVSB_3520_AudioPadDriveStrength_e4mA, /* 4 mA */ |
|---|
| 145 | BVSB_3520_AudioPadDriveStrength_eTRISTATE /* tristate */ |
|---|
| 146 | } BVSB_3520_AudioPadDriveStrength; |
|---|
| 147 | |
|---|
| 148 | /*************************************************************************** |
|---|
| 149 | Summary: |
|---|
| 150 | Enum for output format of the DS_CLK_F1B_ADC pin |
|---|
| 151 | |
|---|
| 152 | Description: |
|---|
| 153 | This enum specifies the output format of the DS_CLK_F1B_ADC pin. |
|---|
| 154 | |
|---|
| 155 | See Also: |
|---|
| 156 | None. |
|---|
| 157 | |
|---|
| 158 | ****************************************************************************/ |
|---|
| 159 | typedef enum BVSB_F1BADC_OutputFormat |
|---|
| 160 | { |
|---|
| 161 | BVSB_F1BADC_OutputFormat_eNothing = 0, /* output nothing */ |
|---|
| 162 | BVSB_F1BADC_OutputFormat_eAD_clk = 2, /* output A/D sample clock */ |
|---|
| 163 | BVSB_F1BADC_OutputFormat_eBaud_clk = 3 /* output pulse swallowed baud clock */ |
|---|
| 164 | } BVSB_F1BADC_OutputFormat; |
|---|
| 165 | |
|---|
| 166 | /*************************************************************************** |
|---|
| 167 | Summary: |
|---|
| 168 | Enum for output format of the DS_CLK_ADC pin |
|---|
| 169 | |
|---|
| 170 | Description: |
|---|
| 171 | This enum specifies the output format of the DS_CLK_ADC pin. |
|---|
| 172 | |
|---|
| 173 | See Also: |
|---|
| 174 | None. |
|---|
| 175 | |
|---|
| 176 | ****************************************************************************/ |
|---|
| 177 | typedef enum BVSB_ADCSEL_OutputFormat |
|---|
| 178 | { |
|---|
| 179 | BVSB_ADCSEL_OutputFormat_eNothing = 0, /* output nothing */ |
|---|
| 180 | BVSB_ADCSEL_OutputFormat_eDelayedReset, /* output delayed reset signal */ |
|---|
| 181 | BVSB_ADCSEL_OutputFormat_eAD_clk /* output A/D sample clock */ |
|---|
| 182 | } BVSB_ADCSEL_OutputFormat; |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | /*************************************************************************** |
|---|
| 186 | Summary: |
|---|
| 187 | Structure for pad configuration |
|---|
| 188 | |
|---|
| 189 | Description: |
|---|
| 190 | This structure contains pad configuration parameters |
|---|
| 191 | |
|---|
| 192 | See Also: |
|---|
| 193 | None. |
|---|
| 194 | |
|---|
| 195 | ****************************************************************************/ |
|---|
| 196 | typedef struct BVSB_PadConfig |
|---|
| 197 | { |
|---|
| 198 | BVSB_3520_PadDriveStrength driveStrength_ps_data_7; /* DS_PS_DATA_7 pin drive strength */ |
|---|
| 199 | BVSB_3520_PadDriveStrength driveStrength_ps_data_6; /* DS_PS_DATA_6 pin drive strength */ |
|---|
| 200 | BVSB_3520_PadDriveStrength driveStrength_ps_data_5; /* DS_PS_DATA_5 pin drive strength */ |
|---|
| 201 | BVSB_3520_PadDriveStrength driveStrength_ps_data_4; /* DS_PS_DATA_4 pin drive strength */ |
|---|
| 202 | BVSB_3520_PadDriveStrength driveStrength_ps_data_3; /* DS_PS_DATA_3 pin drive strength */ |
|---|
| 203 | BVSB_3520_PadDriveStrength driveStrength_ps_data_2; /* DS_PS_DATA_2 pin drive strength */ |
|---|
| 204 | BVSB_3520_PadDriveStrength driveStrength_ps_data_1; /* DS_PS_DATA_1 pin drive strength */ |
|---|
| 205 | BVSB_3520_PadDriveStrength driveStrength_ps_data_0; /* DS_PS_DATA_0 pin drive strength */ |
|---|
| 206 | BVSB_3520_PadDriveStrength driveStrength_ps_clk; /* DS_PS_CLK pin drive strength */ |
|---|
| 207 | BVSB_3520_PadDriveStrength driveStrength_ps_err; /* DS_PS_ERR pin drive strength */ |
|---|
| 208 | BVSB_3520_PadDriveStrength driveStrength_ps_valid; /* DS_PS_VALID pin drive strength */ |
|---|
| 209 | BVSB_3520_PadDriveStrength driveStrength_ps_sync; /* DS_PS_SYNC pin drive strength */ |
|---|
| 210 | BVSB_3520_PadDriveStrength driveStrength_oob_clk; /* OOB_CLK pin drive strength */ |
|---|
| 211 | BVSB_3520_PadDriveStrength driveStrength_oob_sdata; /* OOB_SDATA pin drive strength */ |
|---|
| 212 | BVSB_3520_AudioPadDriveStrength driveStrength_rn_mclk; /* AUD_Rn_MCLK pin drive strength */ |
|---|
| 213 | BVSB_3520_AudioPadDriveStrength driveStrength_rp_sclk; /* AUD_Rp_SCLK pin drive strength */ |
|---|
| 214 | BVSB_3520_AudioPadDriveStrength driveStrength_ln_lr; /* AUD_Ln_LR pin drive strength */ |
|---|
| 215 | BVSB_3520_AudioPadDriveStrength driveStrength_lp_data; /* AUD_Lp_DATA pin drive strength */ |
|---|
| 216 | bool bTristate_clk_adc_f1b; /* true=DS_CLK_ADC_F1B pin tristate */ |
|---|
| 217 | bool bTristate_clk_adc; /* true=DS_CLK_ADC pin tristate */ |
|---|
| 218 | bool bTristate_gpo_7; /* true=GPO_7 pin tristate */ |
|---|
| 219 | bool bTristate_gpo_6; /* true=GPO_6 pin tristate */ |
|---|
| 220 | bool bTristate_gpo_5; /* true=GPO_5 pin tristate */ |
|---|
| 221 | bool bTristate_gpo_4; /* true=GPO_4 pin tristate */ |
|---|
| 222 | bool bTristate_gpo_3; /* true=GPO_3 pin tristate */ |
|---|
| 223 | bool bTristate_gpo_2; /* true=GPO_2 pin tristate */ |
|---|
| 224 | bool bTristate_gpo_1; /* true=GPO_1 pin tristate */ |
|---|
| 225 | bool bTristate_gpo_0; /* true=GPO_0 pin tristate */ |
|---|
| 226 | BVSB_F1BADC_OutputFormat f1bsel; /* DS_CLK_F1B_ADC pin output format */ |
|---|
| 227 | BVSB_ADCSEL_OutputFormat adcsel; /* DS_CLK_ADC pin output format */ |
|---|
| 228 | |
|---|
| 229 | bool bOpenDrain_hm; /* IF demod hsync output */ |
|---|
| 230 | bool bOpenDrain_gm; /* general purpose delta sigma output */ |
|---|
| 231 | bool bOpenDrain_am; /* DS_AGCT_CTL pin output */ |
|---|
| 232 | bool bOpenDrain_im; /* DS_AGCI_CTL pin output */ |
|---|
| 233 | bool bOpenDrain_om; /* OOB_AGC pin output */ |
|---|
| 234 | |
|---|
| 235 | bool bErs; /* PS_ERR function: false=TEI, true=lock indicator */ |
|---|
| 236 | bool bTristate_at; /* true = DS_AGCT_CTL pin is tristate */ |
|---|
| 237 | bool bTristate_it; /* true = DS_AGCI_CTL pin is tristate */ |
|---|
| 238 | bool bTristate_ot; /* true = OOB_AGCI pin is tristate */ |
|---|
| 239 | uint8_t gpio_01; /* GPIO_0/GPIO_1 function selection (see 3520 user manual) */ |
|---|
| 240 | uint8_t oob_gpo; /* OOB_GPO control word (see 3520 user manual) */ |
|---|
| 241 | uint8_t agctsel; /* AGCTSEL control word (see 3520 user manual) */ |
|---|
| 242 | uint8_t agcisel; /* AGCISEL control word (see 3520 user manual) */ |
|---|
| 243 | uint8_t agcgpsel; /* AGCGPSEL control word (see 3520 user manual) */ |
|---|
| 244 | } BVSB_3520_PadConfig; |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | /****************************************************************************** |
|---|
| 248 | Summary: |
|---|
| 249 | Reads a register in an internal core via the IO_MBOX interface. |
|---|
| 250 | Description: |
|---|
| 251 | This function uses the IO_MBOX interface to access the RBUS. This function |
|---|
| 252 | assumes that the accessed core has already been unlocked in the bus bridge, |
|---|
| 253 | which is the default in BCM3520-A1 and later. |
|---|
| 254 | Returns: |
|---|
| 255 | BERR_Code |
|---|
| 256 | ******************************************************************************/ |
|---|
| 257 | BERR_Code BVSB_3520_P_ReadMbox( |
|---|
| 258 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 259 | uint16_t reg, /* [in] RBUS register address */ |
|---|
| 260 | uint32_t *val /* [out] value read from register */ |
|---|
| 261 | ); |
|---|
| 262 | |
|---|
| 263 | |
|---|
| 264 | /****************************************************************************** |
|---|
| 265 | Summary: |
|---|
| 266 | Writes to a register in an internal core via the IO_MBOX interface. |
|---|
| 267 | Description: |
|---|
| 268 | This function uses the IO_MBOX interface to access the RBUS. This function |
|---|
| 269 | assumes that the accessed core has already been unlocked in the bus bridge, |
|---|
| 270 | which is the default in BCM3520-A1 and later. |
|---|
| 271 | Returns: |
|---|
| 272 | BERR_Code |
|---|
| 273 | ******************************************************************************/ |
|---|
| 274 | BERR_Code BVSB_3520_P_WriteMbox( |
|---|
| 275 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 276 | uint16_t reg, /* [in] RBUS register address */ |
|---|
| 277 | uint32_t *val /* [in] value to write */ |
|---|
| 278 | ); |
|---|
| 279 | |
|---|
| 280 | |
|---|
| 281 | /****************************************************************************** |
|---|
| 282 | Summary: |
|---|
| 283 | Reads from the host access buffer. |
|---|
| 284 | Description: |
|---|
| 285 | This function positions the 128 byte window in the AP address space to the |
|---|
| 286 | host access buffer area. (n) bytes are then read into (buf) starting from |
|---|
| 287 | the given HAB (offset) address. |
|---|
| 288 | Returns: |
|---|
| 289 | BERR_Code |
|---|
| 290 | ******************************************************************************/ |
|---|
| 291 | BERR_Code BVSB_3520_P_ReadHab( |
|---|
| 292 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 293 | uint8_t offset, /* [in] starting offset within the HAB to read */ |
|---|
| 294 | uint8_t *buf, /* [out] holds the data read */ |
|---|
| 295 | uint8_t n /* [in] number of bytes to read */ |
|---|
| 296 | ); |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | /****************************************************************************** |
|---|
| 300 | Summary: |
|---|
| 301 | Writes to the host access buffer. |
|---|
| 302 | Description: |
|---|
| 303 | This function positions the 128 byte window in the AP address space to the |
|---|
| 304 | host access buffer area. (n) bytes in (buf) are then written starting from |
|---|
| 305 | the given HAB (offset) address. |
|---|
| 306 | Returns: |
|---|
| 307 | BERR_Code |
|---|
| 308 | ******************************************************************************/ |
|---|
| 309 | BERR_Code BVSB_3520_P_WriteHab( |
|---|
| 310 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 311 | uint8_t offset, /* [in] starting offset in the HAB to write */ |
|---|
| 312 | uint8_t *buf, /* [in] specifies the data to write */ |
|---|
| 313 | uint8_t n /* [in] number of bytes to write */ |
|---|
| 314 | ); |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | /****************************************************************************** |
|---|
| 318 | Summary: |
|---|
| 319 | Reads from the AP RAM/ROM space. |
|---|
| 320 | Description: |
|---|
| 321 | This function is normally used for verifying the contents of the AP RAM |
|---|
| 322 | after microcode download. This function assumes that the AP is already in |
|---|
| 323 | idle or reset state. |
|---|
| 324 | Returns: |
|---|
| 325 | BERR_Code |
|---|
| 326 | ******************************************************************************/ |
|---|
| 327 | BERR_Code BVSB_3520_P_ReadMemory( |
|---|
| 328 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 329 | uint16_t addr, /* [in] starting address */ |
|---|
| 330 | uint8_t *buf, /* [out] holds the data read */ |
|---|
| 331 | uint16_t n /* [in] number of bytes to read */ |
|---|
| 332 | ); |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | /****************************************************************************** |
|---|
| 336 | Summary: |
|---|
| 337 | Writes to the AP RAM space. |
|---|
| 338 | Description: |
|---|
| 339 | This function is normally used for downloading the microcode. This function |
|---|
| 340 | assumes that the AP is already in idle or reset state. |
|---|
| 341 | Returns: |
|---|
| 342 | BERR_Code |
|---|
| 343 | ******************************************************************************/ |
|---|
| 344 | BERR_Code BVSB_3520_P_WriteMemory( |
|---|
| 345 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 346 | uint16_t addr, /* [in] starting address in AP RAM */ |
|---|
| 347 | uint8_t *buf, /* [in] specifies the data to write */ |
|---|
| 348 | uint16_t n /* [in] number of bytes to write */ |
|---|
| 349 | ); |
|---|
| 350 | |
|---|
| 351 | |
|---|
| 352 | /****************************************************************************** |
|---|
| 353 | Summary: |
|---|
| 354 | Positions the 128 byte window in the AP address space. |
|---|
| 355 | Description: |
|---|
| 356 | The last 128-byte window position is stored in the BVSB_Handle struct, |
|---|
| 357 | so I2C accesses will occur only if the window has moved. |
|---|
| 358 | Returns: |
|---|
| 359 | BERR_Code |
|---|
| 360 | ******************************************************************************/ |
|---|
| 361 | BERR_Code BVSB_3520_P_SetApWindow( |
|---|
| 362 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 363 | uint32_t window /* [in] base address of the 128-byte window */ |
|---|
| 364 | ); |
|---|
| 365 | |
|---|
| 366 | |
|---|
| 367 | /****************************************************************************** |
|---|
| 368 | Summary: |
|---|
| 369 | Resets the AP. |
|---|
| 370 | Description: |
|---|
| 371 | This function puts the AP in reset state. |
|---|
| 372 | Returns: |
|---|
| 373 | BERR_Code |
|---|
| 374 | ******************************************************************************/ |
|---|
| 375 | BERR_Code BVSB_3520_P_ResetAp( |
|---|
| 376 | BVSB_Handle h /* [in] BVSB PI Handle */ |
|---|
| 377 | ); |
|---|
| 378 | |
|---|
| 379 | |
|---|
| 380 | /****************************************************************************** |
|---|
| 381 | Summary: |
|---|
| 382 | Runs the AP. |
|---|
| 383 | Description: |
|---|
| 384 | This function takes the AP to out of reset/idle state and starts running. |
|---|
| 385 | Returns: |
|---|
| 386 | BERR_Code |
|---|
| 387 | ******************************************************************************/ |
|---|
| 388 | BERR_Code BVSB_3520_P_RunAp( |
|---|
| 389 | BVSB_Handle h /* [in] BVSB PI Handle */ |
|---|
| 390 | ); |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | /****************************************************************************** |
|---|
| 394 | Summary: |
|---|
| 395 | Disables all host interrupts. |
|---|
| 396 | Description: |
|---|
| 397 | This function clears the host interrupt enable bits on the BCM3520. |
|---|
| 398 | Returns: |
|---|
| 399 | BERR_Code |
|---|
| 400 | ******************************************************************************/ |
|---|
| 401 | BERR_Code BVSB_3520_P_DisableInterrupts( |
|---|
| 402 | BVSB_Handle h /* [in] BVSB PI Handle */ |
|---|
| 403 | ); |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | /****************************************************************************** |
|---|
| 407 | Summary: |
|---|
| 408 | Returns the BERR_Code corresponding to the given BVSB_ApStatus. |
|---|
| 409 | Description: |
|---|
| 410 | This function returns ths BERR_Code of any errors in the given BVSB_ApStatus. |
|---|
| 411 | Returns: |
|---|
| 412 | BERR_Code |
|---|
| 413 | ******************************************************************************/ |
|---|
| 414 | BERR_Code BVSB_3520_P_DecodeError( |
|---|
| 415 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 416 | BVSB_ApStatus *pApStatus /* [in] AP status returned by BVSB_GetApStatus */ |
|---|
| 417 | ); |
|---|
| 418 | |
|---|
| 419 | |
|---|
| 420 | /****************************************************************************** |
|---|
| 421 | Summary: |
|---|
| 422 | This function sends an HAB command. |
|---|
| 423 | Description: |
|---|
| 424 | This function writes a command to the HAB, asserts HABR, waits for the AP to |
|---|
| 425 | release the HAB, then optionally checks for a service acknowlegement from |
|---|
| 426 | the AP. If bCheckForAck is true, then read_len must be greater than 0. |
|---|
| 427 | Returns: |
|---|
| 428 | BERR_Code |
|---|
| 429 | ******************************************************************************/ |
|---|
| 430 | BERR_Code BVSB_3520_P_SendHabCommand( |
|---|
| 431 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 432 | uint8_t *write_buf, /* [in] specifies the HAB command to send */ |
|---|
| 433 | uint8_t write_len, /* [in] number of bytes in the HAB command */ |
|---|
| 434 | uint8_t *read_buf, /* [out] holds the data read from the HAB */ |
|---|
| 435 | uint8_t read_len, /* [in] number of bytes to read from the HAB */ |
|---|
| 436 | bool bCheckForAck /* [in] true = determine if the AP has serviced the command */ |
|---|
| 437 | ); |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | /****************************************************************************** |
|---|
| 441 | Summary: |
|---|
| 442 | This function sends the command already written in the HAB. |
|---|
| 443 | Description: |
|---|
| 444 | This function asserts HABR, waits for the AP to release the HAB, then |
|---|
| 445 | optionally checks for a service acknowlegement from the AP. If bCheckForAck |
|---|
| 446 | is true, then read_len must be greater than 0. This function is called by |
|---|
| 447 | BVSB_3520_P_SendHabCommand(). |
|---|
| 448 | Returns: |
|---|
| 449 | BERR_Code |
|---|
| 450 | ******************************************************************************/ |
|---|
| 451 | BERR_Code BVSB_3520_P_ServiceHab( |
|---|
| 452 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 453 | uint8_t *read_buf, /* [out] holds the data read from the HAB */ |
|---|
| 454 | uint8_t read_len, /* [in] number of bytes to read from the HAB */ |
|---|
| 455 | bool bCheckForAck, /* [in] true = determine if the AP has serviced the command */ |
|---|
| 456 | uint8_t ack_byte /* [in] value of the ack byte to expect */ |
|---|
| 457 | ); |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | /****************************************************************************** |
|---|
| 461 | Summary: |
|---|
| 462 | This function checks if the host is currently permitted to send an HAB |
|---|
| 463 | command. |
|---|
| 464 | Description: |
|---|
| 465 | The HAB is available to the host if all 3 conditions currently apply: |
|---|
| 466 | 1) The AP is running. |
|---|
| 467 | 2) The AP has initialized. |
|---|
| 468 | 3) The AP is not currently servicing the HAB (i.e. HABR bit is 0) |
|---|
| 469 | Returns: |
|---|
| 470 | BERR_Code - BERR_SUCCESS if HAB is available, otherwise BERR_Code is reason |
|---|
| 471 | why HAB is not available |
|---|
| 472 | ******************************************************************************/ |
|---|
| 473 | BERR_Code BVSB_3520_P_CheckHab( |
|---|
| 474 | BVSB_Handle h /* [in] BVSB PI Handle */ |
|---|
| 475 | ); |
|---|
| 476 | |
|---|
| 477 | |
|---|
| 478 | /****************************************************************************** |
|---|
| 479 | Summary: |
|---|
| 480 | Enables/Disables the L1 host interrupt. |
|---|
| 481 | Description: |
|---|
| 482 | Enables/Disables the L1 host interrupt by calling the application-supplied |
|---|
| 483 | callback routine the the BVSB settings. |
|---|
| 484 | Returns: |
|---|
| 485 | BERR_Code |
|---|
| 486 | ******************************************************************************/ |
|---|
| 487 | BERR_Code BVSB_3520_P_EnableHostInterrupt( |
|---|
| 488 | BVSB_Handle h, /* [in] BVSB PI handle */ |
|---|
| 489 | bool bEnable /* [in] true=enables the L1 interrupt on the host processor */ |
|---|
| 490 | ); |
|---|
| 491 | |
|---|
| 492 | |
|---|
| 493 | /****************************************************************************** |
|---|
| 494 | Summary: |
|---|
| 495 | Enables the AP initialization done interrupt. |
|---|
| 496 | Description: |
|---|
| 497 | This function is called by the BVSB_InitAp(). |
|---|
| 498 | Returns: |
|---|
| 499 | BERR_Code |
|---|
| 500 | ******************************************************************************/ |
|---|
| 501 | BERR_Code BVSB_3520_P_EnableInitDoneInterrupt( |
|---|
| 502 | BVSB_Handle h /* [in] BVSB PI Handle */ |
|---|
| 503 | ); |
|---|
| 504 | |
|---|
| 505 | |
|---|
| 506 | /****************************************************************************** |
|---|
| 507 | Summary: |
|---|
| 508 | Enables/Disables the inband channel lock interrupt. |
|---|
| 509 | Description: |
|---|
| 510 | This function enables or disables an interrupt to be generated upon change |
|---|
| 511 | in inband channel lock status. |
|---|
| 512 | Returns: |
|---|
| 513 | BERR_Code |
|---|
| 514 | ******************************************************************************/ |
|---|
| 515 | BERR_Code BVSB_3520_P_EnableLockInterrupt( |
|---|
| 516 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 517 | bool bEnable /* [in] true = enable lock interrupts, false = disables lock interrupts */ |
|---|
| 518 | ); |
|---|
| 519 | |
|---|
| 520 | /****************************************************************************** |
|---|
| 521 | Summary: |
|---|
| 522 | Enables/Disables the out-of-band channel lock interrupt. |
|---|
| 523 | Description: |
|---|
| 524 | This function enables or disables an interrupt to be generated upon change |
|---|
| 525 | in out-of-band channel lock status. |
|---|
| 526 | Returns: |
|---|
| 527 | BERR_Code |
|---|
| 528 | ******************************************************************************/ |
|---|
| 529 | BERR_Code BVSB_3520_P_EnableOobLockInterrupt( |
|---|
| 530 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 531 | bool bEnable /* [in] true = enable lock interrupts, false = disables lock interrupts */ |
|---|
| 532 | ); |
|---|
| 533 | |
|---|
| 534 | |
|---|
| 535 | /****************************************************************************** |
|---|
| 536 | Summary: |
|---|
| 537 | Enables/Disables the BSC interrupt. |
|---|
| 538 | Description: |
|---|
| 539 | This function enables or disables the BSC transaction done interrupt. |
|---|
| 540 | Returns: |
|---|
| 541 | BERR_Code |
|---|
| 542 | ******************************************************************************/ |
|---|
| 543 | BERR_Code BVSB_3520_P_EnableBscInterrupt( |
|---|
| 544 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 545 | bool bEnable /* [in] true = enable the BSC interrupt */ |
|---|
| 546 | ); |
|---|
| 547 | |
|---|
| 548 | |
|---|
| 549 | /****************************************************************************** |
|---|
| 550 | Summary: |
|---|
| 551 | Sets certain BKNI_Events based on the source of the BCM3520 host interrupt. |
|---|
| 552 | Description: |
|---|
| 553 | This function reads and clears the BCM3520 interrupt status registers, |
|---|
| 554 | clears the enable mask of the interrupts, and sets BKNI_Events based on the |
|---|
| 555 | interrupt sources. |
|---|
| 556 | Returns: |
|---|
| 557 | BERR_Code |
|---|
| 558 | ******************************************************************************/ |
|---|
| 559 | BERR_Code BVSB_3520_P_DecodeInterrupt( |
|---|
| 560 | BVSB_Handle h /* [in] BVSB PI Handle */ |
|---|
| 561 | ); |
|---|
| 562 | |
|---|
| 563 | |
|---|
| 564 | /****************************************************************************** |
|---|
| 565 | Summary: |
|---|
| 566 | Initiates VSB acquisition on the BCM3520. |
|---|
| 567 | Description: |
|---|
| 568 | This function sends the Acquire_VSB HAB command to the AP. |
|---|
| 569 | Returns: |
|---|
| 570 | BERR_Code |
|---|
| 571 | ******************************************************************************/ |
|---|
| 572 | BERR_Code BVSB_3520_P_AcquireVsb( |
|---|
| 573 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 574 | const BVSB_InbandParams *pParams /* [in] inband acquisition parameters */ |
|---|
| 575 | ); |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | /****************************************************************************** |
|---|
| 579 | Summary: |
|---|
| 580 | Initiates QAM acquisition on the BCM3520. |
|---|
| 581 | Description: |
|---|
| 582 | This function sends the Acquire_QAM HAB command to the AP. |
|---|
| 583 | Returns: |
|---|
| 584 | BERR_Code |
|---|
| 585 | ******************************************************************************/ |
|---|
| 586 | BERR_Code BVSB_3520_P_AcquireQam( |
|---|
| 587 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 588 | const BVSB_InbandParams *pParams /* [in] inband acquisition parameters */ |
|---|
| 589 | ); |
|---|
| 590 | |
|---|
| 591 | |
|---|
| 592 | /****************************************************************************** |
|---|
| 593 | Summary: |
|---|
| 594 | Initiates NTSC acquisition on the BCM3520. |
|---|
| 595 | Description: |
|---|
| 596 | This function sends the Acquire_NTSC HAB command to the AP. |
|---|
| 597 | Returns: |
|---|
| 598 | BERR_Code |
|---|
| 599 | ******************************************************************************/ |
|---|
| 600 | BERR_Code BVSB_3520_P_AcquireNtsc( |
|---|
| 601 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 602 | const BVSB_InbandParams *pParams /* [in] inband acquisition parameters */ |
|---|
| 603 | ); |
|---|
| 604 | |
|---|
| 605 | |
|---|
| 606 | /****************************************************************************** |
|---|
| 607 | Summary: |
|---|
| 608 | Waits for a BVSB event. |
|---|
| 609 | Description: |
|---|
| 610 | This function waits for an interrupt within the given timeout period. Any |
|---|
| 611 | interrupts are then decoded via I2C. If the given event has been signaled, |
|---|
| 612 | then this function returns BERR_SUCCESS. |
|---|
| 613 | Returns: |
|---|
| 614 | BERR_Code |
|---|
| 615 | ******************************************************************************/ |
|---|
| 616 | BERR_Code BVSB_3520_P_WaitForEvent( |
|---|
| 617 | BVSB_Handle h, /* [in] BVSB PI Handle */ |
|---|
| 618 | BKNI_EventHandle hEvent, /* [in] event to wait on */ |
|---|
| 619 | int timeoutMsec /* [in] timeout in milliseconds */ |
|---|
| 620 | ); |
|---|
| 621 | |
|---|
| 622 | /* BCM3520 implementation of API functions */ |
|---|
| 623 | BERR_Code BVSB_3520_P_Open(BVSB_Handle *, BCHP_Handle, void*, BINT_Handle, const struct BVSB_Settings*); |
|---|
| 624 | BERR_Code BVSB_3520_P_Close(BVSB_Handle); |
|---|
| 625 | BERR_Code BVSB_3520_P_InitAp(BVSB_Handle, const uint8_t *); |
|---|
| 626 | BERR_Code BVSB_3520_P_GetApStatus(BVSB_Handle, BVSB_ApStatus*); |
|---|
| 627 | BERR_Code BVSB_3520_P_GetApVersion(BVSB_Handle, uint16_t*, uint16_t*, uint8_t*, uint8_t*, uint8_t*); |
|---|
| 628 | BERR_Code BVSB_3520_P_ReadRegister(BVSB_Handle, uint32_t, uint32_t*); |
|---|
| 629 | BERR_Code BVSB_3520_P_WriteRegister(BVSB_Handle, uint32_t, uint32_t*); |
|---|
| 630 | BERR_Code BVSB_3520_P_Mi2cWrite(BVSB_Handle, uint8_t, uint8_t*, uint8_t); |
|---|
| 631 | BERR_Code BVSB_3520_P_Mi2cRead(BVSB_Handle, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t); |
|---|
| 632 | BERR_Code BVSB_3520_P_AcquireInband(BVSB_Handle, const BVSB_InbandParams *); |
|---|
| 633 | BERR_Code BVSB_3520_P_GetVsbStatus(BVSB_Handle, BVSB_VsbStatus *); |
|---|
| 634 | BERR_Code BVSB_3520_P_GetQamStatus(BVSB_Handle, BVSB_QamStatus *); |
|---|
| 635 | BERR_Code BVSB_3520_P_GetNtscStatus(BVSB_Handle, BVSB_NtscStatus *); |
|---|
| 636 | BERR_Code BVSB_3520_P_ResetInbandStatus(BVSB_Handle); |
|---|
| 637 | BERR_Code BVSB_3520_P_AcquireOob(BVSB_Handle, const BVSB_OobParams *); |
|---|
| 638 | BERR_Code BVSB_3520_P_GetOobStatus(BVSB_Handle, BVSB_OobStatus *); |
|---|
| 639 | BERR_Code BVSB_3520_P_ResetOobStatus(BVSB_Handle); |
|---|
| 640 | BERR_Code BVSB_3520_P_ConfigBtsc(BVSB_Handle, BVSB_BtscSettings *); |
|---|
| 641 | BERR_Code BVSB_3520_P_SetBtscVolume(BVSB_Handle, uint8_t, uint8_t, bool); |
|---|
| 642 | BERR_Code BVSB_3520_P_GetBtscStatus(BVSB_Handle, BVSB_BtscStatus *); |
|---|
| 643 | BERR_Code BVSB_3520_P_SetInbandOi(BVSB_Handle, BVSB_InbandOiSettings *); |
|---|
| 644 | BERR_Code BVSB_3520_P_GetSoftDecisionBuf(BVSB_Handle, int16_t*, int16_t*); |
|---|
| 645 | BERR_Code BVSB_3520_P_GetOobSoftDecisionBuf(BVSB_Handle, int16_t*, int16_t*); |
|---|
| 646 | BERR_Code BVSB_3520_P_SetTmConfig(BVSB_Handle, void*); |
|---|
| 647 | BERR_Code BVSB_3520_P_GetTmConfig(BVSB_Handle, void*); |
|---|
| 648 | BERR_Code BVSB_3520_P_WriteConfig(BVSB_Handle, uint16_t, uint8_t*, uint8_t); |
|---|
| 649 | BERR_Code BVSB_3520_P_ReadConfig(BVSB_Handle, uint16_t, uint8_t*, uint8_t); |
|---|
| 650 | BERR_Code BVSB_3520_P_GetLockStateChangeEventHandle(BVSB_Handle, BKNI_EventHandle*); |
|---|
| 651 | BERR_Code BVSB_3520_P_GetOobLockStateChangeEventHandle(BVSB_Handle, BKNI_EventHandle*); |
|---|
| 652 | BERR_Code BVSB_3520_P_GetAntennaEventHandle(BVSB_Handle, BKNI_EventHandle*); |
|---|
| 653 | BERR_Code BVSB_3520_P_GetInterruptEventHandle(BVSB_Handle, BKNI_EventHandle*); |
|---|
| 654 | BERR_Code BVSB_3520_P_HandleInterrupt_isr(BVSB_Handle); |
|---|
| 655 | BERR_Code BVSB_3520_P_ProcessInterruptEvent(BVSB_Handle); |
|---|
| 656 | BERR_Code BVSB_3520_P_GetChipRevision(BVSB_Handle, uint8_t*); |
|---|
| 657 | BERR_Code BVSB_3520_P_SetInbandIfFreq(BVSB_Handle, uint32_t); |
|---|
| 658 | BERR_Code BVSB_3520_P_SetOobInterfaceControl(BVSB_Handle, BVSB_OobClockSuppression, BVSB_OobClock); |
|---|
| 659 | |
|---|
| 660 | #ifdef __cplusplus |
|---|
| 661 | } |
|---|
| 662 | #endif |
|---|
| 663 | |
|---|
| 664 | #endif /* BVSB_3520_P_PRIV_H__ */ |
|---|
| 665 | |
|---|