/****************************************************************************** * (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: * * Manage application settings like volume, channel map, etc. * * Revision History: * * Created: 09/28/2009 by Jeff Fisher * * $brcm_Log: $ * * *****************************************************************************/ #ifndef BAPP_SETTINGS_H__ #define BAPP_SETTINGS_H__ #include "bsettop.h" #include "ch_map.h" #include "psip_descriptor.h" #include "bapp.h" /* definitions for the various settings ids */ #define BAST_BASE_ID (1) #define BAST_EAS_ID (BAST_BASE_ID) #define BAST_MISC_ID (BAST_EAS_ID+1) #define BAST_PHONE_NUMBER_ID (BAST_MISC_ID+1) #define BAST_CHANNEL_MAP_HEADER_ID (BAST_PHONE_NUMBER_ID+1) #define BAST_MMS_ENTRY_ID (BAST_CHANNEL_MAP_HEADER_ID+1) #define BAST_FREQ_ENTRY_ID (BAST_MMS_ENTRY_ID+1) #define BAST_ST_ENTRY_ID (BAST_FREQ_ENTRY_ID+1) #define BAST_VCH_ENTRY_ID (BAST_ST_ENTRY_ID+1) #define BAST_CHANNEL_ID (BAST_VCH_ENTRY_ID+1) #define BAST_SHARED_KEY_ID (BAST_CHANNEL_ID+1) #define BAST_UPK_GENERATOR_ID (BAST_SHARED_KEY_ID+1) #define BAST_GP_NVM_VERSION_ID (BAST_UPK_GENERATOR_ID+1) #define BAST_GP_TARGET_INFO_ID (BAST_GP_NVM_VERSION_ID+1) #define BAST_GP_NIB_FRAME_CNT_ID (BAST_GP_TARGET_INFO_ID+1) #define BAST_GP_NIB_BASE_CH_ID (BAST_GP_NIB_FRAME_CNT_ID+1) #define BAST_GP_NIB_POWER_SAVE_ID (BAST_GP_NIB_BASE_CH_ID+1) #define BAST_GP_NIB_GENERAL_ID (BAST_GP_NIB_POWER_SAVE_ID+1) #define BAST_GP_PAIRING_ID_0 (BAST_GP_NIB_GENERAL_ID+1) #define BAST_GP_PAIRING_ID_1 (BAST_GP_PAIRING_ID_0+1) #define BAST_GP_PAIRING_ID_2 (BAST_GP_PAIRING_ID_1+1) #define BAST_GP_PAIRING_ID_3 (BAST_GP_PAIRING_ID_2+1) #define BAST_GP_PAIRING_ID_4 (BAST_GP_PAIRING_ID_3+1) #define BAST_GP_PAIRING_ID_5 (BAST_GP_PAIRING_ID_4+1) #define BAST_GP_VAL_ID (BAST_GP_PAIRING_ID_5+1) #define BAST_GP_KICK_ID (BAST_GP_VAL_ID+1) #define BAST_GP_RIB_ID_0 (BAST_GP_KICK_ID+1) #define BAST_GP_RIB_ID_1 (BAST_GP_RIB_ID_0+1) #define BAST_DCC_ID (BAST_GP_RIB_ID_1+1) #define BAST_RRT_SETTINGS_ID (BAST_DCC_ID+1) #define BAST_RRT_DIM_0 (BAST_RRT_SETTINGS_ID+1) #define BAST_RRT_DIM_1 (BAST_RRT_DIM_0+1) #define BAST_RRT_DIM_2 (BAST_RRT_DIM_1+1) #define BAST_RRT_TBL_0 (BAST_RRT_DIM_2+1) #define BAST_RRT_TBL_1 (BAST_RRT_TBL_0+1) #define BAST_RRT_TBL_2 (BAST_RRT_TBL_1+1) #define BAST_RRT_TBL_3 (BAST_RRT_TBL_2+1) #define BAST_RRT_TBL_4 (BAST_RRT_TBL_3+1) #define BAST_RATINGS_ID (BAST_RRT_TBL_4+1) #define BAST_SCREEN_ID (BAST_RATINGS_ID+1) struct eas_settings_t { uint8_t eas_filter_control; uint8_t eas_state_code; uint8_t eas_county_subdivision; uint16_t eas_county_code; } __attribute__((packed)); struct bit_item_t { unsigned int activated : 1; unsigned int deactivated : 1; unsigned int standby : 1; unsigned int has_CAT : 1; unsigned int av_mute : 1; unsigned int psi_scan : 1; unsigned int state : 4; unsigned int dummy : 22; }; struct misc_settings_t { struct bit_item_t bits; uint8_t dst_delta; uint8_t timeout_policy; uint8_t SCP_operating_mode; uint8_t dummy0; uint16_t CA_System_ID; uint16_t EMM_Provider_ID; uint16_t EMM_PID; uint16_t VCT_ID; uint16_t network_PID; uint16_t hunt_cnt; uint16_t download_failed_cnt; uint16_t download_invalid_cnt; uint16_t timeout; uint16_t max_location_errors; uint16_t location_errors; uint32_t message_time; uint32_t turn_on_freq_khz; uint32_t addressable_time; uint32_t timeout_cnt; uint32_t location; int32_t utc_offset; uint32_t dst_entry; uint32_t dst_exit; uint16_t aspect_ratio; uint16_t hd_options; uint16_t output_format; uint16_t sharpness; uint16_t sd_options; } __attribute__((packed)); struct phone_number_settings_t { uint8_t size; uint8_t data[MAX_PHONE_LEN-2]; } __attribute__((packed)); /* header information about stored channel map */ struct channel_map_header_settings_t { uint8_t mms_count; uint8_t freq_count; uint16_t st_count; uint16_t vch_count; } __attribute__((packed)); struct mms_item_t { uint8_t idx; uint8_t code_rate; uint8_t modulation; uint32_t symbol_rate; } __attribute__((packed)); /* we pack 8 mms structures in to one tuple to reduce overhead 56 bytes*/ struct mms_entry_settings_t { struct mms_item_t mms[8]; } __attribute__((packed)); struct freq_item_t { uint8_t idx; uint32_t freq_khz; } __attribute__((packed)); /* pack 8 freq structures in to one tuple */ struct freq_entry_settings_t { struct freq_item_t freq[8]; } __attribute__((packed)); /* 19 bytes */ struct st_entry_settings_t { uint16_t source_id; uint8_t name[17]; } __attribute__((packed)); struct screen_settings_t { unsigned int sound : 2; unsigned int picture : 1; unsigned int language : 2; unsigned int wiz_completed : 1; unsigned int ratings_lock : 2; unsigned int ratings_tv : 18; unsigned int ratings_movies : 7; unsigned int content_d : 1; unsigned int content_l : 1; unsigned int content_s : 1; unsigned int content_v : 1; unsigned int captions_basic : 4; unsigned int captions_font : 3; unsigned int captions_font_size : 2; unsigned int captions_font_style : 2; unsigned int captions_font_color : 4; unsigned int captions_font_opacity : 3; unsigned int captions_back_color : 4; unsigned int captions_back_opacity : 3; unsigned int captions_edge_color : 4; unsigned int captions_edge_type : 3; unsigned int auto_power_off : 1; unsigned int rrt_status : 2; unsigned int time_zone : 4; unsigned int dst : 1; unsigned int last_rrt_id : 16; unsigned int pin : 32; unsigned int auto_power : 32; } __attribute__((packed)); #define VCH_MAX_AUDIO 4 #define VCH_MAX_DSUB 4 /* 43 bytes long */ struct vch_entry_settings_t { uint16_t ch_num; uint16_t source_id; uint16_t program_num; uint16_t pcr_pid; uint16_t scte127_pid; uint16_t video_pid; uint16_t ca_pid; uint16_t audio_pid[VCH_MAX_AUDIO]; uint8_t audio_type[VCH_MAX_AUDIO]; int8_t audio_lang[VCH_MAX_AUDIO][3]; uint8_t freq_idx; uint8_t mms_idx; uint8_t video_type; uint8_t vchflags; uint8_t audio_count; uint8_t audio_current; #ifdef CONFIG_DVB_SUBTITLE uint8_t dsub_count; uint8_t dsub_current; uint16_t dsub_pid[VCH_MAX_DSUB]; uint8_t dsub_lang[VCH_MAX_DSUB][3]; uint16_t dsub_page[VCH_MAX_DSUB]; #endif } __attribute__((packed)); /* 3 bytes */ struct channel_settings_t { uint16_t channel; uint8_t volume; } __attribute__((packed)); struct shared_key_settings_t { uint8_t decryption_key_type; uint8_t shared_key_A [16]; uint8_t shared_key_B [16]; } __attribute__((packed)); struct upk_generator_settings_t { uint8_t upk_generator_size; uint8_t upk_generator_A[110]; uint8_t upk_generator_B[110]; } __attribute__((packed)); #ifdef __cplusplus extern "C" { #endif void bast_init(bapp_t *app); void bast_channel_save(bapp_t *app); void bast_misc_save(bapp_t *app); void bast_eas_save(bapp_t *app); void bast_phone_number_save(bapp_t *app); void bast_channel_map_save(bapp_t *app); int bast_channel_read(bapp_t *app); int bast_misc_read(bapp_t *app); int bast_eas_read(bapp_t *app); int bast_phone_number_read(bapp_t *app); int bast_channel_map_read(bapp_t *app); void bast_shared_key_save(struct shared_key_settings_t * key); int bast_shared_key_read(struct shared_key_settings_t * key); void bast_upk_generator_save(struct upk_generator_settings_t * gen); int bast_upk_generator_read(struct upk_generator_settings_t * gen); void bast_gp_nvm_save(uint8_t tag, uint8_t size, uint8_t *data); int bast_gp_nvm_read(uint8_t tag, uint8_t *size, uint8_t *data); void bast_dcc_save(dcc_settings_t *settings); int bast_dcc_read(dcc_settings_t *settings); void bast_ratings_save(ratings_settings_t *settings); int bast_ratings_read(ratings_settings_t *settings); void bast_rrt_save(rrt_settings_t *settings); int bast_rrt_read(rrt_settings_t *settings); void bast_screen_save(bapp_t *app); int bast_screen_read(bapp_t *app); #ifdef __cplusplus } #endif #endif /* BAPP_SETTINGS_H__ */