/* $Id: memtest.hh,v 1.8 2008-06-24 10:03:41 sybreon Exp $
|
/* $Id: memtest.hh,v 1.8 2008-06-24 10:03:41 sybreon Exp $
|
**
|
**
|
** VIRTUAL PERIPHERAL I/O LIBRARY
|
** VIRTUAL PERIPHERAL I/O LIBRARY
|
** Copyright (C) 2009 Shawn Tan
|
** Copyright (C) 2009 Shawn Tan
|
**
|
**
|
** This file is part of AEMB.
|
** This file is part of AEMB.
|
**
|
**
|
** AEMB is free software: you can redistribute it and/or modify it
|
** AEMB is free software: you can redistribute it and/or modify it
|
** under the terms of the GNU General Public License as published by
|
** under the terms of the GNU General Public License as published by
|
** the Free Software Foundation, either version 3 of the License, or
|
** the Free Software Foundation, either version 3 of the License, or
|
** (at your option) any later version.
|
** (at your option) any later version.
|
**
|
**
|
** AEMB is distributed in the hope that it will be useful, but WITHOUT
|
** AEMB is distributed in the hope that it will be useful, but WITHOUT
|
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
** License for more details.
|
** License for more details.
|
**
|
**
|
** You should have received a copy of the GNU General Public License
|
** You should have received a copy of the GNU General Public License
|
** along with AEMB. If not, see .
|
** along with AEMB. If not, see .
|
*/
|
*/
|
|
|
/*!
|
/*!
|
GPIO C++ Interface.
|
GPIO C++ Interface.
|
@file vpioGpio.hh
|
@file vpioGpio.hh
|
|
|
This file provides a C++ wrapper class to the low-level C interface.
|
This file provides a C++ wrapper class to the low-level C interface.
|
*/
|
*/
|
|
|
#ifndef VPIO_GPIO_HH
|
#ifndef VPIO_GPIO_HH
|
#define VPIO_GPIO_HH
|
#define VPIO_GPIO_HH
|
|
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
extern "C" {
|
extern "C" {
|
#endif
|
#endif
|
#include "vpioGpio.h"
|
#include "vpioGpio.h"
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
}
|
}
|
#endif
|
#endif
|
|
|
|
namespace vpio {
|
|
|
/*!
|
/*!
|
General-Purpose I/O Class.
|
General-Purpose I/O Class.
|
|
|
This is a C++ wrapper class around the low-level C code.
|
This is a C++ wrapper class around the low-level C code.
|
*/
|
*/
|
|
|
class vpioGpioClass : public vpioGpioRegs
|
class gpioClass : public gpioRegs
|
{
|
{
|
|
|
private:
|
private:
|
|
|
//vpioGpioClass(const vpioGpioClass&);
|
//gpioClass(const gpioClass&);
|
//vpioGpioClass();
|
//gpioClass();
|
vpioGpioClass& operator=(const vpioGpioClass&);
|
gpioClass& operator=(const gpioClass&);
|
|
|
public:
|
public:
|
|
|
//void IniPort(int base_addr) { this = (vpioGpioRegs*)base_addr; }
|
//void IniPort(int base_addr) { this = (gpioRegs*)base_addr; }
|
|
|
void SetBit(int bit) { vpioGpioSetBit( (vpioGpioRegs*)this, bit); } ///< @see vpioGpioSetBit
|
void SetBit(gpioData bit) { gpioSetBit( (gpioRegs*)this, bit); } ///< @see gpioSetBit
|
void ClrBit(int bit) { vpioGpioClrBit( (vpioGpioRegs*)this, bit); } ///< @see vpioGpioClrBit
|
void ClrBit(gpioData bit) { gpioClrBit( (gpioRegs*)this, bit); } ///< @see gpioClrBit
|
void TogBit(int bit) { vpioGpioTogBit( (vpioGpioRegs*)this, bit); } ///< @see vpioGpioTogBit
|
void TogBit(gpioData bit) { gpioTogBit( (gpioRegs*)this, bit); } ///< @see gpioTogBit
|
int GetBit(int bit) { return vpioGpioGetBit( (vpioGpioRegs*)this, bit); } ///< @see vpioGpioGetBit
|
gpioData GetBit(gpioData bit) { return gpioGetBit( (gpioRegs*)this, bit); } ///< @see gpioGetBit
|
|
|
// Port Manipulation
|
// Port Manipulation
|
void CfgPort(int mask) { vpioGpioCfgPort( (vpioGpioRegs*)this, mask); } ///< @see vpioGpioCfgPort
|
//void PutTris(gpioData mask) { gpioPutTris( (gpioRegs*)this, mask); } ///< @see gpioPutTris
|
void PutPort(int data) { vpioGpioPutPort( (vpioGpioRegs*)this, data); } ///< @see vpioGpioPutPort
|
void SetTris(gpioData mask) { gpioSetTris( (gpioRegs*)this, mask); } ///< @see gpioSetTris
|
void ClrPort() { vpioGpioClrPort( (vpioGpioRegs*)this ); } ///< @see vpioGpioClrPort
|
void PutData(gpioData data) { gpioPutData( (gpioRegs*)this, data); } ///< @see gpioPutData
|
int GetPort() { return vpioGpioGetPort( (vpioGpioRegs*)this ); } ///< @see vpioGpioGetPort
|
//void ClrPort() { gpioClrPort( (gpioRegs*)this ); } ///< @see gpioClrPort
|
|
//gpioData GetTris() { return gpioGetTris( (gpioRegs*)this ); } ///< @see gpioGetTris
|
|
gpioData GetData() { return gpioGetData( (gpioRegs*)this ); } ///< @see gpioGetData
|
|
|
|
void Init() { gpioInit( (gpioRegs*)this ); } ///< @see gpioInit
|
};
|
};
|
|
|
|
}
|
|
|
#endif
|
#endif
|
|
|