source: svn/trunk/newcon3bcm2_21bu/magnum/syslib/hdcplib/7552/bhdcplib.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 14.9 KB
RevLine 
[2]1/***************************************************************************
2 *     Copyright (c) 2005-2010, 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: bhdcplib.h $
11 * $brcm_Revision: Hydra_Software_Devel/6 $
12 * $brcm_Date: 3/3/10 12:37p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/syslib/hdcplib/7405/bhdcplib.h $
19 *
20 * Hydra_Software_Devel/6   3/3/10 12:37p vle
21 * SW7405-3987: Merge into main branch
22 *
23 * Hydra_Software_Devel/SW7405-3987/1   3/2/10 5:39p vle
24 * SW7405-3987: Report specific HDCP error status to high level
25 * application.
26 *
27 * Hydra_Software_Devel/5   1/28/10 1:58p vle
28 * SW7420-489: Merge to main branch
29 *
30 * Hydra_Software_Devel/SW7420-489/1   1/26/10 3:39p vle
31 * SW7420-489: propagate max_device_count and max_depth to application
32 *
33 * Hydra_Software_Devel/4   8/25/09 3:30p vle
34 * SW7405-2670:
35 * Do not poll for receiver sense while encryption is still enabled.
36 * Add implementation of interrupt based receiver sense
37 *
38 * Hydra_Software_Devel/PR56486/1   8/6/09 12:05p vle
39 * PR56486: Do not poll for receiver sense while encryption is still
40 * enabled.
41 *
42 * Hydra_Software_Devel/3   11/24/08 8:37p vle
43 * PR49219, PR49593, PR48842, PR48937: Merge to main branch
44 *
45 * Hydra_Software_Devel/HDMI_TX_Plugfest11_200811/2   11/24/08 8:27p vle
46 * PR49219, PR49593, PR48842: Add additional state in the state machine to
47 * clearly identify HDCP authentication errors. Update the current hdcp
48 * state appropriately.
49 *
50 * Hydra_Software_Devel/HDMI_TX_Plugfest11_200811/1   11/12/08 4:55p vle
51 * PR 48937: Add support for HDCP repeater error during HDCP
52 * authentication process.
53 *
54 * Hydra_Software_Devel/2   3/18/08 7:18p vle
55 * PR 39991: Rename HDMIlib to HDCPlib. Remove unused implementation.
56 *
57 * Hydra_Software_Devel/1   2/26/08 5:43p jgarrett
58 * PR 39991: Renaming new HDMlib to HDCPlib
59 *
60 * Hydra_Software_Devel/Syslib_Initiative/5   2/21/08 5:00p vle
61 * PR 31924: Change Settings back to Dependencies
62 * Remove Hotplug callback
63 * Move RevokedKSVList to Handle
64 *
65 * Hydra_Software_Devel/Syslib_Initiative/4   2/15/08 10:01p vle
66 * PR 31924: Improve HDMI Syslib API from feedback.
67 *
68 ***************************************************************************/
69
70#ifndef BHDCPLIB_H__
71#define BHDCPLIB_H__
72
73#include "bfmt.h"
74#include "bavc_hdmi.h"
75
76#include "bhdm.h"
77#include "bhdm_edid.h"
78#include "bhdm_hdcp.h"
79#include "bhsm.h"
80#include "btmr.h"
81
82
83#ifdef __cplusplus
84extern "C" {
85#endif
86
87
88/******************************************************************************
89Summary:
90HDCPlib Context Handle
91*******************************************************************************/
92typedef struct BHDCPlib_P_Handle *BHDCPlib_Handle ;
93
94
95/******************************************************************************
96Summary:
97        Encrypted HDCP key settings.
98
99*******************************************************************************/
100typedef struct BHDCPlib_EncryptedHdcpKeyStruct
101{
102        uint8_t  Alg;
103        uint8_t  cusKeyVarL;
104        uint8_t  cusKeyVarH;
105        uint8_t  cusKeySel;
106        uint32_t CaDataLo;
107        uint32_t CaDataHi;
108        uint32_t TCaDataLo;
109        uint32_t TCaDataHi;
110        uint32_t HdcpKeyLo;
111        uint32_t HdcpKeyHi;
112} BHDCPlib_EncryptedHdcpKeyStruct;
113
114
115/******************************************************************************
116Summary:
117        HDCP information from attached receiver
118       
119Description:
120        Receiver's HDCP related information is retrieved and save for additional usages
121        o RxBksv  -  Receiver BKSV
122        o uiIsAuthenticated  -  authentication result
123        o uiRxBCaps  -  Rx Capabilities
124        o bIsHdcpRepeater  -  Receiver Repeater bit
125       
126See Also:
127        o BHDCPlib_GetReceiverInfo
128
129*******************************************************************************/
130typedef struct BHDCPlib_RxInfo
131{
132        BAVC_HDMI_HDCP_KSV RxBksv;                      /* Receiver Bksv Value */
133        uint8_t uiIsAuthenticated;                      /* flag indicate the authentication result */
134        uint8_t uiRxBCaps;                                      /* Rx Capabilities      */
135        bool bIsHdcpRepeater;                           /* flag indicate whether Rx is an HDCP Repeater */
136} BHDCPlib_RxInfo;
137
138
139
140/******************************************************************************
141Summary:
142        Transmitter's HDCP key set
143       
144Description:
145        Transmitter's HDCP keys for use in HDCP authentication process
146        o TxAksv  -  Transmitter AKSV
147        o TxKeyStructure  - HDCP keys
148       
149See Also:
150        o BHDCPlib_GetConfiguration
151        o BHDCPlib_SetConfiguration
152
153*******************************************************************************/
154typedef struct BHDCPlib_EncryptedTxKeySet
155{
156        /* Transmitter Information */
157        BAVC_HDMI_HDCP_KSV TxAksv;                                                              /* Transmitter Aksv value */
158        BHDCPlib_EncryptedHdcpKeyStruct
159                        TxKeyStructure[BAVC_HDMI_HDCP_N_PRIVATE_KEYS];  /* HDCP private keys */
160
161} BHDCPlib_EncryptedTxKeySet;
162
163
164/******************************************************************************
165Summary:
166        List of HDCP Revoked KSVs       
167       
168Description:
169        The latest list of HDCP Revoked KSV to check the attach receiver(s) KSV
170        o Ksvs  -  List of KSV
171        o uiNumRevokedKsvs  -  number of KSV in the revoked KSV list
172       
173See Also:
174        o BHDCPlib_SetRevokedKSVs
175
176*******************************************************************************/
177typedef struct BHDCPlib_RevokedKsvList
178{
179        BAVC_HDMI_HDCP_KSV *Ksvs;                                       /* pointer to Revoked KSV List */
180        uint16_t uiNumRevokedKsvs;                                      /* number of KSVs in Revoked Ksv List */       
181} BHDCPlib_RevokedKsvList ;
182
183
184/******************************************************************************
185Summary:
186        HDCP configuration for HDCPlib
187       
188Description:
189        Contains all HDCP configurations/information of both transmitter and receivers
190        o eAnSelection  -  An Selection
191        o TxKeySet  - Transmitter HDCP key set
192        o RxInfo  -  Receiver HDCP information
193        o msWaitForR0  -  Wait time before reading R0' (>= 100ms)
194        o msIntervalKsvFifoReadyCheck  -  Interval to check for KSV FIFO ready bit
195        o uiKsvFifoReadyChecks  -  Number of intervals, start value: 1 (count to 50)
196       
197See Also:
198        o BHDCPlib_GetDefaultConfiguration
199        o BHDCPlib_GetConfiguration
200        o BHDCPlib_SetConfiguration
201
202*******************************************************************************/
203typedef struct BHDCPlib_Configuration
204{
205        BHDM_HDCP_AnSelect eAnSelection;
206        BHDCPlib_EncryptedTxKeySet TxKeySet;
207        BHDCPlib_RxInfo RxInfo;
208        uint8_t msWaitForR0;                        /* Wait time to read R0'; time >= 100ms */
209        uint8_t msIntervalKsvFifoReadyCheck;        /* Interval to check for KSV FIFO ready bit. Time out after 5 seconds */
210        uint8_t uiKsvFifoReadyChecks;               /* Number of intervals; start value : 1 (count to 50) */
211        uint8_t uiMaxDeviceCount;                                       /* Max downstream devices support */
212        uint8_t uiMaxDepth;                                                     /* Max depth support */
213       
214} BHDCPlib_Configuration;
215
216
217/******************************************************************************
218Summary:
219        Enumerated Type indicating the current HDCP authentication state
220
221
222See Also:
223        o BHDCPlib_GetAuthenticationState
224       
225*******************************************************************************/
226typedef enum BHDCPlib_State             
227{
228        BHDCPlib_State_eUnPowered,
229        BHDCPlib_State_eUnauthenticated,
230        BHDCPlib_State_eInitializeAuthentication,
231        BHDCPlib_State_eWaitForReceiverAuthentication,
232        BHDCPlib_State_eReceiverR0Ready,
233        BHDCPlib_State_eR0LinkFailure,
234        BHDCPlib_State_eReceiverAuthenticated,  /* Part 1 Completed; R0 Match */
235        BHDCPlib_State_eWaitForRepeaterReady,
236        BHDCPlib_State_eCheckForRepeaterReady,
237        BHDCPlib_State_eRepeaterReady,
238        BHDCPlib_State_eLinkAuthenticated,      /* Part 2 Completed; Include down stream devices */
239        BHDCPlib_State_eEncryptionEnabled,      /* Part 3 Ri Link Integrity Checks Match */
240        BHDCPlib_State_eRepeaterAuthenticationFailure,
241        BHDCPlib_State_eRiLinkIntegrityFailure,
242        BHDCPlib_State_ePjLinkIntegrityFailure
243       
244} BHDCPlib_State;
245
246
247/******************************************************************************
248Summary:
249        Enumerated Type indicating the latest HDCP errors
250
251See Also:
252        o BHDCPlib_State       
253        o BHDCPlib_GetHdcpStatus
254       
255*******************************************************************************/
256typedef enum BHDCPlib_HdcpError
257{
258        BHDCPlib_HdcpError_eSuccess,
259        BHDCPlib_HdcpError_eRxBksvError,
260        BHDCPlib_HdcpError_eRxBksvRevoked,
261        BHDCPlib_HdcpError_eRxBksvI2cReadError,
262        BHDCPlib_HdcpError_eTxAksvError,
263        BHDCPlib_HdcpError_eTxAksvI2cWriteError,
264       
265        BHDCPlib_HdcpError_eReceiverAuthenticationError,
266        BHDCPlib_HdcpError_eRepeaterAuthenticationError,
267        BHDCPlib_HdcpError_eRxDevicesExceeded,
268        BHDCPlib_HdcpError_eRepeaterDepthExceeded,
269        BHDCPlib_HdcpError_eRepeaterFifoNotReady,
270        BHDCPlib_HdcpError_eRepeaterDeviceCount0,
271
272        BHDCPlib_HdcpError_eRepeaterLinkFailure,                /* Repeater Error */   
273        BHDCPlib_HdcpError_eLinkRiFailure,
274        BHDCPlib_HdcpError_eLinkPjFailure,
275
276        BHDCPlib_HdcpError_eFifoUnderflow,
277        BHDCPlib_HdcpError_eFifoOverflow,
278        BHDCPlib_HdcpError_eMultipleAnRequest,
279       
280        BHDCPlib_HdcpError_eCount
281       
282} BHDCPlib_HdcpError;
283
284
285/******************************************************************************
286Summary:
287        Current HDCP status
288       
289Description:
290        The latest HDCP status to report back to the higher application.
291        o eAuthenticationState  -  current authentication state
292        o msRecommendedWaitTime  -  the recommended wait time for higher application
293                                                                before continue with the authentication processs
294       
295See Also:
296        o BHDCPlib_ProcessAuthentication
297
298*******************************************************************************/
299typedef struct BHDCPlib_Status
300{
301        BHDCPlib_State eAuthenticationState;            /* current authentication state */
302        BHDCPlib_HdcpError eHdcpError;          /* last Hdcp error */
303        uint16_t msRecommendedWaitTime;
304} BHDCPlib_Status;
305
306
307
308/******************************************************************************
309Summary:
310        Callback handles retrieves latest revoked KSVs
311               
312See Also:
313*******************************************************************************/
314typedef void (* BHDCPlib_CallBack_GetRevokedKsvs)
315        ( void *pvParam1, int iParam2,  BHDCPlib_RevokedKsvList *pvRevokedKsvList );
316
317
318/******************************************************************************
319Summary:
320        HDCPlib events
321       
322Description:
323        HDCPlib process RI/PJ change event and hotplug event.
324        o event  -  event type 
325       
326See Also:
327        o BHDCPlib_ProcessEvent
328
329*******************************************************************************/
330typedef struct BHDCPlib_Event
331{
332        BHDM_EventType event ;
333} BHDCPlib_Event ;
334
335
336/******************************************************************************
337Summary:
338        HDCPlib dependencies data
339       
340Description:
341        Dependencies data require for BHDCPlib_Open()
342        o hHdm  -  HDMI Core handle
343        o hHsm  -  HSM handle
344        o hTme  -  TMR handle
345        o Revoke KSV Callback.
346       
347See Also:
348        o BHDCPlib_Open
349        o BHDCPlib_GetDefaultDependencies
350
351*******************************************************************************/
352typedef struct BHDCPlib_Dependencies
353{
354        BHDM_Handle hHdm;                               /* HDMI handle */
355        BHSM_Handle hHsm;
356        BTMR_Handle hTmr ;
357
358        BHDCPlib_CallBack_GetRevokedKsvs pfHdcpGetRevokedKsvsCallback;
359        void *pSysDevice;
360        int iGetRevokedKsvParam2;
361       
362} BHDCPlib_Dependencies;
363
364
365/****************************************** HDMI ************************************/
366/*************
367Summary: Open the HDMIlib handle
368**************/
369BERR_Code BHDCPlib_Open(BHDCPlib_Handle *hHDCPlib, const BHDCPlib_Dependencies *pstDependencies);
370
371
372/****************
373Summary: Close the HDMIlib handle
374****************/
375BERR_Code BHDCPlib_Close(BHDCPlib_Handle hHDCPlib);
376
377
378/****************
379Summary: Get the default dependencies
380****************/
381BERR_Code BHDCPlib_GetDefaultDependencies(BHDCPlib_Dependencies *pDefaultDependencies);
382
383
384/******************
385Summary: HDMI Syslib Event Handler
386******************/
387void BHDCPlib_ProcessEvent(BHDCPlib_Handle hHDCPlib, BHDCPlib_Event *stHdmiEvent);
388
389
390/******************************************* HDCP ***********************************/
391/******************
392Summary: Initialize the  HDCP authentication state machine.
393******************/
394BERR_Code BHDCPlib_StartAuthentication(BHDCPlib_Handle hHDCPlib);
395
396
397/******************************************************************************
398Summary:
399Enable/Start HDCP authentication state machine.
400
401Description:
402
403Input:
404        hHDMI - HDMI control handle that was previously opened by BHDM_Open.
405
406Output:
407        stHdcpStatus - HDCP status
408
409Returns:
410        BERR_SUCCESS - Successfully closed the HDMI connection.
411        BHDM_NO_RX_DEVICE
412        BHDM_HDCP_RX_BKSV_ERROR
413        BHDM_HDCP_RX_BKSV_REVOKED
414        BHDM_HDCP_TX_AKSV_ERROR
415        BHDM_HDCP_RX_NO_HDCP_SUPPORT
416        BHDM_HDCP_AUTH_ABORTED
417        BHDM_HDCP_AUTHENTICATE_ERROR           
418        BHDM_HDCP_LINK_RI_FAILURE
419        BHDM_HDCP_LINK_PJ_FAILURE       
420        BHDM_HDCP_REPEATER_FIFO_NOT_READY
421        BHDM_HDCP_REPEATER_DEVCOUNT_0
422        BHDM_HDCP_REPEATER_DEPTH_EXCEEDED
423        BHDM_HDCP_RX_DEVICES_EXCEEDED
424
425See Also:
426       
427*******************************************************************************/
428BERR_Code BHDCPlib_ProcessAuthentication(BHDCPlib_Handle hHDCPlib, BHDCPlib_Status *stHdcpStatus);
429
430
431/******************
432Summary: Disable/Stop HDCP authentication state machine.
433******************/
434BERR_Code BHDCPlib_DisableAuthentication(BHDCPlib_Handle hHDCPlib);
435
436
437/******************
438Summary: Retrieve HDCP information of the attached receiver (Bcaps, etc.)
439******************/
440BERR_Code BHDCPlib_GetReceiverInfo(BHDCPlib_Handle hHDCPlib, 
441        BHDCPlib_RxInfo *stRxHdcpInfo);
442
443
444/******************
445Summary: Get default hdcp configurations (keys, receiver info, etc.)
446******************/
447BERR_Code BHDCPlib_GetDefaultConfiguration(BHDCPlib_Configuration * stHdcpConfiguration);
448
449
450/******************
451Summary: Get hdcp configurations (keys, receiver info, etc.)
452******************/
453BERR_Code BHDCPlib_GetConfiguration(BHDCPlib_Handle hHDCPlib, BHDCPlib_Configuration *stHdcpConfiguration);
454
455
456/******************
457Summary: Set hdcp configurations (keys, receiver info, etc.)
458******************/
459BERR_Code BHDCPlib_SetConfiguration(BHDCPlib_Handle hHDCPlib, BHDCPlib_Configuration *stHdcpConfiguration);
460
461
462/******************
463Summary: Set hdcp revoked ksvs
464******************/
465BERR_Code BHDCPlib_SetRevokedKSVs(BHDCPlib_Handle hHDCPlib, BHDCPlib_RevokedKsvList *stKsvList);
466
467
468/******************
469Summary: Transmit encrypted video
470******************/
471BERR_Code BHDCPlib_TransmitEncrypted(BHDCPlib_Handle hHDCPlib);
472
473
474/******************
475Summary: Transmit clear video
476******************/
477BERR_Code BHDCPlib_TransmitClear(BHDCPlib_Handle hHDCPlib);
478
479
480/******************
481Summary: Retrieve current authentication state
482******************/
483BERR_Code BHDCPlib_GetAuthenticationState(BHDCPlib_Handle hHDCPlib, BHDCPlib_State *eAuthenticationState);
484
485
486/******************
487Summary: Retrieve current authentication state
488******************/
489BERR_Code BHDCPlib_GetHdcpStatus(BHDCPlib_Handle hHDCPlib, BHDCPlib_Status *stHdcpStatus);
490
491/******************
492Summary:
493        Check the current status of the HDCP link
494
495Description:
496        Returns true if the link is authenticated and ready for encryption.
497******************/
498bool BHDCPlib_LinkReadyForEncryption(BHDCPlib_Handle hHDCPlib);
499
500
501#ifdef __cplusplus
502}
503#endif
504
505#endif /* BHDCPLIB_H__ */
506
Note: See TracBrowser for help on using the repository browser.