summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/src/bridgedma.c
diff options
context:
space:
mode:
authorlaranjeiro2009-12-14 10:05:07 +0000
committerlaranjeiro2009-12-14 10:05:07 +0000
commitb535fdf0a9049de7bf456d85f2b331aebaadfeba (patch)
tree9dc7fe92f55b15df75e80f7183421c17f327b68f /cesar/hal/phy/src/bridgedma.c
parent8297b0919aab51e07d35a46f8feda481c74502fa (diff)
cesar/{hal/phy,mac/sar}: move bridge DMA job list to the bridge, closes #852
* hal/phy/bridgedma: * add the job list. * provide an interface to get all the ended jobs. * mac/sar: * remove bridge_dma_jobs list * use the new function of the bridge DMA to get ended jobs. * fix unit tests. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6544 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/hal/phy/src/bridgedma.c')
-rw-r--r--cesar/hal/phy/src/bridgedma.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/cesar/hal/phy/src/bridgedma.c b/cesar/hal/phy/src/bridgedma.c
index 3abc0f24ff..6bf4b6e059 100644
--- a/cesar/hal/phy/src/bridgedma.c
+++ b/cesar/hal/phy/src/bridgedma.c
@@ -143,6 +143,7 @@ phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
dbg_assert (ctx);
dbg_assert (job_first);
dbg_assert (job_last);
+ dbg_assert (job_last->next == NULL);
/* Set the last bit to true in the last job. */
job_last->last = true;
@@ -170,10 +171,21 @@ phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
}
}
+ if (!ctx->bridge.job_head)
+ ctx->bridge.job_head = job_first;
ctx->bridge.job_tail = job_last;
}
-phy_bridgedma_job_t *
+/**
+ * Get the current job descriptor from the bridgedma.
+ * \param ctx the Bridge DMA context.
+ * \return the address of the current job descriptor beeing processed by the
+ * bridge DMA.
+ *
+ * It corresponds to the current job which is being processed by the
+ * bridgedma when the Interruption arrived.
+ */
+static inline phy_bridgedma_job_t *
phy_bridgedma_current_job (phy_bridgedma_t *ctx)
{
dbg_assert (ctx);
@@ -187,3 +199,34 @@ phy_bridgedma_status (phy_bridgedma_t *ctx)
return BF_GET (PHY_BRIDGEDMA_STATUS_ERROR__RUNNING,
PHY_BDGDMA_STATUS_ERROR);
}
+
+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);
+
+ if (ctx->bridge.job_head)
+ {
+ for (job_current = job_head = ctx->bridge.job_head;
+ job_current
+ && (job_current->next != phy_bridgedma_current_job (ctx)
+ || !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;
+ }
+
+ return NULL;
+}