/***************************************************************
 * PrForceSensorJr3PCI.h
 *
 * Concrete derived class of PrForceSensorJr3 for PCI board.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 02/24/03: Weyn Ong : Created.
 */

#ifndef _PrForceSensorJr3PCI_h
#define _PrForceSensorJr3PCI_h

#include "PrForceSensorJr3.h"

class PrForceSensorJr3PCI : public PrForceSensorJr3 {
  public:
    // Most of the public functions are in the base class PrforceSensorJr3.

    // The 2-channel PCI controller card has one channel for force sensing
    // and the other for acceleration.  Instantiate this object with
    // FORCE_SENSOR to use the force sensor (which is the default).  The
    // PrAccelSensorJr3PCI class uses this class to do all its work, so it
    // instantiates this class with ACCEL_SENSOR.  The user should not
    // instantiate this class with ACCEL_SENSOR.

    enum Channel { FORCE_SENSOR, ACCEL_SENSOR };

    PrForceSensorJr3PCI( Channel channel = FORCE_SENSOR );

  protected:
    unsigned short readJr3( int addr );
    void writeJr3( int addr, int data );

  private:
    int toJr3PciAddr( int addr );
    unsigned int readJr3Pm( int addr );
    void writeJr3Pm( int addr, int data1, int data2 );
    unsigned short readJr3Dm( int addr );
    void writeJr3Dm( int addr, int data );
    void resetJr3( void );
    void getBaseAddr( void );
    int getBaseAddrWithOffset( int baseAddrOffset );
    void uploadDSPCode( void );
    void uploadDSPCodeToOneChannel( void );
    void setFullScales( void );

    int jr3BaseAddr_;   // Base address in process space.
    Channel channel_;
};

#endif // _PrForceSensorJr3PCI_h
