View Single Post
  #455 (permalink)  
Old 25th Oct 2009, 11:04 am
AleMaxx AleMaxx is offline
Member
Keen on MPx players
 
Join Date: Sep 2007
Posts: 68
Default

Hi, glad you guys returned from that kinda off-topic discussion :-).
I would translate the above to:
Code:
#define APB0_SCU_BASE	0x1801C000 // declared in hw_memmap.h
#define SCU_CLKCFG		(SCU_BASE + 0x0018)

void _I2S_EnableClock(uint32_t param)
{
	uint32_t clkcfg;
	
	clkcfg = read_reg32(SCU_CLKCFG);
	clkcfg &= ~(1 << param);			// clears the param-th bit
	write_reg32(SCU_CLKCFG, clkcfg);
}

void I2S_PowerOnInit()
{
	int i;

	_I2S_EnableClock(16);
	_I2S_EnableClock(17);
	for (i=0; i<100; i++);		// kinda: wait / count to 100
	Intr_Disable(16);
	
	// ...
}
Although it currently looks to me as if the 1st I2S_PowerOnInit does the same except that the _I2S_EnableClock is indeed 'inline' and the shift is therefore done by the compiler (1<<16 = 0x10000).

Last edited by AleMaxx; 25th Oct 2009 at 11:08 am.
Reply With Quote