Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
UioIrq.h
Go to the documentation of this file.
1 /*
2  * UioIrq.h
3  *
4  * Created on: April 1st, 2020
5  * Author: jcormier
6  */
7 
8 #ifndef UIOIRQ_H
9 #define UIOIRQ_H
10 
11 #include <string>
12 #include <chrono>
13 #include <functional>
14 #include <thread>
15 
16 class tcUioIrq
17 {
18 public:
19  tcUioIrq(std::string acName, std::string acUioPath = std::string());
20  virtual ~tcUioIrq();
21 
22  bool initialize();
23  void close_fd();
24  bool opened() const;
25 
26  std::string name() { return mcName; }
27  std::string path() { return mcUioPath; }
28 
29  int write_enable_irq();
30 
31  int waitForInterrupt(std::chrono::microseconds anTimeout);
32 
33  void set_irq_handler(std::function<void(int)> apIrqHandler) { mpIrqHandler = apIrqHandler; }
34  bool enable_irq_monitor(bool abEnable);
35 
36 private:
37  std::string get_uio_path() const;
38  void monitor_thread();
39 
40  std::string mcName;
41  std::string mcUioPath;
42 
43  int mnUIO_FD;
44  int mnLastInt;
45 
46  std::thread mcMonitorThread;
47  bool mbShutdownThread;
48  std::function<void(int)> mpIrqHandler;
49 };
50 
51 #endif // UIOIRQ_H
tcUioIrq::enable_irq_monitor
bool enable_irq_monitor(bool abEnable)
Definition: UioIrq.cpp:207
tcUioIrq::~tcUioIrq
virtual ~tcUioIrq()
Definition: UioIrq.cpp:47
tcUioIrq::opened
bool opened() const
Definition: UioIrq.cpp:109
tcUioIrq::initialize
bool initialize()
Definition: UioIrq.cpp:57
tcUioIrq::name
std::string name()
Definition: UioIrq.h:26
tcUioIrq
Definition: UioIrq.h:16
tcUioIrq::set_irq_handler
void set_irq_handler(std::function< void(int)> apIrqHandler)
Definition: UioIrq.h:33
tcUioIrq::tcUioIrq
tcUioIrq(std::string acName, std::string acUioPath=std::string())
Definition: UioIrq.cpp:38
tcUioIrq::path
std::string path()
Definition: UioIrq.h:27
tcUioIrq::waitForInterrupt
int waitForInterrupt(std::chrono::microseconds anTimeout)
tcUioIrq::waitForInterrupt Wait for the Uio device to generate an interrupt
Definition: UioIrq.cpp:155
tcUioIrq::write_enable_irq
int write_enable_irq()
Definition: UioIrq.cpp:139
tcUioIrq::close_fd
void close_fd()
Definition: UioIrq.cpp:97