372 std::istringstream strm(spec);
376 epicsSnprintf(buf,
sizeof(buf),
"%x:%x.%x", B, d, f);
377 buf[
sizeof(buf)-1] =
'\0';
378 spec = epicsStrDup(buf);
379 fprintf(stderr,
"Deprecated call. Replace with:\n" 380 " mrmEvgSetupPCI(\"%s\", \"%s\")\n",
386 printf(
"ID %s already in use\n",
id);
397 if(checkUIOVersion(1,2,&kifacever))
401 const epicsPCIDevice *cur = 0;
402 if (devPCIFindSpec(mrmevgs, spec, &cur, 0)) {
403 printf(
"PCI Device not found\n");
412 printf(
"Device %s %x:%x.%x\n",
id, cur->bus, cur->device,
414 printf(
"Using IRQ %u\n", cur->irq);
417 volatile epicsUInt8 *BAR_plx, *BAR_evg;
419 if (devPCIToLocalAddr(cur, 0, (
volatile void**) (
void *) &BAR_plx, 0)) {
420 printf(
"Failed to map BARs 0\n");
424 printf(
"BAR0 mapped to zero? (%08lx)\n",
425 (
unsigned long) BAR_plx);
429 switch(cur->id.device) {
431 if (devPCIToLocalAddr(cur, 2, (
volatile void**) (
void *) &BAR_evg, 0)) {
432 printf(
"Failed to map BARs 2\n");
436 printf(
"BAR2 mapped to zero? (%08lx)\n",
437 (
unsigned long) BAR_evg);
441 #if EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG 443 #elif EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE 459 #if EPICS_BYTE_ORDER == EPICS_ENDIAN_BIG 461 #elif EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE 467 printf(
"Unknown/unsupported PCI device 0x%04x\n", (
unsigned)cur->device);
472 checkVersion(BAR_evg, MRFVersion(0, 3, 0), MRFVersion(0, 8, 0));
476 WRITE32(BAR_evg, IrqEnable, 0);
481 conf = &conf_cpci_evg_300;
482 }
else switch(cur->id.sub_device) {
493 MRFVersion ver(evg->
version());
495 #if !defined(__linux__) && !defined(_WIN32) 500 if(ver>=MRFVersion(0, 8, 0)) {
505 if(ver>=MRFVersion(0, 8, 0) && kifacever>=2) {
511 }
else if(ver<MRFVersion(0, 8, 0)) {
514 printf(
"Warning: this configuration of FW and SW is known to have race conditions in interrupt handling.\n" 515 " Please consider upgrading to FW version 8.\n");
517 printf(
" Also upgrade the linux kernel module to interface version 2.");
518 }
else if(ver>=MRFVersion(0, 8, 0) && kifacever<2) {
520 throw std::runtime_error(
"FW version 8 for this device requires a linux kernel module w/ interface version 2");
522 throw std::logic_error(
"logic error in FW/kernel module compatibility check.");
524 if(devPCIEnableInterrupt(cur)) {
525 printf(
"Failed to enable interrupt\n");
532 if ((ret=devPCIConnectInterrupt(cur, &
evgMrm::isr_pci, (
void*) evg, 0))!=0) {
534 errSymLookup(ret, buf,
sizeof(buf));
535 printf(
"ERROR:Failed to connect PCI interrupt. err (%d) %s\n", ret, buf);
539 printf(
"PCI interrupt connected!\n");
544 }
catch (std::exception& e) {
545 printf(
"Error: %s\n", e.what());
#define PCI_DEVICE_ID_MRF_MTCA_EVM_300
#define BITCLR(ord, len, base, offset, mask)
#define LE_WRITE16(base, offset, value)
#define READ32(base, offset)
#define BE_WRITE32(base, offset, value)
#define PCI_DEVICE_ID_MRF_CPCIEVG300
static Object * getObject(const std::string &name)
#define PCI_DEVICE_ID_XILINX_DEV
struct configuration_pci pci
const epicsPCIDevice * dev
#define INTCSR_INT1_Polarity
#define PCI_SUBDEVICE_ID_MRF_PXIEVG_220
#define NAT_WRITE32(base, offset, value)
#define BITSET(ord, len, base, offset, mask)
void checkVersion(volatile epicsUInt8 *base, const MRFVersion &required, const MRFVersion &recommended)
static void isr_pci(void *)
#define WRITE32(base, offset, value)
#define PCI_DEVICE_ID_MRF_PXIEVG230
#define PCI_DEVICE_ID_PLX_9030
#define INTCSR_INT1_Enable
#define INTCSR_PCI_Enable
MRFVersion version() const