Commit 4024a23b authored by Federico Vaga's avatar Federico Vaga

test:fw: fix according to the new poll API

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 8a15f83f
......@@ -94,8 +94,8 @@ static int byte_addressing_test_mq(enum trtl_mq_type type,
unsigned int cpu, unsigned int hmq)
{
const struct trtl_config_rom *cfg = trtl_config_rom_get();
uint32_t size;
int err, g_err = 0, max_wait_cycle, wait, i;
uint32_t size, status;
int err, g_err = 0, i;
char c = (type == TRTL_HMQ ? 'H' : 'R');
......@@ -118,16 +118,12 @@ static int byte_addressing_test_mq(enum trtl_mq_type type,
goto out; /* can't check input for RMQ */
for (i = 0; i < ARRAY_SIZE(func); ++i) {
wait = (1 << hmq);
max_wait_cycle = 0xFFFFFF;
while ((mq_poll_in(type) & wait) != wait) {
if (--max_wait_cycle == 0) {
pr_error("\tNO MESSAGE PENDING %cMQ[%d\r\n",
c, hmq);
return -1;
}
status = mq_poll_in_wait(type, 1 << hmq, 1000);
if (!status) {
pr_error("\tNO MESSAGE PENDING %cMQ%d\r\n",
c, hmq);
return -1;
}
break; /* FIXME do not test input - somehting wrong with the test */
err = func[i](mq_map_in_header(type, hmq), size);
g_err |= err;
......
......@@ -9,31 +9,27 @@ struct payload {
int main()
{
int cpu, hmq;
int cpu, hmq, count;
const struct trtl_config_rom *cfgrom = trtl_config_rom_get();
int wait = 0, max_wait_cycle, count;
struct trtl_fw_msg msg;
struct payload *p;
uint32_t status;
pr_debug("ASYNC MESSAGES SEND\r\n");
cpu = trtl_get_core_id();
for (hmq = 0; hmq < cfgrom->n_hmq[cpu]; ++hmq) {
wait = (1 << hmq);
mq_map_in_message(TRTL_HMQ, hmq, &msg);
p = msg.payload;
count = 1;
max_wait_cycle = 0xFFFF;
while (1) {
/* Wait incoming message */
while ((mq_poll_in(TRTL_HMQ) & wait) != wait) {
if (--max_wait_cycle == 0) {
pr_error("\tNO MESSAGE PENDING h:%d, cnt:0x%x\r\n",
hmq, count);
return -1;
}
status = mq_poll_in_wait(TRTL_HMQ, 1 << hmq, 1000);
if (!status) {
pr_error("\tNO MESSAGE PENDING h:%d, cnt:0x%x\r\n",
hmq, count);
return -1;
}
pr_debug("\th: %d, l:%d, {idx:0x%lx, max:0x%lx}, cnt:0x%x\r\n",
......
......@@ -12,8 +12,8 @@ int main()
mdelay(100);
cpu = trtl_get_core_id();
for (hmq = 0; hmq < cfgrom->n_hmq[cpu]; ++hmq) {
val = mq_poll_in(TRTL_HMQ);
if ((val & (1 << hmq)) != (1 << hmq)) {
val = mq_poll_in(TRTL_HMQ, 1 << hmq);
if (!val) {
pr_error("CPU-%d HMQ-%d after poll (1): 0x%"PRIx32"\r\n",
cpu, hmq, val);
return -1;
......@@ -21,15 +21,15 @@ int main()
mq_purge(TRTL_HMQ, hmq);
val = mq_poll_in(TRTL_HMQ);
if ((val & (1 << hmq)) == (1 << hmq)) {
val = mq_poll_in(TRTL_HMQ, 1 << hmq);
if (val) {
pr_error("CPU-%d HMQ-%d after poll (2): 0x%"PRIx32"\r\n",
cpu, hmq, val);
return -1;
}
}
val = mq_poll_in(TRTL_HMQ);
val = mq_poll_in(TRTL_HMQ, ~0);
if (val != 0) {
pr_error("CPU-%d END poll: 0x%"PRIx32"\r\n",
cpu, val);
......
......@@ -2,10 +2,11 @@
int main()
{
int cpu, hmq, wait = 0, max_wait_cycle, count;
int cpu, hmq, count;
const struct trtl_config_rom *cfgrom = trtl_config_rom_get();
volatile uint32_t *msg_r, *msg_s;
volatile struct trtl_hmq_header *hdr_r, *hdr_s;
uint32_t status;
pr_debug("SYNC MESSAGES\r\n");
cpu = trtl_get_core_id();
......@@ -13,22 +14,19 @@ int main()
mq_purge(TRTL_HMQ, hmq);
for (hmq = 0; hmq < cfgrom->n_hmq[cpu]; ++hmq) {
wait = (1 << hmq);
hdr_r = mq_map_in_header(TRTL_HMQ, hmq);
msg_r = mq_map_in_buffer(TRTL_HMQ, hmq);
hdr_s = mq_map_out_header(TRTL_HMQ, hmq);
msg_s = mq_map_out_buffer(TRTL_HMQ, hmq);
count = 1;
max_wait_cycle = 0xFFFFFFFF;
while (1) {
/* Wait incoming message */
while ((mq_poll_in(TRTL_HMQ) & wait) != wait) {
if (--max_wait_cycle == 0) {
pr_error("\tNO MESSAGE PENDING h:%d, cnt:0x%x\r\n",
hmq, count);
return -1;
}
status = mq_poll_in_wait(TRTL_HMQ, 1 << hmq, 1000);
if (!status) {
pr_error("\tNO MESSAGE PENDING h:%d, cnt:0x%x\r\n",
hmq, count);
return -1;
}
/* validate message */
......
......@@ -65,7 +65,7 @@ test_hmq(void)
mq_send(TRTL_HMQ, 0);
// Wait for answer
while((mq_poll_in(TRTL_HMQ) & 1) == 0)
while(mq_poll_in(TRTL_HMQ, 1) == 0)
;
if (counts[cpu] != v + 1)
failed('H');
......@@ -80,7 +80,7 @@ test_hmq(void)
failed('K');
mq_discard(TRTL_HMQ, 0);
if ((mq_poll_in(TRTL_HMQ) & 1) != 0)
if (mq_poll_in(TRTL_HMQ, 1) != 0)
failed('k');
}
......@@ -103,7 +103,7 @@ test_rmq(void)
mq_send(TRTL_RMQ, 0);
// Wait for answer
while((mq_poll_in(TRTL_RMQ) & 1) == 0)
while(mq_poll_in(TRTL_RMQ, 1) == 0)
;
// Read answer
......@@ -116,7 +116,7 @@ test_rmq(void)
failed('r');
mq_discard(TRTL_RMQ, 0);
if ((mq_poll_in(TRTL_RMQ) & 1) != 0)
if (mq_poll_in(TRTL_RMQ, 1) != 0)
failed('s');
}
......
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