SRP Version 0

Incoming Request (to firmware from software)

Word#BITSNameDescriptionNote
0[31:0]TID[31:0]Transaction ID(echoed back)
1[29:0]Address[31:2]Start AddressAlways 32-bit aligned
1[31:30]OP-CodeOperation Code

0x0=Read, 0x1=Write,

0x2=Set, 0x3=Clear

2[31:0]WriteData[31:0] or ReadCount[8:0]First Write or Read request counterUp to 2^9 words per transactions
............ 
N-1[31:0]WriteData[31:0]Last Write 
N[31:0]Don't CareDon't Care 

Outgoing Response (from firmware to software)

Word#BITSNameDescriptionNote
0[31:0]TID[31:0]Transaction ID(echoed back)
1[29:0]Address[31:2]Start AddressAlways 32-bit aligned
1[31:30]OP-CodeOperation Code

0x0=Read, 0x1=Write,

0x2=Set, 0x3=Clear

2[31:0]WriteData[31:0] or ReadData[31:0]First Write or First Read 
............ 
N-1[31:0]WriteData[31:0] or ReadData[31:0]Last  Write or Last Read 
N[0]Fail FlagRegister transaction Error(response data)
N[1]Timeout FlagTimeout Error(response data)
N[31:2]ReservedReserved (0x0)Reserved for Future Use

Note: "set" and "clear" were defined but never implemented in the software and firmware.

 


Example Code

Register Read

uint32_t txData[4];
uint32_t rxData[4];

txData[0] = 0xa5a5a5a5; // Context data which is echoed back

txData[1] = 0x00000001; // Read from register 0x4

txData[1] |= 0x00000000; // Opcode is zero for read

txData[2] = 0x00000000; // Read count = 0 for a single location read

txData[3] = 0x00000000; // Final word is ignored

//Send the data, PGP example show (lane=0, vc=0)

pgpcard_send(fd, txData, 4, 0, 0);

// Wait for response (probably should use select call), 

while (pgpcard_recv(fd,rxData,4,&lane,&vc,&eofe,&fifoErr,&lengthErr) == 0) usleep(10);

// Check for timeout or fail

uint32_t regError = rxData[3];

// Extract read data:

uint32_t readData = rxData[2];

Register Write

uint32_t txData[4];
uint32_t rxData[4];
txData[0] = 0xa5a5a5a5; // Context data which is echoed back
txData[1] = 0x00000001; // Write to register 0x4
txData[1] |= 0x40000000; // Opcode is 1 for write
txData[2] = 0xdeadbeef; // Write data
txData[3] = 0x00000000; // Final word is ignored
//Send the data, PGP example show (lane=0, vc=0)
pgpcard_send(fd, txData, 4, 0, 0);
// Wait for response (probably should use select call), 
while (pgpcard_recv(fd,rxData,4,&lane,&vc,&eofe,&fifoErr,&lengthErr) == 0) usleep(10);
// Check for timeout or fail
uint32_t regError = rxData[3];

 

Contact

Ben Reese

bareese@slac.stanford.edu

 

  • No labels