xref: /netbsd-src/crypto/external/cpl/trousers/dist/src/include/tss/tddli.h (revision 2d5f7628c5531eb583b9313ac2fd1cf8582b4479)
1 /*++
2 
3 TPM Device Driver Library interface
4 
5 --*/
6 
7 #ifndef __TDDLI_H__
8 #define __TDDLI_H__
9 
10 #include <tss/tss_typedef.h>
11 #include <tss/tddl_error.h>
12 
13 #if !defined(TDDLI)
14 #ifdef WIN32
15 // --- This should be used on Windows platforms
16 #ifdef TDDLI_EXPORTS
17 #define TDDLI __declspec(dllexport)
18 #else
19 #define TDDLI __declspec(dllimport)
20 #endif
21 #else
22 #define TDDLI
23 #endif
24 #endif /* !defined(TDDLI) */
25 
26 
27 #define TDDL_CAP_VERSION   0x0100
28 #define TDDL_CAP_VER_DRV   0x0101
29 #define TDDL_CAP_VER_FW    0x0102
30 #define TDDL_CAP_VER_FW_DATE   0x0103
31 
32 #define TDDL_CAP_PROPERTY   0x0200
33 #define TDDL_CAP_PROP_MANUFACTURER  0x0201
34 #define TDDL_CAP_PROP_MODULE_TYPE  0x0202
35 #define TDDL_CAP_PROP_GLOBAL_STATE  0x0203
36 
37 
38 //--------------------------------------------------------------------
39 // TDDL specific helper redefinitions
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45     //establish a connection to the TPM device driver
46     TDDLI TSS_RESULT Tddli_Open(void);
47 
48     //close a open connection to the TPM device driver
49     TDDLI TSS_RESULT Tddli_Close(void);
50 
51     //cancels the last outstanding TPM command
52     TDDLI TSS_RESULT Tddli_Cancel(void);
53 
54     // read the attributes returned by the TPM HW/FW
55     TDDLI TSS_RESULT Tddli_GetCapability(
56         UINT32        CapArea,
57         UINT32        SubCap,
58         BYTE         *pCapBuf,
59         UINT32       *puntCapBufLen);
60 
61     // set parameters to the TPM HW/FW
62     TDDLI TSS_RESULT Tddli_SetCapability(
63         UINT32        CapArea,
64         UINT32        SubCap,
65         BYTE         *pCapBuf,
66         UINT32        puntCapBufLen);
67 
68     // get status of the TPM driver and device
69     TDDLI TSS_RESULT Tddli_GetStatus(
70         UINT32        ReqStatusType,
71         UINT32       *puntStatus);
72 
73     // send any data to the TPM module
74     TDDLI TSS_RESULT Tddli_TransmitData(
75         BYTE         *pTransmitBuf,
76         UINT32        TransmitBufLen,
77         BYTE         *pReceiveBuf,
78         UINT32       *puntReceiveBufLen);
79 
80     TDDLI TSS_RESULT Tddli_SetPowerManagement(
81         TSS_BOOL      SendSaveStateCommand,       // in
82         UINT32       *QuerySetNewTPMPowerState);  // in, out
83 
84     TDDLI TSS_RESULT Tddli_PowerManagementControl(
85         TSS_BOOL      SendPowerManager,           // in
86         UINT32       *DriverManagesPowerStates);  // out
87 
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif // __TDDLI_H__
94 
95