#include "cifxlinux.h" #include #include #include int main(void) { struct CIFX_DEVICE_T tISADevice; int fd; memset(&tISADevice, 0, sizeof(tISADevice)); tISADevice.uio_num = -1; tISADevice.uio_fd = -1; tISADevice.pci_card = 0; tISADevice.dpmaddr = 0xC0000; tISADevice.dpmlen = 16 * 1024; /* open /dev/mem to be able to map ISA card to user space */ if(-1 == (fd = cifx_ISA_open())) { printf("Error opening /dev/mem to be able to map ISA device!\n"); /* Map ISA card to user space */ } else if(!cifx_ISA_map_dpm(fd, (void**)&tISADevice.dpm, tISADevice.dpmaddr, tISADevice.dpmlen)) { printf("Error mapping ISA device\n"); } else { struct CIFX_LINUX_INIT init = { .init_options = CIFX_DRIVER_INIT_NOSCAN, .iCardNumber = 0, .fEnableCardLocking = 0, .base_dir = NULL, .poll_interval = 0, .poll_StackSize = 0, /* set to 0 to use default */ .trace_level = 255, /* pass ISA device as user device to cifX device driver */ .user_card_cnt = 1, .user_cards = &tISADevice, }; /* First of all initialize toolkit */ int32_t lRet = cifXDriverInit(&init); if(CIFX_NO_ERROR == lRet) { // TODO: Start main application ... } } if(NULL != tISADevice.dpm) { munmap(tISADevice.dpm, tISADevice.dpmlen); tISADevice.dpm = NULL; } if(-1 != fd) { close(fd); fd = -1; } return 0; }