Commit d59628cd authored by Tristan Gingold's avatar Tristan Gingold

add trtl_fw_ping_timeout.

parent d8d70096
......@@ -55,11 +55,13 @@ int trtl_fw_version(struct trtl_dev *trtl,
* @param[in] trtl device token
* @param[in] idx_cpu CPU index
* @param[in] idx_hmq HMQ index
* @param[in] timeout_ms timeout
* @return 0 on success, -1 on error and errno is set appropriately
*/
int trtl_fw_ping(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq)
int trtl_fw_ping_timeout(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq,
int timeout_ms)
{
struct trtl_desc *wdesc = (struct trtl_desc *)trtl;
struct trtl_msg msg;
......@@ -72,7 +74,7 @@ int trtl_fw_ping(struct trtl_dev *trtl,
msg.hdr.flags = TRTL_HMQ_HEADER_FLAG_RPC;
err = trtl_msg_sync(trtl, idx_cpu, idx_hmq, &msg, &msg,
trtl_default_timeout_ms);
timeout_ms);
if (err < 0)
return -1;
if (msg.hdr.msg_id != TRTL_MSG_ID_PING) {
......@@ -83,6 +85,21 @@ int trtl_fw_ping(struct trtl_dev *trtl,
return 0;
}
/**
* It checks if firmware core is running and answering to messages
* @param[in] trtl device token
* @param[in] idx_cpu CPU index
* @param[in] idx_hmq HMQ index
* @return 0 on success, -1 on error and errno is set appropriately
*/
int trtl_fw_ping(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq)
{
return trtl_fw_ping_timeout(trtl, idx_cpu, idx_hmq,
trtl_default_timeout_ms);
}
static int __trtl_fw_variable(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq,
......
......@@ -205,6 +205,10 @@ extern int trtl_fw_version(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq,
struct trtl_fw_version *version);
extern int trtl_fw_ping_timeout(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq,
int timeout_ms);
extern int trtl_fw_ping(struct trtl_dev *trtl,
unsigned int idx_cpu,
unsigned int idx_hmq);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment