source: svn/trunk/newcon3bcm2_21bu/dta/src/hdcplib/bhdcplib.h

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

1.phkim

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