import old mobicore
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos7580.git] / mobicore / rootpa / Code / Common / pacmtl.h
CommitLineData
cd9434cc 1/*
15e8442f
JA
2Copyright © Trustonic Limited 2013
3
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without modification,
7are 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
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29OF 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/**
43set 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*/
50void setCmdElementInfo(uint32_t* elementNbrP, uint8_t* wsmP, uint32_t* elementOffsetP, uint32_t elementLength);
51
52void setCmdMapInfo(uint8_t* wsmP, const mcBulkMap_t* mapInfoP);
53
54void setCmdCmpVersionAndCmdId(uint8_t* wsmP, cmpCommandId_t commandId);
55
56bool getRspElementInfo(uint32_t* elementNbrP, CMTHANDLE handle, uint32_t* elementOffsetP, uint32_t* elementLengthP);
57
58uint32_t getRspCmpVersion(const uint8_t* wsmP);
59
60uint32_t getRspCmpId(const uint8_t* wsmP);
61
62bool 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*/
67uint32_t getNeededBytesFromResponse(const uint8_t* wsmP);
68
69uint32_t getTotalMappedBufferSize(CmpMessage* commandP);
70#endif // PACMTL_H