#include "common.h" /* include peripheral declarations */
#define printf print_str

void i2c_reg(void);
void run_test(void);


void i2c_reg(void) 
{
	volatile unsigned char* pReg;
	unsigned char i,j;
	
	printf("I2C Register Reset Value:\rn");
	
	SIM_SCGC1 |= 0xF0; // enable I2C clock gate 
	/* Reset value */
	for(i=0;i<4;i++)
	{
		pReg = &I2C0_A1 + 0x10*i;
		for(j=0;j<12;j++)
		{
			printf("@0x%08x = 0x%02x\r\n", pReg, *pReg);
			pReg ++;
		}
	}
	
	printf("I2C Reg Access Test:\r\n");
	for(i=0;i<4;i++)
	{
		pReg = &I2C0_A1 + 0x10*i;
		for(j=0;j<12;j++)
		{
			*pReg = 0xFF;
			printf("@0x%08x = 0x%02x\r\n", pReg, *pReg);
			
			*pReg = 0x00;
			printf("@0x%08x = 0x%02x\r\n", pReg, *pReg);			
			pReg ++;
		}
	}	
	
}

void run_test(void)
{
	/* This function will call the testcase function */
	i2c_reg();
}

