/***************************************************************
 * PrZebraDefn.h
 *
 * This files contains constants for the PCI board for Zebra sensors.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 04/20/98: K.C. Chang: created.
 */

#ifndef _PrZebraDefn_h
#define _PrZebraDefn_h

#include "PrGlobalDefn.h"

#define PR_FORCESENSOR_ID       PR_ZEBRA_FS_ID

#define PR_ZEBRA_CHANNEL_COUNT  6

#define PR_FORCESENSOR_DOF      PR_ZEBRA_CHANNEL_COUNT

#define PR_ZEBRA_BIT_COUNT      10

/* define constants for conversion from binary to voltage */

/* 10bit AD */
#define PR_ZEBRA_AD_BIT_RANGE          1024    
/* range is -5V to 5V */
#define PR_ZEBRA_AD_VOLT_RANGE           10.0    
/* sign deals with inversion */

#define PR_ZEBRA_VOLTS_PER_BIT (-PR_ZEBRA_AD_VOLT_RANGE/PR_ZEBRA_AD_BIT_RANGE) 

#define PR_ZEBRA_OFFSET_ZERO           (PR_ZEBRA_AD_BIT_RANGE/2)


/* address offsets */
#define PR_ZEBRA_BASE                0xff90    /* Card Base Address */
#define PR_ZEBRA_ADDR_SPACE_SIZE     0x100     // XXX Guessed value
#define PR_ZEBRA_PORTA_1             (PR_ZEBRA_BASE+0)     
#define PR_ZEBRA_PORTB_1             (PR_ZEBRA_BASE+1)     
#define PR_ZEBRA_PORTC_1             (PR_ZEBRA_BASE+2)
#define PR_ZEBRA_PORTD_1             (PR_ZEBRA_BASE+3)    // control port
#define PR_ZEBRA_PORTA_2             (PR_ZEBRA_BASE+4)     
#define PR_ZEBRA_PORTB_2             (PR_ZEBRA_BASE+5)     
#define PR_ZEBRA_PORTC_2             (PR_ZEBRA_BASE+6)
#define PR_ZEBRA_PORTD_2             (PR_ZEBRA_BASE+7)    // control port
     
#define PR_ZEBRA_CONV1               0x08    
#define PR_ZEBRA_CONV2               0x08   
#define PR_ZEBRA_CONV3               0x80   
#define PR_ZEBRA_EOC1                0x10   
#define PR_ZEBRA_EOC2                0x20   
#define PR_ZEBRA_EOC3                0x40   

#define PR_ZEBRA_ADDR_MASK           0x07

#define PR_ZEBRA_CH_OFFSET_1         0
#define PR_ZEBRA_CH_OFFSET_2         0
#define PR_ZEBRA_CH_OFFSET_3         4


#define PR_ZEBRA_LO_MASK_1             0xff // >> 0      
#define PR_ZEBRA_LO_MASK_2             0xff // >> 0
#define PR_ZEBRA_LO_MASK_3             0xfc // >> 2

#define PR_ZEBRA_HI_MASK_1             0x03       
#define PR_ZEBRA_HI_MASK_2             0x03
#define PR_ZEBRA_HI_MASK_3             0x3c // >> 2


#define PR_ZEBRA_HI_SCALE_1           8 /* ( = 2^8) */ // << 8
#define PR_ZEBRA_HI_SCALE_2           8 /* ( = 2^8) */ // << 8
#define PR_ZEBRA_HI_SCALE_3           6  /* ( = 2^6) */ // << 8

#define PR_ZEBRA_LO_SCALE_1           0
#define PR_ZEBRA_LO_SCALE_2           0
#define PR_ZEBRA_LO_SCALE_3           2  /* ( = 2^6) */ // << 8


#define PR_ZEBRA_MODE_1              0x9a
#define PR_ZEBRA_MODE_2              0x98

#define PR_ZEBRA_ZERO                0x00

#endif // _PrZebraDefn_h
