From: Paul C. <pa...@us...> - 2004-03-29 12:52:24
|
Update of /cvsroot/emc/emc/src/drivers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13173 Modified Files: Makefile Added Files: extvitalmot.c vital.c vital.h Log Message: Initial commit of the Vital Systems PCI driver --- NEW FILE: vital.c --- /* vital.c $Id: vital.c,v 1.1 2004/03/29 12:40:54 paul_c Exp $ Routines to interface to the Vital Systems MOTENC100 ENC/DAC/ADC card. (MOTENC Rev1) Modification history: 29-March-2004 P.C. Modified the PCI detection routines prior to committing. 12-January-2004 ARR - Revision 0.1 - Adapted from Paul's code */ #if defined(rtlinux) || defined(rtai) // realtime headers #ifndef MODULE #define MODULE #endif #ifndef __KERNEL__ #define __KERNEL__ #endif #include <linux/version.h> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) /* this macro provides backward compatibility for accessing the PCI BAR info */ #define pci_resource_start(dev,bar) ((dev)->base_address[(bar)]) #endif //#include <linux/module.h> #include <linux/pci.h> #include <linux/vmalloc.h> #if !defined(rtai) && !defined(rtlinux_3_2) #include <sys/io.h> #endif #else // nonrealtime headers #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <sys/mman.h> #include <asm/io.h> #include <pci/pci.h> #endif #include "vital.h" /* these decls */ #include "extintf.h" /* EXT_ENCODER_INDEX_MODEL */ #include "rcs_prnt.hh" #include "diagnostics.h" /* printf functions for rtai/rtlinux/linux */ struct pci_dev *dev = NULL; struct pci_access *device; #ifndef __KERNEL__ static int mem_fd; /* File descriptor for /dev/mem access */ static unsigned long offset; /* address offset - see note in vitalMotInit */ #endif volatile unsigned long * pMotenc; int gLIM_HI[] = { 0, 4, 8, 12, 16, 20, 24, 28 }; int gLIM_LO[] = { 1, 5, 9, 13, 17, 21, 25, 29 }; int gAXIS_HOME[] = { 2, 6, 10, 14, 18, 22, 26, 30 }; int gAMP_FAULT[] = { 3, 7, 11, 15, 19, 23, 27, 31 }; int gAMP_EN[] = { 0, 1, 2, 3, 8, 9, 10, 11 }; // vitalMotInit(const char * stuff) // Call once before any of the other motion IO functions are called. // 'stuff' argument can be used to pass board-specific stuff like config // files. int vitalMotInit(const char * stuff) { // DEV ID = 3001 // VID = 10B5 // Sub Sys Dev ID = 9030 // Sub Sys VID = 10B5 #ifdef __KERNEL__ dev = pci_find_device(VENDOR, DEVICE, dev); if( dev ) { pMotenc=(volatile unsigned long *)ioremap_nocache(pci_resource_start(dev, 2), pci_resource_len(dev, 2)); diagnostics("PCI-MOTENC card address @ %x, Len = %d\n",pMotenc, pci_resource_len(dev, 2)); } else { // No card is present diagnostics("<1>**** No PCI-MOTENC card detected **** %x\n",dev); return -1; } diagnostics("MOTENC Card detected in Slot: %2x\n", PCI_SLOT(dev->devfn)); #else /* Code used to find PCI card and base address in user space only */ device = pci_alloc(); /* initialise the pci_access struct */ pci_init(device); /* initialise the pci lib */ pci_scan_bus(device); /* Build a list of devices on the PCI bus */ dev = device->devices; while ((dev != NULL)&&(dev->vendor_id != VENDOR)&&(dev->device_id != DEVICE)) { dev = dev->next; } mem_fd = open("/dev/mem", O_RDWR); if ((dev == NULL) || (mem_fd == -1)) { diagnostics("No PCI card detected.\n"); return -1; } else { diagnostics("Card found in slot %x:%x\n", dev->bus, dev->dev); } /* Some black magic required if the base address is not page aligned...*/ if (dev->base_addr[2] & PCI_BASE_ADDRESS_MEM_MASK & 0xfffff000) { offset = (dev->base_addr[2] & PCI_BASE_ADDRESS_MEM_MASK & 0x00000fff)/4; } else { offset = 0; } /* using MAP_SHARED prevents linux from buffering any read/writes and so *should* be written immediately to the hardware */ pMotenc = mmap(NULL, PCI_MEM_LEN, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, (off_t)dev->base_addr[2] & PCI_BASE_ADDRESS_MEM_MASK); pMotenc = pMotenc + offset; #endif return 0; } // vitalDioInit(const char * stuff) // Call once before any of the other digital IO functions are called. // 'stuff' argument can be used to pass board-specific stuff like config // files. int vitalDioInit(const char * stuff) { return 0; } // extAioInit(const char * stuff) // Call once before any of the other analog IO functions are called. // 'stuff' argument can be used to pass board-specific stuff like config // files. int vitalAioInit(const char * stuff) { int t = 0; for( t = 0; t < VITAL_MAX_AXIS; t++ ) { vitalDacWrite( t, 0.0 ); } return 0; } // vitalDioQuit() // Call once, after which point no other functions will be called until // after a call to extDioInit(). int vitalDioQuit(void) { return 0; } /* vitalAioQuit() Call once, after which point no other functions will be called until after a call to vitalAioInit(). */ int vitalAioQuit(void) { return 0; } /* vitalMotQuit() Call once, after which point no other functions will be called until after a call to vitalMotInit(). */ int vitalMotQuit(void) { diagnostics("Unmapping MOTENC memory\n"); #ifdef __KERNEL__ iounmap((void *)pMotenc); #else munmap ((void *) (pMotenc - offset), PCI_MEM_LEN); close (mem_fd); pci_cleanup (device); #endif return 0; } /* Encoder functions */ /* vitalEncoderNum() returns number of encoders in system. */ int vitalEncoderNum(void) { return 8; } /* vitalEncoderRead(int axis, double * counts) Stores the encoder's counts in counts arg. Returns 0 if OK or -1 if axis is out of range. axis is in range 0 .. max axis - 1. */ int vitalEncoderRead(int axis, double * counts) { return vitalEncoderReadAll(VITAL_MAX_AXIS, counts); } /* vitalEncoderReadLevel(int axis, int * index) For EXT_ENCODER_INDEX_MODEL_MANUAL, stores 1 if encoder is on the index pulse right now, 0 if not. Useful for slow polling to get more accuracy since the manual model has latency. Not valid for EXT_ENCODER_INDEX_MODEL_AUTO. Returns 0 if OK, -1 if not valid. */ int vitalEncoderReadLevel(int axis, int * flag) { vitalEncoderReadLatch(axis, flag); return 0; } // vitalEncoderReadAll(int max, double * counts) // Stores the range of encoders' counts in counts array. Returns 0 if // OK or -1 if the max is greater than number of encoders. max is // number of encoders, so for encoders 0..3 max would be 4. int vitalEncoderReadAll(int max, double * counts) { int t; if( ( max > VITAL_MAX_AXIS ) || ( max < 0 )) return -1; for( t = 0; t < max; t++ ) counts[t] = (double)readl( pMotenc + ((t/4)*8) + (t%4) ); //Enc 0..3 PLD1, Enc 4..7 PLD2 return 0; } /* vitalEncoderIndexModel() Returns the type of encoder indexing done by the board. The handling of index pulses for encoder homing is problematic. There are two models (at least) for how incremental encoders can be homed off the index pulse. The first assumes the encoder index pulse sets a flag when it occurs, but the count value doesn't change. The controller polls on this flag, and when it is seen to be latched the controller reads the position and uses this as an offset. There is a latency that makes this less accurate than the second method, in which the occurrence of the index pulse resets the count automatically. The problem is that the controller logic is different for the two methods, so if you replace a board which does it the first way with one that does it the second, you need to recode the logic. The function "vitalEncoderIndexModel()" returns the model used by the board, so at least you can detect it and if you have coded up both types you can switch automatically. EXT_ENCODER_INDEX_MODEL_MANUAL indicates that the index pulse sets a latch flag, but you have to read this and then the encoder value and handle offsets yourself. The board won't change its count value on the index pulse. EXT_ENCODER_INDEX_MODEL_AUTO indicates that the index pulse zeros the encoder count automatically. */ /* flags defined bit-exclusive for OR'ing if board can do multiple ways */ #define EXT_ENCODER_INDEX_MODEL_MANUAL 0x00000001 #define EXT_ENCODER_INDEX_MODEL_AUTO 0x00000002 unsigned int vitalEncoderIndexModel(void) { return EXT_ENCODER_INDEX_MODEL_AUTO; } // vitalEncoderSetIndexModel(unsigned int model) // For boards that support multiple index models, select which one // is to be used. Returns 0 if OK, -1 if model can't be supported. int vitalEncoderSetIndexModel(unsigned int model) { if( (model & EXT_ENCODER_INDEX_MODEL_AUTO) == EXT_ENCODER_INDEX_MODEL_AUTO ) return 0; else return -1; } // vitalEncoderResetIndex(int axis) // Resets index latching for the indicated axis. Returns 0 if OK or -1 // if the index is out of range. This applies to both // EXT_ENCODER_INDEX_MODEL_MANUAL and EXT_ENCODER_INDEX_MODEL_AUTO. // For the first, it resets the latch flag. For the second, it enables // zeroing on the next index. encoder is range 0..max encoder - 1. int vitalEncoderResetIndex(int nAxis) { int PLDBase = 0; nAxis &= 0x7; // Make sure we are within range. if( nAxis > 3 ) PLDBase = MOTENC_PLD2_BASE; //Access the second PLD writel( 1, pMotenc + PLDBase + (nAxis % 4) ); // resets the flag and enable // the circuit to latch the next // index pulse return 0; } // vitalEncoderReadLatch(int encoder, int * flag) // For EXT_ENCODER_INDEX_MODEL_MANUAL, stores 1 if index has latched // the flag, 0 if not. For EXT_ENCODER_INDEX_MODEL_AUTO, stores 1 if // the encoder has been zeroed. Returns 0 if OK, -1 if not valid. int vitalEncoderReadLatch(int nAxis, int * flag) { unsigned long AuxDat; unsigned long Mask; int PLDBase = 0; *flag = 0; nAxis &= 0x7; // Make sure we are within range. if( nAxis > 3 ) PLDBase = MOTENC_PLD2_BASE; //Access the second PLD AuxDat = readl( pMotenc + PLDBase + 5 ); Mask = 0x1000000 << (nAxis % 4); AuxDat &= Mask; if( AuxDat ) *flag = 1; return 0; } // DAC functions // vitalDacNum() // returns number of DACs in system which is 8 in this case. int vitalDacNum(void) { return 8; } // vitalDacWriteAll(int max, double * volts) // writes the values to the DAC range. Values are array of DAC outputs // in volts. Returns 0 if OK, -1 if not max is out of range. This is // provided for systems in which DACs can be written all at once for // speed or synchronicity. max is number of DACs, so for dacs 0..3 // max would be 4. int vitalDacWriteAll(int max, double * volts) { int t; if( ( max > VITAL_MAX_AXIS ) || ( max < 0 )) return -1; for (t = 0; t < max; t++) vitalDacWrite(t, volts[t]); return 0; } // vitalDacWrite(int axis, double volts) // writes the value to the DAC at indicated dac, 0 .. max DAC - 1. // Value is in volts. Returns 0 if OK, -1 if dac is out of range. int vitalDacWrite(int nAxis, double volts) { // output to DAC word, transfer function: // // 0x0000 -> +10 V // 0x1000 -> 0 V // 0x1FFF -> -10 V int nCounts; nAxis &= 0x7; // Make sure we are not out of range. // convert -10.0 -> 10.0 to 0x1FFF -> 0x0000 nCounts = (int) ((10.0 - volts) / 20.0 * 0x1FFF) ; writel( nCounts & 0x1FFF, pMotenc + MOTENC_DAC_BASE + nAxis ); return 0; } // Input/Output read/write // reads value of digital input at index, stores in value // Index is Zero Based int vitalDioRead(int index, int *value) { unsigned long DatIO; *value = 0; if( index >= 0 && index < 16 ) { // 0..15 DatIO = readl( pMotenc + 0 + 4 ); DatIO = DatIO / 65536; DatIO = DatIO >> index; *value = DatIO & 1; } else if( index > 15 && index < 32 ) { // 16..31 DatIO = readl( pMotenc + 0 + 5 ); DatIO = DatIO >> (index - 16); *value = DatIO & 1; } else if( index > 31 && index < 48 ) { // 32..47 DatIO = readl( pMotenc + MOTENC_PLD2_BASE + 4 ); DatIO = DatIO / 65536; DatIO = DatIO >> (index - 32); *value = DatIO & 1; } else if( index > 47 && index < 68 ) { // 48..67 DatIO = readl( pMotenc + MOTENC_PLD2_BASE + 5 ); DatIO = DatIO >> (index - 48); *value = DatIO & 1; } else if( index == 68 ) //Board ID 0 { DatIO = readl( pMotenc + 0 + 5 ); DatIO = DatIO >> 16; *value = DatIO & 1; } else if( index == 69 ) //Board ID 1 { DatIO = readl( pMotenc + 0 + 5 ); DatIO = DatIO >> 17; *value = DatIO & 1; } else if( index == 70 ) //ADC Done Bit { DatIO = readl( pMotenc + 0 + 5 ); DatIO = DatIO >> 18; *value = DatIO & 1; } else if( index == 71 ) //Master ESTOP { DatIO = readl( pMotenc + 0 + 5 ); DatIO = DatIO >> 19; *value = DatIO & 1; } return 0; } // writes value (non-zero means 1, 0 is 0) at digital out at index // Zero Based Index int vitalDioWrite(int index, int value) { unsigned long DatIO = 0; unsigned long Mask = 0; if( index >= 0 && index < 16 ) { Mask = 1 << index; DatIO = readl( pMotenc + 0 + 4 ); if( value ) DatIO |= Mask; // Set the bit else DatIO &= ~Mask; // Clear the bit writel( DatIO, pMotenc + 0 + 4 ); } else if( index >= 16 && index < 32 ) { Mask = 1 << (index - 16); DatIO = readl( pMotenc + MOTENC_PLD2_BASE + 4 ); if( value ) DatIO |= Mask; // Set the bit else DatIO &= ~Mask; // Clear the bit writel( DatIO, pMotenc + MOTENC_PLD2_BASE + 4 ); } return 0; } /* reads value of digital OUT at index, stores in value. Useful for checking values of previous writes. Returns 0 if OK, -1 if bad index or can't read if they're write-only. */ int vitalDioCheck(int index, int *value) { int state; *value = 0; if( index >= 0 && index < 16 ) { state = readl( pMotenc + 0 + 4 ); state = ( state >> index ) & 1; } else if( index >= 16 && index < 32 ) { state = readl( pMotenc + MOTENC_PLD2_BASE + 4 ); state = ( state >> (index-16) ) & 1; } else return -1; *value = state; return 0; } // Amp functions // vitalAmpEnable(int axis, int enable) // enables or disables amplifier for indicated axis; enable flag is // 1 to enable, 0 to disable // Returns 0 if OK, -1 if not valid (axis is out of range) int vitalAmpEnable(int axis, int enable) { if( axis >= VITAL_MAX_AXIS || axis < 0 ) return -1; return vitalDioWrite( gAMP_EN[axis], enable); } // vitalAmpFault(int axis, int * fault) // Copies into 'fault' the fault state of the amplifier. 1 is faulted, // 0 is OK. // Returns 0 if OK, -1 if not valid (axis out of range) int vitalAmpFault(int axis, int * fault) { if( axis >= VITAL_MAX_AXIS || axis < 0 ) return -1; return vitalDioRead( gAMP_FAULT[axis], fault); } // Limit switch functions */ // vitalMaxLimitSwitchRead(int axis, int * flag) // sets *flag to 0 if the limit switch is not tripped, i.e., everything // is fine, 1 if the limit switch is tripped, i.e., the axis went // too far in the associated direction. // Maximum is defined as the direction in which encoder values increase, // minimum is the other direction. // Returns 0 if OK, -1 if not valid (axis is out of range). int vitalMaxLimitSwitchRead(int axis, int * flag) { if( axis >= VITAL_MAX_AXIS || axis < 0 ) return -1; return vitalDioRead( gLIM_HI[axis], flag); } int vitalMinLimitSwitchRead(int axis, int * flag) { if( axis >= VITAL_MAX_AXIS || axis < 0 ) return -1; return vitalDioRead( gLIM_LO[axis], flag); } // vitalHomeSwitchRead(int axis, int * flag) // sets *flag to 0 if the home switch is not tripped, i.e., everything // is fine, 1 if the home switch is tripped. // Returns 0 if OK, -1 if not valid (axis is out of range). int vitalHomeSwitchRead(int axis, int * flag) { if( axis >= VITAL_MAX_AXIS || axis < 0 ) return -1; return vitalDioRead( gAXIS_HOME[axis], flag); } --- NEW FILE: vital.h --- #ifndef VITAL_H #define VITAL_H /* vital.h $Id: vital.h,v 1.1 2004/03/29 12:40:54 paul_c Exp $ Declarations for Vital Systems cards Modification history: 29-March-2004 P.C. Modified the PCI detection routines prior to committing. Moved the majority of the defines into the header. 3-March-2004 AAR Adapted the Vigilant sources to Vital Systems Motenc100 pci card . */ #ifdef __cplusplus extern "C" { #endif // Number of axes in system #define VITAL_MAX_AXIS 8 #include "emcmotcfg.h" // Device and Vendor ID #define VENDOR 0x10b5 #define DEVICE 0x3001 #define PCI_MEM_LEN 512 #define MOTENC_PLD2_BASE 8 #define MOTENC_DAC_BASE 24 // digital input bit assignments // Connector J6 #define LIM_HI_0 0 #define LIM_LO_0 1 #define HOME_0 2 #define FAULT_0 3 #define LIM_HI_1 4 #define LIM_LO_1 5 #define HOME_1 6 #define FAULT_1 7 #define LIM_HI_2 8 #define LIM_LO_2 9 #define HOME_2 10 #define FAULT_2 11 #define LIM_HI_3 12 #define LIM_LO_3 13 #define HOME_3 14 #define FAULT_3 15 // Connector J7 #define LIM_HI_4 16 #define LIM_LO_4 17 #define HOME_4 18 #define FAULT_4 19 #define LIM_HI_5 20 #define LIM_LO_5 21 #define HOME_5 22 #define FAULT_5 23 #define LIM_HI_6 24 #define LIM_LO_6 25 #define HOME_6 26 #define FAULT_6 27 #define LIM_HI_7 28 #define LIM_LO_7 29 #define HOME_7 30 #define FAULT_7 31 // Output Bits Assignment // Connector J6 #define AMP_EN_0 0 #define AMP_EN_1 1 #define AMP_EN_2 2 #define AMP_EN_3 3 // Connector J7 #define AMP_EN_4 8 #define AMP_EN_5 9 #define AMP_EN_6 10 #define AMP_EN_7 11 /* decls for external interface */ extern int vitalMotInit(const char * stuff); extern int vitalMotQuit(void); extern int vitalDacNum(void); extern int vitalDacWrite(int axis, double volts); extern int vitalDacWriteAll(int max, double * volts); extern int vitalEncoderSetIndexModel(unsigned int model); extern int vitalEncoderNum(void); extern int vitalEncoderRead(int axis, double * counts); extern int vitalEncoderReadAll(int max, double * counts); extern int vitalEncoderResetIndex(int axis); extern int vitalEncoderReadLatch(int axis, int * flag); extern int vitalEncoderReadLevel(int axis, int * flag); extern int vitalMaxLimitSwitchRead(int axis, int * flag); extern int vitalMinLimitSwitchRead(int axis, int * flag); extern int vitalHomeSwitchRead(int axis, int * flag); extern int vitalAmpEnable(int axis, int enable); extern int vitalAmpFault(int axis, int * fault); extern int vitalDioInit(const char * stuff); extern int vitalDioQuit(void); extern int vitalDioMaxInputs(void); extern int vitalDioMaxOutputs(void); extern int vitalDioRead(int index, int *value); extern int vitalDioWrite(int index, int value); extern int vitalDioCheck(int index, int *value); extern int vitalAioInit(const char * stuff); extern int vitalAioQuit(void); extern int vitalAioMaxInputs(void); extern int vitalAioMaxOutputs(void); extern int vitalAioStart(int index); extern void vitalAioWait(void); extern int vitalAioRead(int index, double *volts); extern int vitalAioWrite(int index, double volts); extern int vitalAioCheck(int index, double *volts); extern int vitalModel(void); #ifdef __cplusplus } #endif #endif /* VITAL_H */ Index: Makefile =================================================================== RCS file: /cvsroot/emc/emc/src/drivers/Makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Makefile 11 Mar 2004 16:14:16 -0000 1.13 --- Makefile 29 Mar 2004 12:40:54 -0000 1.14 *************** *** 32,41 **** SRCS = parport.c \ extppt.c \ ! extvtimot.c vti.c HEADERS = diagnostics.h \ extintf.h \ parport.h \ ! vti.h BINS = --- 32,43 ---- SRCS = parport.c \ extppt.c \ ! extvtimot.c vti.c \ ! extvitalmot.c vital.c HEADERS = diagnostics.h \ extintf.h \ parport.h \ ! vti.h \ ! vital.h BINS = *************** *** 45,49 **** vti_isa.o \ vti_pci.o \ ! extvtimot.o else --- 47,53 ---- vti_isa.o \ vti_pci.o \ ! extvtimot.o \ ! extvitalmot.o \ ! vital.o else *************** *** 52,56 **** parport.c \ extppt.c \ ! extvtimot.c vti.c HEADERS = diagnostics.h \ --- 56,61 ---- parport.c \ extppt.c \ ! extvtimot.c vti.c \ ! extvitalmot.c vital.c HEADERS = diagnostics.h \ *************** *** 58,62 **** extintf.h \ parport.h \ ! vti.h BINS = handwheel \ --- 63,68 ---- extintf.h \ parport.h \ ! vti.h \ ! vital.h BINS = handwheel \ *************** *** 69,73 **** extvtimot.o \ vti_isa.o \ ! vti_pci.o endif --- 75,82 ---- extvtimot.o \ vti_isa.o \ ! vti_pci.o \ ! extvitalmot.o \ ! vital.o ! endif --- NEW FILE: extvitalmot.c --- /* extvitalmot.c $Id: extvitalmot.c,v 1.1 2004/03/29 12:40:54 paul_c Exp $ Dispatcher of external motion functions for Vital Systems Motenc100 pci Board Modification history: 3-Mar-2004 AAR Adapted to Vital Systems MOTENC100 pci baord from the Vigilant source. 24-Mar-2002 P.C. created from STG sources. */ #include "extintf.h" /* these decls */ #include "vital.h" /* decls for stg implementation */ /* Uncomment any of the following declarations to inhibit the use of home switches or index pulses when homing, or to ignore limit switches if you don't have them. */ /* Uncomment NO_HOME_SWITCH if you want homing sequence to ignore the home switch, and only use the index pulse for homing. This has the effect of making the home switches always appear tripped. */ /* #define NO_HOME_SWITCH */ /* Uncomment NO_INDEX_PULSE if you want homing sequence to ignore the index pulse, and only use the home switch for homing. This has the effect of making the index pulse always appear present. */ /* #define NO_INDEX_PULSE */ /* Uncomment NO_LIMIT_SWITCH if you don't have limit switches. This has the effect of making the positive and negative travel limit switches never appear tripped. */ /* #define NO_LIMIT_SWITCH */ int extMotInit(const char * stuff) { return vitalMotInit(stuff); } int extAioInit(const char * stuff) { return vitalAioInit(stuff); } int extDioInit(const char * stuff) { return vitalDioInit(stuff); } int extMotQuit(void) { return vitalMotQuit(); } int extAioQuit(void) { return vitalAioQuit(); } int extDioQuit(void) { return vitalDioQuit(); } int extEncoderReadAll(int max, double * counts) { return vitalEncoderReadAll(max, counts); } int extDacWriteAll(int max, double * volts) { return vitalDacWriteAll(max, volts); } // INDEX int extEncoderSetIndexModel(unsigned int model) { return vitalEncoderSetIndexModel(model); } int extEncoderResetIndex(int axis) { return vitalEncoderResetIndex(axis); } int extEncoderReadLatch(int axis, int * flag) { #ifdef NO_INDEX_PULSE *flag = 1; return 0; #else return vitalEncoderReadLatch(axis, flag); #endif } int extMaxLimitSwitchRead(int axis, int * flag) { #ifdef NO_LIMIT_SWITCH *flag = 0; return 0; #else return vitalMaxLimitSwitchRead(axis, flag); #endif } int extMinLimitSwitchRead(int axis, int * flag) { #ifdef NO_LIMIT_SWITCH *flag = 0; return 0; #else return vitalMinLimitSwitchRead(axis, flag); #endif } int extHomeSwitchRead(int axis, int * flag) { #ifdef NO_HOME_SWITCH *flag = 1; return 0; #else return vitalHomeSwitchRead(axis, flag); #endif } int extAmpEnable(int axis, int enable) // Turn amp on/off { return vitalAmpEnable(axis, enable); } int extAmpFault(int axis, int * fault) // read amp fault bit { return vitalAmpFault(axis, fault); } int extDioRead(int index, int *value) { return vitalDioRead(index, value); } int extDioWrite(int index, int value) { return vitalDioWrite(index, value); } int extDioCheck(int index, int *value) { return vitalDioCheck(index, value); } |