12e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley/** 22e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * Copyright(c) 2011 Trusted Logic. All rights reserved. 32e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * 42e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * Redistribution and use in source and binary forms, with or without 52e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * modification, are permitted provided that the following conditions 62e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * are met: 72e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * 82e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * * Redistributions of source code must retain the above copyright 92e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * notice, this list of conditions and the following disclaimer. 102e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * * Redistributions in binary form must reproduce the above copyright 112e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * notice, this list of conditions and the following disclaimer in 122e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * the documentation and/or other materials provided with the 132e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * distribution. 142e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * * Neither the name Trusted Logic nor the names of its 152e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * contributors may be used to endorse or promote products derived 162e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * from this software without specific prior written permission. 172e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * 182e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 192e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 202e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 212e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 222e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 232e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 242e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 252e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 262e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 272e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 282e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 292e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley */ 302e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 312e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#ifndef ___MTC_H_INC___ 322e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#define ___MTC_H_INC___ 332e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 342e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#ifdef __cplusplus 352e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckleyextern "C" { 362e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#endif 372e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 382e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley/*------------------------------------------------------------------------------ 392e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley includes 402e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley------------------------------------------------------------------------------*/ 412e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#include "s_type.h" 422e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#include "s_error.h" 432e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 442e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley/* Define MTC_EXPORTS during the build of mtc libraries. Do 452e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley * not define it in applications. 462e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley */ 472e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 482e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#ifdef MTC_EXPORTS 492e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#define MTC_EXPORT S_DLL_EXPORT 502e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#else 512e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#define MTC_EXPORT S_DLL_IMPORT 522e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#endif 532e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 542e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley/*------------------------------------------------------------------------------ 552e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley typedefs 562e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley------------------------------------------------------------------------------*/ 572e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 582e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckleytypedef struct 592e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley{ 602e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley uint32_t nLow; 612e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley uint32_t nHigh; 622e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley} 632e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan BuckleyS_MONOTONIC_COUNTER_VALUE; 642e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 652e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley/*------------------------------------------------------------------------------ 662e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley defines 672e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley------------------------------------------------------------------------------*/ 682e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 692e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#define S_MONOTONIC_COUNTER_GLOBAL 0x00000000 702e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 712e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley/*------------------------------------------------------------------------------ 722e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley API 732e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley------------------------------------------------------------------------------*/ 742e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 752e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan BuckleyS_RESULT MTC_EXPORT SMonotonicCounterInit(void); 762e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 772e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckleyvoid MTC_EXPORT SMonotonicCounterTerminate(void); 782e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 792e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan BuckleyS_RESULT MTC_EXPORT SMonotonicCounterOpen( 802e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley uint32_t nCounterIdentifier, 812e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley S_HANDLE* phCounter); 822e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 832e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckleyvoid MTC_EXPORT SMonotonicCounterClose(S_HANDLE hCounter); 842e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 852e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan BuckleyS_RESULT MTC_EXPORT SMonotonicCounterGet( 862e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley S_HANDLE hCounter, 872e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley S_MONOTONIC_COUNTER_VALUE* psCurrentValue); 882e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 892e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan BuckleyS_RESULT MTC_EXPORT SMonotonicCounterIncrement( 902e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley S_HANDLE hCounter, 912e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley S_MONOTONIC_COUNTER_VALUE* psNewValue); 922e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 932e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#ifdef __cplusplus 942e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley} 952e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#endif 962e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley 972e9e9eca83c3dee85b7815573a8cf1e6d1780741Bryan Buckley#endif /*___MTC_H_INC___*/ 98