| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | #include "led.h" |
|---|
| 22 | #include "ministd.h" |
|---|
| 23 | #include "bsettop_types.h" |
|---|
| 24 | #include "bsettop.h" |
|---|
| 25 | #include "bsettop_tuner.h" |
|---|
| 26 | #include "bsettop_decode_audio.h" |
|---|
| 27 | #include "bsettop_decode.h" |
|---|
| 28 | #include "bsettop_display.h" |
|---|
| 29 | #include "bsettop_hdmi.h" |
|---|
| 30 | #include "bsettop_rfm.h" |
|---|
| 31 | #include "bgfx.h" |
|---|
| 32 | #include "bspi_flash.h" |
|---|
| 33 | |
|---|
| 34 | unsigned led_set_mode(enum led_mode_t mode) |
|---|
| 35 | { |
|---|
| 36 | return 0; |
|---|
| 37 | } |
|---|
| 38 | unsigned led_update(unsigned elapsed_time) |
|---|
| 39 | { |
|---|
| 40 | return 0; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | #define DBG_PRINT(x) printf x |
|---|
| 44 | |
|---|
| 45 | #define OSD_WIDTH 720 |
|---|
| 46 | #if DISPLAY_NTSC |
|---|
| 47 | #define OSD_HEIGHT 480 |
|---|
| 48 | #else |
|---|
| 49 | #if DISPLAY_PAL |
|---|
| 50 | #define OSD_HEIGHT 576 |
|---|
| 51 | #else |
|---|
| 52 | #error display format (NTSC or PAL) must be defined |
|---|
| 53 | #endif |
|---|
| 54 | #endif |
|---|
| 55 | #define OSD_PITCH (720/2) |
|---|
| 56 | #define NUM_EVENTS 2 |
|---|
| 57 | |
|---|
| 58 | #define GRC_TOP_SLOT 0 |
|---|
| 59 | #define GRC_BOT_SLOT 1 |
|---|
| 60 | |
|---|
| 61 | #define FIELD_MASK ((1UL << GRC_TOP_SLOT) | (1UL << GRC_BOT_SLOT)) |
|---|
| 62 | |
|---|
| 63 | #define MUTEX_TIMEOUT 100 /* milliseconds */ |
|---|
| 64 | #define PEND_TIMEOUT 100 /* milliseconds */ |
|---|
| 65 | |
|---|
| 66 | typedef enum bgraphics_state_t |
|---|
| 67 | { |
|---|
| 68 | eGS_UNINITIALIZED, |
|---|
| 69 | eGS_DEFAULT, |
|---|
| 70 | eGS_PALETTE_SET, |
|---|
| 71 | eGS_PALETTE_LOADED, |
|---|
| 72 | eGS_FB_SET, |
|---|
| 73 | }bgraphics_state_t; |
|---|
| 74 | |
|---|
| 75 | struct bgraphics |
|---|
| 76 | { |
|---|
| 77 | bgraphics_state_t state; |
|---|
| 78 | unsigned int surf_idx; |
|---|
| 79 | unsigned int field_mask; |
|---|
| 80 | unsigned int *p_palette; |
|---|
| 81 | int format; /* P4 and RGB format */ |
|---|
| 82 | int pitch; /* pitch associated with format to use */ |
|---|
| 83 | int bpp; |
|---|
| 84 | b_queue_t queue; |
|---|
| 85 | b_mutex_t mutex; |
|---|
| 86 | b_event_t events[NUM_EVENTS]; |
|---|
| 87 | bgfx_surf_t surf[2]; |
|---|
| 88 | }; |
|---|
| 89 | static struct bgraphics s_graphics = { eGS_UNINITIALIZED, 0, 0, NULL , bgraphics_pixel_format_a8_r8_g8_b8, OSD_PITCH * 8,32 }; |
|---|
| 90 | extern void get_osd_info(unsigned char **pixels, int *pitch, int *width, int *height); |
|---|
| 91 | extern void update_osd(); |
|---|
| 92 | bgraphics_t bgraphics_open( bobject_t id, bdisplay_t display) |
|---|
| 93 | { |
|---|
| 94 | unsigned int flags; |
|---|
| 95 | unsigned char *p_surf; |
|---|
| 96 | unsigned char *pixels; |
|---|
| 97 | uint16_t s_width, s_height, s_pitch; |
|---|
| 98 | int pitch,width,height,bpp; |
|---|
| 99 | |
|---|
| 100 | get_osd_info(&pixels,&pitch,&width,&height); |
|---|
| 101 | s_pitch = (uint16_t)pitch; |
|---|
| 102 | s_width = (uint16_t)width; |
|---|
| 103 | s_height = (uint16_t)height; |
|---|
| 104 | if (s_graphics.state > eGS_UNINITIALIZED) |
|---|
| 105 | return (bgraphics_t)0; |
|---|
| 106 | |
|---|
| 107 | switch (s_graphics.format) |
|---|
| 108 | { |
|---|
| 109 | case bgraphics_pixel_format_a8_r8_g8_b8: |
|---|
| 110 | case bgraphics_pixel_format_y08_cb8_y18_cr8: |
|---|
| 111 | pitch = width * 4; |
|---|
| 112 | bpp = 32; |
|---|
| 113 | break; |
|---|
| 114 | #if 0 |
|---|
| 115 | case bgraphics_pixel_format_r5_g6_b5: |
|---|
| 116 | case bgraphics_pixel_format_a1_r5_g5_b5: |
|---|
| 117 | case bgraphics_pixel_format_r5_g5_b5_a1: |
|---|
| 118 | case bgraphics_pixel_format_a4_r4_g4_b4: |
|---|
| 119 | case bgraphics_pixel_format_r4_g4_b4_a4: |
|---|
| 120 | pitch = width * 2; |
|---|
| 121 | bpp = 16; |
|---|
| 122 | break; |
|---|
| 123 | |
|---|
| 124 | case bgraphics_pixel_format_palette4: |
|---|
| 125 | pitch = width / 2; |
|---|
| 126 | bpp = 4 |
|---|
| 127 | break; |
|---|
| 128 | #endif |
|---|
| 129 | default: |
|---|
| 130 | DBG_PRINT(("%s: unsupported foramt %d", __func__, s_graphics.format)); |
|---|
| 131 | return (bgraphics_t)0; |
|---|
| 132 | } |
|---|
| 133 | if (bgfx_create(&s_graphics.surf[0],width,height,NULL, |
|---|
| 134 | pitch,NULL,BGFX_SURF_BPP(bpp)|BGFX_SURF_RGB) != 0) |
|---|
| 135 | { |
|---|
| 136 | BDBG_ASSERT(0); |
|---|
| 137 | } |
|---|
| 138 | if (bgfx_create(&s_graphics.surf[1],width,height,NULL, |
|---|
| 139 | pitch,NULL,BGFX_SURF_BPP(bpp)|BGFX_SURF_RGB) != 0) |
|---|
| 140 | { |
|---|
| 141 | BDBG_ASSERT(0); |
|---|
| 142 | } |
|---|
| 143 | |
|---|
| 144 | s_graphics.state = eGS_DEFAULT; |
|---|
| 145 | s_graphics.pitch = s_graphics.surf[0].surface.pitch; |
|---|
| 146 | |
|---|
| 147 | return (bgraphics_t)&s_graphics; |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | void bgraphics_close( |
|---|
| 151 | bgraphics_t graphics /* handle returned by bgraphics_open */ |
|---|
| 152 | ) |
|---|
| 153 | { |
|---|
| 154 | bgfx_destroy(&(s_graphics.surf[0])); |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | void bgraphics_get( |
|---|
| 158 | bgraphics_settings *settings /* [out] */ |
|---|
| 159 | ) |
|---|
| 160 | { |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | bresult bgraphics_set( |
|---|
| 164 | const bgraphics_settings *settings |
|---|
| 165 | ) |
|---|
| 166 | { |
|---|
| 167 | return b_ok; |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | /* Convert ARGB to ABGR */ |
|---|
| 171 | static inline unsigned int argb_to_abgr(uint32_t pixel) |
|---|
| 172 | { |
|---|
| 173 | if ((pixel && 0xFF000000) == 0x00000000) { |
|---|
| 174 | return 0xFF000000; |
|---|
| 175 | } |
|---|
| 176 | return ((0xFF00FF00 & pixel) | ((0x00FF0000 & pixel) >> 16) | ((0x000000FF & pixel) << 16)); |
|---|
| 177 | } |
|---|
| 178 | |
|---|
| 179 | /* ARGB to ABGR with source alpha blend */ |
|---|
| 180 | static inline unsigned int argb_to_abgr_w_qalpha(uint32_t src_pixel,uint32_t dst_pixel) |
|---|
| 181 | { |
|---|
| 182 | if ((src_pixel && 0xFF000000) == 0x00000000) { |
|---|
| 183 | return dst_pixel; |
|---|
| 184 | } |
|---|
| 185 | return ((0xFF00FF00 & src_pixel) | ((0x00FF0000 & src_pixel) >> 16) | ((0x000000FF & src_pixel) << 16)); |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | static inline uint32_t bgfx_blend_argb_pixels(uint32_t s_pixel,uint32_t d_pixel) |
|---|
| 190 | { |
|---|
| 191 | uint32_t sr,sg,sb,sa,dr,dg,db,da,oa; |
|---|
| 192 | sa = (s_pixel >> 24) & 0xFF; |
|---|
| 193 | da = (d_pixel >> 24) & 0xFF; |
|---|
| 194 | if ((sa == 0xFF) || (da == 0x00)) |
|---|
| 195 | { |
|---|
| 196 | return s_pixel; |
|---|
| 197 | } |
|---|
| 198 | if ((da == 0xFF) && (sa == 0x00)) |
|---|
| 199 | { |
|---|
| 200 | return d_pixel; |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | sr = (s_pixel >> 16) & 0xFF; |
|---|
| 204 | sg = (s_pixel >> 8) & 0xFF; |
|---|
| 205 | sb = (s_pixel >> 0) & 0xFF; |
|---|
| 206 | dr = (d_pixel >> 16) & 0xFF; |
|---|
| 207 | dg = (d_pixel >> 8) & 0xFF; |
|---|
| 208 | db = (d_pixel >> 0) & 0xFF; |
|---|
| 209 | |
|---|
| 210 | dr = (((sr * sa)/0xFF) & 0xFF) + ((((0xFF - sa) * dr)/0xFF) & 0xFF); |
|---|
| 211 | dg = (((sg * sa)/0xFF) & 0xFF) + ((((0xFF - sa) * dg)/0xFF) & 0xFF); |
|---|
| 212 | db = (((sb * sa)/0xFF) & 0xFF) + ((((0xFF - sa) * db)/0xFF) & 0xFF); |
|---|
| 213 | |
|---|
| 214 | oa = da; |
|---|
| 215 | |
|---|
| 216 | return (oa << 24) | (dr << 16) | (dg << 8) | db; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | bresult bgraphics_sync( |
|---|
| 220 | bgraphics_t g, /* handle returned by bgraphics_open */ |
|---|
| 221 | bool overlay /* overlay is popped or not */ |
|---|
| 222 | ) |
|---|
| 223 | { |
|---|
| 224 | uint8_t *pixels,*src_pixels; |
|---|
| 225 | uint32_t *dst,*src; |
|---|
| 226 | int x,y,pitch,width,height; |
|---|
| 227 | get_osd_info(&pixels,&pitch,&width,&height); |
|---|
| 228 | |
|---|
| 229 | printf("%s:%d\n",__FUNCTION__,__LINE__); |
|---|
| 230 | src_pixels = g->surf[0].surface.buf; |
|---|
| 231 | for (y = 0; y < height; ++y) |
|---|
| 232 | { |
|---|
| 233 | dst = (uint32_t*)pixels; |
|---|
| 234 | src = (uint32_t*)src_pixels; |
|---|
| 235 | for (x = 0; x < width; ++x) |
|---|
| 236 | { |
|---|
| 237 | dst[x] = 0xFF000000; |
|---|
| 238 | dst[x] = bgfx_blend_argb_pixels(src[x],dst[x]); |
|---|
| 239 | if (!overlay) |
|---|
| 240 | dst[x] = argb_to_abgr(dst[x]); |
|---|
| 241 | //dst[x] = argb_to_abgr(src[x]); |
|---|
| 242 | } |
|---|
| 243 | pixels += pitch; |
|---|
| 244 | src_pixels += g->surf[0].surface.pitch; |
|---|
| 245 | } |
|---|
| 246 | |
|---|
| 247 | if (overlay) |
|---|
| 248 | { |
|---|
| 249 | get_osd_info(&pixels,&pitch,&width,&height); |
|---|
| 250 | src_pixels = g->surf[1].surface.buf; |
|---|
| 251 | for (y = 0; y < height; ++y) |
|---|
| 252 | { |
|---|
| 253 | dst = (uint32_t*)pixels; |
|---|
| 254 | src = (uint32_t*)src_pixels; |
|---|
| 255 | for (x = 0; x < width; ++x) |
|---|
| 256 | { |
|---|
| 257 | //dst[x] = argb_to_abgr_w_qalpha(src[x],dst[x]); |
|---|
| 258 | dst[x] = argb_to_abgr(bgfx_blend_argb_pixels(src[x],dst[x])); |
|---|
| 259 | } |
|---|
| 260 | pixels += pitch; |
|---|
| 261 | src_pixels += g->surf[0].surface.pitch; |
|---|
| 262 | } |
|---|
| 263 | } |
|---|
| 264 | update_osd(); |
|---|
| 265 | return b_ok; |
|---|
| 266 | } |
|---|
| 267 | bresult bgraphics_sync_partial( |
|---|
| 268 | bgraphics_t g, /* handle returned by bgraphics_open */ |
|---|
| 269 | bgraphics_id id, |
|---|
| 270 | bool overlay /* overlay is popped or not */ |
|---|
| 271 | ) |
|---|
| 272 | { |
|---|
| 273 | return b_ok; |
|---|
| 274 | } |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | bresult bgraphics_get_framebuffer( |
|---|
| 278 | bgraphics_t graphics, /* handle returned by bgraphics_open */ |
|---|
| 279 | void **buffer, /* [out] address of framebuffer memory */ |
|---|
| 280 | unsigned int **palette, /* [out] address of palette */ |
|---|
| 281 | int *width, /* [out] width of the OSD surface */ |
|---|
| 282 | int *height, /* [out] height of the OSD surface */ |
|---|
| 283 | int *pitch /* [out] pitch of the OSD surface */ |
|---|
| 284 | ) |
|---|
| 285 | { |
|---|
| 286 | *buffer = s_graphics.surf[0].surface.buf; |
|---|
| 287 | *palette = s_graphics.p_palette; |
|---|
| 288 | *width = s_graphics.surf[0].surface.width; |
|---|
| 289 | *height = s_graphics.surf[0].surface.height; |
|---|
| 290 | *pitch = s_graphics.surf[0].surface.pitch; |
|---|
| 291 | return b_ok; |
|---|
| 292 | } |
|---|
| 293 | |
|---|
| 294 | bresult bgraphics_get_osd_params(bgraphics_t graphics, |
|---|
| 295 | bsettop_surf_t *p_osd_surf, |
|---|
| 296 | void **osd_buffer, |
|---|
| 297 | bsettop_surf_t *p_overlay_surf, |
|---|
| 298 | void **overlay_mem) |
|---|
| 299 | { |
|---|
| 300 | *p_osd_surf = NULL; |
|---|
| 301 | *osd_buffer = s_graphics.surf[0].surface.buf; |
|---|
| 302 | if (overlay_mem) |
|---|
| 303 | { |
|---|
| 304 | *p_overlay_surf = NULL; |
|---|
| 305 | *overlay_mem = s_graphics.surf[1].surface.buf; |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | return b_ok; |
|---|
| 309 | } |
|---|
| 310 | bresult bsurface_create_surface(uint32_t width, |
|---|
| 311 | uint32_t height, |
|---|
| 312 | bgraphics_pixel_format format, |
|---|
| 313 | uint8_t **mem, |
|---|
| 314 | uint32_t *pitch, |
|---|
| 315 | bsettop_surf_t *p_settop_surf) |
|---|
| 316 | { |
|---|
| 317 | *mem = (uint8_t*)1; |
|---|
| 318 | return b_ok; |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | bresult bgraphics_load_palette( |
|---|
| 323 | bgraphics_t g /* handle returned by bgraphics_open */ |
|---|
| 324 | ) |
|---|
| 325 | { |
|---|
| 326 | return b_ok; |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | baudio_decode_t baudio_decode_open(bobject_t id) |
|---|
| 330 | { |
|---|
| 331 | return (baudio_decode_t)1; |
|---|
| 332 | } |
|---|
| 333 | void baudio_decode_close(baudio_decode_t codec) |
|---|
| 334 | { |
|---|
| 335 | } |
|---|
| 336 | bresult baudio_decode_start(baudio_decode_t codec, |
|---|
| 337 | bdisplay_t display, |
|---|
| 338 | bstream_t stream) |
|---|
| 339 | { |
|---|
| 340 | return b_ok; |
|---|
| 341 | } |
|---|
| 342 | void baudio_decode_stop(baudio_decode_t codec) |
|---|
| 343 | { |
|---|
| 344 | } |
|---|
| 345 | bresult baudio_decode_get_status(baudio_decode_t codec, |
|---|
| 346 | baudio_decode_status *status) |
|---|
| 347 | { |
|---|
| 348 | return b_ok; |
|---|
| 349 | } |
|---|
| 350 | |
|---|
| 351 | void baudio_decode_get_config(baudio_decode_t codec, |
|---|
| 352 | baudio_decode_config *config) |
|---|
| 353 | { |
|---|
| 354 | } |
|---|
| 355 | |
|---|
| 356 | bresult baudio_decode_set_config(baudio_decode_t codec, |
|---|
| 357 | const baudio_decode_config *config) |
|---|
| 358 | { |
|---|
| 359 | return b_ok; |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | void baudio_decode_get_avl_level(baudio_decode_t audio, int num_energy, long *level) |
|---|
| 363 | { |
|---|
| 364 | *level = 0; |
|---|
| 365 | } |
|---|
| 366 | void baudio_decode_test_tone(baudio_decode_t audio, |
|---|
| 367 | uint32_t *samples, /* array of samples, num_samples long */ |
|---|
| 368 | uint32_t num_samples, /* Number of samples, should be less than sample array size */ |
|---|
| 369 | bool leftChannel, /* true - program left channel, flase program right channel */ |
|---|
| 370 | bool enable /* enable/disable hifidac tone test */ |
|---|
| 371 | ) |
|---|
| 372 | { |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | bdecode_t bdecode_open( |
|---|
| 376 | bobject_t decode_id /* decode object id */ |
|---|
| 377 | ) |
|---|
| 378 | { |
|---|
| 379 | return (bdecode_t)1; |
|---|
| 380 | } |
|---|
| 381 | |
|---|
| 382 | void bdecode_close( |
|---|
| 383 | bdecode_t decode /* handle returned by bdecode_open */ |
|---|
| 384 | ) |
|---|
| 385 | { |
|---|
| 386 | } |
|---|
| 387 | bresult bdecode_start( |
|---|
| 388 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 389 | bstream_t source, /* source for the decode, either analog or digital */ |
|---|
| 390 | bdecode_window_t window /* window to render decode */ |
|---|
| 391 | ) |
|---|
| 392 | { |
|---|
| 393 | return b_ok; |
|---|
| 394 | } |
|---|
| 395 | void bdecode_stop( |
|---|
| 396 | bdecode_t decode /* handle returned by bdecode_open */ |
|---|
| 397 | ) |
|---|
| 398 | { |
|---|
| 399 | } |
|---|
| 400 | |
|---|
| 401 | bresult bdecode_get_status( |
|---|
| 402 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 403 | bdecode_status *status /* [out] status to be populated */ |
|---|
| 404 | ) |
|---|
| 405 | { |
|---|
| 406 | return b_ok; |
|---|
| 407 | } |
|---|
| 408 | |
|---|
| 409 | void bdecode_set_config( |
|---|
| 410 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 411 | bdecode_config *p_cfg /* configuration structure reference */ |
|---|
| 412 | ) |
|---|
| 413 | { |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | void bdecode_get_config( |
|---|
| 417 | bdecode_t decode, /* handle returned by bdecode_open */ |
|---|
| 418 | bdecode_config *p_cfg /* [out] configuration to be populated */ |
|---|
| 419 | ) |
|---|
| 420 | { |
|---|
| 421 | } |
|---|
| 422 | |
|---|
| 423 | bdisplay_t bdisplay_open( |
|---|
| 424 | bobject_t display_id /* handle used to identify a particular display */ |
|---|
| 425 | ) |
|---|
| 426 | { |
|---|
| 427 | return (bdisplay_t)1; |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | |
|---|
| 431 | void bdisplay_close( |
|---|
| 432 | bdisplay_t display /* handle returned by bdisplay_open */ |
|---|
| 433 | ) |
|---|
| 434 | { |
|---|
| 435 | } |
|---|
| 436 | |
|---|
| 437 | |
|---|
| 438 | boutput_rf_t |
|---|
| 439 | boutput_rf_open( bobject_t rfmod_id ) |
|---|
| 440 | { |
|---|
| 441 | return (boutput_rf_t)1; |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | boutput_spdif_t |
|---|
| 446 | boutput_spdif_open(bobject_t spdif_id) |
|---|
| 447 | { |
|---|
| 448 | return (boutput_spdif_t)1; |
|---|
| 449 | } |
|---|
| 450 | |
|---|
| 451 | |
|---|
| 452 | boutput_i2s_t |
|---|
| 453 | boutput_i2s_open(bobject_t i2s_id) |
|---|
| 454 | { |
|---|
| 455 | return (boutput_i2s_t)1; |
|---|
| 456 | } |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | bresult |
|---|
| 461 | bdisplay_set( |
|---|
| 462 | bdisplay_t display, /* handle returned by bdisplay_open */ |
|---|
| 463 | bdisplay_settings *settings /* desired display settings */ |
|---|
| 464 | ) |
|---|
| 465 | { |
|---|
| 466 | return b_ok; |
|---|
| 467 | } |
|---|
| 468 | |
|---|
| 469 | |
|---|
| 470 | void |
|---|
| 471 | bdisplay_get( |
|---|
| 472 | bdisplay_t display, /* handle returned by bdisplay_open */ |
|---|
| 473 | bdisplay_settings *settings /* [out] current settings of display */ |
|---|
| 474 | ) |
|---|
| 475 | { |
|---|
| 476 | } |
|---|
| 477 | |
|---|
| 478 | |
|---|
| 479 | bresult boutput_rf_set(boutput_rf_t rf, |
|---|
| 480 | const boutput_rf_settings *settings |
|---|
| 481 | ) |
|---|
| 482 | { |
|---|
| 483 | return b_ok; |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | |
|---|
| 487 | |
|---|
| 488 | void boutput_rf_get(boutput_rf_t rf, |
|---|
| 489 | boutput_rf_settings *settings /* [out] */ |
|---|
| 490 | ) |
|---|
| 491 | { |
|---|
| 492 | } |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | bresult boutput_spdif_set(boutput_spdif_t spdif, |
|---|
| 496 | const boutput_spdif_settings *settings |
|---|
| 497 | ) |
|---|
| 498 | { |
|---|
| 499 | return b_ok; |
|---|
| 500 | } |
|---|
| 501 | |
|---|
| 502 | |
|---|
| 503 | void boutput_spdif_get(boutput_spdif_t spdif, |
|---|
| 504 | boutput_spdif_settings *settings /* [out] */ |
|---|
| 505 | ) |
|---|
| 506 | { |
|---|
| 507 | } |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | bresult boutput_i2s_set(boutput_i2s_t i2s, |
|---|
| 511 | const boutput_i2s_settings *settings |
|---|
| 512 | ) |
|---|
| 513 | { |
|---|
| 514 | return b_ok; |
|---|
| 515 | } |
|---|
| 516 | |
|---|
| 517 | void boutput_i2s_get(boutput_i2s_t i2s, |
|---|
| 518 | boutput_i2s_settings *settings /* [out] */ |
|---|
| 519 | ) |
|---|
| 520 | { |
|---|
| 521 | } |
|---|
| 522 | |
|---|
| 523 | |
|---|
| 524 | bresult boutput_rf_set_audio_volume( |
|---|
| 525 | boutput_rf_t rf, |
|---|
| 526 | unsigned int volume /* desired volume */ |
|---|
| 527 | ) |
|---|
| 528 | { |
|---|
| 529 | return b_ok; |
|---|
| 530 | } |
|---|
| 531 | |
|---|
| 532 | bresult boutput_rf_get_audio_volume( |
|---|
| 533 | boutput_rf_t rf, |
|---|
| 534 | unsigned int *volume /* [out] current volume of the rf modulater */ |
|---|
| 535 | ) |
|---|
| 536 | { |
|---|
| 537 | return b_ok; |
|---|
| 538 | } |
|---|
| 539 | |
|---|
| 540 | |
|---|
| 541 | bdecode_window_t bdecode_window_open( |
|---|
| 542 | bobject_t window_id, /* window's object id */ |
|---|
| 543 | bdisplay_t display /* display on which the window appears */ |
|---|
| 544 | ) |
|---|
| 545 | { |
|---|
| 546 | return (bdecode_window_t)1; |
|---|
| 547 | } |
|---|
| 548 | |
|---|
| 549 | void bdecode_window_close( |
|---|
| 550 | bdecode_window_t window |
|---|
| 551 | ) |
|---|
| 552 | { |
|---|
| 553 | } |
|---|
| 554 | |
|---|
| 555 | bresult bdecode_window_get( |
|---|
| 556 | bdecode_window_t window, |
|---|
| 557 | bdecode_window_settings *settings /* [out] */ |
|---|
| 558 | ) |
|---|
| 559 | { |
|---|
| 560 | return b_ok; |
|---|
| 561 | } |
|---|
| 562 | |
|---|
| 563 | bresult bdecode_window_set( |
|---|
| 564 | bdecode_window_t window, |
|---|
| 565 | bdecode_window_settings *settings |
|---|
| 566 | ) |
|---|
| 567 | { |
|---|
| 568 | return b_ok; |
|---|
| 569 | } |
|---|
| 570 | |
|---|
| 571 | bresult bdecode_window_preset( |
|---|
| 572 | bdecode_window_t window, |
|---|
| 573 | bdecode_window_settings *settings |
|---|
| 574 | ) |
|---|
| 575 | { |
|---|
| 576 | return b_ok; |
|---|
| 577 | } |
|---|
| 578 | |
|---|
| 579 | |
|---|
| 580 | int b_lock_vdc(void) |
|---|
| 581 | { |
|---|
| 582 | } |
|---|
| 583 | |
|---|
| 584 | void b_unlock_vdc(void) |
|---|
| 585 | { |
|---|
| 586 | } |
|---|
| 587 | |
|---|
| 588 | bresult bdisplay_set_vbi_rating_info( |
|---|
| 589 | bdisplay_t display, unsigned int ratings_tv, unsigned int ratings_movie, |
|---|
| 590 | unsigned int content_v, unsigned int content_s, unsigned int content_l, unsigned int content_d |
|---|
| 591 | ) |
|---|
| 592 | { |
|---|
| 593 | return b_ok; |
|---|
| 594 | } |
|---|
| 595 | |
|---|
| 596 | bresult bdisplay_output_rf_enable( |
|---|
| 597 | bdisplay_t display, /* handle returned by bdisplay_open */ |
|---|
| 598 | bool enable |
|---|
| 599 | ) |
|---|
| 600 | { |
|---|
| 601 | return b_ok; |
|---|
| 602 | } |
|---|
| 603 | |
|---|
| 604 | |
|---|
| 605 | /** |
|---|
| 606 | Summary: |
|---|
| 607 | enable deinterlacer on display (id), and disable deinterlacer on other display (!id) |
|---|
| 608 | **/ |
|---|
| 609 | void bdisplay_set_deinterlacer(bdisplay_t display, int id, bool enable) |
|---|
| 610 | { |
|---|
| 611 | } |
|---|
| 612 | void bdisplay_set_coefficient_index(bdisplay_t display,bool horiz, int output, int coeff_idx) |
|---|
| 613 | { |
|---|
| 614 | } |
|---|
| 615 | |
|---|
| 616 | bresult bdisplay_output_hdmi_enable(bdisplay_t display, bool enable) |
|---|
| 617 | { |
|---|
| 618 | return b_ok; |
|---|
| 619 | } |
|---|
| 620 | bresult bdisplay_set_init_format(bobject_t display_id, bsettop_display_format_t fmt) |
|---|
| 621 | { |
|---|
| 622 | return b_ok; |
|---|
| 623 | } |
|---|
| 624 | void bdisplay_get_default_settings(bdisplay_settings *psettings) |
|---|
| 625 | { |
|---|
| 626 | } |
|---|
| 627 | |
|---|
| 628 | bresult bsettop_init(bsettop_version version) |
|---|
| 629 | { |
|---|
| 630 | } |
|---|
| 631 | bresult smessage_init(void *decode_cfgs) |
|---|
| 632 | { |
|---|
| 633 | return b_ok; |
|---|
| 634 | } |
|---|
| 635 | bresult bsettop_hdmi_open( |
|---|
| 636 | bsettop_hdmi_t *h_hdmi, |
|---|
| 637 | bdisplay_t display, /* display on which the graphics are displayed */ |
|---|
| 638 | baudio_decode_t audio_decode, |
|---|
| 639 | bsettop_hdcp_authentication_cb_t hdcp_authentication_cb |
|---|
| 640 | ) |
|---|
| 641 | { |
|---|
| 642 | return b_ok; |
|---|
| 643 | } |
|---|
| 644 | void bsettop_hdmi_close(bsettop_hdmi_t h_hdmi) |
|---|
| 645 | { |
|---|
| 646 | } |
|---|
| 647 | bresult boutput_hdmi_get_status(bsettop_hdmi_t h_hdmi, |
|---|
| 648 | boutput_hdmi_status *status /* [out] */ |
|---|
| 649 | ) |
|---|
| 650 | { |
|---|
| 651 | return b_ok; |
|---|
| 652 | } |
|---|
| 653 | |
|---|
| 654 | brfm_t brfm_open( |
|---|
| 655 | bobject_t rfm_id /* - index used to identify a particular rfm */ |
|---|
| 656 | ) |
|---|
| 657 | { |
|---|
| 658 | return (brfm_t)1; |
|---|
| 659 | } |
|---|
| 660 | |
|---|
| 661 | /* |
|---|
| 662 | Summary: |
|---|
| 663 | Close the rfm. |
|---|
| 664 | */ |
|---|
| 665 | void brfm_close( |
|---|
| 666 | brfm_t rfm /* - handle returned by brfm_open */ |
|---|
| 667 | ) |
|---|
| 668 | { |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | int chm_process_mss(void *p_chm, /* Channel manager reference */ |
|---|
| 672 | const uint8_t* p_mms, /* Pointer to MMS */ |
|---|
| 673 | unsigned char* mms_buf, /* string buffer */ |
|---|
| 674 | unsigned int mms_len /* string buffer length */ |
|---|
| 675 | ) |
|---|
| 676 | { |
|---|
| 677 | return 0; |
|---|
| 678 | } |
|---|
| 679 | void chm_init(void *p_chm, void *p_app) |
|---|
| 680 | { |
|---|
| 681 | } |
|---|
| 682 | |
|---|
| 683 | /* |
|---|
| 684 | Summary: |
|---|
| 685 | Function to pass a command to the channel manager. |
|---|
| 686 | Any results and notification is handled by passing events to the app via |
|---|
| 687 | the msg_queue. |
|---|
| 688 | |
|---|
| 689 | */ |
|---|
| 690 | void chm_cmd(void *p_chm,void *p_cmd_evt) |
|---|
| 691 | { |
|---|
| 692 | } |
|---|
| 693 | |
|---|
| 694 | #if 0 |
|---|
| 695 | void factory_draw(void *v_app, void *v_screen) |
|---|
| 696 | { |
|---|
| 697 | } |
|---|
| 698 | |
|---|
| 699 | int factory_handle_event(void *v_app, void *v_screen, void *p_event) |
|---|
| 700 | { |
|---|
| 701 | return 0; |
|---|
| 702 | } |
|---|
| 703 | #endif |
|---|
| 704 | void image_get_status(void* st) |
|---|
| 705 | { |
|---|
| 706 | } |
|---|
| 707 | /* Jan 1, 1970 => Thursday */ |
|---|
| 708 | #define START_DAY 3 |
|---|
| 709 | #define START_YEAR 1970 |
|---|
| 710 | /* Days/month for non-leap year */ |
|---|
| 711 | const unsigned char s_days_per_mon[] = |
|---|
| 712 | { |
|---|
| 713 | 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, |
|---|
| 714 | 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, |
|---|
| 715 | }; |
|---|
| 716 | |
|---|
| 717 | #define IS_LEAP_YEAR(y) ( !((y + START_YEAR) % 4) && ( ((y + START_YEAR) % 100) || !((y + START_YEAR) % 400) ) ) |
|---|
| 718 | void utctime(unsigned int secs,b_tm *p_tm) |
|---|
| 719 | { |
|---|
| 720 | unsigned int yday,mon,t_val; |
|---|
| 721 | unsigned char *p_dpm = (unsigned char*)s_days_per_mon; |
|---|
| 722 | |
|---|
| 723 | memset(p_tm,0,sizeof(b_tm)); |
|---|
| 724 | |
|---|
| 725 | /* seconds */ |
|---|
| 726 | p_tm->tm_sec = secs % 60; |
|---|
| 727 | t_val = secs / 60; /* minutes */ |
|---|
| 728 | |
|---|
| 729 | /* minutes */ |
|---|
| 730 | p_tm->tm_min = t_val % 60; |
|---|
| 731 | t_val /= 60; /* hours */ |
|---|
| 732 | |
|---|
| 733 | /* hours */ |
|---|
| 734 | p_tm->tm_hour = t_val % 24; |
|---|
| 735 | t_val /= 24; |
|---|
| 736 | |
|---|
| 737 | /* day of week */ |
|---|
| 738 | p_tm->tm_wday = t_val % 7; |
|---|
| 739 | p_tm->tm_wday = (t_val - START_DAY) % 7; |
|---|
| 740 | |
|---|
| 741 | /* offset value to start of the year */ |
|---|
| 742 | #ifndef LINUX |
|---|
| 743 | t_val += 5; |
|---|
| 744 | #endif |
|---|
| 745 | /* year */ |
|---|
| 746 | p_tm->tm_yday = t_val; |
|---|
| 747 | p_tm->tm_year = 0; |
|---|
| 748 | |
|---|
| 749 | /* day of current year */ |
|---|
| 750 | while ((IS_LEAP_YEAR(p_tm->tm_year) && (p_tm->tm_yday > 365)) || |
|---|
| 751 | (!IS_LEAP_YEAR(p_tm->tm_year) && (p_tm->tm_yday > 364))) |
|---|
| 752 | { |
|---|
| 753 | if (IS_LEAP_YEAR(p_tm->tm_year)) |
|---|
| 754 | p_tm->tm_yday -= 366; |
|---|
| 755 | else |
|---|
| 756 | p_tm->tm_yday -= 365; |
|---|
| 757 | p_tm->tm_year++; |
|---|
| 758 | } |
|---|
| 759 | |
|---|
| 760 | if (IS_LEAP_YEAR(p_tm->tm_year)) |
|---|
| 761 | p_dpm += 12; |
|---|
| 762 | |
|---|
| 763 | yday = p_tm->tm_yday + 1; |
|---|
| 764 | mon = 0; |
|---|
| 765 | while(yday > p_dpm[mon]) |
|---|
| 766 | { |
|---|
| 767 | yday -= p_dpm[mon]; |
|---|
| 768 | mon++; |
|---|
| 769 | } |
|---|
| 770 | |
|---|
| 771 | /* month */ |
|---|
| 772 | p_tm->tm_mon = mon; |
|---|
| 773 | |
|---|
| 774 | /* day of month */ |
|---|
| 775 | p_tm->tm_mday = yday; |
|---|
| 776 | |
|---|
| 777 | } |
|---|
| 778 | |
|---|
| 779 | bool is_video_format_supported() |
|---|
| 780 | { |
|---|
| 781 | return true; |
|---|
| 782 | } |
|---|
| 783 | bool bsettop_hdmi_is_video_fmt_supported(bsettop_display_format_t fmt) |
|---|
| 784 | { |
|---|
| 785 | return true; |
|---|
| 786 | } |
|---|
| 787 | void *image_get_header(int bank, bool *bact) |
|---|
| 788 | { |
|---|
| 789 | return NULL; |
|---|
| 790 | } |
|---|
| 791 | |
|---|
| 792 | bool bsettop_hdmi_get_RGB_output(void) |
|---|
| 793 | { |
|---|
| 794 | return true; |
|---|
| 795 | } |
|---|
| 796 | |
|---|
| 797 | bresult bsettop_hdmi_set_RGB_output(bool bRGB) |
|---|
| 798 | { |
|---|
| 799 | return b_ok; |
|---|
| 800 | } |
|---|
| 801 | bool bsettop_hdmi_get_native_audio_mode(void) |
|---|
| 802 | { |
|---|
| 803 | return true; |
|---|
| 804 | } |
|---|
| 805 | BERR_Code bsettop_hdmi_set_native_audio_mode(bool native) |
|---|
| 806 | { |
|---|
| 807 | return BERR_SUCCESS; |
|---|
| 808 | } |
|---|
| 809 | |
|---|
| 810 | |
|---|
| 811 | bool g_disable_fcc; |
|---|
| 812 | uint32_t ui32OutputChannelMatrix[1][1]; |
|---|
| 813 | void bsettop_uninit(void) |
|---|
| 814 | { |
|---|
| 815 | } |
|---|
| 816 | |
|---|
| 817 | btuner_t btuner_open( |
|---|
| 818 | bobject_t tuner_id /* - handle used to identify a particular tuner */ |
|---|
| 819 | ) |
|---|
| 820 | { |
|---|
| 821 | return (btuner_t)1; |
|---|
| 822 | } |
|---|
| 823 | |
|---|
| 824 | /* |
|---|
| 825 | Summary: |
|---|
| 826 | Close a tuner. |
|---|
| 827 | */ |
|---|
| 828 | void btuner_close( |
|---|
| 829 | btuner_t tuner /* - handle returned by btuner_open */ |
|---|
| 830 | ) |
|---|
| 831 | { |
|---|
| 832 | } |
|---|
| 833 | bresult btuner_get_softdecisions( |
|---|
| 834 | btuner_t tuner, |
|---|
| 835 | btuner_softdecision_t *pdec, /* - [out] array of soft decisions */ |
|---|
| 836 | size_t length /* number of soft decisions to get */ |
|---|
| 837 | ) |
|---|
| 838 | { |
|---|
| 839 | return b_ok; |
|---|
| 840 | } |
|---|
| 841 | bband_t btuner_tune( |
|---|
| 842 | btuner_t tuner, |
|---|
| 843 | unsigned freq, /* - RF center frequency in Hz */ |
|---|
| 844 | btuner_params *params /* - parameters needed to tune and acquire */ |
|---|
| 845 | ) |
|---|
| 846 | { |
|---|
| 847 | return (bband_t)1; |
|---|
| 848 | } |
|---|
| 849 | bresult btuner_get_status( |
|---|
| 850 | btuner_t tuner, |
|---|
| 851 | btuner_status *status /* - [out] Current status of the SDS demod */ |
|---|
| 852 | ) |
|---|
| 853 | { |
|---|
| 854 | return b_ok; |
|---|
| 855 | } |
|---|
| 856 | |
|---|
| 857 | bresult btuner_reset_status(btuner_t tuner) |
|---|
| 858 | { |
|---|
| 859 | return b_ok; |
|---|
| 860 | } |
|---|
| 861 | void btuner_params_init( |
|---|
| 862 | btuner_params *ds, /* - [out] */ |
|---|
| 863 | btuner_t tuner /* - required for possible resource-dependent defaults */ |
|---|
| 864 | ) |
|---|
| 865 | { |
|---|
| 866 | } |
|---|
| 867 | |
|---|
| 868 | int chm_get_hunt_progress(void *p_chm) |
|---|
| 869 | { |
|---|
| 870 | return 50; |
|---|
| 871 | } |
|---|
| 872 | int chm_get_cdl_progress(void *p_chm) |
|---|
| 873 | { |
|---|
| 874 | return 50; |
|---|
| 875 | } |
|---|
| 876 | bool chm_is_chmap_updated(void *p_chm) |
|---|
| 877 | { |
|---|
| 878 | return true; |
|---|
| 879 | } |
|---|
| 880 | bresult bspi_identify( |
|---|
| 881 | bspi_settings_t *p_settings /* [out] SPI flash settings structure */ |
|---|
| 882 | ) |
|---|
| 883 | { |
|---|
| 884 | p_settings->se_cmd = 0xD8; |
|---|
| 885 | p_settings->sector_size = 0x10000; |
|---|
| 886 | p_settings->page_size = 0x100; |
|---|
| 887 | return b_ok; |
|---|
| 888 | } |
|---|
| 889 | |
|---|
| 890 | int chm_get_time_info(void *p_chm, |
|---|
| 891 | unsigned int *utc_secs, /* Current UTC time in seconds */ |
|---|
| 892 | int *local_offset, /* Local time offset from UTC time in seconds */ |
|---|
| 893 | bool *dst /* Daylight savings flag */ |
|---|
| 894 | ) |
|---|
| 895 | { |
|---|
| 896 | return -1; |
|---|
| 897 | } |
|---|
| 898 | |
|---|
| 899 | void bsettop_pvt() |
|---|
| 900 | { |
|---|
| 901 | } |
|---|