ADLINK PCI-7841/cPCI-7841 User Manual

Page 47

Advertising
background image

Function Reference

39

void (far *proc)() : Previous call-back func-
tion

Return Value

Return 0 is successful
-1 if error occurs

Remarks

Install the call-back function for event han-
dling
In normal state, all hardware interrupt of
cPCI/PCI-7841 wouldn’t be set except
receive and transmit interrupt. After calling
the CanInstallCallBack(), the corresponding
interrupt would be activated. The interrupt
occurs when the event happened. It will not
be disabled until using CanRemoveCall-
Back() or a hardware reset.
Actually, the call-back function is a part of
ISR. You need to care about the DOS reen-
trance problem, and returns as soon as
possible to preventing the lost of data.


See Also

CanRemoveCallBack()

Usage

C/C++ (DOS)

#include “pci7841.h
void (far ErrorWarning)();
int handle = CanOpenDriver(0, 0);//open the port

0 of card 0


//

Installs the ErrorWarning handling event and
stores the previous one.

void (far *backup) = CanInstallCallBack(0, 2,

ErrorWarning);

CanRemoveCallBack(0, 2, NULL);//Remove the call-

back function

7

Bus Error

Advertising