/****************************************************************************** * (c)2008-2009 Broadcom Corporation * * This program is the proprietary software of Broadcom Corporation and/or its licensors, * and may only be used, duplicated, modified or distributed pursuant to the terms and * conditions of a separate, written license agreement executed between you and Broadcom * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants * no license (express or implied), right to use, or waiver of any kind with respect to the * Software, and Broadcom expressly reserves all rights in and to the Software and all * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. * * Except as expressly set forth in the Authorized License, * * 1. This program, including its structure, sequence and organization, constitutes the valuable trade * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, * and to use this information only in connection with your use of Broadcom integrated circuit products. * * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF * USE OR PERFORMANCE OF THE SOFTWARE. * * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF * ANY LIMITED REMEDY. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: * * Utility to handle the frontend configuration and tuning. * * Revision History: * * Created: 09/28/2009 by Jeff Fisher * * $brcm_Log: $ * * *****************************************************************************/ #include "bapp_tune.h" #include "bapp.h" #include "nexus_frontend.h" #include "nexus_platform.h" #include "nexus_parser_band.h" #include "nexus_video_decoder.h" #define MAX_EVENT 4 enum { eFE_EVENT_NONE, eFE_EVENT_LOCK, eFE_EVENT_MAX }; struct bapp_tune { bapp_tune_event_t signal_evt; bapp_freq_table_type_t fe_type; NEXUS_FrontendHandle frontend; NEXUS_ParserBand parserBand; NEXUS_FrontendVsbSettings vsbSettings; NEXUS_FrontendQamSettings qamSettings; bapp_task_queue_t queue; bapp_task_event_t event[MAX_EVENT]; unsigned int timeout_ms; }; /** Summary: Return a bapp_tune handle if frontend exists. NEXUS init should be called before calling this function. **/ bapp_result_t bapp_tune_open(bapp_tune_type_t fe_type, bapp_tune_t *p_app_tune, int *band) { bapp_tune_t p_tune = NULL; bool found_frontend = false; int i; p_tune = (bapp_tune_t)bapp_util_malloc(sizeof(struct bapp_tune)); if (!p_tune) return eBAPP_RESULT_ALLOC_FAILURE; bapp_util_memset(p_tune,0,sizeof(struct bapp_tune)); if (bapp_task_create_queue(&p_tune->queue,p_tune->event,MAX_EVENT) != eBAPP_RESULT_OK) { bapp_util_free(p_tune); return eBAPP_RESULT_ALLOC_FAILURE; } p_tune->fe_type = fe_type; p_tune->frontend = NULL; p_tune->parserBand = NEXUS_ParserBand_e0; *band = p_tune->parserBand; *p_app_tune = p_tune; return eBAPP_RESULT_OK; } /** Summary: Release resources. **/ bapp_result_t bapp_tune_close(bapp_tune_t p_tune) { bapp_task_delete_queue(p_tune->queue); bapp_util_free(p_tune); return eBAPP_RESULT_OK; } /** Summary: Lock the frontend. **/ bapp_result_t bapp_tune_lock(bapp_tune_t p_tune, unsigned int freq_hz) { bapp_task_event_t event; bapp_task_reset_queue(p_tune->queue); return eBAPP_RESULT_OK; } /** Summary: Unlock the frontend. **/ bapp_result_t bapp_tune_unlock(bapp_tune_t p_tune) { return eBAPP_RESULT_OK; } /* Summary: Send frontend status event to the application. */ void bapp_tune_send_status(bapp_tune_t p_tune) { }