| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2010-2010 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_tfe_priv.c $ |
|---|
| 39 | * $brcm_Revision: 1 $ |
|---|
| 40 | * $brcm_Date: 9/21/10 1:01p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * Private APIs for translating between NEXUS and TFE enumerations |
|---|
| 44 | * |
|---|
| 45 | * Revision History: |
|---|
| 46 | * |
|---|
| 47 | * $brcm_Log: /nexus/modules/frontend/common/src/nexus_tfe_priv.c $ |
|---|
| 48 | * |
|---|
| 49 | * 1 9/21/10 1:01p shyi |
|---|
| 50 | * SW35230-1124: Re-factoring the private interface between NEXUS and TFE |
|---|
| 51 | * so that it can be shared by TFE based tuner drivers and NEXUS frontend |
|---|
| 52 | * |
|---|
| 53 | ***************************************************************************/ |
|---|
| 54 | |
|---|
| 55 | #include "nexus_frontend_module.h" |
|---|
| 56 | #include "btfe.h" |
|---|
| 57 | |
|---|
| 58 | BDBG_MODULE(nexus_tfe); |
|---|
| 59 | |
|---|
| 60 | BTFE_ModulationFormat NEXUS_TFE_P_VideoFormat2Tfe( |
|---|
| 61 | NEXUS_VideoFormat videoFormat |
|---|
| 62 | ) |
|---|
| 63 | { |
|---|
| 64 | switch (videoFormat) { |
|---|
| 65 | case NEXUS_VideoFormat_eNtsc: /* NTSC Interlaced */ |
|---|
| 66 | return BTFE_ModulationFormat_eNTSC_M; |
|---|
| 67 | case NEXUS_VideoFormat_eNtsc443: /* NTSC encoding with the PAL |
|---|
| 68 | * color carrier frequency. */ |
|---|
| 69 | return BTFE_ModulationFormat_eNTSC_443; |
|---|
| 70 | case NEXUS_VideoFormat_eNtscJapan: /* Japan NTSC, no pedestal level */ |
|---|
| 71 | return BTFE_ModulationFormat_eNTSC_J; |
|---|
| 72 | case NEXUS_VideoFormat_ePalM: /* PAL Brazil */ |
|---|
| 73 | return BTFE_ModulationFormat_ePAL_M; |
|---|
| 74 | case NEXUS_VideoFormat_ePalN: /* PAL_N */ |
|---|
| 75 | return BTFE_ModulationFormat_ePAL_N; |
|---|
| 76 | case NEXUS_VideoFormat_ePalNc: /* PAL_N, Argentina */ |
|---|
| 77 | return BTFE_ModulationFormat_ePAL_NC; |
|---|
| 78 | case NEXUS_VideoFormat_ePalB: /* Australia */ |
|---|
| 79 | return BTFE_ModulationFormat_ePAL_B; |
|---|
| 80 | case NEXUS_VideoFormat_ePalB1: /* Hungary */ |
|---|
| 81 | return BTFE_ModulationFormat_ePAL_B1; |
|---|
| 82 | case NEXUS_VideoFormat_ePalD: /* China */ |
|---|
| 83 | case NEXUS_VideoFormat_ePalD1: /* Poland */ |
|---|
| 84 | /* NEXUS_VideoFormat_ePalDK1=NEXUS_VideoFormat_ePalD1, Eastern Europe */ |
|---|
| 85 | /* NEXUS_VideoFormat_ePalDK2: Eastern Europe */ |
|---|
| 86 | /* NEXUS_VideoFormat_ePalDK3: Eastern Europe */ |
|---|
| 87 | return BTFE_ModulationFormat_ePAL_D; |
|---|
| 88 | case NEXUS_VideoFormat_ePalG: /* Europe. */ |
|---|
| 89 | /* NEXUS_VideoFormat_ePal = NEXUS_VideoFormat_ePalG, PAL Europe */ |
|---|
| 90 | return BTFE_ModulationFormat_ePAL_G; |
|---|
| 91 | case NEXUS_VideoFormat_ePalH: /* Europe */ |
|---|
| 92 | return BTFE_ModulationFormat_ePAL_H; |
|---|
| 93 | case NEXUS_VideoFormat_ePalK: /* Europe */ |
|---|
| 94 | return BTFE_ModulationFormat_ePAL_K; |
|---|
| 95 | case NEXUS_VideoFormat_ePalI: /* U.K. */ |
|---|
| 96 | return BTFE_ModulationFormat_ePAL_I; |
|---|
| 97 | case NEXUS_VideoFormat_ePal60hz: /* 60Hz PAL */ |
|---|
| 98 | return BTFE_ModulationFormat_ePAL_60; |
|---|
| 99 | case NEXUS_VideoFormat_eSecamL: /* France */ |
|---|
| 100 | /* NEXUS_VideoFormat_eSecam, Backward compatibility */ |
|---|
| 101 | return BTFE_ModulationFormat_eSECAM_L; |
|---|
| 102 | case NEXUS_VideoFormat_eSecamB: /* Middle East */ |
|---|
| 103 | return BTFE_ModulationFormat_eSECAM_B; |
|---|
| 104 | case NEXUS_VideoFormat_eSecamG: /* Middle East */ |
|---|
| 105 | return BTFE_ModulationFormat_eSECAM_G; |
|---|
| 106 | case NEXUS_VideoFormat_eSecamD: /* Eastern Europe */ |
|---|
| 107 | return BTFE_ModulationFormat_eSECAM_D; |
|---|
| 108 | case NEXUS_VideoFormat_eSecamK: /* Eastern Europe */ |
|---|
| 109 | return BTFE_ModulationFormat_eSECAM_K; |
|---|
| 110 | case NEXUS_VideoFormat_eSecamH: /* Line SECAM */ |
|---|
| 111 | return BTFE_ModulationFormat_eSECAM_H; |
|---|
| 112 | default: |
|---|
| 113 | return BTFE_ModulationFormat_eUnknown; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | return BTFE_ModulationFormat_eUnknown; |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | NEXUS_VideoFormat NEXUS_TFE_P_ModulationFormat2Nexus( |
|---|
| 120 | BTFE_ModulationFormat modulationFormat |
|---|
| 121 | ) |
|---|
| 122 | { |
|---|
| 123 | switch (modulationFormat) { |
|---|
| 124 | case BTFE_ModulationFormat_eNTSC_M: |
|---|
| 125 | return NEXUS_VideoFormat_eNtsc; |
|---|
| 126 | case BTFE_ModulationFormat_eNTSC_443: |
|---|
| 127 | return NEXUS_VideoFormat_eNtsc443; |
|---|
| 128 | case BTFE_ModulationFormat_eNTSC_J: |
|---|
| 129 | return NEXUS_VideoFormat_eNtscJapan; |
|---|
| 130 | case BTFE_ModulationFormat_ePAL_M: |
|---|
| 131 | return NEXUS_VideoFormat_ePalM; |
|---|
| 132 | case BTFE_ModulationFormat_ePAL_N: |
|---|
| 133 | return NEXUS_VideoFormat_ePalN; |
|---|
| 134 | case BTFE_ModulationFormat_ePAL_NC: |
|---|
| 135 | return NEXUS_VideoFormat_ePalNc; |
|---|
| 136 | case BTFE_ModulationFormat_ePAL_B: |
|---|
| 137 | return NEXUS_VideoFormat_ePalB; |
|---|
| 138 | case BTFE_ModulationFormat_ePAL_B1: |
|---|
| 139 | return NEXUS_VideoFormat_ePalB1; |
|---|
| 140 | case BTFE_ModulationFormat_ePAL_D: |
|---|
| 141 | return NEXUS_VideoFormat_ePalD; |
|---|
| 142 | case BTFE_ModulationFormat_ePAL_G: |
|---|
| 143 | return NEXUS_VideoFormat_ePalG; |
|---|
| 144 | case BTFE_ModulationFormat_ePAL_H: |
|---|
| 145 | return NEXUS_VideoFormat_ePalH; |
|---|
| 146 | case BTFE_ModulationFormat_ePAL_K: |
|---|
| 147 | return NEXUS_VideoFormat_ePalK; |
|---|
| 148 | case BTFE_ModulationFormat_ePAL_I: |
|---|
| 149 | return NEXUS_VideoFormat_ePalI; |
|---|
| 150 | case BTFE_ModulationFormat_ePAL_60: |
|---|
| 151 | return NEXUS_VideoFormat_ePal60hz; |
|---|
| 152 | case BTFE_ModulationFormat_eSECAM_L: |
|---|
| 153 | return NEXUS_VideoFormat_eSecamL; |
|---|
| 154 | case BTFE_ModulationFormat_eSECAM_B: |
|---|
| 155 | return NEXUS_VideoFormat_eSecamB; |
|---|
| 156 | case BTFE_ModulationFormat_eSECAM_G: |
|---|
| 157 | return NEXUS_VideoFormat_eSecamG; |
|---|
| 158 | case BTFE_ModulationFormat_eSECAM_D: |
|---|
| 159 | return NEXUS_VideoFormat_eSecamD; |
|---|
| 160 | case BTFE_ModulationFormat_eSECAM_K: |
|---|
| 161 | return NEXUS_VideoFormat_eSecamK; |
|---|
| 162 | case BTFE_ModulationFormat_eSECAM_H: |
|---|
| 163 | return NEXUS_VideoFormat_eSecamH; |
|---|
| 164 | default: |
|---|
| 165 | return NEXUS_VideoFormat_eUnknown; |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | return NEXUS_VideoFormat_eUnknown; |
|---|
| 169 | } |
|---|
| 170 | |
|---|
| 171 | NEXUS_FrontendOfdmModulation NEXUS_TFE_P_CofdmConst2Nexus( |
|---|
| 172 | BTFE_Cofdm_Constellation constellation |
|---|
| 173 | ) |
|---|
| 174 | { |
|---|
| 175 | switch (constellation) { |
|---|
| 176 | case BTFE_Cofdm_Constellation_eDqpsk: |
|---|
| 177 | return NEXUS_FrontendOfdmModulation_eDqpsk; |
|---|
| 178 | break; |
|---|
| 179 | case BTFE_Cofdm_Constellation_eQpsk: |
|---|
| 180 | return NEXUS_FrontendOfdmModulation_eQpsk; |
|---|
| 181 | break; |
|---|
| 182 | case BTFE_Cofdm_Constellation_e16Qam: |
|---|
| 183 | return NEXUS_FrontendOfdmModulation_eQam16; |
|---|
| 184 | break; |
|---|
| 185 | case BTFE_Cofdm_Constellation_e64Qam: |
|---|
| 186 | return NEXUS_FrontendOfdmModulation_eQam64; |
|---|
| 187 | break; |
|---|
| 188 | default: |
|---|
| 189 | BDBG_MSG(("Unrecognized TFE COFDM modulation format (%d)", |
|---|
| 190 | constellation)); |
|---|
| 191 | break; |
|---|
| 192 | } |
|---|
| 193 | |
|---|
| 194 | return NEXUS_FrontendOfdmModulation_eMax; |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | NEXUS_FrontendOfdmCodeRate NEXUS_TFE_P_CofdmCodeRate2Nexus( |
|---|
| 198 | BTFE_Cofdm_CodeRate codeRate |
|---|
| 199 | ) |
|---|
| 200 | { |
|---|
| 201 | switch (codeRate) { |
|---|
| 202 | case BTFE_Cofdm_CodeRate_e1_2: |
|---|
| 203 | return NEXUS_FrontendOfdmCodeRate_e1_2; |
|---|
| 204 | break; |
|---|
| 205 | case BTFE_Cofdm_CodeRate_e2_3: |
|---|
| 206 | return NEXUS_FrontendOfdmCodeRate_e2_3; |
|---|
| 207 | break; |
|---|
| 208 | case BTFE_Cofdm_CodeRate_e3_4: |
|---|
| 209 | return NEXUS_FrontendOfdmCodeRate_e3_4; |
|---|
| 210 | break; |
|---|
| 211 | case BTFE_Cofdm_CodeRate_e5_6: |
|---|
| 212 | return NEXUS_FrontendOfdmCodeRate_e5_6; |
|---|
| 213 | break; |
|---|
| 214 | case BTFE_Cofdm_CodeRate_e7_8: |
|---|
| 215 | return NEXUS_FrontendOfdmCodeRate_e7_8; |
|---|
| 216 | break; |
|---|
| 217 | default: |
|---|
| 218 | BDBG_MSG(("Unrecognized TFE COFDM code rate (%d)", codeRate)); |
|---|
| 219 | break; |
|---|
| 220 | } |
|---|
| 221 | |
|---|
| 222 | return NEXUS_FrontendOfdmCodeRate_eMax; |
|---|
| 223 | } |
|---|
| 224 | |
|---|