1 /* 2 * Copyright 2017, NXP 3 * All rights reserved. 4 * 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef __SRTM_PEERCORE_H__ 10 #define __SRTM_PEERCORE_H__ 11 12 #include "srtm_defs.h" 13 14 /*! 15 * @addtogroup srtm 16 * @{ 17 */ 18 19 /******************************************************************************* 20 * Definitions 21 ******************************************************************************/ 22 /** 23 * @brief SRTM peer core state 24 */ 25 typedef enum _srtm_peercore_state 26 { 27 SRTM_PeerCore_State_Inactive = 0x00U, /*!< Peer core is not ready to communicate */ 28 SRTM_PeerCore_State_Activating, /*!< Peer core wakeup in progress */ 29 SRTM_PeerCore_State_Activated, /*!< Peer core is ready to communicate */ 30 SRTM_PeerCore_State_Deactivating, /*!< Peer core is going to suspend */ 31 SRTM_PeerCore_State_Deactivated, /*!< Peer core suspended and not ready to communicate */ 32 } srtm_peercore_state_t; 33 34 /** 35 * @brief SRTM peer core wakeup callback function 36 */ 37 typedef srtm_status_t (*srtm_peercore_wakeup_cb_t)(srtm_peercore_t core, void *param); 38 39 /******************************************************************************* 40 * API 41 ******************************************************************************/ 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /*! 47 * @brief Create SRTM peer core object. 48 * 49 * @param id SRTM peer core ID allocated by application. 50 * @return SRTM peer core handle, or NULL on failure. 51 */ 52 srtm_peercore_t SRTM_PeerCore_Create(uint32_t id); 53 54 /*! 55 * @brief Destroy SRTM peer core object. 56 * 57 * @param core SRTM peer core handle. 58 */ 59 void SRTM_PeerCore_Destroy(srtm_peercore_t core); 60 61 /*! 62 * @brief Get SRTM peer core ID. 63 * 64 * @param core SRTM peer core handle. 65 * @return SRTM peer core ID. 66 */ 67 uint32_t SRTM_PeerCore_GetID(srtm_peercore_t core); 68 69 /*! 70 * @brief Start SRTM peer core communication. 71 * 72 * @param core SRTM peer core handle. 73 * @return SRTM_Status_Success on success and others on failure. 74 */ 75 srtm_status_t SRTM_PeerCore_Start(srtm_peercore_t core); 76 77 /*! 78 * @brief Stop SRTM peer core communication. 79 * 80 * @param core SRTM peer core handle. 81 * @return SRTM_Status_Success on success and others on failure. 82 */ 83 srtm_status_t SRTM_PeerCore_Stop(srtm_peercore_t core); 84 85 /*! 86 * @brief Activate the SRTM peer core. 87 * 88 * @param core SRTM peer core handle. 89 * @return SRTM_Status_Success on success and others on failure. 90 */ 91 srtm_status_t SRTM_PeerCore_Activate(srtm_peercore_t core); 92 93 /*! 94 * @brief Deactivate the SRTM peer core. 95 * 96 * @param core SRTM peer core handle. 97 * @param wakeup SRTM peer core wakeup function. 98 * @param param SRTM peer core wakeup parameter. 99 * @return SRTM_Status_Success on success and others on failure. 100 */ 101 srtm_status_t SRTM_PeerCore_Deactivate(srtm_peercore_t core, srtm_peercore_wakeup_cb_t wakeup, void *param); 102 103 /*! 104 * @brief Add communication channel to the SRTM peer core. 105 * 106 * @param core SRTM peer core handle. 107 * @param channel SRTM channel to add. 108 * @return SRTM_Status_Success on success and others on failure. 109 */ 110 srtm_status_t SRTM_PeerCore_AddChannel(srtm_peercore_t core, srtm_channel_t channel); 111 112 /*! 113 * @brief Remove communication channel from the SRTM peer core. 114 * 115 * @param core SRTM peer core handle. 116 * @param channel SRTM channel to remove. 117 * @return SRTM_Status_Success on success and others on failure. 118 */ 119 srtm_status_t SRTM_PeerCore_RemoveChannel(srtm_peercore_t core, srtm_channel_t channel); 120 121 /*! 122 * @brief Get SRTM peer core state. 123 * 124 * @param core SRTM peer core handle. 125 * @return SRTM peer core state. 126 */ 127 srtm_peercore_state_t SRTM_PeerCore_GetState(srtm_peercore_t core); 128 129 /*! 130 * @brief Set SRTM peer core state. 131 * 132 * @param core SRTM peer core handle. 133 * @param state SRTM peer core state to run into. 134 * @return SRTM_Status_Success on success and others on failure. 135 */ 136 srtm_status_t SRTM_PeerCore_SetState(srtm_peercore_t core, srtm_peercore_state_t state); 137 138 #ifdef __cplusplus 139 } 140 #endif 141 142 /*! @} */ 143 144 #endif /* __SRTM_PEERCORE_H__ */ 145