summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/src/bridgedma.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/hal/phy/src/bridgedma.c')
-rw-r--r--cesar/hal/phy/src/bridgedma.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/cesar/hal/phy/src/bridgedma.c b/cesar/hal/phy/src/bridgedma.c
index 45d055ee98..3abc0f24ff 100644
--- a/cesar/hal/phy/src/bridgedma.c
+++ b/cesar/hal/phy/src/bridgedma.c
@@ -45,8 +45,8 @@ _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
running = BF_GET (PHY_BRIDGEDMA_STATUS_ERROR__RUNNING,
PHY_BDGDMA_STATUS_ERROR);
- if((*bridgedma_ctx->bridgedma_cb)(bridgedma_ctx->user_data,
- running))
+ if((*bridgedma_ctx->bridge.bridgedma_cb)
+ (bridgedma_ctx->bridge.user_data, running))
return CYG_ISR_CALL_DSR; // Cause DSR to be run
else
{
@@ -61,21 +61,15 @@ _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
* \param data the user data.
*/
static void
-_bridgedma_ecos_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
+_bridgedma_ecos_dsr(cyg_vector_t vector, cyg_ucount32 count,
+ cyg_addrword_t data)
{
/* nothing to do except calling the phy dsr */
phy_bridgedma_t *bridgedma_ctx;
bridgedma_ctx = (phy_bridgedma_t *)data;
- (*bridgedma_ctx->deferred_cb)(bridgedma_ctx->user_data);
+ (*bridgedma_ctx->bridge.deferred_cb)(bridgedma_ctx->bridge.user_data);
}
-/**
- * Initialise the Bridge DMA.
- * \param user_data User data passed to any callback
- * \param bridgedma_cb Bridge DMA interrupt callback
- * \param deferred_cb DSR callback
- * \return the newly created context
- */
phy_bridgedma_t *
phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
phy_deferred_cb_t deferred_cb)
@@ -85,9 +79,9 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
memset (&phy_bridgedma_global, 0, sizeof (phy_bridgedma_t));
- phy_bridgedma_global.user_data = user_data;
- phy_bridgedma_global.bridgedma_cb = bridgedma_cb;
- phy_bridgedma_global.deferred_cb = deferred_cb;
+ phy_bridgedma_global.bridge.user_data = user_data;
+ phy_bridgedma_global.bridge.bridgedma_cb = bridgedma_cb;
+ phy_bridgedma_global.bridge.deferred_cb = deferred_cb;
/* Reset bridge DMA. */
PHY_RB_RST_MODULE = BF_SET (PHY_RB_RST_MODULE,
@@ -113,10 +107,6 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
return &phy_bridgedma_global;
}
-/**
- * Reset and uninitialise the Bridge DMA.
- * \param ctx Bridge DMA context
- */
void
phy_bridgedma_uninit (phy_bridgedma_t *ctx)
{
@@ -146,16 +136,6 @@ phy_bridge_dma_start__configure (phy_bridgedma_t *ctx,
true);
}
-/**
- * Enqueue and start a list of jobs.
- * \param ctx Bridge DMA context
- * \param job_first first job to enqueue
- * \param job_last last job to enqueue
- *
- * The new jobs are added to the Bridge DMA queue and the Bridge DMA is
- * restarted if it was stopped. The \c last flag must be set in the last
- * enqueued job.
- */
void
phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
phy_bridgedma_job_t *job_last)
@@ -176,13 +156,13 @@ phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
}
else
{
- ctx->job_last->next = job_first;
+ ctx->bridge.job_tail->next = job_first;
arch_reorder_barrier ();
- ctx->job_last->last = false;
+ ctx->bridge.job_tail->last = false;
arch_write_buffer_flush ();
/* if last_job is loaded before last has been written. */
- if (PHY_BDGDMA_CURRENT_JOBD_PTR == (u32) ctx->job_last
+ if (PHY_BDGDMA_CURRENT_JOBD_PTR == (u32) ctx->bridge.job_tail
&& BF_GET (PHY_BRIDGEDMA_JOB_CONF__LAST,
PHY_BDGDMA_JOB_CONF))
{
@@ -190,18 +170,9 @@ phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
}
}
- ctx->job_last = job_last;
+ ctx->bridge.job_tail = job_last;
}
-/**
- * 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.
- */
phy_bridgedma_job_t *
phy_bridgedma_current_job (phy_bridgedma_t *ctx)
{