| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2009 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_frontend_satellite.c $ |
|---|
| 39 | * $brcm_Revision: 10 $ |
|---|
| 40 | * $brcm_Date: 8/3/09 9:24a $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Frontend QAM |
|---|
| 44 | * Generic APIs for QAM tuning. |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /nexus/modules/frontend/common/src/nexus_frontend_satellite.c $ |
|---|
| 49 | * |
|---|
| 50 | * 10 8/3/09 9:24a erickson |
|---|
| 51 | * PR57239: fix non-AST platforms |
|---|
| 52 | * |
|---|
| 53 | * 9 7/13/09 4:48p erickson |
|---|
| 54 | * PR56773: added NEXUS_FrontendDiseqcStatus |
|---|
| 55 | * |
|---|
| 56 | * PR54416/2 5/21/09 6:03p jtna |
|---|
| 57 | * PR54416: improve naming |
|---|
| 58 | * |
|---|
| 59 | * PR54416/1 5/15/09 7:47p jtna |
|---|
| 60 | * PR54416: nexus support for satellite scanning |
|---|
| 61 | * |
|---|
| 62 | * 7 5/11/09 4:29p erickson |
|---|
| 63 | * PR53078: get time of tune or resetStatus so that elapsed time can be |
|---|
| 64 | * returned with status |
|---|
| 65 | * |
|---|
| 66 | * 6 4/2/09 2:29p erickson |
|---|
| 67 | * PR53078: satellite api additions |
|---|
| 68 | * |
|---|
| 69 | * 5 1/23/09 3:32p jgarrett |
|---|
| 70 | * PR 51457: Adding frontend extension hooks for tuners and |
|---|
| 71 | * frontends/demods |
|---|
| 72 | * |
|---|
| 73 | * 4 12/22/08 9:49p agin |
|---|
| 74 | * PR49982: Add reset diseqc. |
|---|
| 75 | * |
|---|
| 76 | * 3 7/11/08 5:07p jtna |
|---|
| 77 | * PR42924: Add channel change measurements functionality |
|---|
| 78 | * |
|---|
| 79 | * 2 3/13/08 7:41p jgarrett |
|---|
| 80 | * PR 39985: Setting defaults |
|---|
| 81 | * |
|---|
| 82 | * 1 1/18/08 2:19p jgarrett |
|---|
| 83 | * PR 38808: Merging to main branch |
|---|
| 84 | * |
|---|
| 85 | * Nexus_Devel/1 10/5/07 5:52p jgarrett |
|---|
| 86 | * PR 35551: Adding initial version |
|---|
| 87 | * |
|---|
| 88 | ***************************************************************************/ |
|---|
| 89 | |
|---|
| 90 | #include "nexus_frontend_module.h" |
|---|
| 91 | |
|---|
| 92 | BDBG_MODULE(nexus_frontend_satellite); |
|---|
| 93 | |
|---|
| 94 | BTRC_MODULE_DECLARE(ChnChange_Tune); |
|---|
| 95 | |
|---|
| 96 | void NEXUS_Frontend_GetDefaultSatelliteSettings( NEXUS_FrontendSatelliteSettings *pSettings ) |
|---|
| 97 | { |
|---|
| 98 | BKNI_Memset(pSettings, 0, sizeof(*pSettings)); |
|---|
| 99 | pSettings->mode = NEXUS_FrontendSatelliteMode_eDvb; |
|---|
| 100 | pSettings->symbolRate = 20000000; |
|---|
| 101 | pSettings->searchRange = 5000000; |
|---|
| 102 | /* Set the equivalent of BAST_ACQSETTINGS_DEFAULT - 0x00036004 */ |
|---|
| 103 | pSettings->spectralInversion = NEXUS_FrontendSatelliteInversion_eScan; |
|---|
| 104 | pSettings->ldpcPilot = true; |
|---|
| 105 | pSettings->ldpcPilotPll = true; |
|---|
| 106 | pSettings->nyquist20 = true; |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | void NEXUS_Frontend_GetDefaultSatelliteSettingsForMode( NEXUS_FrontendSatelliteMode mode, NEXUS_FrontendSatelliteSettings *pSettings ) |
|---|
| 110 | { |
|---|
| 111 | NEXUS_Frontend_GetDefaultSatelliteSettings(pSettings); |
|---|
| 112 | pSettings->mode = mode; |
|---|
| 113 | switch (mode) { |
|---|
| 114 | default: |
|---|
| 115 | case NEXUS_FrontendSatelliteMode_eDss: |
|---|
| 116 | case NEXUS_FrontendSatelliteMode_eDvb: |
|---|
| 117 | /* acq_ctl 0x0600C */ |
|---|
| 118 | pSettings->bertEnable = true; |
|---|
| 119 | pSettings->nyquist20 = true; |
|---|
| 120 | break; |
|---|
| 121 | |
|---|
| 122 | case NEXUS_FrontendSatelliteMode_eDcii: |
|---|
| 123 | case NEXUS_FrontendSatelliteMode_eQpskTurbo: |
|---|
| 124 | case NEXUS_FrontendSatelliteMode_e8pskTurbo: |
|---|
| 125 | case NEXUS_FrontendSatelliteMode_eTurbo: |
|---|
| 126 | break; |
|---|
| 127 | |
|---|
| 128 | case NEXUS_FrontendSatelliteMode_eQpskLdpc: |
|---|
| 129 | case NEXUS_FrontendSatelliteMode_e8pskLdpc: |
|---|
| 130 | /* acq_ctl 0x3600C */ |
|---|
| 131 | pSettings->bertEnable = true; |
|---|
| 132 | pSettings->nyquist20 = true; |
|---|
| 133 | pSettings->ldpcPilot = true; |
|---|
| 134 | pSettings->ldpcPilotPll = true; |
|---|
| 135 | break; |
|---|
| 136 | |
|---|
| 137 | case NEXUS_FrontendSatelliteMode_eLdpc: |
|---|
| 138 | break; |
|---|
| 139 | } |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | NEXUS_Error NEXUS_Frontend_TuneSatellite( NEXUS_FrontendHandle handle, const NEXUS_FrontendSatelliteSettings *pSettings ) |
|---|
| 143 | { |
|---|
| 144 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 145 | |
|---|
| 146 | NEXUS_Time_Get(&handle->resetStatusTime); |
|---|
| 147 | |
|---|
| 148 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 149 | BTRC_TRACE(ChnChange_Tune, START); |
|---|
| 150 | |
|---|
| 151 | if ( NULL == handle->tuneSatellite ) |
|---|
| 152 | { |
|---|
| 153 | if ( handle->pParentFrontend ) |
|---|
| 154 | { |
|---|
| 155 | return NEXUS_Frontend_TuneSatellite(handle->pParentFrontend, pSettings); |
|---|
| 156 | } |
|---|
| 157 | else |
|---|
| 158 | { |
|---|
| 159 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 160 | } |
|---|
| 161 | } |
|---|
| 162 | else |
|---|
| 163 | { |
|---|
| 164 | return handle->tuneSatellite(handle->pDeviceHandle, pSettings); |
|---|
| 165 | } |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | /*************************************************************************** |
|---|
| 169 | Summary: |
|---|
| 170 | Get the status of a satellite tuner |
|---|
| 171 | See Also: |
|---|
| 172 | NEXUS_Frontend_TuneSatellite |
|---|
| 173 | ***************************************************************************/ |
|---|
| 174 | NEXUS_Error NEXUS_Frontend_GetSatelliteStatus( |
|---|
| 175 | NEXUS_FrontendHandle handle, |
|---|
| 176 | NEXUS_FrontendSatelliteStatus *pStatus |
|---|
| 177 | ) |
|---|
| 178 | { |
|---|
| 179 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 180 | BDBG_ASSERT(NULL != pStatus); |
|---|
| 181 | |
|---|
| 182 | if ( NULL == handle->getSatelliteStatus ) |
|---|
| 183 | { |
|---|
| 184 | if ( handle->pParentFrontend ) |
|---|
| 185 | { |
|---|
| 186 | return NEXUS_Frontend_GetSatelliteStatus(handle->pParentFrontend, pStatus); |
|---|
| 187 | } |
|---|
| 188 | else |
|---|
| 189 | { |
|---|
| 190 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | else |
|---|
| 194 | { |
|---|
| 195 | return handle->getSatelliteStatus(handle->pDeviceHandle, pStatus); |
|---|
| 196 | } |
|---|
| 197 | } |
|---|
| 198 | |
|---|
| 199 | /*************************************************************************** |
|---|
| 200 | Summary: |
|---|
| 201 | Get the current DiSEqC settings for a satellite tuner |
|---|
| 202 | See Also: |
|---|
| 203 | NEXUS_Frontend_SetDiseqcSettings |
|---|
| 204 | ***************************************************************************/ |
|---|
| 205 | void NEXUS_Frontend_GetDiseqcSettings( |
|---|
| 206 | NEXUS_FrontendHandle handle, |
|---|
| 207 | NEXUS_FrontendDiseqcSettings *pSettings |
|---|
| 208 | ) |
|---|
| 209 | { |
|---|
| 210 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 211 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 212 | |
|---|
| 213 | if ( NULL == handle->getDiseqcSettings ) |
|---|
| 214 | { |
|---|
| 215 | if ( handle->pParentFrontend ) |
|---|
| 216 | { |
|---|
| 217 | NEXUS_Frontend_GetDiseqcSettings(handle->pParentFrontend, pSettings); |
|---|
| 218 | } |
|---|
| 219 | else |
|---|
| 220 | { |
|---|
| 221 | (void)BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 222 | } |
|---|
| 223 | } |
|---|
| 224 | else |
|---|
| 225 | { |
|---|
| 226 | handle->getDiseqcSettings(handle->pDeviceHandle, pSettings); |
|---|
| 227 | } |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | /*************************************************************************** |
|---|
| 231 | Summary: |
|---|
| 232 | Set the current DiSEqC settings for a satellite tuner |
|---|
| 233 | See Also: |
|---|
| 234 | NEXUS_Frontend_GetDiseqcSettings |
|---|
| 235 | ***************************************************************************/ |
|---|
| 236 | NEXUS_Error NEXUS_Frontend_SetDiseqcSettings( |
|---|
| 237 | NEXUS_FrontendHandle handle, |
|---|
| 238 | const NEXUS_FrontendDiseqcSettings *pSettings |
|---|
| 239 | ) |
|---|
| 240 | { |
|---|
| 241 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 242 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 243 | |
|---|
| 244 | if ( NULL == handle->setDiseqcSettings ) |
|---|
| 245 | { |
|---|
| 246 | if ( handle->pParentFrontend ) |
|---|
| 247 | { |
|---|
| 248 | return NEXUS_Frontend_SetDiseqcSettings(handle->pParentFrontend, pSettings); |
|---|
| 249 | } |
|---|
| 250 | else |
|---|
| 251 | { |
|---|
| 252 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 253 | } |
|---|
| 254 | } |
|---|
| 255 | else |
|---|
| 256 | { |
|---|
| 257 | return handle->setDiseqcSettings(handle->pDeviceHandle, pSettings); |
|---|
| 258 | } |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | NEXUS_Error NEXUS_Frontend_GetDiseqcStatus( |
|---|
| 262 | NEXUS_FrontendHandle handle, |
|---|
| 263 | NEXUS_FrontendDiseqcStatus *pStatus |
|---|
| 264 | ) |
|---|
| 265 | { |
|---|
| 266 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 267 | |
|---|
| 268 | if ( NULL == handle->getDiseqcStatus ) |
|---|
| 269 | { |
|---|
| 270 | if ( handle->pParentFrontend ) |
|---|
| 271 | { |
|---|
| 272 | return NEXUS_Frontend_GetDiseqcStatus(handle->pParentFrontend, pStatus); |
|---|
| 273 | } |
|---|
| 274 | else |
|---|
| 275 | { |
|---|
| 276 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 277 | } |
|---|
| 278 | } |
|---|
| 279 | else |
|---|
| 280 | { |
|---|
| 281 | return handle->getDiseqcStatus(handle->pDeviceHandle, pStatus); |
|---|
| 282 | } |
|---|
| 283 | } |
|---|
| 284 | |
|---|
| 285 | /*************************************************************************** |
|---|
| 286 | Summary: |
|---|
| 287 | Send a DiSEqC message |
|---|
| 288 | Description: |
|---|
| 289 | This routine will send the number of bytes specified in a DiSEqC message. |
|---|
| 290 | The callback provided will be called when the transfer is complete, at |
|---|
| 291 | which point the reply/status can be read. |
|---|
| 292 | See Also: |
|---|
| 293 | NEXUS_Frontend_GetDiseqcReply |
|---|
| 294 | ***************************************************************************/ |
|---|
| 295 | NEXUS_Error NEXUS_Frontend_SendDiseqcMessage( |
|---|
| 296 | NEXUS_FrontendHandle handle, |
|---|
| 297 | const uint8_t *pSendData, |
|---|
| 298 | size_t sendDataSize, /* In Bytes */ |
|---|
| 299 | const NEXUS_CallbackDesc *pSendComplete /* Callback will be received when message status is ready */ |
|---|
| 300 | ) |
|---|
| 301 | { |
|---|
| 302 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 303 | BDBG_ASSERT(NULL != pSendData); |
|---|
| 304 | |
|---|
| 305 | if ( NULL == handle->sendDiseqcMessage ) |
|---|
| 306 | { |
|---|
| 307 | if ( handle->pParentFrontend ) |
|---|
| 308 | { |
|---|
| 309 | return NEXUS_Frontend_SendDiseqcMessage(handle->pParentFrontend, pSendData, sendDataSize, pSendComplete); |
|---|
| 310 | } |
|---|
| 311 | else |
|---|
| 312 | { |
|---|
| 313 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 314 | } |
|---|
| 315 | } |
|---|
| 316 | else |
|---|
| 317 | { |
|---|
| 318 | return handle->sendDiseqcMessage(handle->pDeviceHandle, pSendData, sendDataSize, pSendComplete); |
|---|
| 319 | } |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | /*************************************************************************** |
|---|
| 323 | Summary: |
|---|
| 324 | Reset DiSEqC |
|---|
| 325 | Description: |
|---|
| 326 | This routine will reset the diseqc. |
|---|
| 327 | See Also: |
|---|
| 328 | ***************************************************************************/ |
|---|
| 329 | NEXUS_Error NEXUS_Frontend_ResetDiseqc( |
|---|
| 330 | NEXUS_FrontendHandle handle, |
|---|
| 331 | uint8_t options |
|---|
| 332 | ) |
|---|
| 333 | { |
|---|
| 334 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 335 | |
|---|
| 336 | if ( NULL == handle->resetDiseqc ) |
|---|
| 337 | { |
|---|
| 338 | if ( handle->pParentFrontend ) |
|---|
| 339 | { |
|---|
| 340 | return NEXUS_Frontend_ResetDiseqc(handle->pParentFrontend, options); |
|---|
| 341 | } |
|---|
| 342 | else |
|---|
| 343 | { |
|---|
| 344 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 345 | } |
|---|
| 346 | } |
|---|
| 347 | else |
|---|
| 348 | { |
|---|
| 349 | return handle->resetDiseqc(handle->pDeviceHandle, options); |
|---|
| 350 | } |
|---|
| 351 | } |
|---|
| 352 | |
|---|
| 353 | /*************************************************************************** |
|---|
| 354 | Summary: |
|---|
| 355 | Read a DiSEqC message reply |
|---|
| 356 | Description: |
|---|
| 357 | This routine will read up to the number of bytes specified from a DiSEqC |
|---|
| 358 | message reply. Any remaining bytes will be discarded. |
|---|
| 359 | See Also: |
|---|
| 360 | NEXUS_Frontend_SendDiseqcMessage |
|---|
| 361 | ***************************************************************************/ |
|---|
| 362 | NEXUS_Error NEXUS_Frontend_GetDiseqcReply( |
|---|
| 363 | NEXUS_FrontendHandle handle, |
|---|
| 364 | NEXUS_FrontendDiseqcMessageStatus *pStatus, |
|---|
| 365 | uint8_t *pReplyBuffer, /* [out] */ |
|---|
| 366 | size_t replyBufferSize, /* in bytes */ |
|---|
| 367 | size_t *pReplyLength /* [out] */ |
|---|
| 368 | ) |
|---|
| 369 | { |
|---|
| 370 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 371 | BDBG_ASSERT(NULL != pStatus); |
|---|
| 372 | BDBG_ASSERT(NULL != pReplyBuffer); |
|---|
| 373 | BDBG_ASSERT(NULL != pReplyLength); |
|---|
| 374 | |
|---|
| 375 | if ( NULL == handle->getDiseqcReply ) |
|---|
| 376 | { |
|---|
| 377 | if ( handle->pParentFrontend ) |
|---|
| 378 | { |
|---|
| 379 | return NEXUS_Frontend_GetDiseqcReply(handle->pParentFrontend, pStatus, pReplyBuffer, replyBufferSize, pReplyLength); |
|---|
| 380 | } |
|---|
| 381 | else |
|---|
| 382 | { |
|---|
| 383 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 384 | } |
|---|
| 385 | } |
|---|
| 386 | else |
|---|
| 387 | { |
|---|
| 388 | return handle->getDiseqcReply(handle->pDeviceHandle, pStatus, pReplyBuffer, replyBufferSize, pReplyLength); |
|---|
| 389 | } |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | /*************************************************************************** |
|---|
| 393 | Summary: |
|---|
| 394 | Send a DiSEqC Auto Control Word |
|---|
| 395 | See Also: |
|---|
| 396 | NEXUS_Frontend_SendDiseqcMessage |
|---|
| 397 | ***************************************************************************/ |
|---|
| 398 | NEXUS_Error NEXUS_Frontend_SendDiseqcAcw( |
|---|
| 399 | NEXUS_FrontendHandle handle, |
|---|
| 400 | uint8_t codeWord |
|---|
| 401 | ) |
|---|
| 402 | { |
|---|
| 403 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 404 | |
|---|
| 405 | if ( NULL == handle->sendDiseqcAcw ) |
|---|
| 406 | { |
|---|
| 407 | if ( handle->pParentFrontend ) |
|---|
| 408 | { |
|---|
| 409 | return NEXUS_Frontend_SendDiseqcAcw(handle->pParentFrontend, codeWord); |
|---|
| 410 | } |
|---|
| 411 | else |
|---|
| 412 | { |
|---|
| 413 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 414 | } |
|---|
| 415 | } |
|---|
| 416 | else |
|---|
| 417 | { |
|---|
| 418 | return handle->sendDiseqcAcw(handle->pDeviceHandle, codeWord); |
|---|
| 419 | } |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | NEXUS_Error NEXUS_Frontend_ReadSatelliteConfig( NEXUS_FrontendHandle handle, unsigned id, void *buffer, unsigned bufferSize ) |
|---|
| 423 | { |
|---|
| 424 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 425 | |
|---|
| 426 | if ( NULL == handle->readSatelliteConfig ) |
|---|
| 427 | { |
|---|
| 428 | if ( handle->pParentFrontend ) |
|---|
| 429 | { |
|---|
| 430 | return NEXUS_Frontend_ReadSatelliteConfig(handle->pParentFrontend, id, buffer, bufferSize); |
|---|
| 431 | } |
|---|
| 432 | else |
|---|
| 433 | { |
|---|
| 434 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 435 | } |
|---|
| 436 | } |
|---|
| 437 | else |
|---|
| 438 | { |
|---|
| 439 | return handle->readSatelliteConfig(handle->pDeviceHandle, id, buffer, bufferSize); |
|---|
| 440 | } |
|---|
| 441 | } |
|---|
| 442 | |
|---|
| 443 | NEXUS_Error NEXUS_Frontend_WriteSatelliteConfig( NEXUS_FrontendHandle handle, unsigned id, const void *buffer, unsigned bufferSize ) |
|---|
| 444 | { |
|---|
| 445 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 446 | |
|---|
| 447 | if ( NULL == handle->writeSatelliteConfig ) |
|---|
| 448 | { |
|---|
| 449 | if ( handle->pParentFrontend ) |
|---|
| 450 | { |
|---|
| 451 | return NEXUS_Frontend_WriteSatelliteConfig(handle->pParentFrontend, id, buffer, bufferSize); |
|---|
| 452 | } |
|---|
| 453 | else |
|---|
| 454 | { |
|---|
| 455 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 456 | } |
|---|
| 457 | } |
|---|
| 458 | else |
|---|
| 459 | { |
|---|
| 460 | return handle->writeSatelliteConfig(handle->pDeviceHandle, id, buffer, bufferSize); |
|---|
| 461 | } |
|---|
| 462 | } |
|---|
| 463 | |
|---|
| 464 | void NEXUS_Frontend_GetDefaultSatellitePeakscanSettings(NEXUS_FrontendSatellitePeakscanSettings *pSettings) |
|---|
| 465 | { |
|---|
| 466 | BKNI_Memset(pSettings, 0, sizeof(*pSettings)); |
|---|
| 467 | pSettings->frequency= 0; |
|---|
| 468 | pSettings->minSymbolRate = 15 * 1000000; |
|---|
| 469 | pSettings->maxSymbolRate = 30 * 1000000; |
|---|
| 470 | pSettings->frequencyRange = 5 * 1000000; |
|---|
| 471 | pSettings->frequencyStep = 1 * 1000000; |
|---|
| 472 | /* TODO: hardcoded values are ok for now, but consider querying AST for these */ |
|---|
| 473 | } |
|---|
| 474 | |
|---|
| 475 | NEXUS_Error NEXUS_Frontend_SatellitePeakscan( NEXUS_FrontendHandle handle, const NEXUS_FrontendSatellitePeakscanSettings *pSettings ) |
|---|
| 476 | { |
|---|
| 477 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 478 | |
|---|
| 479 | if ( NULL == handle->satellitePeakscan ) |
|---|
| 480 | { |
|---|
| 481 | if ( handle->pParentFrontend ) |
|---|
| 482 | { |
|---|
| 483 | return NEXUS_Frontend_SatellitePeakscan(handle->pParentFrontend, pSettings); |
|---|
| 484 | } |
|---|
| 485 | else |
|---|
| 486 | { |
|---|
| 487 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 488 | } |
|---|
| 489 | } |
|---|
| 490 | else |
|---|
| 491 | { |
|---|
| 492 | return handle->satellitePeakscan(handle->pDeviceHandle, pSettings); |
|---|
| 493 | } |
|---|
| 494 | } |
|---|
| 495 | |
|---|
| 496 | NEXUS_Error NEXUS_Frontend_GetSatellitePeakscanResult( NEXUS_FrontendHandle handle, NEXUS_FrontendSatellitePeakscanResult *pResult ) |
|---|
| 497 | { |
|---|
| 498 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 499 | |
|---|
| 500 | if ( NULL == handle->getSatellitePeakscanResult ) |
|---|
| 501 | { |
|---|
| 502 | if ( handle->pParentFrontend ) |
|---|
| 503 | { |
|---|
| 504 | return NEXUS_Frontend_GetSatellitePeakscanResult(handle->pParentFrontend, pResult); |
|---|
| 505 | } |
|---|
| 506 | else |
|---|
| 507 | { |
|---|
| 508 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 509 | } |
|---|
| 510 | } |
|---|
| 511 | else |
|---|
| 512 | { |
|---|
| 513 | return handle->getSatellitePeakscanResult(handle->pDeviceHandle, pResult); |
|---|
| 514 | } |
|---|
| 515 | } |
|---|
| 516 | |
|---|
| 517 | #if NEXUS_FRONTEND_AST |
|---|
| 518 | #include "nexus_frontend_ast.h" |
|---|
| 519 | #endif |
|---|
| 520 | |
|---|
| 521 | NEXUS_Error NEXUS_Frontend_ReadSatelliteRegister( NEXUS_FrontendHandle handle, uint32_t address, uint32_t *pValue ) |
|---|
| 522 | { |
|---|
| 523 | #if NEXUS_FRONTEND_AST |
|---|
| 524 | NEXUS_AstDevice *astDevice = NEXUS_Frontend_P_GetAstDevice(handle); |
|---|
| 525 | if (astDevice) { |
|---|
| 526 | return BAST_ReadRegister(astDevice->astChannel, address, pValue); |
|---|
| 527 | } |
|---|
| 528 | else { |
|---|
| 529 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 530 | } |
|---|
| 531 | #else |
|---|
| 532 | BSTD_UNUSED(handle); |
|---|
| 533 | BSTD_UNUSED(address); |
|---|
| 534 | BSTD_UNUSED(pValue); |
|---|
| 535 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 536 | #endif |
|---|
| 537 | } |
|---|
| 538 | |
|---|
| 539 | NEXUS_Error NEXUS_Frontend_WriteSatelliteRegister( NEXUS_FrontendHandle handle, uint32_t address, uint32_t value ) |
|---|
| 540 | { |
|---|
| 541 | #if NEXUS_FRONTEND_AST |
|---|
| 542 | NEXUS_AstDevice *astDevice = NEXUS_Frontend_P_GetAstDevice(handle); |
|---|
| 543 | if (astDevice) { |
|---|
| 544 | return BAST_WriteRegister(astDevice->astChannel, address, &value); |
|---|
| 545 | } |
|---|
| 546 | else { |
|---|
| 547 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 548 | } |
|---|
| 549 | #else |
|---|
| 550 | BSTD_UNUSED(handle); |
|---|
| 551 | BSTD_UNUSED(address); |
|---|
| 552 | BSTD_UNUSED(value); |
|---|
| 553 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 554 | #endif |
|---|
| 555 | } |
|---|
| 556 | |
|---|