/*************************************************************************** * Copyright (c) 2003-2006, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: * * Revision History: * * $brcm_Log: $ * ***************************************************************************/ #ifndef BSETTOP_DISPLAY_H__ #define BSETTOP_DISPLAY_H__ #include "bsettop_types.h" #ifdef HAS_VBI #include "scte_127.h" #endif typedef enum bsettop_display_format_t { bdisplay_format_auto, bdisplay_format_1080i, bdisplay_format_720p, bdisplay_format_480i, bdisplay_format_480p, bdisplay_format_1080p60, bdisplay_format_1080p24, bdisplay_format_1080p30, bdisplay_format_max, }bsettop_display_format_t; /* Summary: SD output options Description: This only applies to SD display for RF output. */ typedef enum bdisplay_sd_output_options { bdisplay_sd_output_options_auto, bdisplay_sd_output_options_widescreen, bdisplay_sd_output_options_full, bdisplay_sd_output_options_zoom, /*bdisplay_sd_output_options_partial_zoom,*/ bdisplay_sd_output_options_max } bdisplay_sd_output_options; /* Summary: HD output options Description: This only applies to HD display for HDMI output. */ typedef enum bdisplay_hd_output_options { bdisplay_hd_output_options_auto, bdisplay_hd_output_options_stretch, bdisplay_hd_output_options_pillarbox, bdisplay_hd_output_options_zoom, } bdisplay_hd_output_options; #ifdef __cplusplus extern "C" { #endif /*=******************************************* A display is a coordinated set of video/audio outputs that are usually sent to one TV set. Each display may have multiple outputs (e.g. svideo, composite), but each output will carry the same content. Decode windows are boxes of video content on a display. You control decode windows and audio volume through the display API. Some chips support more than one display (7038, 7320 and Venom2). For these systems, you will open two bdisplay_t handles and have one bdecode_window_t handle created for each display. **********************************************/ /* Defines */ #define B_N_DISPLAYS 1 /* Summary: Display settings for configuring outputs, video format and aspect ratio. */ typedef enum bdisplay_rfm_t { eRFM_NONE, eRFM_CH3, eRFM_CH4 }bdisplay_rfm_t; /** Summary: Settings for RF output **/ typedef struct boutput_rf_settings { bool enable_output; /* Enable RF Output or not */ bdisplay_rfm_t channel; /* 1 - ch3 output, 2 ch4 output. */ char country[2]; /* 2 letter iso3166 country code */ } boutput_rf_settings; /* Summary: S/PDIF Output channel configuration. */ typedef enum bdisplay_audio_out_ch_cfg { eAUDIO_OUT_CH_CFG_NORM, /* Left input -> Left output, Right input -> Right output */ eAUDIO_OUT_CH_CFG_BOTH_L, /* Left input -> both Left and Right outputs */ eAUDIO_OUT_CH_CFG_BOTH_R, /* Right input -> both Left and Right outputs */ eAUDIO_OUT_CH_CFG_SWAP, /* Left input -> Right output, Right input -> Left output */ } bdisplay_audio_out_ch_cfg_t; typedef struct boutput_spdif_settings { bool enable_output; /* Enable S/PDIF Output or not */ bool enable_cp; /* Enable Copy Protection Toggling */ bool enable_ch_stat; /* Enable channel status and validity bit handling */ bdisplay_audio_out_ch_cfg_t out_ch_cfg; /* Select what channels are output */ bool validity; /* V bit polarity */ uint32_t ch_stat_l_low; /* Low channel status bits for left channel [0:31] */ uint32_t ch_stat_r_low; /* Low channel status bits for right channel [0:31] */ uint32_t ch_stat_hi; /* High channel status bits for both channels [41:32] */ bool pcm; /* If true, always send PCM audio to SPDIF output. If the format is not supported by the chip, you will get no audio output. If false, the audio will be passed-through if supported by SPDIF, otherwise it is decoded by the chip. Specifics: MPEG audio (layer 1/2) will always be decoded and PCM will be sent to SPDIF. */ baudio_format compressed_audio_format; /* compressed output format. If pcm = false and this format is set to a valid format (e.g. baudio_format_dts), output will be transcoded to that format. By default this is baudio_format_unknown, which will leave the compressed data in the original format. */ } boutput_spdif_settings; typedef struct boutput_i2s_settings { bool enable_output; /* Enable I2S Output or not */ bdisplay_audio_out_ch_cfg_t out_ch_cfg; /* Select what channels are output */ unsigned int bits_per_sample; /* 16 = 16 bits per sample, 24 = 24 bits per sample */ bool data_msb_first; /* Set to true for MSB or false for LSB data */ bool data_delayed; /* Set to true to delay data by one SCLK period or false otherwise */ bool lr_clk_polarity; /* Set to 1 for left/right clock to be high for left samples */ } boutput_i2s_settings; /* Summary: RF modulator output handle returned by boutput_rf_open() */ typedef struct boutput_rf *boutput_rf_t; /* Summary: SPDIF audio handle returned by boutput_spdif_open() */ typedef struct boutput_spdif *boutput_spdif_t; /* Summary: I2S audio handle returned by boutput_i2s_open() */ typedef struct boutput_i2s *boutput_i2s_t; /* Summary: Video display rate change callback */ typedef void (*bdisplay_rate_change_cb_t)(bdisplay_t display, /* display contect handle */ void *data_ptr, /* rate_change_data */ void *cbData /* BAVC_VdcDisplay_Info* */ ); /* Summary: Video display settings structure */ typedef struct bdisplay_settings { bsettop_display_format_t format; /* hdmi video format */ bdisplay_rate_change_cb_t rate_change_cb; /* normaly used to notify HDMI of rate change */ void *rate_change_data; /* passed to rate_change_cb */ boutput_rf_t rf; /* attached RF output */ boutput_spdif_t spdif; /* attached SPDIF audio output */ boutput_i2s_t i2s; /* attached I2S audio output */ bdisplay_sd_output_options sd_options; bdisplay_hd_output_options hd_options; unsigned char sharpness; /* 0-25 range, which will convert to 101-126 for coefficient index */ bool force_change_format; /* force to change if RGB or audio passing mode is set */ bool deinterlace; /* Enable/Disable deinterlacer */ bool shrink_width; /* Enable/Disable shrink width deinterlacer option */ int deinterlacer_affinity; /* 0 - HD 1 - SD */ } bdisplay_settings; /* Summary: Open a display. Description: The new display object will already have default outputs configured. You can change the configuration by calling bdisplay_set, making changes, then calling bdisplay_set. */ bdisplay_t bdisplay_open( bobject_t display_id /* handle used to identify a particular display */ ); /* Summary: Close a display. Description: All decode windows opened or cloned for this display should have already been closed, otherwise you get an inconsistent state. */ void bdisplay_close( bdisplay_t display /* handle returned by bdisplay_open */ ); /* Summary: Open a RF output. Description: It must be assigned to a display. */ boutput_rf_t boutput_rf_open( bobject_t rfmod_id ); /* Summary: Open a SPDIF audio output. Description: It must be assigned to a display. */ boutput_spdif_t boutput_spdif_open(bobject_t spdif_id); /* Summary: Open a I2S audio output. Description: It must be assigned to a display. */ boutput_i2s_t boutput_i2s_open(bobject_t i2s_id); /* Summary: Configure the outputs, video format and aspect ratio of the display. */ bresult bdisplay_set( bdisplay_t display, /* handle returned by bdisplay_open */ bdisplay_settings *settings /* desired display settings */ ); /* Summary: Get the current outputs, video format and aspect ratio for a display. */ void bdisplay_get( bdisplay_t display, /* handle returned by bdisplay_open */ bdisplay_settings *settings /* [out] current settings of display */ ); /** Summary: Set new RF settings. Description: These settings will not be applied until bdisplay_set is called with the RF handle assigned. **/ bresult boutput_rf_set(boutput_rf_t rf, const boutput_rf_settings *settings ); /** Summary: Get the current RF settings. **/ void boutput_rf_get(boutput_rf_t rf, boutput_rf_settings *settings /* [out] */ ); /** Summary: Set new SPDIF settings. Description: These settings will not be applied until bdisplay_set is called with the SPDIF handle assigned. **/ bresult boutput_spdif_set(boutput_spdif_t spdif, const boutput_spdif_settings *settings ); /** Summary: Get the current SPDIF settings. **/ void boutput_spdif_get(boutput_spdif_t spdif, boutput_spdif_settings *settings /* [out] */ ); /** Summary: Set new I2S settings. Description: These settings will not be applied until bdisplay_set is called with the I2S handle assigned. **/ bresult boutput_i2s_set(boutput_i2s_t i2s, const boutput_i2s_settings *settings ); /** Summary: Get the current I2S settings. **/ void boutput_i2s_get(boutput_i2s_t i2s, boutput_i2s_settings *settings /* [out] */ ); /* Summary: Set the audio volume for the rf modulator. Description: This function only sets the rfm audio volume. */ bresult boutput_rf_set_audio_volume( boutput_rf_t rf, unsigned int volume /* desired volume */ ); /* Summary: Get the audio levels for the rf modulator. */ bresult boutput_rf_get_audio_volume( boutput_rf_t rf, unsigned int *volume /* [out] current volume of the rf modulater */ ); /* Summary: Open a new decode window. Description: Creates a new decode window on the given display. The window_id is a global id, not relative to the display. On PIP systems, B_ID(1) always refers to PIP. */ bdecode_window_t bdecode_window_open( bobject_t window_id, /* window's object id */ bdisplay_t display /* display on which the window appears */ ); /* Summary: Hide and close a decode window. Description: Any decode which you started to this decode window should have already been stopped. */ void bdecode_window_close( bdecode_window_t window ); /* Summary: Decode window settings returned by bdecode_window_get. */ typedef struct bdecode_window_settings { bsettop_rect def_position; /* default position and size on the display. Use display-relative coordinates. */ bsettop_rect position; /* Position and size on the display. Use display-relative coordinates. */ } bdecode_window_settings; /* Summary: Get the current settings of a decode window. */ bresult bdecode_window_get( bdecode_window_t window, bdecode_window_settings *settings /* [out] */ ); /* Summary: Apply new settings to the decode window. Description: Only those individual settings which have changed will be asserted. */ bresult bdecode_window_set( bdecode_window_t window, bdecode_window_settings *settings ); /* Summary: Pass new settings to the decode window without BVDC_ApplyChanges. Description: Only those individual settings which have changed will be asserted. */ bresult bdecode_window_preset( bdecode_window_t window, bdecode_window_settings *settings ); int b_lock_vdc(void); void b_unlock_vdc(void); #ifdef HAS_VBI /* Summary: enable amol and gs Description: enable/disable amol and gs */ bresult bdisplay_vbi_enable_amol_gs(bool enable); /* Summary: enque gs data to vbvi encode engine Description: enque gs data to vbvi encode engine */ bresult vbi_gs_write_isr(pscte_127_handle pscte_127, int field_parity); /* Summary: enque AMOL data to vbvi encode engine Description: enque AMOL data to vbvi encode engine */ bresult vbi_amol_write_isr(pscte_127_handle pscte_127, int field_parity); #endif /* HAS_VBI */ bresult bdisplay_set_vbi_rating_info( bdisplay_t display, unsigned int ratings_tv, unsigned int ratings_movie, unsigned int content_v, unsigned int content_s, unsigned int content_l, unsigned int content_d ); bresult bdisplay_output_rf_enable( bdisplay_t display, /* handle returned by bdisplay_open */ bool enable ); /** Summary: enable deinterlacer on display (id), and disable deinterlacer on other display (!id) **/ void bdisplay_set_deinterlacer(bdisplay_t display, int id, bool enable); /** Summary: set SCL coefficient for SD path coeff_idx (1-26, which is softness -> sharpness) **/ void bdisplay_set_coefficient_index(bdisplay_t display,bool horiz, int output, int coeff_idx); /* Summary: enable visibility of HDMI window Description: enable/disable HDMI window in case HDCP authentication failed */ bresult bdisplay_output_hdmi_enable(bdisplay_t display, bool enable); /* Summary: to set initial hdmi video format if not default 720p Description: to set initial hdmi video format if not default 720p */ bresult bdisplay_set_init_format(bobject_t display_id, bsettop_display_format_t fmt); /* Summary: return default display settings Description: return default display settings */ void bdisplay_get_default_settings(bdisplay_settings *psettings); /* Summary: record auto aspect ratio for ntsc and 480p video format on hdmi output Description: record auto aspect ratio for ntsc and 480p video format on hdmi output that is returned from edid message of the display TV */ void bdisplay_record_hdmi_auto_aspect_ratio(bdisplay_t display, uint32_t auto_hdmi_480i_aspect_ratio, uint32_t auto_hdmi_480p_aspect_ratio); #ifdef __cplusplus } #endif #endif /* BSETTOP_DISPLAY_H__ */