pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
GPIO.h
1#ifndef PFLIB_GPIO_H_
2#define PFLIB_GPIO_H_
3
4#include "pflib/WishboneTarget.h"
5#include <vector>
6
7namespace pflib {
8
12class GPIO : public WishboneTarget {
13 public:
14 GPIO(WishboneInterface* wb, int target = tgt_GPIO) : WishboneTarget(wb,target) {
15 ngpi_=-1;
16 ngpo_=-1;
17 }
18
22 int getGPOcount();
23
27 int getGPIcount();
28
32 bool getGPI(int ibit);
33
38
42 void setGPO(int ibit, bool toTrue);
43
47 void setGPO(const std::vector<bool>& bits);
48
53
55 bool getGPI_single(int ibit) { return getGPI(ibit); }
56 std::vector<bool> getGPI_all() { return getGPI(); }
57 void setGPO_single(int ibit, bool t) { return setGPO(ibit,t); }
58 void setGPO_all(const std::vector<bool>& b) { return setGPO(b); }
59
60 private:
64 int ngpi_, ngpo_;
65
66};
67
68}
69
70#endif // PFLIB_GPIO_H_
Representation of GPIO controller in the Polarfire.
Definition: GPIO.h:12
bool getGPI_single(int ibit)
convenience wrapper for python bindings
Definition: GPIO.h:55
std::vector< bool > getGPI()
Read all GPI bits.
Definition: GPIO.cxx:38
void setGPO(int ibit, bool toTrue)
Set a single GPO bit.
Definition: GPIO.cxx:52
std::vector< bool > getGPO()
Read all GPO bits.
Definition: GPIO.cxx:82
int getGPOcount()
Get the number of GPO bits.
Definition: GPIO.cxx:15
int ngpi_
Cached numbers of GPI and GPO bits.
Definition: GPIO.h:64
int getGPIcount()
Get the number of GPI bits.
Definition: GPIO.cxx:21
Abstract interface for wishbone transactions, used by ~all classes in pflib.
Definition: WishboneInterface.h:15
Parent class for standard wishbone targets providing some utilities.
Definition: WishboneTarget.h:29
WishboneTarget(WishboneInterface *wb, int target)
simply store pointer to interface and target we will interact with
Definition: WishboneTarget.h:34
Polarfire Interaction Library.
Definition: Backend.h:8