summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/src/bridgedma.c
diff options
context:
space:
mode:
authorlaranjeiro2009-11-27 08:50:39 +0000
committerlaranjeiro2009-11-27 08:50:39 +0000
commit55aefc1cee1a4ba6e70d3b5e94a4b501f7618972 (patch)
treee68a2ca92f87fb8cefb2ff0a9bb8b5d74e9aabe9 /cesar/hal/phy/src/bridgedma.c
parent2a28ff86b35c1df6eff993de6ff44f1efdfe87ff (diff)
cesar/hal/phy: used the register access file from the hardware base
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6490 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/hal/phy/src/bridgedma.c')
-rw-r--r--cesar/hal/phy/src/bridgedma.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/cesar/hal/phy/src/bridgedma.c b/cesar/hal/phy/src/bridgedma.c
index 58badc5fe4..78b31263f8 100644
--- a/cesar/hal/phy/src/bridgedma.c
+++ b/cesar/hal/phy/src/bridgedma.c
@@ -33,8 +33,6 @@ static phy_bridgedma_t phy_bridgedma_global;
static cyg_uint32
_bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
{
- volatile u32* job_current = (u32 *) PHY_BRIDGEDMA_CURR_JOBD_PTR;
- volatile u32 *control = (u32*) PHY_BRIDGEDMA_CONTROL;
/* nothing to do except calling the bridgedma callback */
phy_bridgedma_t *bridgedma_ctx;
@@ -45,12 +43,14 @@ _bridgedma_ecos_isr(cyg_vector_t vector, cyg_addrword_t data)
bridgedma_ctx = (phy_bridgedma_t *)data;
/* If the bridge DMA is not running. */
- if (!((phy_bridgedma_ctrl_t *) control)->start)
+ if (!BF_GET (PHY_BRIDGEDMA_STATUS_ERROR__RUNNING,
+ PHY_BDGDMA_STATUS_ERROR))
bridgedma_ctx->job_first = NULL;
/* Remove the head of the bridgedma list. */
arch_write_buffer_flush ();
- bridgedma_ctx->job_current = (phy_bridgedma_job_t *) *job_current;
+ bridgedma_ctx->job_current =
+ (phy_bridgedma_job_t *) PHY_BDGDMA_CURRENT_JOBD_PTR;
if((*bridgedma_ctx->bridgedma_cb)(bridgedma_ctx->user_data,
*((u32 *)((void *)&bridgedma_ctx->status))))
@@ -121,15 +121,14 @@ phy_bridgedma_init (void *user_data, phy_bridgedma_cb_t bridgedma_cb,
void
phy_bridgedma_uninit (phy_bridgedma_t *ctx)
{
- volatile u32 *control;
dbg_assert (ctx);
- control = (u32 *)PHY_BRIDGEDMA_CONTROL;
-
// Set the current job as the last one.
- ctx->job_first->last = true;
+ if (ctx->job_first)
+ ctx->job_first->last = true;
- while (((phy_bridgedma_ctrl_t *)control)->start);
+ while ((!BF_GET (PHY_BRIDGEDMA_STATUS_ERROR__RUNNING,
+ PHY_BDGDMA_STATUS_ERROR)));
}
/**
@@ -146,49 +145,46 @@ void
phy_bridgedma_start (phy_bridgedma_t *ctx, phy_bridgedma_job_t *job_first,
phy_bridgedma_job_t *job_last)
{
- volatile u32 *control = (u32*) PHY_BRIDGEDMA_CONTROL;
-
dbg_assert (ctx);
dbg_assert (job_first);
dbg_assert (job_last);
/* Bridge context is empty. */
if ((ctx->job_first == NULL)
- && (!((phy_bridgedma_ctrl_t *) control)->start))
+ && (!BF_GET (PHY_BRIDGEDMA_STATUS_ERROR__RUNNING,
+ PHY_BDGDMA_STATUS_ERROR)))
{
- volatile u32 *job_desc = (u32*) PHY_BRIDGEDMA_JOBD_PTR;
-
ctx->job_first = job_first;
ctx->job_last = job_last;
/* Set the last bit to true in the last job. */
job_last->last = true;
- /* Set the address to the bridgedma. */
arch_write_buffer_flush ();
- *job_desc = (u32) job_first;
+ /* Set the address to the bridgedma. */
+ PHY_BDGDMA_FIRST_JOBD_PTR = (u32) job_first;
/* Start the bridgedma. */
- ((phy_bridgedma_ctrl_t *) control)->start = true;
+ PHY_BDGDMA_CONTROL_CONFIG = BF_SET (PHY_BDGDMA_CONTROL_CONFIG,
+ PHY_BRIDGEDMA_CONTROL__START,
+ true);
}
else
{
- volatile u32 *job_config = (u32*) PHY_BRIDGEDMA_JOB_CONF;
-
ctx->job_last->last = false;
ctx->job_last->next = job_first;
job_last->last = true;
arch_write_buffer_flush ();
/* last_job is loaded, but transfer will stop or is stopped. */
- if (BF_GET (PHY_BRIDGEDMA_JOB_CONF__LAST, *job_config))
+ if (BF_GET (PHY_BRIDGEDMA_JOB_CONF__LAST, PHY_BDGDMA_JOB_CONF))
{
- volatile u32* first_job_desc = (u32 *)PHY_BRIDGEDMA_JOBD_PTR;
-
arch_write_buffer_flush ();
- *first_job_desc = (u32) job_first;
+ PHY_BDGDMA_FIRST_JOBD_PTR = (u32) job_first;
/* Start the bridgedma. */
- ((phy_bridgedma_ctrl_t *) control)->start = true;
+ PHY_BDGDMA_CONTROL_CONFIG = BF_SET (PHY_BDGDMA_CONTROL_CONFIG,
+ PHY_BRIDGEDMA_CONTROL__START,
+ true);
}
}
}
@@ -213,6 +209,6 @@ phy_bridgedma_current_job (phy_bridgedma_t *ctx)
bool
phy_bridgedma_status (phy_bridgedma_t *ctx)
{
- volatile u32 *control = (u32*) PHY_BRIDGEDMA_STATUS_ERROR;
- return (*control & 0x1);
+ return BF_GET (PHY_BRIDGEDMA_STATUS_ERROR__RUNNING,
+ PHY_BDGDMA_STATUS_ERROR);
}