User guide

CIF Peripheral Model - SimpleTimer
CoMET Version 5.9 – Tutorial 111
Data = IP->regTIFR;
#ifdef _DEBUG
AmpiStreamPrintf(DEBUG_MSG,
"%s: Read data %#06x from TIFR\n",IP->pModulePathName,Data);
#endif
break;
case MTR1_OFFSET:
Data = IP->regMTR[MATCH1_IX];
#ifdef _DEBUG
AmpiStreamPrintf(DEBUG_MSG,
"%s: Read data %#06x from MTR1\n",IP->pModulePathName,Data);
#endif
break;
case MTR2_OFFSET:
Data = IP->regMTR[MATCH2_IX];
#ifdef _DEBUG
AmpiStreamPrintf(DEBUG_MSG,
"%s: Read data %#06x from MTR2\n",IP->pModulePathName,Data);
#endif
break;
default:
if (!Untimed)
AmpiStreamPrintf(WARNING_MSG, "%s: Attempt to read from an
undefined register location 0x%lX\n", IP->pModulePathName, Address);
/*
** Unknown register, just return a default value of 0.
*/
Data = 0;
break;
}
CODE ENDS
Modifying the WriteRegister Function - Respond to Register Writes
The WriteRegister function begins with a comment and statement similar to the following:
/**
** Function:
** void WriteRegister(tInstanceData *IP, const tWord32
Address, const tWord32 Data)
**
** Description:
** Writes a device register. This function assumes that
all the registers are
** aligned to a 4-byte boundary.
**
** Parameters:
** Address
** The address of the register.
** Data
** The data to be written.
**
** Returns:
** Nothing.
*/
static void WriteRegister(tInstanceData *IP, const tWord32 Address,
const tWord32 Data)