/***************************************************************
 * PrIOWrap.h
 *
 * This is a wrapper class providing the interface
 * for hardware IO functions.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 10/26/97: K.C. Chang: created.
 * 02/22/03: Weyn Ong  : Version for QNX 6.
 */

#ifndef _PrIOWrap_h
#define _PrIOWrap_h

#include <hw/inout.h>

// input*() returns the value peeked
// output*() returns the value poked

class PrIOWrap
{
  public:
    // peek one byte
    inline unsigned int input1B(int hwPort) const
      { return in8(hwPort); }
    // poke one byte
    inline unsigned int output1B(int hwPort, unsigned int value) const
      { out8(hwPort,value); 
        return value; }

    // peek two bytes
    inline unsigned int input2B(int hwPort) const
      { return in16(hwPort); }
    // poke two bytes
    inline unsigned int output2B(int hwPort, unsigned int value) const
      { out16(hwPort,value); 
        return value; }

    // peek four bytes
    inline unsigned long input4B(int hwPort) const
      { return in32(hwPort); }
    // poke four bytes
    inline unsigned long output4B(int hwPort, unsigned int value) const
      { out32(hwPort,value); 
        return value; }
};

#endif //_PrIOWrap_h


