Commit cc481bd6 authored by Federico Vaga's avatar Federico Vaga

sw:lib: bugfix ping and version commands

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent ae0a9efa
......@@ -25,14 +25,24 @@ int trtl_fw_version(struct trtl_dev *trtl,
unsigned int idx_hmq,
struct trtl_fw_version *version)
{
struct trtl_desc *wdesc = (struct trtl_desc *)trtl;
struct trtl_msg msg;
int err;
/* FIXME with new hmqcol redefine messages to ACK/NACK */
memset(&msg, 0, sizeof(struct trtl_msg));
msg.hdr.msg_id = TRTL_MSG_ID_VER;
msg.hdr.seq = wdesc->seq;
msg.hdr.sync_id = msg.hdr.seq;
msg.hdr.flags = TRTL_HMQ_HEADER_FLAG_RPC;
err = trtl_msg_sync(trtl, idx_cpu, idx_hmq, &msg, &msg,
trtl_default_timeout_ms);
if (err <= 0)
if (err < 0)
return -1;
if (msg.hdr.msg_id != TRTL_MSG_ID_VER) {
errno = ETRTL_INVALID_MESSAGE;
return -1;
}
memcpy(version, msg.data, msg.hdr.len * 4);
......@@ -59,11 +69,16 @@ int trtl_fw_ping(struct trtl_dev *trtl,
msg.hdr.msg_id = TRTL_MSG_ID_PING;
msg.hdr.seq = wdesc->seq;
msg.hdr.sync_id = msg.hdr.seq;
msg.hdr.flags = TRTL_HMQ_HEADER_FLAG_RPC;
err = trtl_msg_sync(trtl, idx_cpu, idx_hmq, &msg, &msg,
trtl_default_timeout_ms);
if (err <= 0)
if (err < 0)
return -1;
if (msg.hdr.msg_id != TRTL_MSG_ID_PING) {
errno = ETRTL_INVALID_MESSAGE;
return -1;
}
return 0;
}
......
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