//Setup PR Reg. for Modulo N Counter to 0x123456
outp(XDATA(Addr),0x56); //Least significant Byte first
outp(XDATA(Addr),0x34); //then middle byte
outp(XDATA(Addr),0x12); //then most significant byte
//Enable Counters
outp(XCMD(Addr),IOR(EnAB));
}
/* Write_7266_PR
Input: Addr has Address of 7266 counter.
Data: has 24 bit data to be written to PR register
*/
void Write_7266_PR(int Addr,unsigned long Data);
void Write_7266_PR(int Addr,unsigned long Data)
{
outp(XCMD(Addr),RLD(Rst_BP));
//Reset Byte Pointer to Synchronize Byte Writing
outp(XDATA(Addr),(unsigned char)Data);
Data >>= 8;
outp (XDATA(Addr),(unsigned char)Data);
Data >>= 8;
outp(XDATA(Addr),(unsigned char)Data);
}
/* Read_7266_OL
Input: Addr has Address of 7266 counter.
Output: Data returns 24 bit OL register value.
*/
unsigned long Read_7266_OL(int Addr);
unsigned long Read_7266_OL(int Addr)
{ unsigned long Data=0;
outp(XCMD(Addr),(RLD(Rst_BP + Trf_Cntr_OL)); //Reset Byte Pointer to Synchronize Byte reading and
Transferring of data from counters to OL.
Data |=(unsigned long)inp(XDATA(Addr));
//read byte 0 from OL
lrotr(Data,8);
//Rotate for next Byte
Data |=(unsigned long)inp(XDATA(Addr));
//read byte 1 from OL
lrotr(Data,8);
//Rotate for next Byte
Data |=(unsigned long)inp(XDATA(Addr)); //read byte 2 from OL
lrotr(Data,16);
//Rotate for last Byte
return(Data);
}
/* Get_7266_Flags
Input: Addr has Address of 7266 counter.
returns Flags of counter
*/
unsigned char Get_7266_Flags(int Addr);
unsigned char Get_7266_Flags(int Addr)
{
return(inp(XCMD(Addr)));
}
7266R1-011598-14