| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2005-2011, 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: bhdm_cec_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/17 $ |
|---|
| 12 | * $brcm_Date: 11/23/11 3:06p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/hdm/7038/bhdm_cec_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/17 11/23/11 3:06p vle |
|---|
| 21 | * SW7425-1140: Fix build errors when building with BHDM_CEC_SUPPORT |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/16 11/22/11 6:02p vle |
|---|
| 24 | * SW7425-1140: Merge to mainline. Remove all CEC functionality out of |
|---|
| 25 | * HDM PI. |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/SW7425-1140/2 11/22/11 5:48p vle |
|---|
| 28 | * SW7425-1140: Add BHDM_CONFIG_CEC_LEGACY_SUPPORT for backward compatible |
|---|
| 29 | * for CEC legacy platforms. |
|---|
| 30 | * |
|---|
| 31 | * Hydra_Software_Devel/SW7425-1140/1 11/16/11 12:16p vle |
|---|
| 32 | * SW7425-1140: Remove all CEC functionalities out of HDM PI |
|---|
| 33 | * |
|---|
| 34 | * Hydra_Software_Devel/15 11/14/11 2:15p rgreen |
|---|
| 35 | * SW7425-1710: Update BHDM_CONFIG macro usage. Describe specific |
|---|
| 36 | * functionality vs chip process |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/14 10/18/11 1:06p vle |
|---|
| 39 | * SWBLURAY-26139: Ensure CEC_ADDR is set to UNREGISTER address (0xF) by |
|---|
| 40 | * default. |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/13 10/11/11 4:50p vle |
|---|
| 43 | * SW7429-5: Add support for 7429. |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/12 4/7/11 6:18p vle |
|---|
| 46 | * SW3548-2895: Fix incorrect CEC default timing program for some |
|---|
| 47 | * platforms, namely 7405, 7325, etc. |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/11 11/19/10 4:57p vle |
|---|
| 50 | * SW7400-2947: Fix CEC timing configuration for 7400 |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/10 9/28/10 7:19p vle |
|---|
| 53 | * SW7422-23: Refactor HDMI code to isolate platform dependent code |
|---|
| 54 | * furthermore. Add support for 7422 and other 40nm platforms. |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/9 4/21/10 4:27p vle |
|---|
| 57 | * SW3548-2895: update default CEC timings. |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/8 1/6/10 4:30p vle |
|---|
| 60 | * SW3548-2670: Fix compiler errors for HDMI TX platforms. Centralize all |
|---|
| 61 | * CEC timing configurations |
|---|
| 62 | * |
|---|
| 63 | * Hydra_Software_Devel/7 12/29/09 3:51p rgreen |
|---|
| 64 | * SW3548-2670: Add register offset to support multiple fe channels |
|---|
| 65 | * Add function to adjust default timing |
|---|
| 66 | * |
|---|
| 67 | * Hydra_Software_Devel/6 10/31/08 3:20p vle |
|---|
| 68 | * PR47447: Fix compiling error on 3549/3556 |
|---|
| 69 | * |
|---|
| 70 | * Hydra_Software_Devel/5 10/30/08 5:51p vle |
|---|
| 71 | * PR47447: Merge to main branch. |
|---|
| 72 | * Add new GetReceivedMessage API. Use same CEC configuration for |
|---|
| 73 | * transmitter and receiver. |
|---|
| 74 | * |
|---|
| 75 | * Hydra_Software_Devel/PR47447/1 9/30/08 7:04p vle |
|---|
| 76 | * PR47447: Add new GetReceivedMessage API. Use same CEC configuration for |
|---|
| 77 | * transmitter and receiver. |
|---|
| 78 | * |
|---|
| 79 | * Hydra_Software_Devel/4 9/11/08 10:17p rgreen |
|---|
| 80 | * PR45482: PR44257,PR45482: merge changes |
|---|
| 81 | * |
|---|
| 82 | * Hydra_Software_Devel/PR45482/1 8/7/08 2:08p honglang |
|---|
| 83 | * PR44257,PR45482: support CEC on 3549/56 HDMI input |
|---|
| 84 | * |
|---|
| 85 | * Hydra_Software_Devel/3 7/21/08 6:28p vle |
|---|
| 86 | * PR44257: Add CEC support for 3549/3556 |
|---|
| 87 | * |
|---|
| 88 | * Hydra_Software_Devel/2 5/27/08 12:21p vle |
|---|
| 89 | * PR42271, PR40264: add CEC support for HDMI Rx platforms |
|---|
| 90 | * |
|---|
| 91 | * Hydra_Software_Devel/PR42271/3 5/23/08 6:25p vle |
|---|
| 92 | * PR 42271: Modify to allow easier code reuse between HDMI Tx and HDMI Rx |
|---|
| 93 | * |
|---|
| 94 | * Hydra_Software_Devel/PR42271/2 5/16/08 4:48p honglang |
|---|
| 95 | * PR42271, PR40264: add CEC support to 3563 |
|---|
| 96 | * |
|---|
| 97 | * Hydra_Software_Devel/PR42271/1 5/16/08 2:55p honglang |
|---|
| 98 | * PR42271, PR40264: add CEC support to 3563 |
|---|
| 99 | * |
|---|
| 100 | * Hydra_Software_Devel/1 4/28/08 6:11p vle |
|---|
| 101 | * PR42271: Move HDMI CEC implementation to bhdm_cec_priv files |
|---|
| 102 | * |
|---|
| 103 | ***************************************************************************/ |
|---|
| 104 | |
|---|
| 105 | #ifndef BHDM_CEC_PRIV_H__ |
|---|
| 106 | #define BHDM_CEC_PRIV_H__ |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | /****************************** Include Files ********************************/ |
|---|
| 110 | |
|---|
| 111 | #ifdef __cplusplus |
|---|
| 112 | extern "C" { |
|---|
| 113 | #endif |
|---|
| 114 | |
|---|
| 115 | #define BCEC_BROADCAST_ADDR 0xF |
|---|
| 116 | |
|---|
| 117 | |
|---|
| 118 | /****************************************************************************** |
|---|
| 119 | Summary: |
|---|
| 120 | Data structure containing CEC information |
|---|
| 121 | *******************************************************************************/ |
|---|
| 122 | typedef struct _BCEC_CONFIG_ |
|---|
| 123 | { |
|---|
| 124 | uint8_t CecLogicalAddr ; |
|---|
| 125 | uint8_t CecPhysicalAddr [2] ; |
|---|
| 126 | uint8_t FirstCecMessage ; |
|---|
| 127 | uint8_t CecBufferedMsg[24] ; |
|---|
| 128 | uint8_t CecBufferedMsgLength ; |
|---|
| 129 | |
|---|
| 130 | } BCEC_CONFIG; |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | /******************************************************************************/ |
|---|
| 134 | /* HDMI Rx */ |
|---|
| 135 | #if (BCHP_CHIP == 3563) || (BCHP_CHIP == 3548) || (BCHP_CHIP == 3556) |
|---|
| 136 | |
|---|
| 137 | #include "bhdr_priv.h" |
|---|
| 138 | #include "bhdr.h" |
|---|
| 139 | #include "bhdr_cec.h" |
|---|
| 140 | #include "bhdr_config.h" |
|---|
| 141 | |
|---|
| 142 | #define BCEC_CONFIG_DEVICE_TYPE BHDR_CONFIG_CEC_DEVICE_TYPE |
|---|
| 143 | |
|---|
| 144 | /****************************************************************************** |
|---|
| 145 | Summary: |
|---|
| 146 | CEC Function Return Values |
|---|
| 147 | *******************************************************************************/ |
|---|
| 148 | #define BCEC_NOT_IMPLEMENTED BHDR_CEC_NOT_IMPLEMENTED |
|---|
| 149 | #define BCEC_NO_PHYS_ADDR BHDR_CEC_NO_PHYS_ADDR |
|---|
| 150 | #define BCEC_ASSIGNED_FREEUSE_ADDR BHDR_CEC_ASSIGNED_FREEUSE_ADDR |
|---|
| 151 | #define BCEC_ASSIGNED_UNREGISTERED_ADDR BHDR_CEC_ASSIGNED_UNREGISTERED_ADDR |
|---|
| 152 | #define BCEC_NO_LOGICAL_ADDR BHDR_CEC_NO_LOGICAL_ADDR |
|---|
| 153 | #define BCEC_EXCEED_MAX_DEVICE_LEVELS BHDR_CEC_EXCEED_MAX_DEVICE_LEVELS |
|---|
| 154 | #define BCEC_TRANSMIT_ERROR BHDR_CEC_TRANSMIT_ERROR |
|---|
| 155 | #define BCEC_RECEIVE_ERROR BHDR_CEC_RECEIVE_ERROR |
|---|
| 156 | #define BCEC_NOT_ENOUGH_MEM BHDR_CEC_NOT_ENOUGH_MEM |
|---|
| 157 | #define BCEC_EXCEED_MSG_LENGTH BHDR_CEC_EXCEED_MSG_LENGTH |
|---|
| 158 | #define BCEC_TRANSMIT_BUSY BHDR_CEC_TRANSMIT_BUSY |
|---|
| 159 | |
|---|
| 160 | #if BCHP_CHIP == 3563 |
|---|
| 161 | /*3563*/ |
|---|
| 162 | #include "bchp_hdmi_rx_0.h" |
|---|
| 163 | |
|---|
| 164 | #define BCEC_Handle BHDR_P_Handle * |
|---|
| 165 | |
|---|
| 166 | #define BCHP_MASK_DVP(Register,Field) BCHP_HDMI_RX_0_##Register##_##Field##_MASK |
|---|
| 167 | |
|---|
| 168 | #define REGADDR_CEC_CNTRL_1 BCHP_HDMI_RX_0_CEC_CNTRL_1 |
|---|
| 169 | #define REGNAME_CEC_CNTRL_1 HDMI_RX_0_CEC_CNTRL_1 |
|---|
| 170 | |
|---|
| 171 | #define REGADDR_CEC_CNTRL_5 BCHP_HDMI_RX_0_CEC_CNTRL_5 |
|---|
| 172 | #define REGNAME_CEC_CNTRL_5 HDMI_RX_0_CEC_CNTRL_5 |
|---|
| 173 | |
|---|
| 174 | #define REGADDR_CEC_TX_DATA_1 BCHP_HDMI_RX_0_CEC_TX_DATA_1 |
|---|
| 175 | #define REGNAME_CEC_TX_DATA_1 HDMI_RX_0_CEC_TX_DATA_1 |
|---|
| 176 | |
|---|
| 177 | #define REGADDR_CEC_RX_DATA_1 BCHP_HDMI_RX_0_CEC_RX_DATA_1 |
|---|
| 178 | #define REGNAME_CEC_RX_DATA_1 HDMI_RX_0_CEC_RX_DATA_1 |
|---|
| 179 | |
|---|
| 180 | #else |
|---|
| 181 | |
|---|
| 182 | /*3548 3556*/ |
|---|
| 183 | #include "bchp_hdmi_rx_fe_0.h" |
|---|
| 184 | #include "bhdr_fe.h" |
|---|
| 185 | #include "bhdr_fe_priv.h" |
|---|
| 186 | |
|---|
| 187 | #define BCEC_Handle BHDR_FE_ChannelHandle |
|---|
| 188 | |
|---|
| 189 | #define BCHP_MASK_DVP(Register,Field) \ |
|---|
| 190 | BCHP_HDMI_RX_FE_0_##Register##_##Field##_MASK |
|---|
| 191 | |
|---|
| 192 | #define REGADDR_CEC_CNTRL_1 BCHP_HDMI_RX_FE_0_CEC_CNTRL_1 |
|---|
| 193 | #define REGNAME_CEC_CNTRL_1 HDMI_RX_FE_0_CEC_CNTRL_1 |
|---|
| 194 | |
|---|
| 195 | #define REGADDR_CEC_CNTRL_2 BCHP_HDMI_RX_FE_0_CEC_CNTRL_2 |
|---|
| 196 | #define REGNAME_CEC_CNTRL_2 HDMI_RX_FE_0_CEC_CNTRL_2 |
|---|
| 197 | |
|---|
| 198 | #define REGADDR_CEC_CNTRL_3 BCHP_HDMI_RX_FE_0_CEC_CNTRL_3 |
|---|
| 199 | #define REGNAME_CEC_CNTRL_3 HDMI_RX_FE_0_CEC_CNTRL_3 |
|---|
| 200 | |
|---|
| 201 | #define REGADDR_CEC_CNTRL_4 BCHP_HDMI_RX_FE_0_CEC_CNTRL_4 |
|---|
| 202 | #define REGNAME_CEC_CNTRL_4 HDMI_RX_FE_0_CEC_CNTRL_4 |
|---|
| 203 | |
|---|
| 204 | #define REGADDR_CEC_CNTRL_5 BCHP_HDMI_RX_FE_0_CEC_CNTRL_5 |
|---|
| 205 | #define REGNAME_CEC_CNTRL_5 HDMI_RX_FE_0_CEC_CNTRL_5 |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | #define REGADDR_CEC_TX_DATA_1 BCHP_HDMI_RX_FE_0_CEC_TX_DATA_1 |
|---|
| 209 | #define REGNAME_CEC_TX_DATA_1 HDMI_RX_FE_0_CEC_TX_DATA_1 |
|---|
| 210 | |
|---|
| 211 | #define REGADDR_CEC_RX_DATA_1 BCHP_HDMI_RX_FE_0_CEC_RX_DATA_1 |
|---|
| 212 | #define REGNAME_CEC_RX_DATA_1 HDMI_RX_FE_0_CEC_RX_DATA_1 |
|---|
| 213 | #endif |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | /* HDMI TX */ |
|---|
| 217 | #else |
|---|
| 218 | |
|---|
| 219 | #include "bhdm_priv.h" |
|---|
| 220 | #include "bhdm.h" |
|---|
| 221 | #include "bhdm_cec.h" |
|---|
| 222 | #include "bhdm_config.h" |
|---|
| 223 | #include "bchp_hdmi.h" |
|---|
| 224 | |
|---|
| 225 | #if BHDM_CONFIG_CEC_LEGACY_SUPPORT |
|---|
| 226 | |
|---|
| 227 | #define BCEC_Handle BHDM_Handle |
|---|
| 228 | |
|---|
| 229 | #define BCEC_CONFIG_DEVICE_TYPE BHDM_CONFIG_CEC_DEVICE_TYPE |
|---|
| 230 | |
|---|
| 231 | /****************************************************************************** |
|---|
| 232 | Summary: |
|---|
| 233 | CEC Function Return Values |
|---|
| 234 | *******************************************************************************/ |
|---|
| 235 | #define BCEC_NOT_IMPLEMENTED BHDM_CEC_NOT_IMPLEMENTED |
|---|
| 236 | #define BCEC_NO_PHYS_ADDR BHDM_CEC_NO_PHYS_ADDR |
|---|
| 237 | #define BCEC_ASSIGNED_FREEUSE_ADDR BHDM_CEC_ASSIGNED_FREEUSE_ADDR |
|---|
| 238 | #define BCEC_ASSIGNED_UNREGISTERED_ADDR BHDM_CEC_ASSIGNED_UNREGISTERED_ADDR |
|---|
| 239 | #define BCEC_NO_LOGICAL_ADDR BHDM_CEC_NO_LOGICAL_ADDR |
|---|
| 240 | #define BCEC_EXCEED_MAX_DEVICE_LEVELS BHDM_CEC_EXCEED_MAX_DEVICE_LEVELS |
|---|
| 241 | #define BCEC_TRANSMIT_ERROR BHDM_CEC_TRANSMIT_ERROR |
|---|
| 242 | #define BCEC_RECEIVE_ERROR BHDM_CEC_RECEIVE_ERROR |
|---|
| 243 | #define BCEC_NOT_ENOUGH_MEM BHDM_CEC_NOT_ENOUGH_MEM |
|---|
| 244 | #define BCEC_EXCEED_MSG_LENGTH BHDM_CEC_EXCEED_MSG_LENGTH |
|---|
| 245 | #define BCEC_TRANSMIT_BUSY BHDM_CEC_TRANSMIT_BUSY |
|---|
| 246 | |
|---|
| 247 | |
|---|
| 248 | #if BHDM_CONFIG_40NM_SUPPORT |
|---|
| 249 | #define BCHP_MASK_DVP(Register,Field) BCHP_AON_HDMI_TX_##Register##_##Field##_MASK |
|---|
| 250 | |
|---|
| 251 | #define REGADDR_CEC_CNTRL_1 BCHP_AON_HDMI_TX_CEC_CNTRL_1 |
|---|
| 252 | #define REGNAME_CEC_CNTRL_1 AON_HDMI_TX_CEC_CNTRL_1 |
|---|
| 253 | |
|---|
| 254 | #define REGADDR_CEC_CNTRL_2 BCHP_AON_HDMI_TX_CEC_CNTRL_2 |
|---|
| 255 | #define REGNAME_CEC_CNTRL_2 AON_HDMI_TX_CEC_CNTRL_2 |
|---|
| 256 | |
|---|
| 257 | #define REGADDR_CEC_CNTRL_3 BCHP_AON_HDMI_TX_CEC_CNTRL_3 |
|---|
| 258 | #define REGNAME_CEC_CNTRL_3 AON_HDMI_TX_CEC_CNTRL_3 |
|---|
| 259 | |
|---|
| 260 | #define REGADDR_CEC_CNTRL_4 BCHP_AON_HDMI_TX_CEC_CNTRL_4 |
|---|
| 261 | #define REGNAME_CEC_CNTRL_4 AON_HDMI_TX_CEC_CNTRL_4 |
|---|
| 262 | |
|---|
| 263 | #define REGADDR_CEC_CNTRL_5 BCHP_AON_HDMI_TX_CEC_CNTRL_5 |
|---|
| 264 | #define REGNAME_CEC_CNTRL_5 AON_HDMI_TX_CEC_CNTRL_5 |
|---|
| 265 | |
|---|
| 266 | #define REGADDR_CEC_CNTRL_6 BCHP_AON_HDMI_TX_CEC_CNTRL_6 |
|---|
| 267 | #define REGNAME_CEC_CNTRL_6 AON_HDMI_TX_CEC_CNTRL_6 |
|---|
| 268 | |
|---|
| 269 | #define REGADDR_CEC_TX_DATA_1 BCHP_AON_HDMI_TX_CEC_TX_DATA_1 |
|---|
| 270 | #define REGNAME_CEC_TX_DATA_1 AON_HDMI_TX_CEC_TX_DATA_1 |
|---|
| 271 | |
|---|
| 272 | #define REGADDR_CEC_RX_DATA_1 BCHP_AON_HDMI_TX_CEC_RX_DATA_1 |
|---|
| 273 | #define REGNAME_CEC_RX_DATA_1 AON_HDMI_TX_CEC_RX_DATA_1 |
|---|
| 274 | |
|---|
| 275 | #else |
|---|
| 276 | #define BCHP_MASK_DVP(Register,Field) BCHP_HDMI_##Register##_##Field##_MASK |
|---|
| 277 | |
|---|
| 278 | #define REGADDR_CEC_CNTRL_1 BCHP_HDMI_CEC_CNTRL_1 |
|---|
| 279 | #define REGNAME_CEC_CNTRL_1 HDMI_CEC_CNTRL_1 |
|---|
| 280 | |
|---|
| 281 | #define REGADDR_CEC_CNTRL_2 BCHP_HDMI_CEC_CNTRL_2 |
|---|
| 282 | #define REGNAME_CEC_CNTRL_2 HDMI_CEC_CNTRL_2 |
|---|
| 283 | |
|---|
| 284 | #define REGADDR_CEC_CNTRL_3 BCHP_HDMI_CEC_CNTRL_3 |
|---|
| 285 | #define REGNAME_CEC_CNTRL_3 HDMI_CEC_CNTRL_3 |
|---|
| 286 | |
|---|
| 287 | #define REGADDR_CEC_CNTRL_4 BCHP_HDMI_CEC_CNTRL_4 |
|---|
| 288 | #define REGNAME_CEC_CNTRL_4 HDMI_CEC_CNTRL_4 |
|---|
| 289 | |
|---|
| 290 | #define REGADDR_CEC_CNTRL_5 BCHP_HDMI_CEC_CNTRL_5 |
|---|
| 291 | #define REGNAME_CEC_CNTRL_5 HDMI_CEC_CNTRL_5 |
|---|
| 292 | |
|---|
| 293 | #define REGADDR_CEC_TX_DATA_1 BCHP_HDMI_CEC_TX_DATA_1 |
|---|
| 294 | #define REGNAME_CEC_TX_DATA_1 HDMI_CEC_TX_DATA_1 |
|---|
| 295 | |
|---|
| 296 | #define REGADDR_CEC_RX_DATA_1 BCHP_HDMI_CEC_RX_DATA_1 |
|---|
| 297 | #define REGNAME_CEC_RX_DATA_1 HDMI_CEC_RX_DATA_1 |
|---|
| 298 | #endif |
|---|
| 299 | |
|---|
| 300 | #endif /* end BHDM_CONFIG_CEC_LEGACY_SUPPORT */ |
|---|
| 301 | |
|---|
| 302 | #endif /* HDMI_TX */ |
|---|
| 303 | |
|---|
| 304 | |
|---|
| 305 | |
|---|
| 306 | #if BHDM_CONFIG_CEC_LEGACY_SUPPORT |
|---|
| 307 | |
|---|
| 308 | #if (BCHP_CHIP == 7038) || (BCHP_CHIP == 7401) || (BCHP_CHIP == 7403) \ |
|---|
| 309 | || (BCHP_CHIP == 7440) || (BCHP_CHIP == 7400) || (BCHP_CHIP == 7405) \ |
|---|
| 310 | || (BCHP_CHIP == 7325) || (BCHP_CHIP == 7335) |
|---|
| 311 | |
|---|
| 312 | /* Optimal settings for HDMI CEC control registers for 108Mhz system clock */ |
|---|
| 313 | #define BHDM_CEC_CNTRL_1_DIV_CLK_CNT_VALUE 0xa8b |
|---|
| 314 | #define BHDM_CEC_CNTRL_2_CNT_TO_400_US_VALUE 0x00e |
|---|
| 315 | #define BHDM_CEC_CNTRL_2_CNT_TO_600_US_VALUE 0x018 |
|---|
| 316 | #define BHDM_CEC_CNTRL_2_CNT_TO_800_US_VALUE 0x022 |
|---|
| 317 | #define BHDM_CEC_CNTRL_2_CNT_TO_1300_US_VALUE 0x032 |
|---|
| 318 | #define BHDM_CEC_CNTRL_2_CNT_TO_1500_US_VALUE 0x03c |
|---|
| 319 | #define BHDM_CEC_CNTRL_3_CNT_TO_1700_US_VALUE 0x046 |
|---|
| 320 | #define BHDM_CEC_CNTRL_3_CNT_TO_2050_US_VALUE 0x050 |
|---|
| 321 | #define BHDM_CEC_CNTRL_3_CNT_TO_2400_US_VALUE 0x062 |
|---|
| 322 | #define BHDM_CEC_CNTRL_3_CNT_TO_2750_US_VALUE 0x070 |
|---|
| 323 | #define BHDM_CEC_CNTRL_4_CNT_TO_3500_US_VALUE 0x08A |
|---|
| 324 | #define BHDM_CEC_CNTRL_4_CNT_TO_3600_US_VALUE 0x094 |
|---|
| 325 | #define BHDM_CEC_CNTRL_4_CNT_TO_3900_US_VALUE 0x09e |
|---|
| 326 | #define BHDM_CEC_CNTRL_4_CNT_TO_4300_US_VALUE 0x0aa |
|---|
| 327 | #define BHDM_CEC_CNTRL_5_CNT_TO_4500_US_VALUE 0x0b4 |
|---|
| 328 | #define BHDM_CEC_CNTRL_5_CNT_TO_4700_US_VALUE 0x0be |
|---|
| 329 | |
|---|
| 330 | #else |
|---|
| 331 | /* Optimal settings for HDMI CEC control registers for 27Mhz system clock */ |
|---|
| 332 | #define BHDM_CEC_CNTRL_1_DIV_CLK_CNT_VALUE 0x545 |
|---|
| 333 | #define BHDM_CEC_CNTRL_2_CNT_TO_400_US_VALUE 0x007 |
|---|
| 334 | #define BHDM_CEC_CNTRL_2_CNT_TO_600_US_VALUE 0x00c |
|---|
| 335 | #define BHDM_CEC_CNTRL_2_CNT_TO_800_US_VALUE 0x011 |
|---|
| 336 | #define BHDM_CEC_CNTRL_2_CNT_TO_1300_US_VALUE 0x019 |
|---|
| 337 | #define BHDM_CEC_CNTRL_2_CNT_TO_1500_US_VALUE 0x01e |
|---|
| 338 | #define BHDM_CEC_CNTRL_3_CNT_TO_1700_US_VALUE 0x023 |
|---|
| 339 | #define BHDM_CEC_CNTRL_3_CNT_TO_2050_US_VALUE 0x028 |
|---|
| 340 | #define BHDM_CEC_CNTRL_3_CNT_TO_2400_US_VALUE 0x031 |
|---|
| 341 | #define BHDM_CEC_CNTRL_3_CNT_TO_2750_US_VALUE 0x038 |
|---|
| 342 | #define BHDM_CEC_CNTRL_4_CNT_TO_3500_US_VALUE 0x045 |
|---|
| 343 | #define BHDM_CEC_CNTRL_4_CNT_TO_3600_US_VALUE 0x04a |
|---|
| 344 | #define BHDM_CEC_CNTRL_4_CNT_TO_3900_US_VALUE 0x04f |
|---|
| 345 | #define BHDM_CEC_CNTRL_4_CNT_TO_4300_US_VALUE 0x055 |
|---|
| 346 | #define BHDM_CEC_CNTRL_5_CNT_TO_4500_US_VALUE 0x05a |
|---|
| 347 | #define BHDM_CEC_CNTRL_5_CNT_TO_4700_US_VALUE 0x05f |
|---|
| 348 | #endif |
|---|
| 349 | |
|---|
| 350 | |
|---|
| 351 | /****************************************************************************** |
|---|
| 352 | Summary: |
|---|
| 353 | Reset CEC core |
|---|
| 354 | |
|---|
| 355 | Description: |
|---|
| 356 | Reset CEC core or hold the core in reset to disable CEC functionality |
|---|
| 357 | |
|---|
| 358 | Input: |
|---|
| 359 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 360 | bReset - setting whether to reset the core |
|---|
| 361 | |
|---|
| 362 | ******************************************************************************/ |
|---|
| 363 | void BHDM_CEC_P_ResetCore ( |
|---|
| 364 | BCEC_Handle hHDMI, |
|---|
| 365 | uint8_t bReset |
|---|
| 366 | ); |
|---|
| 367 | |
|---|
| 368 | |
|---|
| 369 | /****************************************************************************** |
|---|
| 370 | Summary: |
|---|
| 371 | Get the Logical and Physical addresses for HDMI device. |
|---|
| 372 | |
|---|
| 373 | Description: |
|---|
| 374 | Determine what my MyPhysical and MyLogical device addresses are. |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | Input: |
|---|
| 378 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 379 | |
|---|
| 380 | Output: |
|---|
| 381 | pMyPhysicalAddr - pointer to memory location to hold this devices |
|---|
| 382 | current physical address. See section 8.7.3 In the HDMI Spec. |
|---|
| 383 | |
|---|
| 384 | pMyLogicalAddr - pointer to memory location to hold this device's |
|---|
| 385 | current logical address, See CEC supplement section 10.2.1 in the HDMI |
|---|
| 386 | Spec, |
|---|
| 387 | |
|---|
| 388 | Returns: |
|---|
| 389 | BERR_SUCCESS - Successfully returned the Logical and |
|---|
| 390 | Physical Addresses |
|---|
| 391 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 392 | BHDM_CEC_NO_PHYS_ADDR - No Phys Device Addrs left in HDMI cluster |
|---|
| 393 | BHDM_CEC_ASSIGNED_FREEUSE_ADDR - Device Assigned the Free Use Address |
|---|
| 394 | BHDM_CEC_ASSIGNED_UNREGISTERED_ADDR - Device Assigned the Unregistered Address |
|---|
| 395 | BHDM_CEC_NO_LOGICAL_ADDR - No Logical Addresses left in HDMI cluster |
|---|
| 396 | BHDM_CEC_EXCEED_MAX_DEVICE_LEVELS - Num of Devices exceed HDMI cluster maximum |
|---|
| 397 | |
|---|
| 398 | |
|---|
| 399 | See Also: |
|---|
| 400 | BHDM_CEC_P_SetMyAddrs |
|---|
| 401 | *******************************************************************************/ |
|---|
| 402 | BERR_Code BHDM_CEC_P_GetMyAddrs( |
|---|
| 403 | BCEC_Handle hHDMI, /* [in] HDMI CEC handle */ |
|---|
| 404 | uint8_t *pMyPhysicalAddr, /* [out] ptr to uint8 to hold my Physical Addr */ |
|---|
| 405 | uint8_t *pMyLogicalAddr /* [out] ptr to uint8 to hold my Logical Addr */ |
|---|
| 406 | ) ; |
|---|
| 407 | |
|---|
| 408 | |
|---|
| 409 | /****************************************************************************** |
|---|
| 410 | Summary: |
|---|
| 411 | Set the Logical CEC Address for this Device |
|---|
| 412 | |
|---|
| 413 | |
|---|
| 414 | Input: |
|---|
| 415 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 416 | MyLogicalAddr - CEC Address to use for this device (1-15). |
|---|
| 417 | |
|---|
| 418 | Output: |
|---|
| 419 | <none> |
|---|
| 420 | |
|---|
| 421 | Returns: |
|---|
| 422 | BERR_SUCCESS - Successfully broadcast the <Report Physical Address> message |
|---|
| 423 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | See Also: |
|---|
| 427 | o BHDM_CEC_P_GetMyAddrs |
|---|
| 428 | *******************************************************************************/ |
|---|
| 429 | BERR_Code BHDM_CEC_P_SetMyAddr( |
|---|
| 430 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 431 | uint8_t MyLogicalAddr |
|---|
| 432 | ) ; |
|---|
| 433 | |
|---|
| 434 | |
|---|
| 435 | /****************************************************************************** |
|---|
| 436 | Summary: |
|---|
| 437 | Get the Message/Status for the CEC Interrupt |
|---|
| 438 | |
|---|
| 439 | Description: |
|---|
| 440 | Read the Interrupt and Status bits to determine the result of CEC messages |
|---|
| 441 | |
|---|
| 442 | Input: |
|---|
| 443 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 444 | MessageType - Interrupt is result of transmitted or received message. |
|---|
| 445 | CECStatus - Status of the transmitted or received message (OK, ERROR) |
|---|
| 446 | EOM - End Of Message indicator (true indicates last of message) |
|---|
| 447 | |
|---|
| 448 | Output: |
|---|
| 449 | <none> |
|---|
| 450 | |
|---|
| 451 | Returns: |
|---|
| 452 | BERR_SUCCESS - Successfully broadcast the <Report Physical Address> message |
|---|
| 453 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 454 | BHDM_ERR_CEC_ReceiveError - Error broadcasting <Report Physical Address> |
|---|
| 455 | message |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | See Also: |
|---|
| 459 | |
|---|
| 460 | *******************************************************************************/ |
|---|
| 461 | BERR_Code BHDM_CEC_P_GetMsgInfo( |
|---|
| 462 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 463 | BAVC_HDMI_CEC_IntMessageType * MessageType, /* Interrupt Message Type (Rx or Tx */ |
|---|
| 464 | uint8_t *CECStatus, |
|---|
| 465 | uint8_t *CECMsgLength, |
|---|
| 466 | uint8_t *EOM |
|---|
| 467 | ) ; |
|---|
| 468 | |
|---|
| 469 | |
|---|
| 470 | /****************************************************************************** |
|---|
| 471 | Summary: |
|---|
| 472 | Transmit CEC Polling message |
|---|
| 473 | |
|---|
| 474 | Description: |
|---|
| 475 | Transmit formatted CEC Polling message to determine the device logical address. |
|---|
| 476 | |
|---|
| 477 | Input: |
|---|
| 478 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 479 | LogicalAddr - The logical address to poll for |
|---|
| 480 | |
|---|
| 481 | Output: |
|---|
| 482 | <none> |
|---|
| 483 | |
|---|
| 484 | Returns: |
|---|
| 485 | BERR_SUCCESS - Successfully set up the message for transmission |
|---|
| 486 | (TBD) Interrupt may signal message has been acknowledged by recipient |
|---|
| 487 | BHDM_CEC_TRANSMIT_BUSY - Busy transmitting another CEC message |
|---|
| 488 | |
|---|
| 489 | See Also: |
|---|
| 490 | o BHDM_CEC_P_XmitMsg |
|---|
| 491 | o BHDM_CEC_P_RecvMsg |
|---|
| 492 | |
|---|
| 493 | *******************************************************************************/ |
|---|
| 494 | BERR_Code BHDM_CEC_P_PingLogicalAddr( |
|---|
| 495 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 496 | uint8_t LogicalAddr /* [in] device logical address */ |
|---|
| 497 | ); |
|---|
| 498 | |
|---|
| 499 | |
|---|
| 500 | /****************************************************************************** |
|---|
| 501 | Summary: |
|---|
| 502 | Transmit a CEC message |
|---|
| 503 | |
|---|
| 504 | Description: |
|---|
| 505 | Transmit the prevously formatted CEC message. The message has the |
|---|
| 506 | destinaton embedded in the header block of the message. |
|---|
| 507 | |
|---|
| 508 | Input: |
|---|
| 509 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 510 | pCECTxMsgBuf - pointer to CEC message to be transmitted |
|---|
| 511 | ByteLength - number of bytes that make up the CEC message |
|---|
| 512 | |
|---|
| 513 | Output: |
|---|
| 514 | <none> |
|---|
| 515 | |
|---|
| 516 | Returns: |
|---|
| 517 | BERR_SUCCESS - Successfully set up the message for transmission |
|---|
| 518 | (TBD) Interrupt may signal message has been acknowledged by recipient |
|---|
| 519 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 520 | BHDM_ERR_CEC_TransmitError - Error Transmittiing CEC Message |
|---|
| 521 | |
|---|
| 522 | |
|---|
| 523 | See Also: |
|---|
| 524 | o BHDM_CEC_P_RecvMsg |
|---|
| 525 | |
|---|
| 526 | *******************************************************************************/ |
|---|
| 527 | BERR_Code BHDM_CEC_P_XmitMsg( |
|---|
| 528 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 529 | uint8_t DestinationAddr, |
|---|
| 530 | const uint8_t *pCECTxMsgBuf, /* [in] ptr to buffer containing CEC msg to send */ |
|---|
| 531 | uint8_t ByteLength /* [in] size (bytes) of buffer to send */ |
|---|
| 532 | ) ; |
|---|
| 533 | |
|---|
| 534 | |
|---|
| 535 | |
|---|
| 536 | /****************************************************************************** |
|---|
| 537 | Summary: |
|---|
| 538 | Enable the HDMI Core to receive a CEC message |
|---|
| 539 | |
|---|
| 540 | Description: |
|---|
| 541 | This function will enable the Core to receive messsages on the CEC bus. |
|---|
| 542 | BHDM_CEC_EnableReceive should be called after each message is received and |
|---|
| 543 | acknowledge so the next CEC message intended for the core can be received |
|---|
| 544 | |
|---|
| 545 | Input: |
|---|
| 546 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 547 | |
|---|
| 548 | Output: |
|---|
| 549 | None |
|---|
| 550 | |
|---|
| 551 | Returns: |
|---|
| 552 | BERR_SUCCESS - Successfully retrieved the stored CEC message. |
|---|
| 553 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | See Also: |
|---|
| 557 | o BHDM_CEC_P_RecvMsg |
|---|
| 558 | |
|---|
| 559 | *******************************************************************************/ |
|---|
| 560 | BERR_Code BHDM_CEC_P_EnableReceive( |
|---|
| 561 | BCEC_Handle hHDMI /* [in] HDMI handle */ |
|---|
| 562 | ) ; |
|---|
| 563 | |
|---|
| 564 | |
|---|
| 565 | /****************************************************************************** |
|---|
| 566 | Summary: |
|---|
| 567 | Get a received CEC message |
|---|
| 568 | |
|---|
| 569 | Description: |
|---|
| 570 | Copy the contents of the received CEC message to a data structure for use. |
|---|
| 571 | |
|---|
| 572 | Input: |
|---|
| 573 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 574 | |
|---|
| 575 | Output: |
|---|
| 576 | pRecvMessageData - pointer to memory location to hold received message data |
|---|
| 577 | |
|---|
| 578 | Returns: |
|---|
| 579 | BERR_SUCCESS - Successfully retrieved the stored CEC message. |
|---|
| 580 | |
|---|
| 581 | See Also: |
|---|
| 582 | o BHDM_CEC_P_XmitMsg |
|---|
| 583 | |
|---|
| 584 | *******************************************************************************/ |
|---|
| 585 | BERR_Code BHDM_CEC_P_GetReceivedMessage( |
|---|
| 586 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 587 | BAVC_HDMI_CEC_MessageData *pRecvMessageData /* [out] ptr to storage for received CEC msg */ |
|---|
| 588 | ) ; |
|---|
| 589 | |
|---|
| 590 | |
|---|
| 591 | /****************************************************************************** |
|---|
| 592 | Summary: |
|---|
| 593 | Receive a CEC message |
|---|
| 594 | |
|---|
| 595 | Description: |
|---|
| 596 | Copy the contents of the received CEC message to a buffer for use. |
|---|
| 597 | |
|---|
| 598 | Input: |
|---|
| 599 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 600 | iByteLength - size of memory pointed to by pCECRxMsgBuf |
|---|
| 601 | |
|---|
| 602 | Output: |
|---|
| 603 | pCECRxMsgBuf - pointer to memory location to hold received message |
|---|
| 604 | |
|---|
| 605 | Returns: |
|---|
| 606 | BERR_SUCCESS - Successfully retrieved the stored CEC message. |
|---|
| 607 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 608 | BHDM_ERR_CEC_ReceiveError - Error Receiving CEC Message |
|---|
| 609 | BHDM_CEC_NOT_ENOUGH_MEM - Not enough memory to hold CEC message |
|---|
| 610 | |
|---|
| 611 | Note: |
|---|
| 612 | The calling function must allocate and free the 16 byte buffer |
|---|
| 613 | pointed to by pCECRxMsgBuf |
|---|
| 614 | |
|---|
| 615 | |
|---|
| 616 | See Also: |
|---|
| 617 | o BHDM_CEC_P_XmitMsg |
|---|
| 618 | |
|---|
| 619 | *******************************************************************************/ |
|---|
| 620 | BERR_Code BHDM_CEC_P_RecvMsg( |
|---|
| 621 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 622 | uint8_t *pCECRxMsgBuf, /* [out] ptr to storage for received CEC msg */ |
|---|
| 623 | uint8_t *iByteLength /* [in ] size of memory in Received CEC Msg */ |
|---|
| 624 | ) ; |
|---|
| 625 | |
|---|
| 626 | /****************************************************************************** |
|---|
| 627 | Summary: |
|---|
| 628 | Report the Physical Address and Device Type as a broadcast message. |
|---|
| 629 | |
|---|
| 630 | Description: |
|---|
| 631 | CEC Devices shall report the association between its logical and physical |
|---|
| 632 | addresses by broadcasting the <Report Physical Address> message |
|---|
| 633 | |
|---|
| 634 | Input: |
|---|
| 635 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 636 | |
|---|
| 637 | Output: |
|---|
| 638 | <none> |
|---|
| 639 | |
|---|
| 640 | Returns: |
|---|
| 641 | BERR_SUCCESS - Successfully broadcast the <Report Physical Address> message |
|---|
| 642 | BERR_INVALID_PARAMETER - Invalid function parameter. |
|---|
| 643 | BHDM_ERR_CEC_ReceiveError - Error broadcasting <Report Physical Address> |
|---|
| 644 | message |
|---|
| 645 | |
|---|
| 646 | |
|---|
| 647 | See Also: |
|---|
| 648 | |
|---|
| 649 | *******************************************************************************/ |
|---|
| 650 | BERR_Code BHDM_CEC_P_ReportPhysicalAddress( |
|---|
| 651 | BCEC_Handle hHDMI /* [in] HDMI handle */ |
|---|
| 652 | ) ; |
|---|
| 653 | |
|---|
| 654 | |
|---|
| 655 | /****************************************************************************** |
|---|
| 656 | Summary: |
|---|
| 657 | Enable/Disable CEC core. |
|---|
| 658 | |
|---|
| 659 | Description: |
|---|
| 660 | The CEC core will be disabled by holding CEC core in reset state. Otherwise, the core is |
|---|
| 661 | enabled. |
|---|
| 662 | |
|---|
| 663 | Input: |
|---|
| 664 | hHDMI - HDMI control handle that was previously opened by BHDM_Open. |
|---|
| 665 | bEnableCecCore - boolean to indicate enable/disable CEC core |
|---|
| 666 | |
|---|
| 667 | Output: |
|---|
| 668 | <none> |
|---|
| 669 | |
|---|
| 670 | Returns: |
|---|
| 671 | BERR_SUCCESS - Successfully broadcast the <Report Physical Address> message |
|---|
| 672 | |
|---|
| 673 | See Also: |
|---|
| 674 | |
|---|
| 675 | *******************************************************************************/ |
|---|
| 676 | BERR_Code BHDM_CEC_P_Enable( |
|---|
| 677 | BCEC_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 678 | bool bEnableCec /* [in] boolean to enable/disable CEC core */ |
|---|
| 679 | ); |
|---|
| 680 | |
|---|
| 681 | |
|---|
| 682 | /****************************************************************************** |
|---|
| 683 | Summary: |
|---|
| 684 | Initialize CEC core. |
|---|
| 685 | |
|---|
| 686 | Description: |
|---|
| 687 | The CEC core will be initialized with the appropriate parameters |
|---|
| 688 | enabled. |
|---|
| 689 | |
|---|
| 690 | Input: |
|---|
| 691 | hCEC - HDMI control handle (Rx or Tx) that was previously opened. |
|---|
| 692 | |
|---|
| 693 | Output: |
|---|
| 694 | <none> |
|---|
| 695 | |
|---|
| 696 | Returns: |
|---|
| 697 | <none> |
|---|
| 698 | |
|---|
| 699 | See Also: |
|---|
| 700 | |
|---|
| 701 | *******************************************************************************/ |
|---|
| 702 | void BHDM_CEC_P_Initialize( |
|---|
| 703 | BCEC_Handle hHDMI /* [in] HDMI handle */ |
|---|
| 704 | ) ; |
|---|
| 705 | |
|---|
| 706 | #endif /* end BHDM_CONFIG_CEC_LEGACY_SUPPORT */ |
|---|
| 707 | |
|---|
| 708 | #ifdef __cplusplus |
|---|
| 709 | } |
|---|
| 710 | #endif |
|---|
| 711 | |
|---|
| 712 | #endif /* ifndef BHDM_CEC_PRIV_H__ */ |
|---|
| 713 | |
|---|
| 714 | /* End of File */ |
|---|