summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/hal/phy/inc/bridgedma.h11
-rw-r--r--cesar/hal/phy/inc/bridgedma_common.h15
-rw-r--r--cesar/hal/phy/soft/bridgedma/src/bridgedma.c25
-rw-r--r--cesar/hal/phy/src/bridgedma.c28
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/src/activate.c4
5 files changed, 38 insertions, 45 deletions
diff --git a/cesar/hal/phy/inc/bridgedma.h b/cesar/hal/phy/inc/bridgedma.h
index a32b0696c0..6dfdf7b42e 100644
--- a/cesar/hal/phy/inc/bridgedma.h
+++ b/cesar/hal/phy/inc/bridgedma.h
@@ -33,15 +33,6 @@ struct phy_bridgedma_ctrl_t
};
typedef struct phy_bridgedma_ctrl_t phy_bridgedma_ctrl_t;
-struct phy_bridgedma_pending_list_t
-{
- /** The head of the chain. */
- phy_bridgedma_job_t *head;
- /** The tail of the chain. */
- phy_bridgedma_job_t *tail;
-};
-typedef struct phy_bridgedma_pending_list_t phy_bridgedma_pending_list_t;
-
/** Bridge DMA context. */
struct phy_bridgedma_t
{
@@ -51,7 +42,7 @@ struct phy_bridgedma_t
phy_bridgedma_it_mgr_t it_mgr;
/** Pending new list.
* Workaround maria:#971. */
- phy_bridgedma_pending_list_t jobs_pending;
+ phy_bridgedma_list_t jobs_pending;
};
#endif /* hal_phy_inc_bridgedma_h */
diff --git a/cesar/hal/phy/inc/bridgedma_common.h b/cesar/hal/phy/inc/bridgedma_common.h
index 60372ed1e5..e6171f7e3e 100644
--- a/cesar/hal/phy/inc/bridgedma_common.h
+++ b/cesar/hal/phy/inc/bridgedma_common.h
@@ -23,6 +23,15 @@
#define PHY_BRGDMA_CORRECT_ADDRESS(addr) \
((addr) & ~0x1)
+struct phy_bridgedma_list_t
+{
+ /** The head of the chain. */
+ phy_bridgedma_job_t *head;
+ /** The tail of the chain. */
+ phy_bridgedma_job_t *tail;
+};
+typedef struct phy_bridgedma_list_t phy_bridgedma_list_t;
+
struct phy_bridgedma_common_t
{
/** User data passed to any callback. */
@@ -31,10 +40,8 @@ struct phy_bridgedma_common_t
phy_bridgedma_cb_t bridgedma_cb;
/** DSR callback. */
phy_deferred_cb_t deferred_cb;
- /** Bridgedma job head. */
- phy_bridgedma_job_t *job_head;
- /** Bridgedma job tail. */
- phy_bridgedma_job_t *job_tail;
+ /** Jobs being processed by the DMA. */
+ phy_bridgedma_list_t jobs_process;
};
typedef struct phy_bridgedma_common_t phy_bridgedma_common_t;
diff --git a/cesar/hal/phy/soft/bridgedma/src/bridgedma.c b/cesar/hal/phy/soft/bridgedma/src/bridgedma.c
index 0b0d246f2b..b93a2cda42 100644
--- a/cesar/hal/phy/soft/bridgedma/src/bridgedma.c
+++ b/cesar/hal/phy/soft/bridgedma/src/bridgedma.c
@@ -14,6 +14,7 @@
#include "common/defs/ethernet.h"
#include "common/defs/homeplugAV.h"
#include "lib/bitstream.h"
+#include "lib/slist.h"
#include "hal/phy/soft/bridgedma/bridgedma_crc.h"
#include "hal/phy/soft/bridgedma/inc/bridgedma.h"
@@ -50,6 +51,7 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
bridgedma_ctx.crc_ctx.reg_init = 0;
bridgedma_ctx.crc_ctx.table.t32 = enc_tab;
crc_init(&bridgedma_ctx.crc_ctx);
+ slist_init (bridgedma_ctx.bridge.jobs_process., bare);
return &bridgedma_ctx;
}
@@ -364,26 +366,21 @@ phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
dbg_assert (job_last->next == NULL);
/* check current job processing */
- if(ctx->bridge.job_head == NULL)
+ if (slist_empty (ctx->bridge.jobs_process., bare))
{
- /* no more job in queue */
- ctx->bridge.job_head = job_first;
+ slist_push_back_range (
+ ctx->bridge.jobs_process., job_first, job_last, bare);
ctx->job_current = job_first;
- ctx->bridge.job_tail = job_last;
memset(&ctx->status, '\0', sizeof(phy_bridgedma_status_t));
ctx->status.running = true;
}
else
{
- /* there are still job inside */
- dbg_assert(ctx->bridge.job_tail);
- ctx->bridge.job_tail->next = job_first;
- ctx->bridge.job_tail = job_last;
-
+ slist_push_back_range (
+ ctx->bridge.jobs_process., job_first, job_last, bare);
if (!ctx->job_current)
ctx->job_current = job_first;
}
-
phy_bridgedma_process (ctx);
}
@@ -398,16 +395,16 @@ phy_bridgedma_job_t *
phy_bridgedma_jobs_get_ended (phy_bridgedma_t *ctx)
{
dbg_assert (ctx);
- phy_bridgedma_job_t *job_head = ctx->bridge.job_head;
-
+ phy_bridgedma_job_t *job_head =
+ ctx->bridge.jobs_process.head;
if (ctx->job_current && ctx->job_current->next)
{
phy_bridgedma_job_t *tmp = ctx->job_current->next;
ctx->job_current->next = NULL;
- ctx->bridge.job_head = ctx->job_current = tmp;
+ ctx->bridge.jobs_process.head = ctx->job_current = tmp;
}
else
- ctx->bridge.job_head = ctx->bridge.job_tail = NULL;
+ slist_init (ctx->bridge.jobs_process., bare);
return job_head;
}
diff --git a/cesar/hal/phy/src/bridgedma.c b/cesar/hal/phy/src/bridgedma.c
index 1c95b9db06..67dcd285c7 100644
--- a/cesar/hal/phy/src/bridgedma.c
+++ b/cesar/hal/phy/src/bridgedma.c
@@ -61,13 +61,10 @@ phy_bridgedma_start_jobs_pending (phy_bridgedma_t *ctx)
(u32)ctx->jobs_pending.tail);
arch_write_buffer_flush ();
phy_bridge_dma_start__configure (ctx, ctx->jobs_pending.head);
- /* Bridge DMA head is not null, chain the list to the
- tail. */
- if (ctx->bridge.job_head)
- ctx->bridge.job_tail->next = ctx->jobs_pending.head;
- else
- ctx->bridge.job_head = ctx->jobs_pending.head;
- ctx->bridge.job_tail = ctx->jobs_pending.tail;
+ slist_push_back_range (ctx->bridge.jobs_process.,
+ ctx->jobs_pending.head,
+ ctx->jobs_pending.tail,
+ bare);
slist_init (ctx->jobs_pending., bare);
}
@@ -173,7 +170,7 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
cyg_interrupt_acknowledge(PHY_BRIDGEDMA_END_INTERRUPT);
cyg_interrupt_unmask(PHY_BRIDGEDMA_END_INTERRUPT);
}
-
+ slist_init (phy_bridgedma_global.bridge.jobs_process., bare);
slist_init (phy_bridgedma_global.jobs_pending., bare);
return &phy_bridgedma_global;
}
@@ -226,15 +223,15 @@ phy_bridgedma_job_t *
phy_bridgedma_jobs_get_ended (phy_bridgedma_t *ctx)
{
dbg_assert (ctx);
- phy_bridgedma_job_t *job_head = ctx->bridge.job_head;
+ phy_bridgedma_job_t *job_head = ctx->bridge.jobs_process.head;
if (job_head)
{
/* Bridgedma is not running. */
if (!_phy_bridgedma_status (ctx))
{
- ctx->bridge.job_tail->next = NULL;
- ctx->bridge.job_head = ctx->bridge.job_tail = NULL;
+ ctx->bridge.jobs_process.tail->next = NULL;
+ slist_init (phy_bridgedma_global.bridge.jobs_process., bare);
}
else
{
@@ -251,15 +248,16 @@ phy_bridgedma_jobs_get_ended (phy_bridgedma_t *ctx)
{
if ((u32) job_current->next ==
PHY_BRGDMA_SPC_ADDRESS((u32)job_current))
- ctx->bridge.job_head = ctx->bridge.job_tail = NULL;
+ slist_init (
+ phy_bridgedma_global.bridge.jobs_process., bare);
else
- ctx->bridge.job_head = job_current->next;
+ ctx->bridge.jobs_process.head = job_current->next;
job_current->next = NULL;
}
else
{
- ctx->bridge.job_tail->next = NULL;
- ctx->bridge.job_head = ctx->bridge.job_tail = NULL;
+ ctx->bridge.jobs_process.tail->next = NULL;
+ slist_init (phy_bridgedma_global.bridge.jobs_process., bare);
}
}
diff --git a/cesar/mac/sar/test/unit_test/ecos/src/activate.c b/cesar/mac/sar/test/unit_test/ecos/src/activate.c
index 779605214d..ccfa3e4576 100644
--- a/cesar/mac/sar/test/unit_test/ecos/src/activate.c
+++ b/cesar/mac/sar/test/unit_test/ecos/src/activate.c
@@ -111,8 +111,8 @@ test_case__sar_activate (test_t test)
t.sar->bridgedma_ctx->job_current =
(phy_bridgedma_job_t *) PHY_BRGDMA_SPC_ADDRESS ((u32)
&jobs[2]->job);
- t.sar->bridgedma_ctx->bridge.job_head = &jobs[0]->job;
- t.sar->bridgedma_ctx->bridge.job_tail = &jobs[2]->job;
+ t.sar->bridgedma_ctx->bridge.jobs_process.head = &jobs[0]->job;
+ t.sar->bridgedma_ctx->bridge.jobs_process.tail = &jobs[2]->job;
t.sar->bridgedma_ctx->job_current = &jobs[2]->job;
memset (&t.rea_done, 0, sizeof (struct
sar_test_reassembly_complete_t));