From 2d43f2df66e4fc29ec123ab6197908c5bfadbe2f Mon Sep 17 00:00:00 2001 From: Christian Mauderer Date: Thu, 29 Mar 2012 10:58:37 +0200 Subject: bsp/mpc55xx: Support re-initialization of eDMA --- c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c') diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c b/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c index cedcb60501..32e598fe20 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/edma/edma.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -25,7 +25,6 @@ #include #include -#include #include @@ -65,7 +64,7 @@ static uint32_t edma_channel_occupation [EDMA_GROUP_COUNT]; static RTEMS_CHAIN_DEFINE_EMPTY(edma_channel_chain); -volatile struct EDMA_tag *edma_get_regs_by_channel(unsigned channel) +static volatile struct EDMA_tag *edma_get_regs_by_channel(unsigned channel) { #if EDMA_MODULE_COUNT == 1 return &EDMA; @@ -76,7 +75,7 @@ volatile struct EDMA_tag *edma_get_regs_by_channel(unsigned channel) #endif } -volatile struct EDMA_tag *edma_get_regs_by_module(unsigned module) +static volatile struct EDMA_tag *edma_get_regs_by_module(unsigned module) { #if EDMA_MODULE_COUNT == 1 return &EDMA; @@ -211,15 +210,30 @@ void mpc55xx_edma_init(void) channel_remaining -= channel_count; + /* Disable requests */ + edma->CERQR.B.CERQ = 0x40; + /* Arbitration mode: group round robin, channel fixed */ edma->CR.B.ERGA = 1; edma->CR.B.ERCA = 0; for (channel = 0; channel < channel_count; ++channel) { + volatile struct tcd_t *tcd = &edma->TCD [channel]; edma->CPR [channel].R = 0x80U | (channel & 0xfU); + + /* Initialize TCD, stop channel first */ + tcd->BMF.R = 0; + tcd->SADDR = 0; + tcd->SDF.R = 0; + tcd->NBYTES = 0; + tcd->SLAST = 0; + tcd->DADDR = 0; + tcd->CDF.R = 0; + tcd->DLAST_SGA = 0; } - /* Clear TCDs */ - memset((void *) &edma->TCD [0], 0, channel_count * sizeof(edma->TCD [0])); + /* Clear interrupt requests */ + edma->CIRQR.B.CINT = 0x40; + edma->CER.B.CERR = 0x40; } for (group = 0; group < EDMA_GROUP_COUNT; ++group) { -- cgit v1.2.3