summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/soft
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-05-26 09:33:01 +0200
committerNélio Laranjeiro2011-06-07 11:06:15 +0200
commit8121c5eef6440f1790948d3022e9ab316df7d580 (patch)
treeaf6035a3554a446127e00c51843b37ac7f5c0d46 /cesar/hal/phy/soft
parent3ba440ae3d917ab38ff673f0418d439b93a8d74a (diff)
cesar/hal/phy: use slist to handle jobs processed by BRG DMA, refs #2537
Diffstat (limited to 'cesar/hal/phy/soft')
-rw-r--r--cesar/hal/phy/soft/bridgedma/src/bridgedma.c25
1 files changed, 11 insertions, 14 deletions
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;
}