| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2010-2011 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_scan.c $ |
|---|
| 39 | * $brcm_Revision: 1 $ |
|---|
| 40 | * $brcm_Date: 5/26/11 7:17p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Frontend channel scan |
|---|
| 44 | * |
|---|
| 45 | * Revision History: |
|---|
| 46 | * |
|---|
| 47 | * $brcm_Log: /nexus/modules/frontend/7552/src/nexus_frontend_scan.c $ |
|---|
| 48 | * |
|---|
| 49 | * 1 5/26/11 7:17p jtna |
|---|
| 50 | * SW7552-35: initial branch-out |
|---|
| 51 | * |
|---|
| 52 | ***************************************************************************/ |
|---|
| 53 | |
|---|
| 54 | /* base was /nexus/modules/frontend/35230/src/nexus_frontend_scan.c@@/main/1 */ |
|---|
| 55 | /* TODO: this could be a symlink */ |
|---|
| 56 | |
|---|
| 57 | #include "nexus_frontend_module.h" |
|---|
| 58 | #include "nexus_frontend_scan.h" |
|---|
| 59 | |
|---|
| 60 | BDBG_MODULE(nexus_frontend_scan); |
|---|
| 61 | |
|---|
| 62 | /*************************************************************************** |
|---|
| 63 | Summary: |
|---|
| 64 | Get default options for NEXUS_Frontend_ScanFrequency |
|---|
| 65 | ***************************************************************************/ |
|---|
| 66 | void NEXUS_Frontend_GetDefaultScanSettings( |
|---|
| 67 | NEXUS_FrontendHandle handle, |
|---|
| 68 | NEXUS_FrontendScanSettings *pSettings /* [out] */ |
|---|
| 69 | ) |
|---|
| 70 | { |
|---|
| 71 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 72 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 73 | BKNI_Memset(pSettings, 0, sizeof(*pSettings)); |
|---|
| 74 | if ( handle->capabilities.scan ) |
|---|
| 75 | { |
|---|
| 76 | if ( handle->capabilities.vsb ) |
|---|
| 77 | { |
|---|
| 78 | pSettings->signalTypes[NEXUS_FrontendSignalType_eVsb] = true; |
|---|
| 79 | } |
|---|
| 80 | if ( handle->capabilities.qam ) |
|---|
| 81 | { |
|---|
| 82 | pSettings->signalTypes[NEXUS_FrontendSignalType_eQam] = true; |
|---|
| 83 | } |
|---|
| 84 | if ( handle->capabilities.analog ) |
|---|
| 85 | { |
|---|
| 86 | pSettings->signalTypes[NEXUS_FrontendSignalType_eAnalog] = true; |
|---|
| 87 | } |
|---|
| 88 | if ( handle->capabilities.ofdm ) |
|---|
| 89 | { |
|---|
| 90 | pSettings->signalTypes[NEXUS_FrontendSignalType_eDvbt] = true; |
|---|
| 91 | if ( handle->capabilities.ofdmModes[NEXUS_FrontendOfdmMode_eIsdbt] ) |
|---|
| 92 | { |
|---|
| 93 | pSettings->signalTypes[NEXUS_FrontendSignalType_eIsdbt] = true; |
|---|
| 94 | } |
|---|
| 95 | } |
|---|
| 96 | } |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | /*************************************************************************** |
|---|
| 100 | Summary: |
|---|
| 101 | Scan a frequency for specified signal types |
|---|
| 102 | |
|---|
| 103 | Description: |
|---|
| 104 | This is a blocking function. It will return NEXUS_SUCCESS if a signal |
|---|
| 105 | is detected matching the specified settings. If no signal is |
|---|
| 106 | detected, NEXUS_TIMEOUT will be returned. |
|---|
| 107 | ***************************************************************************/ |
|---|
| 108 | NEXUS_Error NEXUS_Frontend_ScanFrequency( |
|---|
| 109 | NEXUS_FrontendHandle handle, |
|---|
| 110 | const NEXUS_FrontendScanSettings *pSettings, |
|---|
| 111 | NEXUS_FrontendScanResults *pResults /* [out] */ |
|---|
| 112 | ) |
|---|
| 113 | { |
|---|
| 114 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 115 | BDBG_ASSERT(NULL != pSettings); |
|---|
| 116 | BDBG_ASSERT(NULL != pResults); |
|---|
| 117 | |
|---|
| 118 | if ( NULL == handle->scanFrequency ) |
|---|
| 119 | { |
|---|
| 120 | if ( handle->pParentFrontend ) |
|---|
| 121 | { |
|---|
| 122 | return NEXUS_Frontend_ScanFrequency(handle->pParentFrontend, pSettings, pResults); |
|---|
| 123 | } |
|---|
| 124 | else |
|---|
| 125 | { |
|---|
| 126 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 127 | } |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | return handle->scanFrequency(handle->pDeviceHandle, pSettings, pResults); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | /*************************************************************************** |
|---|
| 134 | Summary: |
|---|
| 135 | Get thresholds for NEXUS_Frontend_ScanFrequency operation |
|---|
| 136 | ***************************************************************************/ |
|---|
| 137 | void NEXUS_Frontend_GetScanThresholds( |
|---|
| 138 | NEXUS_FrontendHandle handle, |
|---|
| 139 | NEXUS_FrontendScanThresholds *pThresholds /* [out] */ |
|---|
| 140 | ) |
|---|
| 141 | { |
|---|
| 142 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 143 | BDBG_ASSERT(NULL != pThresholds); |
|---|
| 144 | |
|---|
| 145 | if ( handle->getScanThresholds ) |
|---|
| 146 | { |
|---|
| 147 | handle->getScanThresholds(handle->pDeviceHandle, pThresholds); |
|---|
| 148 | } |
|---|
| 149 | else if ( handle->pParentFrontend ) |
|---|
| 150 | { |
|---|
| 151 | NEXUS_Frontend_GetScanThresholds(handle->pParentFrontend, pThresholds); |
|---|
| 152 | } |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | /*************************************************************************** |
|---|
| 156 | Summary: |
|---|
| 157 | Set thresholds for NEXUS_Frontend_ScanFrequency operation |
|---|
| 158 | ***************************************************************************/ |
|---|
| 159 | NEXUS_Error NEXUS_Frontend_SetScanThresholds( |
|---|
| 160 | NEXUS_FrontendHandle handle, |
|---|
| 161 | const NEXUS_FrontendScanThresholds *pThresholds |
|---|
| 162 | ) |
|---|
| 163 | { |
|---|
| 164 | BDBG_OBJECT_ASSERT(handle, NEXUS_Frontend); |
|---|
| 165 | BDBG_ASSERT(NULL != pThresholds); |
|---|
| 166 | |
|---|
| 167 | if ( NULL == handle->setScanThresholds ) |
|---|
| 168 | { |
|---|
| 169 | if ( handle->pParentFrontend ) |
|---|
| 170 | { |
|---|
| 171 | return NEXUS_Frontend_SetScanThresholds(handle->pParentFrontend, pThresholds); |
|---|
| 172 | } |
|---|
| 173 | else |
|---|
| 174 | { |
|---|
| 175 | return BERR_TRACE(BERR_NOT_SUPPORTED); |
|---|
| 176 | } |
|---|
| 177 | } |
|---|
| 178 | else |
|---|
| 179 | { |
|---|
| 180 | return handle->setScanThresholds(handle->pDeviceHandle, pThresholds); |
|---|
| 181 | } |
|---|
| 182 | } |
|---|
| 183 | |
|---|