Commit 63276363 authored by Federico Vaga's avatar Federico Vaga

sw:lib: bugfix wrong endianess calculation

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 40c622db
......@@ -192,6 +192,8 @@ enum trtl_msg_filter_operation_type {
__TRTL_MSG_FILTER_MAX,
};
#define TRTL_MSG_FILTER_FLAG_HEADER (0)
#define TRTL_MSG_FILTER_FLAG_PAYLOAD (1 << 0)
/**
......
......@@ -65,18 +65,18 @@ enum trtl_msg_filter_predefined {
*/
static struct trtl_msg_filter filters[] = {
[TRTL_MSG_FILTER_ASYNC] = {
.flags = 0,
.flags = TRTL_MSG_FILTER_FLAG_HEADER,
.operation = TRTL_MSG_FILTER_AND,
.word_offset = 0, /* ATTENTION: sync_id in the message header */
.mask = (TRTL_HMQ_HEADER_FLAG_SYNC | TRTL_HMQ_HEADER_FLAG_ACK) << 8,
.word_offset = 0, /* ATTENTION: flags in the message header */
.mask = (TRTL_HMQ_HEADER_FLAG_SYNC | TRTL_HMQ_HEADER_FLAG_ACK) << 16,
.value = 0,
},
[TRTL_MSG_FILTER_SYNC] = {
.flags = 0,
.flags = TRTL_MSG_FILTER_FLAG_HEADER,
.operation = TRTL_MSG_FILTER_AND,
.word_offset = 1, /* ATTENTION: sync_id in the message header */
.mask = TRTL_HMQ_HEADER_FLAG_ACK << 8,
.value = TRTL_HMQ_HEADER_FLAG_ACK << 8,
.word_offset = 0, /* ATTENTION: flags in the message header */
.mask = TRTL_HMQ_HEADER_FLAG_ACK << 16,
.value = TRTL_HMQ_HEADER_FLAG_ACK << 16,
},
};
......@@ -1048,6 +1048,9 @@ int trtl_msg_async_send(struct trtl_dev *trtl,
* @param[out] msg_r message received
* @param[in] timeout like poll(2)
* @return 0 on success, otherwise -1 and errno is set appropriately
*
* This function configure some filters, so it does some bit magic which have been
* tested on a little-endian host.
*/
int trtl_msg_sync(struct trtl_dev *trtl,
unsigned int idx_cpu,
......@@ -1059,7 +1062,7 @@ int trtl_msg_sync(struct trtl_dev *trtl,
struct trtl_desc *wdesc = (struct trtl_desc *)trtl;
struct polltrtl p;
struct trtl_msg_filter f_sync = {
.flags = 0,
.flags = TRTL_MSG_FILTER_FLAG_HEADER,
.operation = TRTL_MSG_FILTER_AND,
.word_offset = 1, /* ATTENTION: sync_id in the message header */
.mask = 0xFFFF0000,
......
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