00001 /************************************************************************************ 00002 * writeRegisterDirect 00003 * 00004 * synopsis: Function to write a register field. This routine does not care about 00005 * the old value of the register, anything not included in the field 00006 * will be zeroed out in the new value. The routine is intended for quicker access 00007 * to the FPGA registers in critical code sections (accesses to the FPGA registers 00008 * take approximately 1 micro-second apiece.) The inlined routine does nothing but 00009 * the write (ie. no validity checks or confirmation). 00010 * 00011 * arguments: 00012 * IN: id = the index of the rodRegister[] element to write. 00013 * width = width of field to write. 00014 * offset = LSB of field being written. 00015 * value = the value to write to from rodRegister['id'] 00016 ************************************************************************************/ 00017 #ifndef ACCESS_REGISTER_H 00018 #define ACCESS_REGISTER_H 00019 #include "simulation.h" 00020 #include "macros.h" 00021 00022 /* The RodReg structure contains addresses for every FPGA register which has an ID. 00023 These are defined in registerIndices.h */ 00024 typedef struct RodReg { 00025 UINT32 *address; 00026 } RodReg; 00027 extern far RodReg rodRegister[]; 00028 00029 static inline INT32 writeRegisterDirect(UINT32 id, UINT32 width, UINT32 offset, 00030 UINT32 value); 00031 00032 static inline INT32 writeRegisterDirect(UINT32 id, UINT32 width, UINT32 offset, 00033 UINT32 value) { 00034 INT32 returnCode= SUCCESS; 00035 00036 *rodRegister[id].address= (FIELD_VAL(offset,width,value)); 00037 00038 //simFpgaWriteM(id, width, offset, value); //Simulation: Check access 00039 return returnCode; 00040 } 00041 #endif