| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * TV service host API, |
| 30 | * See vc_hdmi.h for HDMI related constants |
| 31 | * See vc_sdtv.h for SDTV related constants |
| 32 | */ |
| 33 | |
| 34 | #ifndef _VC_TVSERVICE_H_ |
| 35 | #define _VC_TVSERVICE_H_ |
| 36 | |
| 37 | #include "vcinclude/common.h" |
| 38 | #include "interface/vcos/vcos.h" |
| 39 | #include "interface/vchi/vchi.h" |
| 40 | #include "interface/vmcs_host/vc_tvservice_defs.h" |
| 41 | #include "interface/vmcs_host/vc_hdmi.h" |
| 42 | #include "interface/vmcs_host/vc_sdtv.h" |
| 43 | |
| 44 | /** |
| 45 | * \file |
| 46 | * |
| 47 | * This API defines the controls for both HDMI and analogue TVs. It allows |
| 48 | * the user to dynamically switch between HDMI and SDTV without having |
| 49 | * to worry about switch one off before turning the other on. It also |
| 50 | * allows the user to query the supported HDMI resolutions and audio |
| 51 | * formats and turn on/off copy protection. |
| 52 | * |
| 53 | * There are three ways to turn on HDMI: preferred mode; best matched mode |
| 54 | * and explicit mode. See the three power on functions for details. |
| 55 | */ |
| 56 | |
| 57 | /** |
| 58 | * TVSERVICE_CALLBACK_T is the callback function for host side notification. |
| 59 | * Host applications register a single callback for all TV related notifications. |
| 60 | * See <DFN>VC_HDMI_NOTIFY_T</DFN> and <DFN>VC_SDTV_NOTIFY_T</DFN> in vc_hdmi.h and vc_sdtv.h |
| 61 | * respectively for list of reasons and respective param1 and param2 |
| 62 | * |
| 63 | * @param callback_data is the context passed in during the call to vc_tv_register_callback |
| 64 | * |
| 65 | * @param reason is the notification reason |
| 66 | * |
| 67 | * @param param1 is the first optional parameter |
| 68 | * |
| 69 | * @param param2 is the second optional parameter |
| 70 | * |
| 71 | * @return void |
| 72 | */ |
| 73 | typedef void (*TVSERVICE_CALLBACK_T)(void *callback_data, uint32_t reason, uint32_t param1, uint32_t param2); |
| 74 | |
| 75 | /* API at application start time */ |
| 76 | /** |
| 77 | * <DFN>vc_vchi_tv_init</DFN> is called at the beginning of the application |
| 78 | * to initialise the client to TV service |
| 79 | * |
| 80 | * @param initialise_instance is the VCHI instance |
| 81 | * |
| 82 | * @param array of pointers of connections |
| 83 | * |
| 84 | * @param number of connections (currently this is always <DFN>1</DFN> |
| 85 | * |
| 86 | * @return Zero is successful A negative return value indicates failure (which may mean it has not been started on VideoCore). |
| 87 | */ |
| 88 | VCHPRE_ int vc_vchi_tv_init(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections ); |
| 89 | |
| 90 | /** |
| 91 | * <DFN>vc_vchi_tv_stop</DFN> is called to stop the host side of TV service. |
| 92 | * |
| 93 | * @param none |
| 94 | * |
| 95 | * @return void |
| 96 | */ |
| 97 | VCHPRE_ void vc_vchi_tv_stop( void ); |
| 98 | |
| 99 | /** |
| 100 | * Host applications should call <DFN>vc_tv_register_callback</DFN> at |
| 101 | * the beginning to register a callback function to handle all notifications. |
| 102 | * See <DFN>TVSERVICE_CALLBACK_T </DFN> |
| 103 | * |
| 104 | * @param callback function |
| 105 | * |
| 106 | * @param callback_data is the context to be passed when function is called |
| 107 | * |
| 108 | * @return void |
| 109 | */ |
| 110 | VCHPRE_ void vc_tv_register_callback(TVSERVICE_CALLBACK_T callback, void *callback_data); |
| 111 | |
| 112 | /** |
| 113 | * <DFN>vc_tv_unregister_callback</DFN> removes a function registered with |
| 114 | * <DFN>vc_tv_register_callback</DFN> from the list of callbacks. |
| 115 | * |
| 116 | * @param callback function |
| 117 | * |
| 118 | * @return void |
| 119 | */ |
| 120 | VCHPRE_ void vc_tv_unregister_callback(TVSERVICE_CALLBACK_T callback); |
| 121 | |
| 122 | /** |
| 123 | * <DFN>vc_tv_unregister_callback</DFN> removes a function registered with |
| 124 | * <DFN>vc_tv_register_callback</DFN> from the list of callbacks. |
| 125 | * In contrast to vc_tv_unregister_callback this one matches not only the |
| 126 | * function pointer but also the data pointer before removal. |
| 127 | * |
| 128 | * @param callback function |
| 129 | * |
| 130 | * @return void |
| 131 | */ |
| 132 | VCHPRE_ void vc_tv_unregister_callback_full(TVSERVICE_CALLBACK_T callback, void *callback_data); |
| 133 | |
| 134 | /** |
| 135 | * In the following API any functions applying to HDMI only will have hdmi_ |
| 136 | * in the name, ditto for SDTV only will have sdtv_ in the name, |
| 137 | * Otherwise the function applies to both SDTV and HDMI (e.g. power off) |
| 138 | */ |
| 139 | |
| 140 | /** |
| 141 | * <DFN>vc_tv_get_state</DFN> is used to obtain the current TV state. |
| 142 | * Host applications should call this function right after registering |
| 143 | * a callback in case any notifications are missed. |
| 144 | * |
| 145 | * Now deprecated - use vc_tv_get_display_state instead |
| 146 | * |
| 147 | * @param pointer to TV_GET_STATE_RESP_T |
| 148 | * |
| 149 | * @return zero if the command is sent successfully, non zero otherwise |
| 150 | * If the command fails to be sent, passed in state is unchanged |
| 151 | * |
| 152 | */ |
| 153 | VCHPRE_ int VCHPOST_ vc_tv_get_state(TV_GET_STATE_RESP_T *tvstate); |
| 154 | VCHPRE_ int VCHPOST_ vc_tv_get_state_id(uint32_t display_id, TV_GET_STATE_RESP_T *tvstate); |
| 155 | |
| 156 | /** |
| 157 | * <DFN>vc_tv_get_display_state</DFN> is used to obtain the current TV display |
| 158 | * state. This function supersedes vc_tv_get_state (which is only kept for |
| 159 | * backward compatibility. |
| 160 | * Host applications should call this function right after registering |
| 161 | * a callback in case any notifications are missed. |
| 162 | * |
| 163 | * @param pointer to TV_DISPLAY_STATE_T |
| 164 | * |
| 165 | * @return zero if the command is sent successfully, non zero otherwise |
| 166 | * If the command fails to be sent, passed in state is unchanged |
| 167 | * |
| 168 | */ |
| 169 | VCHPRE_ int VCHPOST_ vc_tv_get_display_state(TV_DISPLAY_STATE_T *tvstate); |
| 170 | VCHPRE_ int VCHPOST_ vc_tv_get_display_state_id(uint32_t display_id, TV_DISPLAY_STATE_T *tvstate); |
| 171 | |
| 172 | /** |
| 173 | * Use <DFN>vc_tv_hdmi_power_on_preferred</DFN> if you don't care what resolutions |
| 174 | * a TV supports and just want to turn on its native resolution. Analogue TV will |
| 175 | * be powered down if on (same for the following two HDMI power on functions.) |
| 176 | * If power on is successful, a host application must wait for the power on complete |
| 177 | * callback before attempting to open the display. |
| 178 | * |
| 179 | * @param none |
| 180 | * |
| 181 | * @return single value interpreted as HDMI_RESULT_T (zero means success) |
| 182 | * if successful, there will be a callback when the power on is complete |
| 183 | * |
| 184 | **/ |
| 185 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_preferred( void ); |
| 186 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_preferred_id(uint32_t display_id); |
| 187 | |
| 188 | /** |
| 189 | * Same as above, but tell the TV to enter 3D mode. The TV will go to 2D mode |
| 190 | * if the preferred mode doesn't support 3D. |
| 191 | **/ |
| 192 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_preferred_3d( void ); |
| 193 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_preferred_3d_id(uint32_t display_id); |
| 194 | |
| 195 | /** |
| 196 | * Use <DFN>vc_tv_hdmi_power_on_best</DFN> to power on HDMI at best matched resolution |
| 197 | * based on passed in parameters. Use HDMI_MODE_MATCH_FRAMERATE if you want to |
| 198 | * match the frame rate; use HDMI_MODE_MATCH_RESOLUTION if you want to match on |
| 199 | * screen size; add HDMI_MODE_MATCH_SCANMODE if you want to force |
| 200 | * interlaced/progressive mode. If no matching mode is found, the native resolution |
| 201 | * will be used instead. |
| 202 | * |
| 203 | * @param width is the desired minimum screen width |
| 204 | * |
| 205 | * @param height is the desired minimum screen height |
| 206 | * |
| 207 | * @param rate is the desired frame rate |
| 208 | * |
| 209 | * @param scan_mode (HDMI_NONINTERLACED / HDMI_INTERLACED) is the desired scan mode |
| 210 | * |
| 211 | * @param match flags is the matching flag <DFN>EDID_MODE_MATCH_FLAG_T</DFN> |
| 212 | * |
| 213 | * @return same as <DFN>vc_tv_hdmi_power_on_preferred</DFN> |
| 214 | */ |
| 215 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_best(uint32_t width, uint32_t height, uint32_t frame_rate, |
| 216 | HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags); |
| 217 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_best_id(uint32_t display_id, uint32_t width, uint32_t height, uint32_t frame_rate, |
| 218 | HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags); |
| 219 | |
| 220 | /** |
| 221 | * Same as above, but tell the TV to enter 3D mode. The TV will go to 2D mode |
| 222 | * if no suitable 3D mode can be found. |
| 223 | **/ |
| 224 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_best_3d(uint32_t width, uint32_t height, uint32_t frame_rate, |
| 225 | HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags); |
| 226 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_best_3d_id(uint32_t display_id, uint32_t width, uint32_t height, uint32_t frame_rate, |
| 227 | HDMI_INTERLACED_T scan_mode, EDID_MODE_MATCH_FLAG_T match_flags); |
| 228 | |
| 229 | /** |
| 230 | * Use <DFN>vc_tv_hdmi_power_on_explicit</DFN> if you want full control over what mode |
| 231 | * the TV is driven. This function is used, for example, when the host has the EDID |
| 232 | * and HDMI middleware does not know. If HDMI middleware has knowledge of EDID, the |
| 233 | * passed in mode is still subject to TV's supported modes |
| 234 | * |
| 235 | * @param mode (HDMI_MODE_HDMI/HDMI_MODE_DVI/HDMI_MODE_3D) |
| 236 | * |
| 237 | * @param group (HDMI_RES_GROUP_CEA/HDMI_RES_GROUP_DMT) |
| 238 | * |
| 239 | * @param code either <DFN>HDMI_CEA_RES_CODE_T</DFN> or <DFN>HDMI_DMT_RES_CODE_T</DFN> |
| 240 | * |
| 241 | * @return same as <DFN>vc_tv_hdmi_power_on_preferred</DFN> |
| 242 | */ |
| 243 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_explicit_new(HDMI_MODE_T mode, HDMI_RES_GROUP_T group, uint32_t code); |
| 244 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_explicit_new_id(uint32_t display_id, HDMI_MODE_T mode, HDMI_RES_GROUP_T group, uint32_t code); |
| 245 | |
| 246 | /** |
| 247 | * <DFN>vc_tv_sdtv_power_on</DFN> is used to turn on analogue TV. HDMI will |
| 248 | * automatically be powered off if on. |
| 249 | * |
| 250 | * @param SDTV mode <DFN>SDTV_MODE_T</DFN> |
| 251 | * |
| 252 | * @param options <DFN>SDTV_OPTIONS_T</DFN> |
| 253 | * |
| 254 | * @return single value (zero means success) if successful, there will be a callback when the power on is complete |
| 255 | * |
| 256 | */ |
| 257 | VCHPRE_ int VCHPOST_ vc_tv_sdtv_power_on(SDTV_MODE_T mode, SDTV_OPTIONS_T *options); |
| 258 | VCHPRE_ int VCHPOST_ vc_tv_sdtv_power_on_id(uint32_t display_id, SDTV_MODE_T mode, SDTV_OPTIONS_T *options); |
| 259 | |
| 260 | /** |
| 261 | * <DFN>vc_tv_power_off</DFN> is used to turn off either analogue or HDMI output. |
| 262 | * If HDMI is powered down, there will be a callback with reason UNPLUGGED (if no |
| 263 | * cable is attached) or STANDBY (if a cable is attached) |
| 264 | * |
| 265 | * @param none |
| 266 | * |
| 267 | * @return whether command is succcessfully sent |
| 268 | * |
| 269 | */ |
| 270 | VCHPRE_ int VCHPOST_ vc_tv_power_off( void ); |
| 271 | VCHPRE_ int VCHPOST_ vc_tv_power_off_id(uint32_t display_id); |
| 272 | |
| 273 | /** |
| 274 | * <DFN>vc_tv_hdmi_get_supported_modes</DFN> is used to get a list of supported |
| 275 | * modes for a particular standard (CEA/DMT/CEA3D). Prefer resolution (group and mode) |
| 276 | * is also returned, if needed. If there are more modes supported than the size of the array |
| 277 | * supply, only the array will be filled. |
| 278 | * |
| 279 | * @param group(HDMI_RES_GROUP_CEA/HDMI_RES_GROUP_DMT) |
| 280 | * |
| 281 | * @param array of <DFN>TV_SUPPORT_MODE_T</DFN> struct |
| 282 | * |
| 283 | * @param length of array above (in elements, not bytes) |
| 284 | * |
| 285 | * @pointer to preferred group (can be NULL) |
| 286 | * |
| 287 | * @pointer to prefer mode code (can be NULL) |
| 288 | * |
| 289 | * @return the number of modes actually written in the array, |
| 290 | * zero means no modes (no EDID or cable unplugged) |
| 291 | * |
| 292 | */ |
| 293 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_supported_modes_new(HDMI_RES_GROUP_T group, |
| 294 | TV_SUPPORTED_MODE_NEW_T *supported_modes, |
| 295 | uint32_t max_supported_modes, |
| 296 | HDMI_RES_GROUP_T *preferred_group, |
| 297 | uint32_t *preferred_mode); |
| 298 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_supported_modes_new_id(uint32_t display_id, |
| 299 | HDMI_RES_GROUP_T group, |
| 300 | TV_SUPPORTED_MODE_NEW_T *supported_modes, |
| 301 | uint32_t max_supported_modes, |
| 302 | HDMI_RES_GROUP_T *preferred_group, |
| 303 | uint32_t *preferred_mode); |
| 304 | /** |
| 305 | * <DFN>vc_tv_hdmi_mode_supported</DFN> is used to query whether a particular mode |
| 306 | * is supported or not. |
| 307 | * |
| 308 | * @param resolution standard (HDMI_RES_GROUP_CEA/HDMI_RES_GROUP_DMT) |
| 309 | * |
| 310 | * @param mode code |
| 311 | * |
| 312 | * @return > 0 means supported, 0 means unsupported, < 0 means error |
| 313 | * |
| 314 | */ |
| 315 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_mode_supported(HDMI_RES_GROUP_T group, |
| 316 | uint32_t mode); |
| 317 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_mode_supported_id(uint32_t display_d, HDMI_RES_GROUP_T group, |
| 318 | uint32_t mode); |
| 319 | |
| 320 | /** |
| 321 | * <DFN>vc_tv_hdmi_audio_supported</DFN> is used to query whether a |
| 322 | * particular audio format is supported. By default a device has to support |
| 323 | * 16-bit stereo PCM at 32/44.1/48 kHz if audio is supported at all. |
| 324 | * Support of other audio formats allow SPDIF to be used. |
| 325 | * A return value of zero means the audio format is completely supported. |
| 326 | * Any non-zero values are interpreted as bit mask (EDID_AUDIO_SUPPORT_FLAG_T). |
| 327 | * For example, if EDID_AUDIO_NO_SUPPORT is set, the audio format is not supported. |
| 328 | * If EDID_AUDIO_CHAN_UNSUPPORTED is set, the max no. of channels has exceeded. |
| 329 | * |
| 330 | * @param audio format supplied as (<DFN>EDID_AudioFormat</DFN> + <DFN>EDID_AudioCodingExtension</DFN>) |
| 331 | * |
| 332 | * @param no. of channels (1-8) |
| 333 | * |
| 334 | * @param sample rate <DFN>EDID_AudioSampleRate</DFN> but NOT "refer to header" |
| 335 | * |
| 336 | * @param bit rate (or sample size if pcm) use <DFN>EDID_AudioSampleSize</DFN> as sample size argument |
| 337 | * |
| 338 | * @return: single value return interpreted as flags in <DFN>EDID_AUDIO_SUPPORT_FLAG_T</DFN> |
| 339 | * |
| 340 | */ |
| 341 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_audio_supported(uint32_t audio_format, uint32_t num_channels, |
| 342 | EDID_AudioSampleRate fs, uint32_t bitrate); |
| 343 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_audio_supported_id(uint32_t display_id, uint32_t audio_format, uint32_t num_channels, |
| 344 | EDID_AudioSampleRate fs, uint32_t bitrate); |
| 345 | |
| 346 | /** |
| 347 | * Use <DFN>vc_tv_enable_copyprotect</DFN> to turn on copy protection. |
| 348 | * For HDMI, only HDMI_CP_HDCP is recognised. |
| 349 | * For SDTV, use one of the values in SDTV_CP_MODE_T |
| 350 | * |
| 351 | * @param copy protect mode |
| 352 | * |
| 353 | * @param time out in milliseconds (only applicable to HDMI) |
| 354 | * |
| 355 | * @return 0 means success, additional result via callback |
| 356 | * |
| 357 | */ |
| 358 | VCHPRE_ int VCHPOST_ vc_tv_enable_copyprotect(uint32_t cp_mode, uint32_t timeout); |
| 359 | VCHPRE_ int VCHPOST_ vc_tv_enable_copyprotect_id(uint32_t display_id, uint32_t cp_mode, uint32_t timeout); |
| 360 | |
| 361 | /** |
| 362 | * Use <DFN>vc_tv_disable_copyprotect</DFN> to turn off copy protection |
| 363 | * |
| 364 | * @param none |
| 365 | * |
| 366 | * @rturn 0 means success, additional result via callback |
| 367 | * |
| 368 | */ |
| 369 | VCHPRE_ int VCHPOST_ vc_tv_disable_copyprotect( void ); |
| 370 | VCHPRE_ int VCHPOST_ vc_tv_disable_copyprotect_id(uint32_t display_id); |
| 371 | |
| 372 | /** |
| 373 | * Use <DFN>vc_tv_show_info</DFN> to show or hide info screen. |
| 374 | * Only usable in HDMI at the moment. |
| 375 | * |
| 376 | * @param show (1) or hide (0) info screen |
| 377 | * |
| 378 | * @return zero if command is successfully sent |
| 379 | * |
| 380 | */ |
| 381 | VCHPRE_ int VCHPOST_ vc_tv_show_info(uint32_t show); |
| 382 | VCHPRE_ int VCHPOST_ vc_tv_show_info_id(uint32_t display_id, uint32_t show); |
| 383 | |
| 384 | /** |
| 385 | * <DFN>vc_tv_hdmi_get_av_latency</DFN> is used to get the AV latency |
| 386 | * (in ms) for HDMI (lipsync), only valid if HDMI is currently powered on, |
| 387 | * otherwise you get zero. The latency is defined as the relative delay |
| 388 | * of the video stream to the audio stream |
| 389 | * |
| 390 | * @param none |
| 391 | * |
| 392 | * @return latency (zero if error or latency is not defined), |
| 393 | * < 0 if failed to send command) |
| 394 | * |
| 395 | */ |
| 396 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_av_latency( void ); |
| 397 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_av_latency_id(uint32_t display_id); |
| 398 | |
| 399 | /** |
| 400 | * Use <DFN>vc_tv_hdmi_set_hdcp_key</DFN> to download HDCP key to HDCP middleware |
| 401 | * |
| 402 | * @param AES encrypted key block (328 bytes) |
| 403 | * |
| 404 | * @return single value return indicating queued status |
| 405 | * Callback indicates the validity of key |
| 406 | */ |
| 407 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_hdcp_key(const uint8_t *key); |
| 408 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_hdcp_key_id(uint32_t display_id, const uint8_t *key); |
| 409 | |
| 410 | /** |
| 411 | * Use <DFN>vc_tv_hdmi_set_hdcp_revoked_list</DFN> to download SRM |
| 412 | * revoked list |
| 413 | * |
| 414 | * @param list |
| 415 | * |
| 416 | * @param size of list (no. of keys) |
| 417 | * |
| 418 | * @return single value return indicating queued status |
| 419 | * Callback indicates the number of keys set (zero if failed, unless you are clearing the list) |
| 420 | * |
| 421 | */ |
| 422 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_hdcp_revoked_list(const uint8_t *list, uint32_t num_keys); |
| 423 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_hdcp_revoked_list_id(uint32_t display_id, const uint8_t *list, uint32_t num_keys); |
| 424 | |
| 425 | /** |
| 426 | * <DFN>vc_tv_hdmi_set_spd</DFN> is used to set the SPD infoframe. |
| 427 | * |
| 428 | * @param manufacturer (max. 8 characters) |
| 429 | * |
| 430 | * @param description (max. 16 characters) |
| 431 | * |
| 432 | * @param product type <DFN>HDMI_SPD_TYPE_CODE_T</DFN> |
| 433 | * |
| 434 | * @return whether command was sent successfully (zero means success) |
| 435 | * |
| 436 | */ |
| 437 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_spd(const char *manufacturer, const char *description, HDMI_SPD_TYPE_CODE_T type); |
| 438 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_spd_id(uint32_t display_id, const char *manufacturer, const char *description, HDMI_SPD_TYPE_CODE_T type); |
| 439 | |
| 440 | /** |
| 441 | * <DFN>vc_tv_hdmi_set_display_options</DFN> is used to set the |
| 442 | * active area for HDMI (bar width/height should be set to zero if absent) |
| 443 | * This information is conveyed in AVI infoframe. |
| 444 | * |
| 445 | * @param aspect ratio <DFN>HDMI_ASPECT_T</DFN> |
| 446 | * |
| 447 | * @param left bar width |
| 448 | * |
| 449 | * @param right bar width |
| 450 | * |
| 451 | * @param top bar height |
| 452 | * |
| 453 | * @param bottom bar height |
| 454 | * |
| 455 | * @return whether command was sent successfully (zero means success) |
| 456 | * |
| 457 | */ |
| 458 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_display_options(HDMI_ASPECT_T aspect, uint32_t left_bar_width, uint32_t right_bar_width, uint32_t top_bar_height, uint32_t bottom_bar_height, uint32_t overscan_flags); |
| 459 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_display_options_id(uint32_t display_id, HDMI_ASPECT_T aspect, uint32_t left_bar_width, uint32_t right_bar_width, uint32_t top_bar_height, uint32_t bottom_bar_height, uint32_t overscan_flags); |
| 460 | |
| 461 | /** |
| 462 | * Use <DFN>vc_tv_test_mode_start</DFN> to generate test signal. |
| 463 | * At the moment only DVI test signal is supported. |
| 464 | * HDMI must be powered off before this function is called. |
| 465 | * |
| 466 | * @param 24-bit background colour (if applicable) |
| 467 | * |
| 468 | * @param test mode <DFN>TV_TEST_MODE_T</DFN> |
| 469 | * |
| 470 | * @return whether command was sent successfully (zero means success) |
| 471 | * |
| 472 | */ |
| 473 | VCHPRE_ int VCHPOST_ vc_tv_test_mode_start(uint32_t colour, TV_TEST_MODE_T test_mode); |
| 474 | VCHPRE_ int VCHPOST_ vc_tv_test_mode_start_id(uint32_t display_id, uint32_t colour, TV_TEST_MODE_T test_mode); |
| 475 | |
| 476 | /** |
| 477 | * Use <DFN>vc_tv_test_mode_stop</DFN> to stop the test signal and power down |
| 478 | * HDMI. |
| 479 | * |
| 480 | * @param none |
| 481 | * |
| 482 | * @return whether command was sent successfully (zero means success) |
| 483 | * |
| 484 | */ |
| 485 | VCHPRE_ int VCHPOST_ vc_tv_test_mode_stop( void ); |
| 486 | VCHPRE_ int VCHPOST_ vc_tv_test_mode_stop_id(uint32_t display_id); |
| 487 | |
| 488 | /** |
| 489 | * <DFN>vc_tv_hdmi_ddc_read</DFN> allows an host application to read EDID |
| 490 | * with DDC protocol. |
| 491 | * |
| 492 | * @param offset |
| 493 | * |
| 494 | * @param length to read (this is typically 128 bytes to coincide with EDID block size) |
| 495 | * |
| 496 | * @param pointer to buffer, must be 16 byte aligned |
| 497 | * |
| 498 | * @returns length of data read (so zero means error) and the buffer will be filled |
| 499 | * only if there is no error |
| 500 | * |
| 501 | */ |
| 502 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_ddc_read(uint32_t offset, uint32_t length, uint8_t *buffer); |
| 503 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_ddc_read_id(uint32_t display_id, uint32_t offset, uint32_t length, uint8_t *buffer); |
| 504 | |
| 505 | /** |
| 506 | * Sets the TV state to attached. |
| 507 | * Required when hotplug interrupt is not handled by VideoCore. |
| 508 | * |
| 509 | * @param attached non-zero if the TV is attached or zero for unplugged. |
| 510 | */ |
| 511 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_attached(uint32_t attached); |
| 512 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_attached_id(uint32_t display_id, uint32_t attached); |
| 513 | |
| 514 | /** |
| 515 | * Sets one of the HDMI properties. HDMI properties persist |
| 516 | * between HDMI power on/off |
| 517 | * |
| 518 | * @param property [in] |
| 519 | * |
| 520 | * @return zero if successful, non-zero otherwise |
| 521 | */ |
| 522 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_property(const HDMI_PROPERTY_PARAM_T *property); |
| 523 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_set_property_id(uint32_t display_id, const HDMI_PROPERTY_PARAM_T *property); |
| 524 | |
| 525 | /** |
| 526 | * Gets the current value of an HDMI property. |
| 527 | * |
| 528 | * @param property [in/out] |
| 529 | * |
| 530 | * @return zero if success (param1/param2 will be set), non-zero otherwise (param1/param2 will not be set) |
| 531 | */ |
| 532 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_property(HDMI_PROPERTY_PARAM_T *property); |
| 533 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_property_id(uint32_t display_id, HDMI_PROPERTY_PARAM_T *property); |
| 534 | |
| 535 | /** |
| 536 | * Converts the notification reason to a string. |
| 537 | * |
| 538 | * @param reason is the notification reason |
| 539 | * @return The notification reason as a string. |
| 540 | */ |
| 541 | VCHPRE_ const char* vc_tv_notification_name(VC_HDMI_NOTIFY_T reason); |
| 542 | VCHPRE_ const char* vc_tv_notification_name_id(uint32_t display_id, VC_HDMI_NOTIFY_T reason); |
| 543 | |
| 544 | /** |
| 545 | * Get the unique device ID from the EDID |
| 546 | * @param pointer to device ID struct |
| 547 | * @return zero if successful, non-zero if failed. |
| 548 | */ |
| 549 | VCHPRE_ int VCHPOST_ vc_tv_get_device_id(TV_DEVICE_ID_T *id); |
| 550 | VCHPRE_ int VCHPOST_ vc_tv_get_device_id_id(uint32_t display_id, TV_DEVICE_ID_T *id); |
| 551 | |
| 552 | /** |
| 553 | * Get list of attached devices |
| 554 | * @param pointer to attached devices struc |
| 555 | * @return zero if successful, non-zero if failed. |
| 556 | */ |
| 557 | VCHPRE_ int VCHPOST_ vc_tv_get_attached_devices(TV_ATTACHED_DEVICES_T *devices); |
| 558 | |
| 559 | // temporary: maintain backwards compatibility |
| 560 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_supported_modes(HDMI_RES_GROUP_T group, |
| 561 | TV_SUPPORTED_MODE_T *supported_modes, |
| 562 | uint32_t max_supported_modes, |
| 563 | HDMI_RES_GROUP_T *preferred_group, |
| 564 | uint32_t *preferred_mode); |
| 565 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_get_supported_modes_id(uint32_t display_id, |
| 566 | HDMI_RES_GROUP_T group, |
| 567 | TV_SUPPORTED_MODE_T *supported_modes, |
| 568 | uint32_t max_supported_modes, |
| 569 | HDMI_RES_GROUP_T *preferred_group, |
| 570 | uint32_t *preferred_mode); |
| 571 | |
| 572 | // temporary: maintain backwards compatibility |
| 573 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_explicit(HDMI_MODE_T mode, HDMI_RES_GROUP_T group, uint32_t code); |
| 574 | VCHPRE_ int VCHPOST_ vc_tv_hdmi_power_on_explicit_id(uint32_t display_id, HDMI_MODE_T mode, HDMI_RES_GROUP_T group, uint32_t code); |
| 575 | |
| 576 | #endif |
| 577 | |