Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

SATA problem with TIMER!

$
0
0

Platform: OMAPL138

DSP side (DSP/BIOS): I used EDMA to transfer data via EMIFA, so i needed to init the TIMER by called "uint32_t USTIMER_init(void)",if not, the program would run in an error.

ARM side (Linux): However, after DSPside used this function--"used USTIMER_init", i can't dismount the SATA disk by called "system("umount /mnt/disk")". So,I can't save the data. I don't know haw to configer this TIMER module.


======================= USTIMER_init(void)====================================
//-----------------------------------------------------------------------------
// \brief initialize the microsecond timer.
//
// \param none.
//
// \return uint32_t
// ERR_NO_ERROR - everything is ok...us timer ready to use.
// ERR_INIT_FAIL - something happened during initialization.
//-----------------------------------------------------------------------------
uint32_t USTIMER_init(void)
{
// configure timer 0 for free run.
// 32-bit unchained mode, timer3:4 /12 prescaler.

// enable muxed pins as gpio outputs and disable all related interrupts.
// would need to also setup the pinmux register to select the gpio
// function of these pins in order to use as gpio.
TMR0->GPINT_GPEN = GPENO12 | GPENI12;
TMR0->GPDATA_GPDIR = GPDIRO12 | GPDIRI12;

// stop and reset timer.
TMR0->TGCR = 0x00000000;
TMR0->TCR = 0x00000000;

// disable interrupts and set emulation to free run.
TMR0->INTCTLSTAT = 0;
SETBIT(TMR0->EMUMGT, SOFT | FREE);

// config timer0 in 32-bit unchained mode.
// remove timer0 - 3:4 from reset.
SETBIT(TMR0->TGCR, PRESCALER(TIMER_DIV - 1) | TIMMODE_32BIT_UNCHAINED | TIM34RS );

// init timer0 - 1:2 period....use full range of counter.
TMR0->TIM34 = 0x00000000;
TMR0->PRD34 = 0xFFFFFFFF;

// start timer0 - 3:4.
SETBIT(TMR0->TCR, ENAMODE34_CONT);

// configure timer 1 for start/stop.
// 32-bit unchained mode, timer3:4 /12 prescaler.

// enable muxed pins as gpio outputs and disable all related interrupts.
// would need to also setup the pinmux register to select the gpio
// function of these pins in order to use as gpio.
TMR1->GPINT_GPEN = GPENO12 | GPENI12;
TMR1->GPDATA_GPDIR = GPDIRO12 | GPDIRI12;

// stop and reset timer.
TMR1->TGCR = 0x00000000;
TMR1->TCR = 0x00000000;

// disable interrupts and set emulation to free run.
TMR1->INTCTLSTAT = 0;
SETBIT(TMR1->EMUMGT, SOFT | FREE);

// config timer1 in 32-bit unchained mode.
SETBIT(TMR1->TGCR, PRESCALER(TIMER_DIV - 1) | TIMMODE_32BIT_UNCHAINED);

// init timer1 - 3:4 period....0 until someone calls delay().
TMR1->TIM34 = 0x00000000;
TMR1->PRD34 = 0x00000000;

return (ERR_NO_ERROR);
}


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>