00001 /********************************************************************* 00002 00003 Name: mvmestd.h 00004 Created by: Stefan Ritt 00005 00006 Cotents: MIDAS VME standard routines. Have to be combined 00007 with bt617.c 00008 00009 $Log: mvmestd.h,v $ 00010 Revision 1.6 2003/11/24 08:22:45 midas 00011 Changed timeouts from INT to DWORD, added ignore_timeout to cm_cleanup, adde '-f' flag to ODBEdit 'cleanup' 00012 00013 Revision 1.5 2001/06/27 12:16:30 midas 00014 Added OS_IRIX 00015 00016 Revision 1.4 2001/04/05 05:51:36 midas 00017 Added VME_LM 00018 00019 Revision 1.3 2000/09/28 11:12:15 midas 00020 Added DMA flag to vme_read/vme_write 00021 00022 Revision 1.2 2000/09/26 07:45:19 midas 00023 Added vme_write 00024 00025 Revision 1.1 2000/09/26 07:26:56 midas 00026 Added file 00027 00028 00029 *********************************************************************/ 00030 00031 /**dox***************************************************************/ 00032 /** @file mvmestd.h 00033 The Midas VME include file 00034 */ 00035 00036 /** @defgroup mvmestdinclude Midas VME Standard 00037 */ 00038 /** @defgroup mvmestddefineh VME #define 00039 */ 00040 /** @defgroup mvmestdfunctionh VME Functions (vme_xxx) 00041 */ 00042 00043 /**dox***************************************************************/ 00044 /** @addtogroup mvmestdinclude 00045 * 00046 * @{ */ 00047 00048 /**dox***************************************************************/ 00049 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00050 00051 /*---- replacements if not running under MIDAS ---------------------*/ 00052 00053 #ifndef MIDAS_TYPE_DEFINED 00054 #define MIDAS_TYPE_DEFINED 00055 00056 typedef unsigned short int WORD; 00057 00058 #ifdef __alpha 00059 typedef unsigned int DWORD; 00060 #else 00061 typedef unsigned long int DWORD; 00062 #endif 00063 00064 #define SUCCESS 1 00065 00066 #endif /* MIDAS_TYPE_DEFINED */ 00067 00068 /* make functions under WinNT dll exportable */ 00069 #if defined(_MSC_VER) && defined(MIDAS_DLL) 00070 #define EXPRT __declspec(dllexport) 00071 #else 00072 #define EXPRT 00073 #endif 00074 00075 /**dox***************************************************************/ 00076 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00077 00078 /*---- constants ---------------------------------------------------*/ 00079 00080 /**dox***************************************************************/ 00081 /** @addtogroup mvmestddefineh 00082 * 00083 * @{ */ 00084 00085 /* data modes */ 00086 #define VME_A16D16 1 /// - 00087 #define VME_A16D32 2 /// - 00088 #define VME_A24D16 3 /// - 00089 #define VME_A24D32 4 /// - 00090 #define VME_A32D16 5 /// - 00091 #define VME_A32D32 6 /// - 00092 #define VME_RAMD16 7 /// RAM memory of VME adapter 00093 #define VME_RAND32 8 /// - 00094 #define VME_LM 9 /// local memory mapped to VME 00095 00096 /* vme_ioctl commands */ 00097 #define VME_IOCTL_AMOD_SET 0 00098 #define VME_IOCTL_AMOD_GET 1 00099 00100 /* vme bus address modifiers */ 00101 #define VME_AMOD_A32_SB (0x0F) /**< A32 Extended Supervisory Block */ 00102 #define VME_AMOD_A32_SP (0x0E) /**< A32 Extended Supervisory Program */ 00103 #define VME_AMOD_A32_SD (0x0D) /**< A32 Extended Supervisory Data */ 00104 #define VME_AMOD_A32_NB (0x0B) /**< A32 Extended Non-Privileged Block */ 00105 #define VME_AMOD_A32_NP (0x0A) /**< A32 Extended Non-Privileged Program */ 00106 #define VME_AMOD_A32_ND (0x09) /**< A32 Extended Non-Privileged Data */ 00107 #define VME_AMOD_A32_SMBLT (0x0C) /**< A32 Multiplexed Block Transfer (D64) */ 00108 #define VME_AMOD_A32_NMBLT (0x08) /**< A32 Multiplexed Block Transfer (D64) */ 00109 00110 #define VME_AMOD_A32 VME_AMOD_A32_SD 00111 #define VME_AMOD_A32_D64 VME_AMOD_A32_SMBLT 00112 00113 #define VME_AMOD_A24_SB (0x3F) /**< A24 Standard Supervisory Block Transfer */ 00114 #define VME_AMOD_A24_SP (0x3E) /**< A24 Standard Supervisory Program Access */ 00115 #define VME_AMOD_A24_SD (0x3D) /**< A24 Standard Supervisory Data Access */ 00116 #define VME_AMOD_A24_NB (0x3B) /**< A24 Standard Non-Privileged Block Transfer */ 00117 #define VME_AMOD_A24_NP (0x3A) /**< A24 Standard Non-Privileged Program Access */ 00118 #define VME_AMOD_A24_ND (0x39) /**< A24 Standard Non-Privileged Data Access */ 00119 #define VME_AMOD_A24_SMBLT (0x3C) /**< A24 Multiplexed Block Transfer (D64) */ 00120 #define VME_AMOD_A24_NMBLT (0x38) /**< A24 Multiplexed Block Transfer (D64) */ 00121 00122 #define VME_AMOD_A24 VME_AMOD_A24_SD 00123 #define VME_AMOD_A24_D64 VME_AMOD_A24_SMBLT 00124 00125 #define VME_AMOD_A16_SD (0x2D) /**< A16 Short Supervisory Data Access */ 00126 #define VME_AMOD_A16_ND (0x29) /**< A16 Short Non-Privileged Data Access */ 00127 00128 #define VME_AMOD_A16 BT_AMOD_A16_SD 00129 00130 /**dox***************************************************************/ 00131 /** @} */ // end of mvmestdfunctinoh 00132 00133 /**dox***************************************************************/ 00134 /** @addtogroup mvmestdfunctionh 00135 * 00136 * @{ */ 00137 00138 /*---- function declarations ---------------------------------------*/ 00139 00140 /**dox***************************************************************/ 00141 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00142 00143 /* make functions callable from a C++ program */ 00144 #ifdef __cplusplus 00145 extern "C" { 00146 #endif 00147 00148 /**dox***************************************************************/ 00149 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00150 00151 /********************************************************************/ 00152 /** 00153 @param device .... 00154 @param mode ... 00155 @return SUCCESS 00156 */ 00157 int EXPRT vme_open(int device, int mode); 00158 00159 /********************************************************************/ 00160 /** 00161 @param vh .... 00162 @param req ... 00163 @param parm ... 00164 @return SUCCESS 00165 */ 00166 int EXPRT vme_ioctl(int vh, int req, int *parm); 00167 00168 /********************************************************************/ 00169 /** 00170 @param vh .... 00171 @return SUCCESS 00172 */ 00173 int EXPRT vme_close(int vh); 00174 00175 /********************************************************************/ 00176 /** 00177 @param vh ... 00178 @param dst ... 00179 @param vme_addr 00180 @param am 00181 @param size 00182 @param dma 00183 @return SUCCESS 00184 */ 00185 int EXPRT vme_read(int vh, void *dst, int vme_addr, int am, int size, int dma); 00186 00187 /********************************************************************/ 00188 /** 00189 @param vh ... 00190 @param src ... 00191 @param vme_addr 00192 @param am 00193 @param size 00194 @param dma 00195 @return SUCCESS 00196 */ 00197 int EXPRT vme_write(int vh, void *src, int vme_addr, int am, int size, int dma); 00198 00199 /********************************************************************/ 00200 /** 00201 @param vh ... 00202 @param ptr ... 00203 @param vme_addr 00204 @param size 00205 @return SUCCESS 00206 */ 00207 int EXPRT vme_mmap(int vh, void **ptr, int vme_addr, int size); 00208 00209 /********************************************************************/ 00210 /** 00211 @param vh .... 00212 @param ptr ... 00213 @param size 00214 @return SUCCESS 00215 */ 00216 int EXPRT vme_unmap(int vh, void *ptr, int size); 00217 00218 #ifdef __cplusplus 00219 } 00220 #endif 00221 00222 /**dox***************************************************************/ 00223 /** @} */ // end of mvmestdfunctinoh 00224 00225 /**dox***************************************************************/ 00226 /** @} */ // end of mvmestdinclude