Commit | Line | Data |
---|---|---|
cd9434cc | 1 | /* |
15e8442f JA |
2 | Copyright © Trustonic Limited 2013 |
3 | ||
4 | All rights reserved. | |
5 | ||
6 | Redistribution and use in source and binary forms, with or without modification, | |
7 | are permitted provided that the following conditions are met: | |
8 | ||
9 | 1. Redistributions of source code must retain the above copyright notice, this | |
10 | list of conditions and the following disclaimer. | |
11 | ||
12 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
13 | this list of conditions and the following disclaimer in the documentation | |
14 | and/or other materials provided with the distribution. | |
15 | ||
16 | 3. Neither the name of the Trustonic Limited nor the names of its contributors | |
17 | may be used to endorse or promote products derived from this software | |
18 | without specific prior written permission. | |
19 | ||
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
24 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
25 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | |
28 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
29 | OF THE POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | |
cd9434cc T |
31 | |
32 | #ifndef PACMTL_H | |
33 | #define PACMTL_H | |
34 | ||
35 | #include <MobiCoreDriverApi.h> | |
36 | #include <TlCm/3.0/tlCmApi.h> | |
37 | #include "trustletchannel.h" | |
38 | #include "rootpa.h" | |
39 | ||
40 | #define CMP_VERSION 0x00030000 | |
41 | ||
42 | /** | |
43 | set the element info (offset and size) to wsmP in correct location | |
44 | ||
45 | @param elementNbrP number of the element, starting from one, increased by one before return | |
46 | @param wsmP pointer to the beginnign of wsm buffer | |
47 | @param &elementOffsetP offset to the element, 0 when the element number is 1, increased by length before return | |
48 | @param elementLength length of the element | |
49 | */ | |
50 | void setCmdElementInfo(uint32_t* elementNbrP, uint8_t* wsmP, uint32_t* elementOffsetP, uint32_t elementLength); | |
51 | ||
52 | void setCmdMapInfo(uint8_t* wsmP, const mcBulkMap_t* mapInfoP); | |
53 | ||
54 | void setCmdCmpVersionAndCmdId(uint8_t* wsmP, cmpCommandId_t commandId); | |
55 | ||
56 | bool getRspElementInfo(uint32_t* elementNbrP, CMTHANDLE handle, uint32_t* elementOffsetP, uint32_t* elementLengthP); | |
57 | ||
58 | uint32_t getRspCmpVersion(const uint8_t* wsmP); | |
59 | ||
60 | uint32_t getRspCmpId(const uint8_t* wsmP); | |
61 | ||
62 | bool isValidResponseTo(cmpCommandId_t commandId, const uint8_t* wsmP); | |
63 | /** | |
64 | @param pointer to the buffer containing response from CMTL | |
65 | @return needed bytes from the response, -1 if wsmP is not valid response. Accoriding to the specification 0 if the response fit into the buffer. | |
66 | */ | |
67 | uint32_t getNeededBytesFromResponse(const uint8_t* wsmP); | |
68 | ||
69 | uint32_t getTotalMappedBufferSize(CmpMessage* commandP); | |
70 | #endif // PACMTL_H |