Commit 207f6f59 authored by Federico Vaga's avatar Federico Vaga

wrtd:rt: change a bit code style

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>


NOTE
This commit has been created by `git subtree` on the Mock Turtle repository
on tag mock-turtle-2.0

This commit will not compile
parent 644776ed
......@@ -24,10 +24,13 @@ static SMEM struct wrtd_trigger_entry buf[16];
void loop_queue_init()
{
head = tail = count = 0;
head = 0;
tail = 0;
count = 0;
}
void loop_queue_push(struct wrtd_trig_id *id, uint32_t seq, struct wr_timestamp *ts)
void loop_queue_push(struct wrtd_trig_id *id, uint32_t seq,
struct wr_timestamp *ts)
{
if (count >= LOOP_QUEUE_SIZE)
return;
......@@ -39,22 +42,21 @@ void loop_queue_push(struct wrtd_trig_id *id, uint32_t seq, struct wr_timestamp
smem_atomic_add(&head, 1);
if (head >= LOOP_QUEUE_SIZE)
head = 0;
smem_atomic_add(&count, 1);
}
struct wrtd_trigger_entry *loop_queue_pop()
struct wrtd_trigger_entry *loop_queue_pop(void)
{
if (!count)
return NULL;
struct wrtd_trigger_entry *rv;
struct wrtd_trigger_entry *rv = &buf[tail];
if (count == 0)
return NULL; /* No entry */
smem_atomic_add(&tail, 1);
rv = &buf[tail];
smem_atomic_add(&tail, 1);
if(tail >= LOOP_QUEUE_SIZE)
tail = 0;
smem_atomic_sub(&count, 1);
return rv;
......
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