diff options
author | Buddy Liong <buddy.liong@ti.com> | 2016-06-17 10:30:07 -0500 |
---|---|---|
committer | Buddy Liong <buddy.liong@ti.com> | 2016-06-17 10:30:07 -0500 |
commit | d0d2e63691f4c6906aa9ae28c16f5b92de8c1bcd (patch) | |
tree | 6a874121e0c5846ad00fc291682b0f09b45498c9 | |
parent | 4e9b02508ac3847df0af5c496a1be7b4ae082ad5 (diff) | |
download | dce-d0d2e63691f4c6906aa9ae28c16f5b92de8c1bcd.tar.gz |
get_rproc_info: Introduce new API to query remoteproc
This is the initial implementation of an extensible API
that allows the user to query various remote core
parameters. Currently, there are three query parameters
that are supported:
1. CPU Load
2. Total configured heap size
3. Available heap size
The intent of this API is to programmatically call the
API and feed it in various other tools that can be
developed on top of this (for example: soc performance
visualization etc.)
NOTE: This will require the implementation on ipumm-fw
and/or dspdce-fw.
Change-Id: I94c309221dbce24162a4f31166890d3acdb2d049
Signed-off-by: Karthik Ramanan <a0393906@ti.com>
Signed-off-by: Buddy Liong <buddy.liong@ti.com>
-rw-r--r-- | dce_rpc.h | 3 | ||||
-rw-r--r-- | libdce.c | 38 | ||||
-rw-r--r-- | libdce.h | 15 |
3 files changed, 55 insertions, 1 deletions
@@ -60,7 +60,8 @@ typedef enum dce_rpc_call { DCE_RPC_CODEC_CONTROL, DCE_RPC_CODEC_GET_VERSION, DCE_RPC_CODEC_PROCESS, - DCE_RPC_CODEC_DELETE + DCE_RPC_CODEC_DELETE, + DCE_RPC_GET_INFO } dce_rpc_call; //Enumeration for dce function callback @@ -565,6 +565,44 @@ EXIT: return; } + /*===============================================================*/ +/** get_rproc_info : Get Information from the Remote proc. + * + * @ param engine [in] : Engine Handle obtained in Engine_open() call. + * @ param info_type [in] : Information type as defined in the rproc_info_type ++ */ +int32_t get_rproc_info(Engine_Handle engine, rproc_info_type info_type) +{ + MmRpc_FxnCtx fxnCtx; + int32_t fxnRet; + dce_error_status eError = DCE_EOK; + int32_t coreIdx = INVALID_CORE; + int tableIdx = -1; + + /*Acquire permission to use IPC*/ + pthread_mutex_lock(&ipc_mutex); + + _ASSERT(engine != NULL, DCE_EINVALID_INPUT); + + /* Marshall function arguments into the send buffer */ + Fill_MmRpc_fxnCtx(&fxnCtx, DCE_RPC_GET_INFO, 1, 0, NULL); + Fill_MmRpc_fxnCtx_Scalar_Params(&(fxnCtx.params[0]), sizeof(rproc_info_type), (int32_t)info_type); + + coreIdx = getCoreIndexFromEngine(engine, &tableIdx); + _ASSERT(coreIdx != INVALID_CORE,DCE_EINVALID_INPUT); + + /* Invoke the Remote function through MmRpc */ + eError = MmRpc_call(MmRpcHandle[coreIdx], &fxnCtx, &fxnRet); + _ASSERT(eError == DCE_EOK, DCE_EIPC_CALL_FAIL); + +EXIT: + /*Relinquish IPC*/ + pthread_mutex_unlock(&ipc_mutex); + + return fxnRet; +} + + /*===============================================================*/ /** Functions create(), control(), get_version(), process(), delete() are common codec * glue function signatures which are same for both encoder and decoder @@ -58,6 +58,13 @@ typedef enum dce_error_status { DCE_EOMAPDRM_FAIL = -7 } dce_error_status; + +typedef enum rproc_info_type { + RPROC_CPU_LOAD = 0, + RPROC_TOTAL_HEAP_SIZE = 1, + RPROC_AVAILABLE_HEAP_SIZE = 2 +} rproc_info_type; + /***************************** Memory Allocation/Free APIs *****************************/ /*=====================================================================================*/ /** dce_alloc : Allocate the Data structures passed to codec-engine APIs @@ -183,5 +190,13 @@ int dce_get_fd(); void dce_set_fd(int fd); + /*===============================================================*/ +/** get_rproc_info : Get Information from the Remote proc. + * + * @ param engine [in] : Engine Handle obtained in Engine_open() call. + * @ param info_type [in] : Information type as defined in the rproc_info_type ++ */ +int32_t get_rproc_info(Engine_Handle engine, rproc_info_type info_type); + #endif /* __LIBDCE_H__ */ |