Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _QEGPIOINT_H
00017 #define _QEGPIOINT_H
00018
00019 #include "property.h"
00020 #include "singleton.h"
00021 #include "9302hw.h"
00022
00023
00024 #define QEG_OBJECT 3
00025 #define QEG_PROP_WIDTH PROP_ID(QEG_OBJECT, 0)
00026
00027
00028 #define QEG_INTERRUPT_POSEDGE 0x0001
00029 #define QEG_INTERRUPT_NEGEDGE 0x0002
00030
00031 #define QEG_DEFAULT_BASE 0x440
00032 #define QEG_NUM_IO 16
00033
00034
00035
00036
00037
00038
00039
00057 class CQEGpioInt : public IProperty
00058 {
00059 public:
00063 SINGLETON(CQEGpioInt);
00064
00069 virtual int GetProperty(int property, long *value);
00070
00075 virtual int SetProperty(int property, long value);
00076
00088 void SetData(unsigned int data);
00089
00097 void SetDataBit(unsigned int bit);
00098
00106 void ResetDataBit(unsigned int bit);
00107
00117 void SetDataDirection(unsigned int direction);
00118
00127 unsigned int GetData();
00128
00133 unsigned int GetDataDirection();
00134
00146 int SetInterruptMode(unsigned int io, unsigned int mode);
00147
00155 int SetInterrupt(unsigned int io, bool enable);
00156
00168 int RegisterCallback(unsigned int io, void *userPointer, void (*callback)(unsigned int, struct timeval *, void *));
00169
00176 int UnregisterCallback(unsigned int io);
00177
00178 private:
00179 CQEGpioInt();
00180 ~CQEGpioInt();
00181
00182 int OpenDevice(unsigned int io);
00183 void CloseDevice(unsigned int io);
00184
00185 void SetSignal(bool set);
00186
00187 static void SigHandler(int signum);
00188
00189 static int m_fd[QEG_NUM_IO];
00190 static void (*m_callback[QEG_NUM_IO])(unsigned int, struct timeval *, void *);
00191 static void *m_userPointer[QEG_NUM_IO];
00192
00193 C9302Hardware *m_p9302hw;
00194 volatile unsigned short *m_data;
00195 volatile unsigned short *m_dataDir;
00196 volatile unsigned short *m_intMode;
00197 };
00198
00199 #endif