#ifndef _V1495_REGISTERS_H_ #define _V1495_REGISTERS_H_ #include #include #include #include #ifdef VXWORKS #include #include #include #endif #ifdef Linux_vme #include "jvme.h" #endif #include #define v1495_OK ( 0) #define v1495_ERROR (-1) // Last byte used by the Configuration ROM on the V1445 #define V1495_BOARD_SIZE (0x81FF) #if defined VXWORKS #define V1495_ADDRESS_TYPE atVMEA32 #elif defined Linux_vme //#define V1495_ADDRESS_TYPE (0x09) //#define V1495_ADDRESS_TYPE (0x39) #define V1495_ADDRESS_TYPE (GEF_VME_ADDR_MOD_A32UD) //#define V1495_ADDRESS_TYPE (GEF_VME_ADDR_MOD_A32UB) #else #define V1495_ADDRESS_TYPE (VME_AM_EXT_SUP_DATA) #endif /* Register Addresses Map for the V1495 board by CAEN. */ /* From Technical Information Manual for V1495, Rev. #13 */ typedef volatile struct { epicsUInt8 user_fpga_blt[0x1000-0x0000]; /* 0x0000 USER FPGA Block Transfer */ epicsUInt8 user_fpga_acc[0x8000-0x1000]; /* 0x1000 USER FPGA Access */ epicsUInt16 reserved[4]; /* 0x8000 Reserved addresses */ epicsUInt16 geo_addr; /* 0x8008 Geo Address Register */ epicsUInt16 module_reset; /* 0x800A Module Reset */ epicsUInt16 fw_revision; /* 0x800C Firmware revision */ epicsUInt16 select_vme_flash; /* 0x800E Select VME FPGA Flash */ epicsUInt16 vme_fpga_flash; /* 0x8010 VME FPGA Flash Memory */ epicsUInt16 select_user_flash; /* 0x8012 Select User FPGA Flash */ epicsUInt16 user_fpga_flash; /* 0x8014 User FPGA Flash Memory */ epicsUInt16 user_fpga_config; /* 0x8016 User FPGA Config */ epicsUInt16 scratch_16; /* 0x8018 Scratch 16 */ epicsUInt32 scratch_32; /* 0x8020 Scratch 32 */ } V1495_REGS; /* Basic function declarations */ /* In the functions below bease address is the VME base addresof the board */ /* not the local address */ epicsUInt32 v1495_read_reg32 ( volatile unsigned int* addr ); void v1495_write_reg32( volatile unsigned int* addr, epicsUInt32 val ); epicsUInt16 v1495_read_reg16 ( volatile unsigned int* addr ); void v1495_write_reg16( volatile unsigned int* addr, epicsUInt16 val ); epicsInt8 v1495_get_geo_address ( char* baseAddr, epicsUInt16* val ); /* Return geo address */ epicsInt8 v1495_get_fw_revision ( char* baseAddr, epicsUInt16* val ); /* Return Firmware revision */ epicsInt8 v1495_get_scratch16 ( char* baseAddr, epicsUInt16* val ); /* Return sratch16 register */ epicsInt8 v1495_get_scratch32 ( char* baseAddr, epicsUInt32* val ); /* Return sratch32 register */ epicsInt8 v1495_reset_module ( char* baseAddr ); /* Module reset */ epicsInt8 v1495_set_scratch16 ( char* baseAddr, epicsUInt16 val ); /* Set sratch16 register */ epicsInt8 v1495_set_scratch32 ( char* baseAddr, epicsUInt32 val ); /* Set sratch32 register */ epicsInt8 v1495_get_regs( char* baseAddr, V1495_REGS** regs ); /* Get the address of the registers */ #endif