/************************************************************************************ * writeRegisterDirect * * synopsis: Function to write a register field. This routine does not care about * the old value of the register, anything not included in the field * will be zeroed out in the new value. The routine is intended for quicker access * to the FPGA registers in critical code sections (accesses to the FPGA registers * take approximately 1 micro-second apiece.) The inlined routine does nothing but * the write (ie. no validity checks or confirmation). * * arguments: * IN: id = the index of the rodRegister[] element to write. * width = width of field to write. * offset = LSB of field being written. * value = the value to write to from rodRegister['id'] ************************************************************************************/ #ifndef ACCESS_REGISTER_H #define ACCESS_REGISTER_H #include "simulation.h" #include "macros.h" /* The RodReg structure contains addresses for every FPGA register which has an ID. These are defined in registerIndices.h */ typedef struct RodReg { UINT32 *address; } RodReg; extern far RodReg rodRegister[]; static inline INT32 writeRegisterDirect(UINT32 id, UINT32 width, UINT32 offset, UINT32 value); static inline INT32 writeRegisterDirect(UINT32 id, UINT32 width, UINT32 offset, UINT32 value) { INT32 returnCode= SUCCESS; *rodRegister[id].address= (FIELD_VAL(offset,width,value)); //simFpgaWriteM(id, width, offset, value); //Simulation: Check access return returnCode; } #endif