summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/soft
diff options
context:
space:
mode:
authorlaranjeiro2010-01-26 10:43:26 +0000
committerlaranjeiro2010-01-26 10:43:26 +0000
commitd1ff87059b79353714fa3bcd3178a58b0761628a (patch)
treef70bad3e3c6e6277b3864cd67946122af274b531 /cesar/hal/phy/soft
parent85037849329d128c9e6ee64a3c2cccf931401fa3 (diff)
cesar/hal/phy/bridgedma: avoid bridgedma to loop, closes #863
Old code parsed the job list in the bridgedma to return the chained of ended jobs. Now it wait until the current job is completely processed by the bridgedma and return the head of the list until the current one. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6647 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/hal/phy/soft')
-rw-r--r--cesar/hal/phy/soft/bridgedma/src/bridgedma.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/cesar/hal/phy/soft/bridgedma/src/bridgedma.c b/cesar/hal/phy/soft/bridgedma/src/bridgedma.c
index 3a17237966..5dac1387bb 100644
--- a/cesar/hal/phy/soft/bridgedma/src/bridgedma.c
+++ b/cesar/hal/phy/soft/bridgedma/src/bridgedma.c
@@ -316,13 +316,18 @@ _job_process(phy_bridgedma_t *ctx, phy_bridgedma_job_t *job)
if(ctx->job_current->job_it)
{
+ /** Keeps a reference on the next job to process in the case if the
+ * callbacks change the current job or unchain the current job from
+ * the list. */
+ phy_bridgedma_job_t *job = ctx->job_current->next;
/* Process interruption. */
if (ctx->bridge.bridgedma_cb (ctx->bridge.user_data,
ctx->status.running))
/* simulate a DSR call. */
ctx->bridge.deferred_cb (ctx->bridge.user_data);
+ ctx->job_current = job;
}
- if (ctx->job_current)
+ else
ctx->job_current = ctx->job_current->next;
return true;
@@ -387,32 +392,16 @@ phy_bridgedma_status (phy_bridgedma_t *ctx)
phy_bridgedma_job_t *
phy_bridgedma_jobs_get_ended (phy_bridgedma_t *ctx)
{
- phy_bridgedma_job_t *job_head;
- phy_bridgedma_job_t *job_current;
dbg_assert (ctx);
+ phy_bridgedma_job_t *job_head = ctx->bridge.job_head;
- if (ctx->bridge.job_head
- && (ctx->bridge.job_head != ctx->job_current
- || !phy_bridgedma_status (ctx)))
+ if (ctx->job_current && ctx->job_current->next)
{
- for (job_current = job_head = ctx->bridge.job_head;
- job_current
- && (job_current->next != ctx->job_current
- || !phy_bridgedma_status (ctx));
- job_current = job_current->next);
-
- /* The new bridge DMA head is the next of the current one. */
- if (job_current)
- {
- ctx->bridge.job_head = job_current->next;
- job_current->next = NULL;
- }
- else
- ctx->bridge.job_tail = ctx->bridge.job_head = NULL;
-
- /* Return the list. */
- return job_head;
+ phy_bridgedma_job_t *tmp = ctx->job_current->next;
+ ctx->job_current->next = NULL;
+ ctx->bridge.job_head = ctx->job_current = tmp;
}
-
- return NULL;
+ else
+ ctx->bridge.job_head = ctx->bridge.job_tail = NULL;
+ return job_head;
}