[PATCH 026/111] GRTM: fixed bug where transmitter start loop was optimized away
Daniel Hellstrom
daniel at gaisler.com
Thu Feb 26 16:38:28 UTC 2015
---
c/src/lib/libbsp/sparc/shared/tmtc/grtm.c | 33 +++++++++++++++--------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c b/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c
index de1df72..49025bc 100644
--- a/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c
+++ b/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c
@@ -761,8 +761,7 @@ static int grtm_start(struct grtm_priv *pDev)
struct grtm_regs *regs = pDev->regs;
int i;
struct grtm_ioc_config *cfg = &pDev->config;
- volatile unsigned int *txrdy_reg;
- unsigned int txrdy_mask;
+ unsigned int txrdy;
/* Clear Descriptors */
memset(pDev->bds,0,0x400);
@@ -818,21 +817,23 @@ static int grtm_start(struct grtm_priv *pDev)
i--;
}
- /* Location of TXRDY Bit is different for different revisions */
- if ( pDev->subrev == 0 ) {
- txrdy_reg = ®s->dma_ctrl;
- txrdy_mask = GRTM_REV0_DMA_CTRL_TXRDY;
- } else {
- txrdy_reg = ®s->dma_status;
- txrdy_mask = GRTM_REV1_DMA_STS_TXRDY;
- }
-
/* Check transmitter startup OK */
- i=0;
- while( !(READ_REG(txrdy_reg) & txrdy_mask) && (i<1000000) ){
- i++;
- }
- if ( !(READ_REG(txrdy_reg) & txrdy_mask) ){
+ i = 1000000;
+ do {
+ /* Location of TXRDY Bit is different for different revisions */
+ if ( pDev->subrev == 0 ) {
+ txrdy = READ_REG(®s->dma_ctrl) &
+ GRTM_REV0_DMA_CTRL_TXRDY;
+ } else {
+ txrdy = READ_REG(®s->dma_status) &
+ GRTM_REV1_DMA_STS_TXRDY;
+ }
+ if (txrdy != 0)
+ break;
+
+ asm volatile ("nop"::);
+ } while ( --i > 0 );
+ if ( i == 0 ) {
/* Reset Failed */
DBG("GRTM: start: Reseting transmitter failed (%d)\n",i);
return RTEMS_IO_ERROR;
--
1.7.0.4
More information about the devel
mailing list