| 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: brfm.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/33 $ |
|---|
| 12 | * $brcm_Date: 1/14/11 10:41a $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/rfm/7038/brfm.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/33 1/14/11 10:41a jtna |
|---|
| 21 | * SW7550-660: initial code clean-up |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/32 10/25/10 12:27p jtna |
|---|
| 24 | * SW7420-972: add BRFM_Standby and Resume |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/31 3/24/10 3:07p jtna |
|---|
| 27 | * SW7405-4109: added BRFM_AudioEncoding_eStereoExtDeviation |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/30 1/25/08 11:24a jtna |
|---|
| 30 | * PR34667: Merge SIF & dualBTSC support |
|---|
| 31 | * |
|---|
| 32 | ***************************************************************************/ |
|---|
| 33 | |
|---|
| 34 | /*= Module Overview ************************************************************ |
|---|
| 35 | <verbatim> |
|---|
| 36 | |
|---|
| 37 | Overview |
|---|
| 38 | The RF Modulator (RFM) converts a NTSC/PAL compliant digital video source |
|---|
| 39 | and a Pulse Code Modulated (PCM) audio source into an analog composite |
|---|
| 40 | television signal which is suitable for demodulation by a television |
|---|
| 41 | demodulator. The digital video source (video input into RFM) is assumed |
|---|
| 42 | to come from Video Encoder (VEC) core. The PCM audio source |
|---|
| 43 | (audio input into RFM) is assumed to come from HiFiDAC core. |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | Design |
|---|
| 47 | The design for BRFM PI API is broken into two parts. |
|---|
| 48 | |
|---|
| 49 | o Part 1 (open/close/configuration): |
|---|
| 50 | |
|---|
| 51 | These APIs are used for opening and closing BRFM device/device channel. |
|---|
| 52 | When a device/device channel is opened, the device/device channel can be |
|---|
| 53 | configured. |
|---|
| 54 | |
|---|
| 55 | o Part 2 (get/set): |
|---|
| 56 | |
|---|
| 57 | These APIs are used for getting and setting runtime attributes of BRFM. |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | Usage |
|---|
| 61 | The usage of BRFM involves the following: |
|---|
| 62 | |
|---|
| 63 | * Configure/Open of BRFM |
|---|
| 64 | |
|---|
| 65 | * Configure BRFM device for the target system |
|---|
| 66 | * Open BRFM device |
|---|
| 67 | |
|---|
| 68 | * Program device channel |
|---|
| 69 | |
|---|
| 70 | * Program output channel |
|---|
| 71 | * Program output modulation type |
|---|
| 72 | * Program enable output |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | Interrupt Requirements |
|---|
| 76 | This module requires L2 interrupts. They are handled internally |
|---|
| 77 | by the RFM PI. |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | Sample Code |
|---|
| 81 | |
|---|
| 82 | // |
|---|
| 83 | // NOTE: The following sample code does not do any error checking. |
|---|
| 84 | // |
|---|
| 85 | // In this example, the target H/W board is configured for NTSC application. |
|---|
| 86 | // |
|---|
| 87 | static BRFM_Handle hRfmDev; |
|---|
| 88 | static BCHP_Handle hChip7038; |
|---|
| 89 | static BREG_Handle hReg7038; |
|---|
| 90 | static BINT_Handle hInt7038; |
|---|
| 91 | |
|---|
| 92 | main( void ) |
|---|
| 93 | { |
|---|
| 94 | BRFM_Settings rfmDevSettings; |
|---|
| 95 | |
|---|
| 96 | // Initialize hChip7038, hReg7038, and hInt7038... |
|---|
| 97 | |
|---|
| 98 | // ************************************************************************* |
|---|
| 99 | // Start of H/W board specific configuration for BRFM |
|---|
| 100 | // ************************************************************************* |
|---|
| 101 | |
|---|
| 102 | // Configure BRFM Device |
|---|
| 103 | BRFM_GetDefaultSettings(&rfmDevSettings, hChip7038); |
|---|
| 104 | rfmDevSettings.audioEncoding = BRFM_AudioEncoding_eStereo; |
|---|
| 105 | |
|---|
| 106 | // Open BRFM Device |
|---|
| 107 | BRFM_Open(hRfmDev, hChip7038, hReg7038, hInt7038, &rfmDevSettings); |
|---|
| 108 | |
|---|
| 109 | // ************************************************************************* |
|---|
| 110 | // End of H/W board specific configuration for BRFM |
|---|
| 111 | // ************************************************************************* |
|---|
| 112 | |
|---|
| 113 | // Setup Rf Modulator to use Channel 3 and NTSC Open Cable modulation |
|---|
| 114 | BRFM_SetModulationType(hRfmDev, BRFM_ModulationType_eNtscOpenCable, BRFM_OutputChannel_eCh3); |
|---|
| 115 | |
|---|
| 116 | while(1) |
|---|
| 117 | { |
|---|
| 118 | BRFM_Status status; |
|---|
| 119 | |
|---|
| 120 | // Check status every 5 seconds |
|---|
| 121 | BKNI_Sleep(5000); |
|---|
| 122 | BRFM_GetStatus(hRfmDev, &status); |
|---|
| 123 | printf(" OutputChannel=%d, mute=%d\n", status.outputChannel+3, status.mute); |
|---|
| 124 | printf(" rfmStatusSignals=%08x\n", status.rfmStatusSignals); |
|---|
| 125 | } |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | </verbatim> |
|---|
| 129 | *******************************************************************************/ |
|---|
| 130 | |
|---|
| 131 | #ifndef BRFM_H__ |
|---|
| 132 | #define BRFM_H__ |
|---|
| 133 | |
|---|
| 134 | #include "bchp.h" |
|---|
| 135 | #include "breg_mem.h" |
|---|
| 136 | #include "bint.h" |
|---|
| 137 | #include "bkni.h" |
|---|
| 138 | #include "berr_ids.h" |
|---|
| 139 | |
|---|
| 140 | #ifdef __cplusplus |
|---|
| 141 | extern "C" { |
|---|
| 142 | #endif |
|---|
| 143 | |
|---|
| 144 | /******************************************************************************* |
|---|
| 145 | Summary: |
|---|
| 146 | Error Codes specific to BRFM |
|---|
| 147 | *******************************************************************************/ |
|---|
| 148 | #define BRFM_ERR_VOLUME_RANGE BERR_MAKE_CODE(BERR_RFM_ID, 0) |
|---|
| 149 | #define BRFM_ERR_CARR_AMPL_RANGE BERR_MAKE_CODE(BERR_RFM_ID, 0) |
|---|
| 150 | |
|---|
| 151 | /******************************************************************************* |
|---|
| 152 | Summary: |
|---|
| 153 | Max and Min amplitude for NICAM carrier |
|---|
| 154 | *******************************************************************************/ |
|---|
| 155 | #define BRFM_NICAM_CARR_AMPL_MAX BRFM_NicamCarrierAmpl_eNeg13p5 |
|---|
| 156 | #define BRFM_NICAM_CARR_AMPL_MIN BRFM_NicamCarrierAmpl_eNeg37p0 |
|---|
| 157 | |
|---|
| 158 | /******************************************************************************* |
|---|
| 159 | Summary: |
|---|
| 160 | The handles for Rf Modulator module. |
|---|
| 161 | |
|---|
| 162 | Description: |
|---|
| 163 | An opaque handle for BRFM device. |
|---|
| 164 | |
|---|
| 165 | See Also: |
|---|
| 166 | BRFM_Open() |
|---|
| 167 | *******************************************************************************/ |
|---|
| 168 | typedef struct BRFM_P_Handle *BRFM_Handle; |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | /******************************************************************************* |
|---|
| 172 | Summary: |
|---|
| 173 | Enumeration for Rf Modulator audio/video output channel. |
|---|
| 174 | |
|---|
| 175 | Description: |
|---|
| 176 | This enumeration defines the output channel (Ch. 3 or Ch. 4). |
|---|
| 177 | |
|---|
| 178 | See Also: |
|---|
| 179 | BRFM_SetModulationType(), BRFM_GetStatus() |
|---|
| 180 | *******************************************************************************/ |
|---|
| 181 | typedef enum BRFM_OutputChannel |
|---|
| 182 | { |
|---|
| 183 | /* Do not change the order of this enumeration; tables are dependent on this order */ |
|---|
| 184 | BRFM_OutputChannel_eBaseband, /* Baseband bypass, BTSC routed to baseband output. Baseband audio only */ |
|---|
| 185 | BRFM_OutputChannel_eCh3, /* Channel 3 */ |
|---|
| 186 | BRFM_OutputChannel_eCh4, /* Channel 4 */ |
|---|
| 187 | BRFM_OutputChannel_eSIF, /* Sound Intermediate Frequency mode. Frequency modulated audio only */ |
|---|
| 188 | BRFM_OutputChannel_eLast |
|---|
| 189 | } BRFM_OutputChannel; |
|---|
| 190 | |
|---|
| 191 | /******************************************************************************* |
|---|
| 192 | Summary: |
|---|
| 193 | Enumeration for output modulation type. |
|---|
| 194 | |
|---|
| 195 | Description: |
|---|
| 196 | This enumeration defines the modulation type, not all are supported. |
|---|
| 197 | |
|---|
| 198 | The following information is from "Video Demystified Third Edition" |
|---|
| 199 | |
|---|
| 200 | NSTC by countries: |
|---|
| 201 | The following countries use the (M) NTSC standard. |
|---|
| 202 | Antigua Japan (NTSCJ, color-space conversion is different) |
|---|
| 203 | Aruba South Korea |
|---|
| 204 | Bahamas Mexico |
|---|
| 205 | Barbados Montserrat |
|---|
| 206 | Belize Myanmar |
|---|
| 207 | Bermuda Nicaragua |
|---|
| 208 | Bolivia Panama |
|---|
| 209 | Canada Peru |
|---|
| 210 | Chile Philippines |
|---|
| 211 | Colombia Puerto Rico |
|---|
| 212 | Costa Rica St. Kitts and Nevis |
|---|
| 213 | Cuba Samoa |
|---|
| 214 | Curacao Suriname |
|---|
| 215 | Taiwan Dominican Republic |
|---|
| 216 | Ecuador Trinidad/Tobago |
|---|
| 217 | El Salvador United States of America |
|---|
| 218 | Guatemala Venezuela |
|---|
| 219 | Honduras Virgin Islands |
|---|
| 220 | Guam Jamaica |
|---|
| 221 | |
|---|
| 222 | PAL by countries: |
|---|
| 223 | The following countries use the (N) PAL standard. Note that Argentina |
|---|
| 224 | uses a modified PAL standard, called N C . |
|---|
| 225 | Argentina Paraguay |
|---|
| 226 | Aryenuna Uruguay |
|---|
| 227 | The following countries use the (M) PAL standard. |
|---|
| 228 | Brazil |
|---|
| 229 | The following countries use the (B) PAL standard. |
|---|
| 230 | Australia Indonesia |
|---|
| 231 | Bangladesh Maldives |
|---|
| 232 | Belgium Malta |
|---|
| 233 | Nigeria Brunei Darussalam |
|---|
| 234 | Estonia Rwandese Republic |
|---|
| 235 | Ghana Sao Tome & Principe |
|---|
| 236 | India Seychelles |
|---|
| 237 | The following countries use the (G) PAL standard. |
|---|
| 238 | Hungary Zambia |
|---|
| 239 | Mozambique Zimbabwe |
|---|
| 240 | Romania |
|---|
| 241 | The following countries use the (D) PAL standard. |
|---|
| 242 | China Latvia |
|---|
| 243 | Czech Republic Poland |
|---|
| 244 | Hungary Romania |
|---|
| 245 | North Korea |
|---|
| 246 | The following countries use the (I) PAL standard. |
|---|
| 247 | Angola Malawi |
|---|
| 248 | Botswana Namibia |
|---|
| 249 | China Nigeria |
|---|
| 250 | Gambia South Africa |
|---|
| 251 | Guinea-Bissau Tanzania |
|---|
| 252 | Ireland United Kingdom |
|---|
| 253 | Lesotho Zanzibar |
|---|
| 254 | Macau |
|---|
| 255 | The following countries use the (B) and (G) PAL standards. |
|---|
| 256 | Albania Kenya |
|---|
| 257 | Algeria Kuwait |
|---|
| 258 | Austria Liberia |
|---|
| 259 | Bahrain Libya |
|---|
| 260 | Cambodia Lithuania |
|---|
| 261 | Cameroon Luxembourg |
|---|
| 262 | Croatia Malaysia |
|---|
| 263 | Cyprus Netherlands |
|---|
| 264 | Denmark New Zealand |
|---|
| 265 | Egypt Norway |
|---|
| 266 | Equatorial Guinea Oman |
|---|
| 267 | Ethiopia Pakistan |
|---|
| 268 | Finland Papua New Guinea |
|---|
| 269 | Germany Portugal |
|---|
| 270 | Iceland Qatar |
|---|
| 271 | Israel Sierra Leone |
|---|
| 272 | Italy Singapore |
|---|
| 273 | Jordan Slovenia |
|---|
| 274 | Somalia Syria |
|---|
| 275 | Spain Thailand |
|---|
| 276 | Sri Lanka Turkey |
|---|
| 277 | Sudan Yemen |
|---|
| 278 | Sweden Yugoslavia |
|---|
| 279 | Switzerland |
|---|
| 280 | The following countries use the (H) PAL standard. |
|---|
| 281 | Belgium |
|---|
| 282 | |
|---|
| 283 | SECAM by countries: |
|---|
| 284 | The following countries use the (B) and (G) SECAM standards. |
|---|
| 285 | Greece Mauritius |
|---|
| 286 | Iran Morocco |
|---|
| 287 | Iraq Saudi Arabia |
|---|
| 288 | Lebanon Tunisia |
|---|
| 289 | Mali |
|---|
| 290 | The following countries use the (D) and (K) SECAM standards. |
|---|
| 291 | Azerbaijan Lithuania |
|---|
| 292 | Belarus Moldova |
|---|
| 293 | Bulgaria Russia |
|---|
| 294 | Georgia Ukraine |
|---|
| 295 | Kazakhstan VietNam |
|---|
| 296 | Latvia |
|---|
| 297 | The following countries use the (B) SECAM standard. |
|---|
| 298 | Mauritania Djibouti |
|---|
| 299 | The following countries use the (D) SECAM standard. |
|---|
| 300 | Afghanistan Mongolia |
|---|
| 301 | |
|---|
| 302 | See Also: |
|---|
| 303 | BRFM_SetModulationType(), BRFM_GetStatus() |
|---|
| 304 | *******************************************************************************/ |
|---|
| 305 | typedef enum BRFM_ModulationType |
|---|
| 306 | { |
|---|
| 307 | /* Do not change the order of this enumeration; tables are dependent on this order */ |
|---|
| 308 | BRFM_ModulationType_eNtscCustom = 0, /* Not supported */ |
|---|
| 309 | BRFM_ModulationType_ePalCustom = 1, /* Not supported */ |
|---|
| 310 | BRFM_ModulationType_eNtscOpenCable = 10, /* Supported */ |
|---|
| 311 | |
|---|
| 312 | BRFM_ModulationType_eSecamBG = 30, /* Not supported */ |
|---|
| 313 | BRFM_ModulationType_eSecamDK = 31, /* Not supported */ |
|---|
| 314 | BRFM_ModulationType_eSecamK1 = 32, /* Not supported */ |
|---|
| 315 | |
|---|
| 316 | BRFM_ModulationType_ePalBG = 40, /* Supported */ |
|---|
| 317 | BRFM_ModulationType_ePalD = 41, /* Supported */ |
|---|
| 318 | BRFM_ModulationType_ePalH = 42, /* Not supported */ |
|---|
| 319 | BRFM_ModulationType_ePalI = 43, /* Supported, but only in baseband */ |
|---|
| 320 | BRFM_ModulationType_ePalM = 44, /* Supported */ |
|---|
| 321 | BRFM_ModulationType_ePalN = 45, /* Supported */ |
|---|
| 322 | BRFM_ModulationType_ePalDChina = 46 /* Supported */ |
|---|
| 323 | } BRFM_ModulationType; |
|---|
| 324 | |
|---|
| 325 | /******************************************************************************* |
|---|
| 326 | Summary: |
|---|
| 327 | Enumeration for Rf Modulator audio encoding. |
|---|
| 328 | |
|---|
| 329 | Description: |
|---|
| 330 | This enumeration defines the audio encoding. |
|---|
| 331 | Audio encoding supports BTSC analog standard. BTSC analog standard |
|---|
| 332 | contains three BTSC variations: BTSC-USA, BTSC-EIA-J, and BTSC-Zweiton-M. |
|---|
| 333 | Rf Modulator only support BTSC-USA. Countries that use BTSC USA |
|---|
| 334 | standard are: United States, Canada, Mexico, Brazil, and Taiwan. |
|---|
| 335 | BTSC-EIA-J is used in Japan, BTSC-Zweiton-M is used in South Korea. |
|---|
| 336 | |
|---|
| 337 | Pal audio encoding only support mono. |
|---|
| 338 | |
|---|
| 339 | The following table highlighting the recommend settings for Rfm based on |
|---|
| 340 | inputs into the Rfm. |
|---|
| 341 | |
|---|
| 342 | |
|---|
| 343 | BTSC Rfm Audio Rfm Rfm Audio |
|---|
| 344 | Input Signal Decoder Input Ch. Mode of Output Spectrum |
|---|
| 345 | Standard Type Mode A B Operation L+R L-R SAP |
|---|
| 346 | ---------------------------------------------------------------------------------- |
|---|
| 347 | NTSC-USA Digital Don't Care L R Stereo L+R L-R |
|---|
| 348 | NTSC-USA Analog Stereo L R Stereo L+R L-R |
|---|
| 349 | NTSC-USA Analog Mono L+R L+R Mono L+R |
|---|
| 350 | ***NTSC-USA Analog Mono+SAP L+R SAP Sap and Mono L+R SAP |
|---|
| 351 | NTSC-USA Analog SAP Only SAP SAP Sap SAP |
|---|
| 352 | |
|---|
| 353 | NTSC-Japan Digital Don't Care L R Japanese Mono2 L+R |
|---|
| 354 | NTSC-Japan Analog Stereo L R Japanese Mono2 L+R |
|---|
| 355 | NTSC-Japan Analog Main main main Japanese Mono1 main |
|---|
| 356 | NTSC-Japan Analog Main Sub main sub Japanese Mono1 main |
|---|
| 357 | NTSC-Japan Analog Sub sub sub Japanese Mono1 sub |
|---|
| 358 | |
|---|
| 359 | PAL Digital Don't Care L R Mono L+R |
|---|
| 360 | PAL Analog Mono L+R L+R Mono L+R |
|---|
| 361 | |
|---|
| 362 | Rfm Mono Audio Encoding uses: |
|---|
| 363 | 75us, 25kHz: NTSC-USA and NTSC-Japan |
|---|
| 364 | 50us, 50kHz: PAL |
|---|
| 365 | |
|---|
| 366 | ====================== Application Notes ================================== |
|---|
| 367 | *** Note:It is recommended NOT to use Mono+SAP mode of BTSC Decoder. |
|---|
| 368 | From a STB System point-of-view, Mono+SAP mode can cause problems. If you |
|---|
| 369 | use Mono+SAP mode, the STB System software must make sure to route either |
|---|
| 370 | main audio program (Mono component) or secondary audio program (SAP component) |
|---|
| 371 | to the audio DAC. Only one of the audio program can be routed to audio DAC, |
|---|
| 372 | otherwise the output on the audio DAC will be unpredictable. If you do use |
|---|
| 373 | Mono+SAP mode, which we don't recommend, then Rfm should be set to |
|---|
| 374 | BRFM_AudioEncoding_eSapMono. |
|---|
| 375 | -------------------- For NTSC-USA applications: --------------------------- |
|---|
| 376 | We recommend keeping Rfm Audio Encoding in BRFM_AudioEncoding_eStereo mode |
|---|
| 377 | for NTSC-USA applications. In this mode, Rfm output would work for |
|---|
| 378 | Digital Signal and Analog Signal (BTSC Stereo, BTSC Mono, BTSC SAP only). |
|---|
| 379 | -------------------- For NTSC-Japan applications: -------------------------- |
|---|
| 380 | We recommend keeping Rfm Audio Encoding in BRFM_AudioEncoding_eJpMono2 mode. |
|---|
| 381 | -------------------- For PAL applications: --------------------------------- |
|---|
| 382 | We recommend keeping Rfm Audio Encoding in BRFM_AudioEncoding_eMono mode. |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | BTSC_CTRL0_ BAUD BTSC BRFM BTSC |
|---|
| 386 | BASIC_CTRL Decoder Setting Encoder Setting |
|---|
| 387 | --------------------------------------------------------------------------- |
|---|
| 388 | [18:16]=0 BAUD_BTSC_USOutputMode_eMono BRFM_AudioEncoding_eMono |
|---|
| 389 | [18:16]=1 BAUD_BTSC_USOutputMode_eStereo BRFM_AudioEncoding_eStereo |
|---|
| 390 | [18:16]=6 BAUD_BTSC_USOutputMode_eSap BRFM_AudioEncoding_eSap |
|---|
| 391 | [18:16]=7 BAUD_BTSC_USOutputMode_eSapMono BRFM_AudioEncoding_eSapMono |
|---|
| 392 | [15:14]=0 BAUD_BTSC_JpOutputMode_eMain BRFM_AudioEncoding_eJpMono1 |
|---|
| 393 | [15:14]=1 BAUD_BTSC_JpOutputMode_eStereo BRFM_AudioEncoding_eJpMono2 |
|---|
| 394 | [15:14]=2 BAUD_BTSC_JpOutputMode_eSub BRFM_AudioEncoding_eJpMono1 |
|---|
| 395 | [15:14]=3 BAUD_BTSC_JpOutputMode_eMainSub BRFM_AudioEncoding_eJpMono1 |
|---|
| 396 | |
|---|
| 397 | |
|---|
| 398 | See Also: |
|---|
| 399 | BRFM_SetAudioEncoding(), BRFM_GetStatus() |
|---|
| 400 | *******************************************************************************/ |
|---|
| 401 | typedef enum BRFM_AudioEncoding |
|---|
| 402 | { |
|---|
| 403 | /* Do not change the order of this enumeration; tables are dependent on this order |
|---|
| 404 | Note that Nicam audio encoding modes are not supported for 97038 and 97401 platforms */ |
|---|
| 405 | BRFM_AudioEncoding_eMono, /* Monaural transmission of 2nd audio channel */ |
|---|
| 406 | BRFM_AudioEncoding_eStereo, /* BTSC stereo encoding & transmission of 2nd audio channel */ |
|---|
| 407 | BRFM_AudioEncoding_eStereoExtDeviation, /* BTSC stereo with extended deviation */ |
|---|
| 408 | BRFM_AudioEncoding_eSap, /* BTSC SAP encoding, see above for more details */ |
|---|
| 409 | BRFM_AudioEncoding_eSapMono, /* Mono and BTSC SAP encoding, see above for more details */ |
|---|
| 410 | BRFM_AudioEncoding_eJpMono1, /* Japanese Mono1, see above for more details */ |
|---|
| 411 | BRFM_AudioEncoding_eJpMono2, /* Japanese Mono2, see above for more details */ |
|---|
| 412 | BRFM_AudioEncoding_eNicamStereo, /* NICAM Stereo encoding */ |
|---|
| 413 | BRFM_AudioEncoding_eNicamDualMono, /* NICAM Dual Mono encoding mode */ |
|---|
| 414 | BRFM_AudioEncoding_eNicamMono, /* NICAM Mono encoding mode */ |
|---|
| 415 | BRFM_AudioEncoding_eLast |
|---|
| 416 | } BRFM_AudioEncoding; |
|---|
| 417 | |
|---|
| 418 | /******************************************************************************* |
|---|
| 419 | Summary: |
|---|
| 420 | Enumeration for BTSC encoder type |
|---|
| 421 | |
|---|
| 422 | Description: |
|---|
| 423 | This enumeration defines the two encoder types that can be used. |
|---|
| 424 | *******************************************************************************/ |
|---|
| 425 | typedef enum BRFM_EncoderType |
|---|
| 426 | { |
|---|
| 427 | BRFM_EncoderType_singleBTSC, /* First BTSC-encoder */ |
|---|
| 428 | BRFM_EncoderType_dualBTSC /* Second BTSC-encoder for dual RFM encoder chips. |
|---|
| 429 | Only supports baseband and SIF audio, no NICAM support */ |
|---|
| 430 | } BRFM_EncoderType; |
|---|
| 431 | |
|---|
| 432 | /******************************************************************************* |
|---|
| 433 | Summary: |
|---|
| 434 | Enumeration for NICAM carrier amplitude level |
|---|
| 435 | |
|---|
| 436 | Description: |
|---|
| 437 | This enumeration defines the different amplitudes that can be used to set NICAM |
|---|
| 438 | carrier levels. |
|---|
| 439 | |
|---|
| 440 | See Also: |
|---|
| 441 | BRFM_SetNicamCarrierLevel(), BRFM_GetStatus() |
|---|
| 442 | *******************************************************************************/ |
|---|
| 443 | typedef enum BRFM_NicamCarrierAmpl |
|---|
| 444 | { |
|---|
| 445 | BRFM_NicamCarrierAmpl_eNeg37p0 = 1, |
|---|
| 446 | BRFM_NicamCarrierAmpl_eNeg31p0, |
|---|
| 447 | BRFM_NicamCarrierAmpl_eNeg27p5, |
|---|
| 448 | BRFM_NicamCarrierAmpl_eNeg25p0, |
|---|
| 449 | BRFM_NicamCarrierAmpl_eNeg23p0, |
|---|
| 450 | BRFM_NicamCarrierAmpl_eNeg21p5, |
|---|
| 451 | BRFM_NicamCarrierAmpl_eNeg20p0, |
|---|
| 452 | BRFM_NicamCarrierAmpl_eNeg19p0, |
|---|
| 453 | BRFM_NicamCarrierAmpl_eNeg18p0, |
|---|
| 454 | BRFM_NicamCarrierAmpl_eNeg17p0, |
|---|
| 455 | BRFM_NicamCarrierAmpl_eNeg16p0, |
|---|
| 456 | BRFM_NicamCarrierAmpl_eNeg15p5, |
|---|
| 457 | BRFM_NicamCarrierAmpl_eNeg14p5, |
|---|
| 458 | BRFM_NicamCarrierAmpl_eNeg14p0, |
|---|
| 459 | BRFM_NicamCarrierAmpl_eNeg13p5 |
|---|
| 460 | } BRFM_NicamCarrierAmpl; |
|---|
| 461 | |
|---|
| 462 | /******************************************************************************* |
|---|
| 463 | Summary: |
|---|
| 464 | This structure represents the RFM Status for a Rf Modulator module. |
|---|
| 465 | |
|---|
| 466 | Description: |
|---|
| 467 | This structure is returned when BRFM_GetStatus() is called. This |
|---|
| 468 | structure contains the complete status of Rf Modulator module. |
|---|
| 469 | |
|---|
| 470 | See Also: |
|---|
| 471 | BRFM_GetStatus() |
|---|
| 472 | *******************************************************************************/ |
|---|
| 473 | typedef struct BRFM_Status |
|---|
| 474 | { |
|---|
| 475 | BRFM_OutputChannel outputChannel; /* Output Channel number */ |
|---|
| 476 | BRFM_ModulationType modType; /* Modulation Type */ |
|---|
| 477 | BRFM_AudioEncoding audioEncoding; /* Audio Encoding mode */ |
|---|
| 478 | bool isMuteEnable; /* Enable=1, Disable=0 */ |
|---|
| 479 | bool isOutputEnable; /* Enable=1, Disable=0 */ |
|---|
| 480 | bool isPowerSaverEnable; /* Enable=1, Disable=0 */ |
|---|
| 481 | int volume; /* in 1 dB steps */ |
|---|
| 482 | uint32_t rfmStatusSignals; |
|---|
| 483 | } BRFM_Status; |
|---|
| 484 | |
|---|
| 485 | /******************************************************************************* |
|---|
| 486 | Summary: |
|---|
| 487 | Required default settings structure for Rf Modulator module. |
|---|
| 488 | |
|---|
| 489 | Description: |
|---|
| 490 | The default setting structure defines the default configuration of |
|---|
| 491 | Rf Modulator when the device is opened. |
|---|
| 492 | |
|---|
| 493 | See Also: |
|---|
| 494 | BRFM_Open() |
|---|
| 495 | *******************************************************************************/ |
|---|
| 496 | #define BRFM_SETTINGS_MODTYPE (BRFM_ModulationType_eNtscOpenCable) |
|---|
| 497 | #define BRFM_SETTINGS_CHNBR (BRFM_OutputChannel_eCh3) |
|---|
| 498 | #define BRFM_SETTINGS_AUDIOENCODING (BRFM_AudioEncoding_eStereo) |
|---|
| 499 | #if (BCHP_CHIP==7038) |
|---|
| 500 | #define BRFM_SETTINGS_VOLUME (18) |
|---|
| 501 | #else |
|---|
| 502 | #define BRFM_SETTINGS_VOLUME (6) |
|---|
| 503 | #endif |
|---|
| 504 | #define BRFM_SETTINGS_ENCTYPE (BRFM_EncoderType_singleBTSC) |
|---|
| 505 | |
|---|
| 506 | typedef struct BRFM_Settings |
|---|
| 507 | { |
|---|
| 508 | BRFM_ModulationType modType; /* Modulation Type */ |
|---|
| 509 | BRFM_OutputChannel chNbr; /* Channel number to use */ |
|---|
| 510 | BRFM_AudioEncoding audioEncoding; /* Audio Encoding mode */ |
|---|
| 511 | int volume; /* in 1 dB steps */ |
|---|
| 512 | BRFM_EncoderType encType; /* Encoder type (first or second BTSC encoder) */ |
|---|
| 513 | } BRFM_Settings; |
|---|
| 514 | |
|---|
| 515 | /******************************************************************************* |
|---|
| 516 | Summary: |
|---|
| 517 | This function opens Rf Modulator module. |
|---|
| 518 | |
|---|
| 519 | Description: |
|---|
| 520 | This function is responsible for opening BRFM module. When BRFM is |
|---|
| 521 | opened, it will create a module handle and configure the module based |
|---|
| 522 | on the default settings. Once the device is opened, it must be closed |
|---|
| 523 | before it can be opened again. |
|---|
| 524 | |
|---|
| 525 | See Also: |
|---|
| 526 | BRFM_Close(), BRFM_GetDefaultSettings() |
|---|
| 527 | *******************************************************************************/ |
|---|
| 528 | BERR_Code BRFM_Open( |
|---|
| 529 | BRFM_Handle *phRfm, /* [out] Returns handle */ |
|---|
| 530 | BCHP_Handle hChip, /* [in] Chip handle */ |
|---|
| 531 | BREG_Handle hRegister, /* [in] Register handle */ |
|---|
| 532 | BINT_Handle hInterrupt, /* [in] Interrupt handle */ |
|---|
| 533 | const BRFM_Settings *pDefSettings /* [in] Default settings */ |
|---|
| 534 | ); |
|---|
| 535 | |
|---|
| 536 | /******************************************************************************* |
|---|
| 537 | Summary: |
|---|
| 538 | This function closes Rf Modulator module. |
|---|
| 539 | |
|---|
| 540 | Description: |
|---|
| 541 | This function is responsible for closing BRFM module. Closing BRFM |
|---|
| 542 | will free BRFM handle. |
|---|
| 543 | |
|---|
| 544 | See Also: |
|---|
| 545 | BRFM_Open() |
|---|
| 546 | *******************************************************************************/ |
|---|
| 547 | BERR_Code BRFM_Close( |
|---|
| 548 | BRFM_Handle hDev /* [in] Device handle */ |
|---|
| 549 | ); |
|---|
| 550 | |
|---|
| 551 | /******************************************************************************* |
|---|
| 552 | Summary: |
|---|
| 553 | This function returns the default settings for Rf Modulator module. |
|---|
| 554 | |
|---|
| 555 | Description: |
|---|
| 556 | This function is responsible for returning the default setting for |
|---|
| 557 | BRFM module. The returning default setting should be when |
|---|
| 558 | opening the device. |
|---|
| 559 | |
|---|
| 560 | See Also: |
|---|
| 561 | BRFM_Open() |
|---|
| 562 | *******************************************************************************/ |
|---|
| 563 | BERR_Code BRFM_GetDefaultSettings( |
|---|
| 564 | BRFM_Settings *pDefSettings, /* [out] Returns default setting */ |
|---|
| 565 | BCHP_Handle hChip /* [in] Chip handle */ |
|---|
| 566 | ); |
|---|
| 567 | |
|---|
| 568 | /******************************************************************************* |
|---|
| 569 | Summary: |
|---|
| 570 | This function enables output of Rf Modulator module. |
|---|
| 571 | |
|---|
| 572 | Description: |
|---|
| 573 | This function is responsible for enabling the Rf Modulator. Enabling |
|---|
| 574 | the output will using the current setting, such as modulation type, |
|---|
| 575 | output channel, etc. |
|---|
| 576 | |
|---|
| 577 | See Also: |
|---|
| 578 | BRFM_DisableRfOutput() |
|---|
| 579 | *******************************************************************************/ |
|---|
| 580 | BERR_Code BRFM_EnableRfOutput( |
|---|
| 581 | BRFM_Handle hDev /* [in] Device handle */ |
|---|
| 582 | ); |
|---|
| 583 | |
|---|
| 584 | /******************************************************************************* |
|---|
| 585 | Summary: |
|---|
| 586 | This function disables output of Rf Modulator module. |
|---|
| 587 | |
|---|
| 588 | Description: |
|---|
| 589 | This function is responsible for disabling the Rf Modulator. Disabling |
|---|
| 590 | the output will shutdown Rf output of the Rf Modulator. |
|---|
| 591 | |
|---|
| 592 | Calling this function will disable the Rf output, disabling both |
|---|
| 593 | video and audio outputs. |
|---|
| 594 | |
|---|
| 595 | See Also: |
|---|
| 596 | BRFM_EnableRfOutput() |
|---|
| 597 | *******************************************************************************/ |
|---|
| 598 | BERR_Code BRFM_DisableRfOutput( |
|---|
| 599 | BRFM_Handle hDev /* [in] Device handle */ |
|---|
| 600 | ); |
|---|
| 601 | |
|---|
| 602 | /******************************************************************************* |
|---|
| 603 | Summary: |
|---|
| 604 | This function sets the current audio output volume of Rf Modulator |
|---|
| 605 | module. |
|---|
| 606 | |
|---|
| 607 | Description: |
|---|
| 608 | This function is responsible for setting the current audio output |
|---|
| 609 | volume of BRFM module. Volume changes are adjusted using a ramping |
|---|
| 610 | function. |
|---|
| 611 | |
|---|
| 612 | Note: Volume setting is relative to the audio source, therefore |
|---|
| 613 | the 0 dB setting is 0 dB from the audio source. Audio source |
|---|
| 614 | for BRFM comes from HiFiDAC core. |
|---|
| 615 | |
|---|
| 616 | See Also: |
|---|
| 617 | BRFM_GetStatus(), BRFM_SetAudioMute() |
|---|
| 618 | *******************************************************************************/ |
|---|
| 619 | BERR_Code BRFM_SetAudioVolume( |
|---|
| 620 | BRFM_Handle hDev, /* [in] Device handle */ |
|---|
| 621 | int volume /* [in] Requested audio volume, in 1 dB steps */ |
|---|
| 622 | ); |
|---|
| 623 | |
|---|
| 624 | /******************************************************************************* |
|---|
| 625 | Summary: |
|---|
| 626 | This function sets the current audio mute mode of Rf Modulator module. |
|---|
| 627 | |
|---|
| 628 | Description: |
|---|
| 629 | This function is responsible for setting the current audio mute mode |
|---|
| 630 | BRFM module. Mute changes are adjusted using a ramping function. |
|---|
| 631 | |
|---|
| 632 | See Also: |
|---|
| 633 | BRFM_GetStatus() |
|---|
| 634 | *******************************************************************************/ |
|---|
| 635 | BERR_Code BRFM_SetAudioMute( |
|---|
| 636 | BRFM_Handle hDev, /* [in] Device handle */ |
|---|
| 637 | bool mute /* [in] 0=disable mute, 1=enable mute */ |
|---|
| 638 | ); |
|---|
| 639 | |
|---|
| 640 | /******************************************************************************* |
|---|
| 641 | Summary: |
|---|
| 642 | This function sets the current audio encoding of Rf Modulator module. |
|---|
| 643 | |
|---|
| 644 | Description: |
|---|
| 645 | This function is responsible for setting the current audio encoding mode |
|---|
| 646 | BRFM module. The selected encoding mode should match the source of |
|---|
| 647 | audio channel. If the audio source to Rf Modulator is outputting |
|---|
| 648 | Stereo, then Rf Modulator audio encoding should also be set to Stereo. |
|---|
| 649 | Please BRFM_AudioEncoding description for a more detail discussion |
|---|
| 650 | regarding audio input and output. |
|---|
| 651 | |
|---|
| 652 | See Also: |
|---|
| 653 | BRFM_GetStatus(), BRFM_AudioEncoding. |
|---|
| 654 | *******************************************************************************/ |
|---|
| 655 | BERR_Code BRFM_SetAudioEncoding( |
|---|
| 656 | BRFM_Handle hDev, /* [in] Device handle */ |
|---|
| 657 | BRFM_AudioEncoding audioEncoding /* [in] Requested audio encoding */ |
|---|
| 658 | ); |
|---|
| 659 | |
|---|
| 660 | /******************************************************************************* |
|---|
| 661 | Summary: |
|---|
| 662 | This function sets the current modulation type of Rf Modulator module. |
|---|
| 663 | |
|---|
| 664 | Description: |
|---|
| 665 | This function is responsible for setting the current modulation type of |
|---|
| 666 | BRFM module. When setting the modulation type, one must also provide the |
|---|
| 667 | channel number to use. |
|---|
| 668 | |
|---|
| 669 | NOTE: If BRFM output is disabled, this function will enable BRFM output. |
|---|
| 670 | |
|---|
| 671 | See Also: |
|---|
| 672 | BRFM_GetStatus(), BRFM_SetAudioMute(), BRFM_SetAudioVolume(), |
|---|
| 673 | BRFM_EnableRfOutput(), BRFM_DisableRfOutput() |
|---|
| 674 | *******************************************************************************/ |
|---|
| 675 | BERR_Code BRFM_SetModulationType( |
|---|
| 676 | BRFM_Handle hDev, /* [in] Device handle */ |
|---|
| 677 | BRFM_ModulationType modType, /* [in] Requested modulation type */ |
|---|
| 678 | BRFM_OutputChannel chNbr /* [in] Requested channel number */ |
|---|
| 679 | ); |
|---|
| 680 | |
|---|
| 681 | /******************************************************************************* |
|---|
| 682 | Summary: |
|---|
| 683 | This function enable the power-saver mode. |
|---|
| 684 | |
|---|
| 685 | Description: |
|---|
| 686 | This function is responsible for enabling the RFM power-saver mode. |
|---|
| 687 | To exist power-saver mode, calling any of the "setting" functions in |
|---|
| 688 | BRFM will disable power-saver mode with one exception, calling |
|---|
| 689 | BRFM_DisableRfOutput() will not disable power-saver mode automatically. |
|---|
| 690 | |
|---|
| 691 | See Also: |
|---|
| 692 | BRFM_SetAudioMute(), BRFM_SetAudioVolume(), BRFM_SetAudioEncoding(), |
|---|
| 693 | BRFM_EnableRfOutput(), BRFM_DisableRfOutput() |
|---|
| 694 | *******************************************************************************/ |
|---|
| 695 | BERR_Code BRFM_EnablePowerSaver( |
|---|
| 696 | BRFM_Handle hDev /* [in] Device handle */ |
|---|
| 697 | ); |
|---|
| 698 | |
|---|
| 699 | /******************************************************************************* |
|---|
| 700 | Summary: |
|---|
| 701 | Enter standby mode |
|---|
| 702 | *******************************************************************************/ |
|---|
| 703 | BERR_Code BRFM_Standby( |
|---|
| 704 | BRFM_Handle hDev /* [in] Device handle */ |
|---|
| 705 | ); |
|---|
| 706 | |
|---|
| 707 | /******************************************************************************* |
|---|
| 708 | Summary: |
|---|
| 709 | Resume from standby mode |
|---|
| 710 | ********************************************************************************/ |
|---|
| 711 | BERR_Code BRFM_Resume( |
|---|
| 712 | BRFM_Handle hDev /* [in] Device handle */ |
|---|
| 713 | ); |
|---|
| 714 | |
|---|
| 715 | /******************************************************************************* |
|---|
| 716 | Summary: |
|---|
| 717 | This function gets the current Rf Modulator status. |
|---|
| 718 | |
|---|
| 719 | Description: |
|---|
| 720 | This function is responsible for getting the current Rf Modulator status. |
|---|
| 721 | |
|---|
| 722 | See Also: |
|---|
| 723 | BRFM_Status |
|---|
| 724 | *******************************************************************************/ |
|---|
| 725 | BERR_Code BRFM_GetStatus( |
|---|
| 726 | BRFM_Handle hDev, /* [in] Device handle */ |
|---|
| 727 | BRFM_Status *status /* [out] Returns status */ |
|---|
| 728 | ); |
|---|
| 729 | |
|---|
| 730 | /******************************************************************************* |
|---|
| 731 | Summary: |
|---|
| 732 | This function sets the RFM audio standard register |
|---|
| 733 | |
|---|
| 734 | Description: |
|---|
| 735 | This function is responsible for setting the correct audio standard (Mono, Nicam, etc.) |
|---|
| 736 | |
|---|
| 737 | See Also: |
|---|
| 738 | BRFM_SetAudioEncoding |
|---|
| 739 | *******************************************************************************/ |
|---|
| 740 | BERR_Code BRFM_SetAudioStandard( |
|---|
| 741 | BRFM_Handle hDev, |
|---|
| 742 | BRFM_AudioEncoding audioEncoding); |
|---|
| 743 | |
|---|
| 744 | /******************************************************************************* |
|---|
| 745 | Summary: |
|---|
| 746 | This function sets the NICAM carrier amplitude values |
|---|
| 747 | |
|---|
| 748 | Description: |
|---|
| 749 | This function is responsible for setting the amplitude for NICAM carrier |
|---|
| 750 | |
|---|
| 751 | See Also: |
|---|
| 752 | BRFM_SetNicamVolume |
|---|
| 753 | *******************************************************************************/ |
|---|
| 754 | BERR_Code BRFM_SetNicamCarrierLevel( |
|---|
| 755 | BRFM_Handle hDev, |
|---|
| 756 | uint32_t eNicamCarrAmpl); |
|---|
| 757 | |
|---|
| 758 | /******************************************************************************* |
|---|
| 759 | Summary: |
|---|
| 760 | This function set the volume for NICAM encoder |
|---|
| 761 | |
|---|
| 762 | Description: |
|---|
| 763 | This function is responsible for setting the volume scaling at input to NICAM audio encoder. |
|---|
| 764 | |
|---|
| 765 | See Also: |
|---|
| 766 | BRFM_SetNicamCarrierLevel |
|---|
| 767 | *******************************************************************************/ |
|---|
| 768 | BERR_Code BRFM_SetNicamVolume( |
|---|
| 769 | BRFM_Handle hDev, |
|---|
| 770 | int volumeDbLeft, |
|---|
| 771 | int volumeDbRight); |
|---|
| 772 | |
|---|
| 773 | #ifdef __cplusplus |
|---|
| 774 | } |
|---|
| 775 | #endif |
|---|
| 776 | |
|---|
| 777 | #endif /* #ifndef BRFM_H__ */ |
|---|