#include "bus_lock.h"#include <vxWorks.h>#include <taskLib.h>#include <logLib.h>Include dependency graph for bus_lock.c:

Go to the source code of this file.
Data Structures | |
| struct | BL_ADDR_INFO |
Functions | |
| void | regWriteChar (char *addr, char c) |
| char | regReadChar (char *addr) |
| void | regWriteShort (short *addr, short c) |
| short | regReadShort (short *addr) |
| void | regWriteLong (long *addr, long c) |
| long | regReadLong (long *addr) |
| void | regWriteULong (unsigned long *addr, unsigned long c) |
| unsigned long | regReadULong (long *addr) |
| int | testBusLockRead () |
| int | testBusLockWrite () |
| BL_ADDR_INFO * | getBusLockInfo (int board_type, unsigned long addr) |
| void | freeBusLockInfo (struct BL_ADDR_INFO *info) |
| int | enableBusLock (struct BL_ADDR_INFO *info) |
| int | disableBusLock (struct BL_ADDR_INFO *info) |
Variables | |
| int | bus_lock_use_intlock = 1 |
| void * | test_bus_lock_addr = (void *) 0x4e00000 |
| int | test_buf_size = 0x4000 |
| int | test_bus_lock_board_type = VX_MVME162_BOARD_TYPE |
| char | c = 'a' |
| int | testBusLockQuit |
| int | test_bus_lock_count = 0x4000 |
| int | intLockKey = 0 |
|
||||||||||||
|
Definition at line 27 of file bus_lock.c. 00028 {
00029 *addr = c;
00030 }
|
|
|
Definition at line 33 of file bus_lock.c. 00034 {
00035 return *addr;
00036 }
|
|
||||||||||||
|
Definition at line 39 of file bus_lock.c. 00040 {
00041 *addr = c;
00042 }
|
|
|
Definition at line 45 of file bus_lock.c. 00046 {
00047 return *addr;
00048 }
|
|
||||||||||||
|
Definition at line 51 of file bus_lock.c. Referenced by disableBusLock(), and enableBusLock().
00052 {
00053 *addr = c;
00054 }
|
|
|
Definition at line 57 of file bus_lock.c. Referenced by disableBusLock(), and enableBusLock().
00058 {
00059 return *addr;
00060 }
|
|
||||||||||||
|
Definition at line 63 of file bus_lock.c. 00064 {
00065 *addr = c;
00066 }
|
|
|
Definition at line 69 of file bus_lock.c. 00070 {
00071 return *addr;
00072 }
|
|
|
Definition at line 78 of file bus_lock.c. 00079 {
00080 struct BL_ADDR_INFO *info;
00081 char c1, c2;
00082 int i;
00083
00084 info =
00085 getBusLockInfo (test_bus_lock_board_type,
00086 (unsigned long) test_bus_lock_addr);
00087 if (0 == info)
00088 {
00089 return -1;
00090 }
00091 for (i = 0; i < test_bus_lock_count && !testBusLockQuit; i++)
00092 {
00093 enableBusLock (info);
00094 c1 = *((char *) test_bus_lock_addr);
00095 c2 = *((char *) test_bus_lock_addr + test_buf_size - 1);
00096 disableBusLock (info);
00097 if (c1 != c2)
00098 {
00099 logMsg (" %c != %c", c1, c2, 0, 0, 0, 0);
00100 return -1;
00101 }
00102 }
00103 }
|
|
|
Definition at line 108 of file bus_lock.c. 00109 {
00110 struct BL_ADDR_INFO *info;
00111 int i;
00112
00113 info =
00114 getBusLockInfo (test_bus_lock_board_type,
00115 (unsigned long) test_bus_lock_addr);
00116 if (0 == info)
00117 {
00118 return -1;
00119 }
00120 for (i = 0; i < test_bus_lock_count && !testBusLockQuit; i++)
00121 {
00122 c++;
00123 if (c > 'z')
00124 {
00125 c = 'a';
00126 }
00127 enableBusLock (info);
00128 memset (test_bus_lock_addr, c, test_buf_size);
00129 disableBusLock (info);
00130 }
00131 freeBusLockInfo (info);
00132 return 0;
00133 }
|
|
||||||||||||
|
Definition at line 136 of file bus_lock.c. 00137 {
00138 struct BL_ADDR_INFO *info;
00139 char vme_bus_enable_control_reg;
00140 unsigned long a1;
00141 unsigned long enda1;
00142 unsigned long starta1;
00143
00144 switch (board_type)
00145 {
00146 case VX_MVME162_BOARD_TYPE:
00147 info = (struct BL_ADDR_INFO *) malloc (sizeof (struct BL_ADDR_INFO));
00148 if (0 == info)
00149 {
00150 return 0;
00151 }
00152 info->addr = addr;
00153 info->board_type = board_type;
00154 return info;
00155
00156 default:
00157 break;
00158 }
00159 return (0);
00160 }
|
|
|
Definition at line 163 of file bus_lock.c. 00164 {
00165 if (0 == info)
00166 {
00167 return;
00168 }
00169 free (info);
00170 }
|
|
|
Definition at line 173 of file bus_lock.c. 00174 {
00175 long requestor_control_register_val;
00176 long DHB = 0;
00177 int board_type;
00178 if (0 == info)
00179 {
00180 return -1;
00181 }
00182 #ifdef VXWORKS
00183 if (bus_lock_use_intlock)
00184 {
00185 intLockKey = intLock ();
00186 }
00187 else
00188 {
00189 taskLock ();
00190 }
00191 #endif
00192 board_type = info->board_type;
00193 switch (board_type)
00194 {
00195 case VX_MVME162_BOARD_TYPE:
00196 while (!DHB)
00197 {
00198 requestor_control_register_val = regReadLong ((long *) 0xFFF40030);
00199 DHB = requestor_control_register_val & (1 << 14);
00200 requestor_control_register_val |= (1 << 13);
00201 regWriteLong (((long *) 0xFFF40030),
00202 requestor_control_register_val);
00203 }
00204 return 0;
00205
00206 defualt:
00207 return -1;
00208 }
00209 return -1;
00210 }
|
|
|
Definition at line 217 of file bus_lock.c. 00218 {
00219 long requestor_control_register_val;
00220 long DHB = 0;
00221 long attribute_register;
00222 int board_type;
00223 if (0 == info)
00224 {
00225 return -1;
00226 }
00227 board_type = info->board_type;
00228 switch (board_type)
00229 {
00230 case VX_MVME162_BOARD_TYPE:
00231 requestor_control_register_val = regReadLong ((long *) 0xFFF40030);
00232 requestor_control_register_val &= ~(1 << 13);
00233 regWriteLong (((long *) 0xfff40030), requestor_control_register_val);
00234 #ifdef VXWORKS
00235 if (bus_lock_use_intlock)
00236 {
00237 intUnlock (intLockKey);
00238 }
00239 else
00240 {
00241 taskUnlock ();
00242 }
00243 #endif
00244 return 0;
00245 defualt:
00246 break;
00247 }
00248 #ifdef VXWORKS
00249 if (bus_lock_use_intlock)
00250 {
00251 intUnlock (intLockKey);
00252 }
00253 else
00254 {
00255 taskUnlock ();
00256 }
00257 #endif
00258 return -1;
00259 }
|
|
|
Definition at line 15 of file bus_lock.c. |
|
|
Definition at line 16 of file bus_lock.c. |
|
|
Definition at line 17 of file bus_lock.c. |
|
|
Definition at line 18 of file bus_lock.c. |
|
|
Definition at line 19 of file bus_lock.c. |
|
|
Definition at line 20 of file bus_lock.c. |
|
|
Definition at line 21 of file bus_lock.c. |
|
|
Definition at line 22 of file bus_lock.c. |
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001