| 1 | /****************************************************************************** |
|---|
| 2 | * (c)2008-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: $ |
|---|
| 39 | * $brcm_Revision: $ |
|---|
| 40 | * $brcm_Date: $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Manage application settings like volume, channel map, etc. |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * Created: 09/28/2009 by Jeff Fisher |
|---|
| 49 | * |
|---|
| 50 | * $brcm_Log: $ |
|---|
| 51 | * |
|---|
| 52 | * |
|---|
| 53 | *****************************************************************************/ |
|---|
| 54 | #ifndef BAPP_SETTINGS_H__ |
|---|
| 55 | #define BAPP_SETTINGS_H__ |
|---|
| 56 | |
|---|
| 57 | #include "bsettop.h" |
|---|
| 58 | #include "ch_map.h" |
|---|
| 59 | #include "psip_descriptor.h" |
|---|
| 60 | #include "bapp.h" |
|---|
| 61 | |
|---|
| 62 | /* definitions for the various settings ids */ |
|---|
| 63 | #define BAST_BASE_ID (1) |
|---|
| 64 | #define BAST_EAS_ID (BAST_BASE_ID + 1) |
|---|
| 65 | #define BAST_MISC_ID (BAST_BASE_ID + 2) |
|---|
| 66 | #define BAST_CHANNEL_MAP_ID (BAST_BASE_ID + 3) |
|---|
| 67 | #define BAST_CHANNEL_ID (BAST_BASE_ID + 4) |
|---|
| 68 | #define BAST_GP_NVM_VERSION_ID (BAST_BASE_ID + 5) |
|---|
| 69 | #define BAST_GP_TARGET_INFO_ID (BAST_BASE_ID + 6) |
|---|
| 70 | #define BAST_GP_NIB_FRAME_CNT_ID (BAST_BASE_ID + 7) |
|---|
| 71 | #define BAST_GP_NIB_BASE_CH_ID (BAST_BASE_ID + 8) |
|---|
| 72 | #define BAST_GP_NIB_POWER_SAVE_ID (BAST_BASE_ID + 9) |
|---|
| 73 | #define BAST_GP_NIB_GENERAL_ID (BAST_BASE_ID + 10) |
|---|
| 74 | #define BAST_GP_PAIRING_ID_0 (BAST_BASE_ID + 11) |
|---|
| 75 | #define BAST_GP_PAIRING_ID_1 (BAST_BASE_ID + 12) |
|---|
| 76 | #define BAST_GP_PAIRING_ID_2 (BAST_BASE_ID + 13) |
|---|
| 77 | #define BAST_GP_PAIRING_ID_3 (BAST_BASE_ID + 14) |
|---|
| 78 | #define BAST_GP_PAIRING_ID_4 (BAST_BASE_ID + 15) |
|---|
| 79 | #define BAST_GP_PAIRING_ID_5 (BAST_BASE_ID + 16) |
|---|
| 80 | #define BAST_GP_VAL_ID (BAST_BASE_ID + 17) |
|---|
| 81 | #define BAST_GP_KICK_ID (BAST_BASE_ID + 18) |
|---|
| 82 | #define BAST_GP_RIB_ID_0 (BAST_BASE_ID + 19) |
|---|
| 83 | #define BAST_GP_RIB_ID_1 (BAST_BASE_ID + 20) |
|---|
| 84 | #define BAST_DCC_ID (BAST_BASE_ID + 21) |
|---|
| 85 | #define BAST_RRT_SETTINGS_ID (BAST_BASE_ID + 22) |
|---|
| 86 | #define BAST_RRT_DIM_0 (BAST_BASE_ID + 23) |
|---|
| 87 | #define BAST_RRT_DIM_1 (BAST_BASE_ID + 24) |
|---|
| 88 | #define BAST_RRT_DIM_2 (BAST_BASE_ID + 25) |
|---|
| 89 | #define BAST_RRT_TBL_0 (BAST_BASE_ID + 27) |
|---|
| 90 | #define BAST_RRT_TBL_1 (BAST_BASE_ID + 27) |
|---|
| 91 | #define BAST_RRT_TBL_2 (BAST_BASE_ID + 28) |
|---|
| 92 | #define BAST_RRT_TBL_3 (BAST_BASE_ID + 29) |
|---|
| 93 | #define BAST_RRT_TBL_4 (BAST_BASE_ID + 30) |
|---|
| 94 | #define BAST_RATINGS_ID (BAST_BASE_ID + 31) |
|---|
| 95 | |
|---|
| 96 | #define BAST_SCREEN_ID (BAST_BASE_ID + 32) |
|---|
| 97 | |
|---|
| 98 | struct eas_settings_t { |
|---|
| 99 | uint8_t eas_filter_control; |
|---|
| 100 | uint8_t eas_state_code; |
|---|
| 101 | uint8_t eas_county_subdivision; |
|---|
| 102 | uint16_t eas_county_code; |
|---|
| 103 | } __attribute__((packed)); |
|---|
| 104 | |
|---|
| 105 | struct bit_item_t { |
|---|
| 106 | unsigned int standby : 1; |
|---|
| 107 | unsigned int has_CAT : 1; |
|---|
| 108 | unsigned int av_mute : 1; |
|---|
| 109 | unsigned int psi_scan : 1; |
|---|
| 110 | unsigned int state : 4; |
|---|
| 111 | unsigned int dummy : 22; |
|---|
| 112 | }; |
|---|
| 113 | |
|---|
| 114 | struct misc_settings_t { |
|---|
| 115 | struct bit_item_t bits; |
|---|
| 116 | uint8_t dst_delta; |
|---|
| 117 | uint8_t timeout_policy; |
|---|
| 118 | uint8_t dummy0; |
|---|
| 119 | uint16_t hunt_cnt; |
|---|
| 120 | uint16_t timeout; |
|---|
| 121 | uint16_t max_location_errors; |
|---|
| 122 | uint16_t location_errors; |
|---|
| 123 | uint32_t message_time; |
|---|
| 124 | uint32_t turn_on_freq_khz; |
|---|
| 125 | uint32_t addressable_time; |
|---|
| 126 | uint32_t timeout_cnt; |
|---|
| 127 | uint32_t location; |
|---|
| 128 | int32_t utc_offset; |
|---|
| 129 | uint32_t dst_entry; |
|---|
| 130 | uint32_t dst_exit; |
|---|
| 131 | |
|---|
| 132 | uint16_t aspect_ratio; |
|---|
| 133 | uint16_t hd_options; |
|---|
| 134 | uint16_t output_format; |
|---|
| 135 | uint16_t sharpness; |
|---|
| 136 | uint16_t sd_options; |
|---|
| 137 | } __attribute__((packed)); |
|---|
| 138 | |
|---|
| 139 | /* header information about stored channel map */ |
|---|
| 140 | struct channel_map_header_settings_t { |
|---|
| 141 | uint8_t ch_count; |
|---|
| 142 | uint8_t freq_count; |
|---|
| 143 | uint16_t st_count; |
|---|
| 144 | uint16_t vch_count; |
|---|
| 145 | } __attribute__((packed)); |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | struct mms_item_t { |
|---|
| 149 | uint8_t idx; |
|---|
| 150 | uint8_t code_rate; |
|---|
| 151 | uint8_t modulation; |
|---|
| 152 | uint32_t symbol_rate; |
|---|
| 153 | } __attribute__((packed)); |
|---|
| 154 | |
|---|
| 155 | /* we pack 8 mms structures in to one tuple to reduce overhead 56 bytes*/ |
|---|
| 156 | struct mms_entry_settings_t { |
|---|
| 157 | struct mms_item_t mms[8]; |
|---|
| 158 | } __attribute__((packed)); |
|---|
| 159 | |
|---|
| 160 | struct freq_item_t { |
|---|
| 161 | uint8_t idx; |
|---|
| 162 | uint32_t freq_khz; |
|---|
| 163 | } __attribute__((packed)); |
|---|
| 164 | |
|---|
| 165 | /* pack 8 freq structures in to one tuple */ |
|---|
| 166 | struct freq_entry_settings_t { |
|---|
| 167 | struct freq_item_t freq[8]; |
|---|
| 168 | } __attribute__((packed)); |
|---|
| 169 | |
|---|
| 170 | /* 19 bytes */ |
|---|
| 171 | struct st_entry_settings_t { |
|---|
| 172 | uint16_t source_id; |
|---|
| 173 | uint8_t name[17]; |
|---|
| 174 | } __attribute__((packed)); |
|---|
| 175 | |
|---|
| 176 | struct screen_settings_t { |
|---|
| 177 | unsigned int sound : 2; |
|---|
| 178 | unsigned int picture : 1; |
|---|
| 179 | unsigned int language : 2; |
|---|
| 180 | unsigned int wiz_completed : 1; |
|---|
| 181 | unsigned int ratings_lock : 2; |
|---|
| 182 | unsigned int ratings_tv : 18; |
|---|
| 183 | unsigned int ratings_movies : 7; |
|---|
| 184 | unsigned int content_d : 1; |
|---|
| 185 | unsigned int content_l : 1; |
|---|
| 186 | unsigned int content_s : 1; |
|---|
| 187 | unsigned int content_v : 1; |
|---|
| 188 | unsigned int captions_basic : 4; |
|---|
| 189 | unsigned int captions_font : 3; |
|---|
| 190 | unsigned int captions_font_size : 2; |
|---|
| 191 | unsigned int captions_font_style : 2; |
|---|
| 192 | unsigned int captions_font_color : 4; |
|---|
| 193 | unsigned int captions_font_opacity : 3; |
|---|
| 194 | unsigned int captions_back_color : 4; |
|---|
| 195 | unsigned int captions_back_opacity : 3; |
|---|
| 196 | unsigned int captions_edge_color : 4; |
|---|
| 197 | unsigned int captions_edge_type : 3; |
|---|
| 198 | unsigned int auto_power_off : 2; /* handle no signal case */ |
|---|
| 199 | unsigned int rrt_status : 2; |
|---|
| 200 | unsigned int time_zone : 4; |
|---|
| 201 | unsigned int dst : 1; |
|---|
| 202 | unsigned int analog_captioning : 1; |
|---|
| 203 | unsigned int last_rrt_id : 16; |
|---|
| 204 | unsigned int pin : 32; |
|---|
| 205 | unsigned int auto_power : 32; |
|---|
| 206 | } __attribute__((packed)); |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | #define VCH_MAX_AUDIO 4 |
|---|
| 210 | #define VCH_MAX_DSUB 4 |
|---|
| 211 | /* 43 bytes long */ |
|---|
| 212 | struct vch_entry_settings_t { |
|---|
| 213 | uint16_t ch_num; |
|---|
| 214 | uint16_t source_id; |
|---|
| 215 | uint16_t program_num; |
|---|
| 216 | uint16_t pcr_pid; |
|---|
| 217 | uint16_t scte127_pid; |
|---|
| 218 | uint16_t video_pid; |
|---|
| 219 | uint16_t ca_pid; |
|---|
| 220 | uint16_t audio_pid[VCH_MAX_AUDIO]; |
|---|
| 221 | uint8_t audio_type[VCH_MAX_AUDIO]; |
|---|
| 222 | int8_t audio_lang[VCH_MAX_AUDIO][3]; |
|---|
| 223 | uint8_t freq_idx; |
|---|
| 224 | uint8_t mms_idx; |
|---|
| 225 | uint8_t video_type; |
|---|
| 226 | uint8_t vchflags; |
|---|
| 227 | uint8_t audio_count; |
|---|
| 228 | uint8_t audio_current; |
|---|
| 229 | #ifdef CONFIG_DVB_SUBTITLE |
|---|
| 230 | uint8_t dsub_count; |
|---|
| 231 | uint8_t dsub_current; |
|---|
| 232 | uint16_t dsub_pid[VCH_MAX_DSUB]; |
|---|
| 233 | uint8_t dsub_lang[VCH_MAX_DSUB][3]; |
|---|
| 234 | uint16_t dsub_page[VCH_MAX_DSUB]; |
|---|
| 235 | #endif |
|---|
| 236 | } __attribute__((packed)); |
|---|
| 237 | |
|---|
| 238 | /* 3 bytes */ |
|---|
| 239 | struct channel_settings_t { |
|---|
| 240 | uint16_t channel; /* current channel */ |
|---|
| 241 | uint8_t volume; |
|---|
| 242 | uint16_t num_channels; /* total channels */ |
|---|
| 243 | bool rfm; /* RFM channel for ACB612 */ |
|---|
| 244 | } __attribute__((packed)); |
|---|
| 245 | |
|---|
| 246 | /* note that we will reuse the channel DB for current channel number */ |
|---|
| 247 | struct ch_map_settings_t |
|---|
| 248 | { |
|---|
| 249 | unsigned short major; |
|---|
| 250 | unsigned short minor; |
|---|
| 251 | unsigned short freq_idx; |
|---|
| 252 | bool psi; |
|---|
| 253 | unsigned short pcr_pid; |
|---|
| 254 | unsigned short video_pid; |
|---|
| 255 | unsigned char has_lang; |
|---|
| 256 | bool hidden; |
|---|
| 257 | unsigned short video_type; |
|---|
| 258 | unsigned short program_num; |
|---|
| 259 | unsigned short num_audio; |
|---|
| 260 | unsigned short audio_pid[MAX_AUDIO_PIDS]; |
|---|
| 261 | unsigned short ch_name[MAX_CH_SHORT_NAME_CHARS]; |
|---|
| 262 | unsigned short audio_type[MAX_AUDIO_PIDS]; |
|---|
| 263 | unsigned char audio_lang[MAX_AUDIO_PIDS][3]; |
|---|
| 264 | unsigned int frequency_khz; |
|---|
| 265 | unsigned int cur_audio; |
|---|
| 266 | unsigned int source_id; |
|---|
| 267 | bool skip; |
|---|
| 268 | bool favorite; |
|---|
| 269 | } __attribute__((packed)); |
|---|
| 270 | |
|---|
| 271 | #ifdef __cplusplus |
|---|
| 272 | extern "C" { |
|---|
| 273 | #endif |
|---|
| 274 | |
|---|
| 275 | void bast_init(bapp_t *app); |
|---|
| 276 | void bast_channel_save(bapp_t *app); |
|---|
| 277 | void bast_misc_save(bapp_t *app); |
|---|
| 278 | void bast_eas_save(bapp_t *app); |
|---|
| 279 | void bast_channel_map_save(bapp_t *app); |
|---|
| 280 | int bast_channel_read(bapp_t *app); |
|---|
| 281 | int bast_misc_read(bapp_t *app); |
|---|
| 282 | int bast_eas_read(bapp_t *app); |
|---|
| 283 | int bast_channel_map_read(bapp_t *app); |
|---|
| 284 | |
|---|
| 285 | void bast_gp_nvm_save(uint8_t tag, uint8_t size, uint8_t *data); |
|---|
| 286 | int bast_gp_nvm_read(uint8_t tag, uint8_t *size, uint8_t *data); |
|---|
| 287 | |
|---|
| 288 | void bast_dcc_save(dcc_settings_t *settings); |
|---|
| 289 | int bast_dcc_read(dcc_settings_t *settings); |
|---|
| 290 | |
|---|
| 291 | void bast_ratings_save(ratings_settings_t *settings); |
|---|
| 292 | int bast_ratings_read(ratings_settings_t *settings); |
|---|
| 293 | |
|---|
| 294 | void bast_rrt_save(rrt_settings_t *settings); |
|---|
| 295 | int bast_rrt_read(rrt_settings_t *settings); |
|---|
| 296 | |
|---|
| 297 | void bast_screen_save(bapp_t *app); |
|---|
| 298 | int bast_screen_read(bapp_t *app); |
|---|
| 299 | |
|---|
| 300 | #ifdef __cplusplus |
|---|
| 301 | } |
|---|
| 302 | #endif |
|---|
| 303 | |
|---|
| 304 | #endif /* BAPP_SETTINGS_H__ */ |
|---|