📄 vmeintr.c
字号:
/* vmeintr.c
This example uses SICL to cause a VME interrupt from an
HPE1361 register-based relay card at logical address 136. */
#include <stdio.h>
#include <sicl.h>
static void vmeint (INST, unsigned short);
static void int_setup (INST, unsigned long);
static void int_hndlr (INST, long, long);
int intr = 0;
void main() {
INST id_intf1;
unsigned long mask = 1;
ionerror (I_ERROR_EXIT);
iintroff ();
id_intf1 = iopen ("vxi,136");
int_setup (id_intf1, mask);
vmeint (id_intf1, 136);
/* wait for SRQ or interrupt condition */
iwaithdlr (0);
iintron ();
iclose (id_intf1);
}
static void int_setup(INST id, unsigned long mask) {
ionintr(id, int_hndlr);
isetintr(id, I_INTR_VXI_SIGNAL, mask);
}
static void vmeint (INST id, unsigned short laddr) {
int reg;
char *a16_ptr = 0;
reg = 8;
a16_ptr = imap (id, I_MAP_A16, 0, 1, 0);
/* Cause uhf mux to interrupt: */
*(unsigned short *)(a16_ptr + 0xc000 + laddr * 64 + reg) = 0x0;
}
static void int_hndlr (INST id, long reason, long sec) {
printf ("VME interrupt: reason: 0x%x, sec: 0x%x\n", reason,sec);
intr = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -