3.1 Initialization and Exit Function Calls for Linux

All the demo applications begin with the following functions and should be called in sequence to initialize the JNMM-4LP-XT Driver .

  1. JNMMCANOpen () : This function opens a handle to access the Diamond JNMM CAN driver and returns the handle value.

  2. JNMMCANClose () : This function closes the access to the Diamond JNMM CAN driver.

These function calls are important in opening and closing the file descriptor.

#include "../CANLib/libcan.h"

int main()
{

int can_fd;
int flag;

can_fd = JNMMCANOpen(&flag);

if(can_fd == -1)
{
	return 0;
}

if(flag == 1) // ISA mode
{	
	printf("JNMMCAN4LP-XT-ISA mode ");
	Base_address = 0x6000;
	JNMMCANBaseAddrInit(base_address);
	Diobase_address = 0x140;
	JNMMCANDIOAddrInit(diobase_address);
}
else
{
      printf("JNMMCAN4LP-XT-PCI mode ");
}

JNMMCANClose(can_fd);

}

Last updated