ssi_pal_mutex.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**************************************************************************************
  2. * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
  3. * *
  4. * This file and the related binary are licensed under the following license: *
  5. * *
  6. * ARM Object Code and Header Files License, v1.0 Redistribution. *
  7. * *
  8. * Redistribution and use of object code, header files, and documentation, without *
  9. * modification, are permitted provided that the following conditions are met: *
  10. * *
  11. * 1) Redistributions must reproduce the above copyright notice and the *
  12. * following disclaimer in the documentation and/or other materials *
  13. * provided with the distribution. *
  14. * *
  15. * 2) Unless to the extent explicitly permitted by law, no reverse *
  16. * engineering, decompilation, or disassembly of is permitted. *
  17. * *
  18. * 3) Redistribution and use is permitted solely for the purpose of *
  19. * developing or executing applications that are targeted for use *
  20. * on an ARM-based product. *
  21. * *
  22. * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  23. * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
  24. * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
  25. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
  26. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
  28. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
  33. **************************************************************************************/
  34. #ifndef _SSI_PAL_MUTEX_H
  35. #define _SSI_PAL_MUTEX_H
  36. #include "ssi_pal_types.h"
  37. #include "ssi_pal_mutex_plat.h"
  38. #include "ssi_pal_types_plat.h"
  39. #ifdef __cplusplus
  40. extern "C"
  41. {
  42. #endif
  43. /*!
  44. @file
  45. @brief This file contains functions for resource management (mutex operations).
  46. The functions implementations are generally just wrappers to different operating system calls.
  47. None of the described functions will check the input parameters so the behavior
  48. of the APIs in illegal parameters case is dependent on the operating system behavior.
  49. @defgroup ssi_pal_mutex CryptoCell PAL mutex APIs
  50. @{
  51. @ingroup ssi_pal
  52. */
  53. /*----------------------------
  54. PUBLIC FUNCTIONS
  55. -----------------------------------*/
  56. /**
  57. * @brief This function purpose is to create a mutex.
  58. *
  59. *
  60. * @return Zero on success.
  61. * @return A non-zero value on failure.
  62. */
  63. //SaSiError_t SaSi_PalMutexCreate(SaSi_PalMutex *pMutexId /*!< [out] Pointer to created mutex handle. */);
  64. #define SaSi_PalMutexCreate(a) (0)
  65. /**
  66. * @brief This function purpose is to destroy a mutex.
  67. *
  68. *
  69. * @return Zero on success.
  70. * @return A non-zero value on failure.
  71. */
  72. //SaSiError_t SaSi_PalMutexDestroy(SaSi_PalMutex *pMutexId /*!< [in] Pointer to mutex handle. */);
  73. #define SaSi_PalMutexDestroy(a) (0)
  74. /**
  75. * @brief This function purpose is to Wait for Mutex with aTimeOut. aTimeOut is
  76. * specified in milliseconds (SASI_INFINITE is blocking).
  77. *
  78. * @return Zero on success.
  79. * @return A non-zero value on failure.
  80. */
  81. #define SaSi_PalMutexLock(a, b) (0)
  82. //SaSiError_t SaSi_PalMutexLock (SaSi_PalMutex *pMutexId, /*!< [in] Pointer to Mutex handle. */
  83. // uint32_t aTimeOut /*!< [in] Timeout in mSec, or SASI_INFINITE. */);
  84. /**
  85. * @brief This function purpose is to release the mutex.
  86. *
  87. * @return Zero on success.
  88. * @return A non-zero value on failure.
  89. */
  90. #define SaSi_PalMutexUnlock(a) (0)
  91. //SaSiError_t SaSi_PalMutexUnlock (SaSi_PalMutex *pMutexId/*!< [in] Pointer to Mutex handle. */);
  92. /**
  93. * @brief This function gets the number of users of CC-hardware
  94. *
  95. * @return Number of users
  96. */
  97. int32_t SaSi_PalPowerModeStatus(void);
  98. /**
  99. * @brief This function enables/disables power level
  100. *
  101. * @return 0 on success, otherwise false
  102. */
  103. uint32_t SaSi_PalPowerSaveModeSelect(bool isPowerSaveMode);
  104. #define CC_SUCCESS SASI_SUCCESS
  105. #define CC_FALSE SASI_FALSE
  106. #define CC_TRUE SASI_TRUE
  107. /*! Get ARM Cerberus status. Return number of active registered CC operations */
  108. #define CC_STATUS_GET SaSi_PalPowerSaveModeStatus()
  109. /*! Notify ARM Cerberus is active. */
  110. #define CC_IS_WAKE SaSi_PalPowerSaveModeSelect(CC_FALSE)
  111. /*! Notify ARM Cerberus is idle. */
  112. #define CC_IS_IDLE SaSi_PalPowerSaveModeSelect(CC_TRUE)
  113. #ifdef __cplusplus
  114. }
  115. #endif
  116. /**
  117. @}
  118. */
  119. #endif