source: svn/newcon3bcm2_21bu/magnum/portinginterface/hdm/7552/bhdm_cec.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 8.4 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-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.c $
11 * $brcm_Revision: Hydra_Software_Devel/20 $
12 * $brcm_Date: 11/22/11 6:02p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/hdm/7038/bhdm_cec.c $
19 *
20 * Hydra_Software_Devel/20   11/22/11 6:02p vle
21 * SW7425-1140: Merge to mainline.  Remove all CEC functionality out of
22 * HDM PI.
23 *
24 * Hydra_Software_Devel/SW7425-1140/2   11/22/11 5:47p vle
25 * SW7425-1140: Add BHDM_CONFIG_CEC_LEGACY_SUPPORT for backward compatible
26 * for CEC legacy platforms.
27 *
28 * Hydra_Software_Devel/SW7425-1140/1   11/16/11 12:16p vle
29 * SW7425-1140: Remove all CEC functionalities out of HDM PI
30 *
31 * Hydra_Software_Devel/19   1/4/10 2:22p rgreen
32 * SW3548-2670: Fix bdbg leave trace message for BHDM_CEC_GetMsgInfo
33 *
34 * Hydra_Software_Devel/18   10/30/08 5:51p vle
35 * PR47447: Merge to main branch.
36 * Add new GetReceivedMessage API. Use same CEC configuration for
37 * transmitter and receiver.
38 *
39 * Hydra_Software_Devel/PR47447/1   9/30/08 7:03p vle
40 * PR47447: Add new GetReceivedMessage API. Use same CEC configuration for
41 * transmitter and receiver.
42 *
43 * Hydra_Software_Devel/17   4/28/08 6:02p vle
44 * PR42271: Move HDMI CEC implementations to bhdm_cec_priv to allow ease
45 * of code sharing between HDMI transmitter and receiver platforms.
46 *
47 * Hydra_Software_Devel/16   4/24/08 9:30p vle
48 * PR42168: Add implementation of CEC message queue allowing CEC bus to be
49 * re-enabled faster to process next message.
50 *
51 * Hydra_Software_Devel/15   3/28/08 8:20p vle
52 * PR 39341: Stop/start transmitting CEC message when reset/dereset CEC
53 * core.
54 *
55 * Hydra_Software_Devel/14   3/11/08 3:30p rgreen
56 * PR40264: Add HDMI CEC Support for 3563
57 *
58 * Hydra_Software_Devel/13   2/14/08 5:21p vle
59 * PR 39069: Add BHDM_CEC_PingLogicalAddr() API for polling logical
60 * address.
61 *
62 * Hydra_Software_Devel/12   2/5/08 3:41p vle
63 * PR 39341: Fix debug message in BHDM_CEC_ReportPhysicalAddress
64 *
65 * Hydra_Software_Devel/11   2/4/08 10:36p vle
66 * PR 39341: Add API allowing application to enable/disable CEC core.
67 * Fix compiler warning in BHDM_CEC_ReportPhysicalAddress()
68 *
69 * Hydra_Software_Devel/10   1/28/08 11:39a vle
70 * PR 39069: Add implementation of BHDM_CEC_ReportPhysicalAddress
71 * function.
72 *
73 * Hydra_Software_Devel/9   12/3/07 6:07p rgreen
74 * PR37814:Prevent transmission of 2nd CEC message when another is active
75 *
76 * Hydra_Software_Devel/8   4/11/07 2:11p vle
77 * PR 26746: Fix debug message.
78 *
79 * Hydra_Software_Devel/7   1/11/07 5:07p rgreen
80 * PR27069: Adjust CEC default timings
81 *
82 * Hydra_Software_Devel/6   12/21/06 2:59p rgreen
83 * PR26531: Should use #if instead of #ifdef for compile flag
84 * BDBG_DEBUG_BUILD
85 *
86 * Hydra_Software_Devel/5   2/1/06 6:56p rgreen
87 * PR14359,PR19283: HDMI CEC Support
88 * Move BHDM_CEC_xxx definitions to bavc_hdmi.h (BAVC_HDMI_CEC_xxx for
89 * shared use with both Rx and Tx devices
90 * Update CEC code for getting CEC logical/physical addresses
91 *
92 * Hydra_Software_Devel/4   9/28/05 3:11p rgreen
93 * PR8896: Add standard documentation file header
94 *
95 ***************************************************************************/
96
97
98
99/****************************** Include Files ********************************/
100#include "bstd.h"
101
102#include "bavc_hdmi.h"
103#include "bhdm_config.h"
104
105#include "bhdm_cec.h"
106#include "bhdm_cec_priv.h"
107#include "bhdm_priv.h"
108
109
110BDBG_MODULE(BHDM_CEC) ;
111
112#define BHDM_CHECK_RC( rc, func )                     \
113do                                                \
114{                                                                                         \
115        if( (rc = BERR_TRACE(func)) != BERR_SUCCESS ) \
116        {                                                                                     \
117                goto done;                                                            \
118        }                                                                                     \
119} while(0)
120
121
122
123/*=************************ Module Overview ********************************
124  The CEC (Consumer Electronic Control) functions provide support for sending
125  and receving messages used for the control of HDMI devices connected
126  together.
127
128  These functions do not interpret CEC messages, but buffers them for access
129  by application software.  Support is also provided to send messages to
130  other HDMI connected devices.
131***************************************************************************/
132
133#if BHDM_CONFIG_CEC_LEGACY_SUPPORT
134
135/******************************************************************************
136 * Public API
137 ******************************************************************************/
138
139BERR_Code BHDM_CEC_GetMyAddrs(
140   BHDM_Handle hHDMI,        /* [in] HDMI handle */
141   uint8_t *pMyPhysicalAddr, /* [out] ptr to uint8 to hold my Physical Addr */
142   uint8_t *pMyLogicalAddr   /* [out] ptr to uint8 to hold my Logical Addr */
143) 
144{
145        BERR_Code rc = BERR_SUCCESS ;
146
147        BDBG_ENTER(BHDM_CEC_GetMyAddrs);
148        BDBG_ASSERT(hHDMI);
149
150        rc = BHDM_CEC_P_GetMyAddrs(hHDMI, pMyPhysicalAddr, pMyLogicalAddr);
151
152
153        BDBG_LEAVE(BHDM_CEC_GetMyAddrs);
154        return rc ;
155}
156
157
158BERR_Code BHDM_CEC_SetMyAddr(
159   BHDM_Handle hHDMI,
160   uint8_t MyLogicalAddr
161)
162{
163        BERR_Code rc = BERR_SUCCESS;
164
165        BDBG_ENTER(BHDM_CEC_SetMyAddr);
166        BDBG_ASSERT(hHDMI);
167       
168        rc = BHDM_CEC_P_SetMyAddr(hHDMI, MyLogicalAddr);
169
170
171        BDBG_LEAVE(BHDM_CEC_SetMyAddr);
172        return rc;
173}
174
175
176BERR_Code BHDM_CEC_GetMsgInfo(
177        BHDM_Handle hHDMI,     
178        BAVC_HDMI_CEC_IntMessageType *CECMsgType, /* Interrupt Message Type (Rx or) Tx */
179        uint8_t *CECMsgStatus,
180        uint8_t *CECMsgLength,
181        uint8_t *EOM
182)
183{
184        BERR_Code rc = BERR_SUCCESS ;
185        BDBG_ENTER(BHDM_CEC_GetMsgInfo);
186        BDBG_ASSERT(hHDMI);
187       
188        rc = BHDM_CEC_P_GetMsgInfo(hHDMI, CECMsgType, CECMsgStatus, CECMsgLength, EOM);
189       
190
191        BDBG_LEAVE(BHDM_CEC_GetMsgInfo);
192        return rc ;
193}
194
195
196BERR_Code BHDM_CEC_PingLogicalAddr(
197   BHDM_Handle hHDMI,     /* [in] HDMI handle */
198   uint8_t LogicalAddr  /* [in] device logical address */
199) 
200{
201        BERR_Code rc = BERR_SUCCESS ;
202        BDBG_ENTER(BHDM_CEC_PingLogicalAddr);
203        BDBG_ASSERT(hHDMI);
204
205        rc = BHDM_CEC_P_PingLogicalAddr(hHDMI, LogicalAddr);
206       
207       
208        BDBG_LEAVE(BHDM_CEC_PingLogicalAddr);
209        return rc ;     
210}
211
212
213   
214BERR_Code BHDM_CEC_XmitMsg(
215   BHDM_Handle hHDMI,     /* [in] HDMI handle */
216   uint8_t DestinationAddr, 
217   const uint8_t *pCecTxMsgBuf, /* [in] ptr to buffer containing CEC msg to send */
218   uint8_t uiPayLoadLength       /* [in] size (bytes) of buffer to send */
219) 
220{
221        BERR_Code rc = BERR_SUCCESS ;
222
223        BDBG_ENTER(BHDM_CEC_XmitMsg);
224        BDBG_ASSERT(hHDMI);
225
226        rc = BHDM_CEC_P_XmitMsg(hHDMI, DestinationAddr, pCecTxMsgBuf, uiPayLoadLength);
227
228       
229        BDBG_LEAVE(BHDM_CEC_XmitMsg);
230        return rc ;     
231}
232
233
234BERR_Code BHDM_CEC_EnableReceive(
235   BHDM_Handle hHDMI     /* [in] HDMI handle */
236) 
237{
238        BERR_Code rc = BERR_SUCCESS ;
239
240        BDBG_ENTER(BHDM_CEC_EnableReceive);
241        BDBG_ASSERT(hHDMI);
242
243        rc = BHDM_CEC_P_EnableReceive(hHDMI);
244       
245       
246        BDBG_LEAVE(BHDM_CEC_EnableReceive);
247        return rc ;
248}
249
250
251BERR_Code BHDM_CEC_GetReceivedMessage(
252        BHDM_Handle hHDMI,     /* [in] HDMI handle */
253        BAVC_HDMI_CEC_MessageData *pRecvMessageData /* [out] ptr to storage for received CEC msg */
254) 
255{
256        BERR_Code rc = BERR_SUCCESS ;
257
258        BDBG_ENTER(BHDM_CEC_GetReceivedMessage);
259        BDBG_ASSERT(hHDMI);
260
261        rc = BHDM_CEC_P_GetReceivedMessage(hHDMI, pRecvMessageData);
262
263
264        BDBG_LEAVE(BHDM_CEC_GetReceivedMessage);
265        return rc ;
266}
267
268
269BERR_Code BHDM_CEC_RecvMsg(
270   BHDM_Handle hHDMI,     /* [in] HDMI handle */
271   uint8_t *pCECRxMsgBuf, /* [out] ptr to storage for received CEC msg */
272   uint8_t *iByteLength       /* [in ] size of memory in Received CEC Msg */
273) 
274{
275        BERR_Code rc = BERR_SUCCESS ;
276
277        BDBG_ENTER(BHDM_CEC_RecvMsg);
278        BDBG_ASSERT(hHDMI);
279
280        rc = BHDM_CEC_P_RecvMsg(hHDMI, pCECRxMsgBuf, iByteLength);
281
282
283        BDBG_LEAVE(BHDM_CEC_RecvMsg);
284        return rc ;
285}
286
287
288
289BERR_Code BHDM_CEC_ReportPhysicalAddress(
290   BHDM_Handle hHDMI     /* [in] HDMI handle */
291) 
292{
293        BERR_Code rc = BERR_SUCCESS ;
294
295        BDBG_ENTER(BHDM_CEC_ReportPhysicalAddress);
296        BDBG_ASSERT(hHDMI);
297
298        rc = BHDM_CEC_P_ReportPhysicalAddress(hHDMI);
299       
300
301        BDBG_LEAVE(BHDM_CEC_ReportPhysicalAddress);
302        return rc ;
303}
304
305
306BERR_Code BHDM_CEC_Enable(
307        BHDM_Handle hHDMI,              /* [in] HDMI handle */
308        bool bEnableCec         /* [in] boolean to enable/disable CEC core      */
309)
310{
311        BERR_Code rc = BERR_SUCCESS;
312
313        BDBG_ENTER(BHDM_CEC_Enable);
314        BDBG_ASSERT(hHDMI);
315
316        rc = BHDM_CEC_P_Enable(hHDMI, bEnableCec);
317
318
319        BDBG_LEAVE(BHDM_CEC_Enable);
320        return rc;
321}
322
323#endif /* end BHDM_CONFIG_CEC_LEGACY_SUPPORT */
324
Note: See TracBrowser for help on using the repository browser.