stardundee.h
106 lines
| 3.5 KiB
| text/x-c
|
CLexer
/ rmapplugin / stardundee.h
r0 | #ifndef STARDUNDEE_H | |||
#define STARDUNDEE_H | ||||
#include <QWidget> | ||||
#include <QPushButton> | ||||
#include <QGridLayout> | ||||
#include <QSpinBox> | ||||
#include <QLabel> | ||||
r3 | #include <QSemaphore> | |||
r10 | #include <QTimer> | |||
#include <QDialog> | ||||
paul@pc-solar1.lab-lpp.local
|
r1 | #include "rmapoperations.h" | ||
r10 | #include "spw_usb_api.h" | |||
#include "spw_config_library.h" | ||||
r11 | #include "ccsds.h" | |||
r13 | #include "tmpackettoread.h" | |||
paul@pc-solar1.lab-lpp.local
|
r1 | |||
#define BWAIT_0 0 | ||||
#define BWAIT_1 1 | ||||
r11 | #define PATH_ADDRESSING_OFFSET 1 | |||
r0 | ||||
class StarDundee : public QWidget | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
explicit StarDundee(QWidget *parent = 0); | ||||
~StarDundee(); | ||||
r3 | unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0); | |||
unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0); | ||||
unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication); | ||||
r0 | ||||
r11 | unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | |||
r13 | QList<TMPacketToRead*> ccsdsPacketStore; | |||
r11 | ||||
r0 | signals: | |||
void sendMessage(QString message); | ||||
r3 | void isOpen(bool); | |||
paul@pc-solar1.lab-lpp.local
|
r1 | void RMAP_write_reply_setText(QString); | ||
void appendToLog(QString); | ||||
r3 | void ccsdsPacketAvailable(unsigned char*, unsigned int); | |||
r11 | void packetStoreNotEmpty(); | |||
r0 | ||||
public slots: | ||||
r6 | void Open(); | |||
void Close(); | ||||
r11 | void reTestSPWLink(); | |||
int receiveSPWPacketLoop(unsigned char requestID=0); | ||||
int receiveSPWPacket(unsigned char requestID=0); | ||||
r3 | void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | |||
void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | ||||
r11 | void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;} | |||
r10 | void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} | |||
// | ||||
void receivePollingLoop(); | ||||
r0 | ||||
private: | ||||
r3 | unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); | |||
unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); | ||||
r10 | void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();} | |||
void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();} | ||||
unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts); | ||||
r0 | ||||
r7 | unsigned int getLinkStatus(unsigned char link); | |||
r11 | unsigned int GetRoutingTableEntry(int tableEntry); | |||
r7 | ||||
r3 | unsigned char rmapTargetLogicalAddress ; | |||
unsigned char rmapSourceLogicalAddress ; | ||||
r5 | RMAP_command_codes commandCode; | |||
r3 | ||||
r0 | QLabel *usbDeviceNumber_LABEL; | |||
paul@pc-solar1.lab-lpp.local
|
r1 | QLabel *linkNumber_LABEL; | ||
r10 | QLabel *starDundeeStatusQueryDialogLabel; | |||
r0 | ||||
QSpinBox *usbDeviceNumber_SPINBOX; | ||||
paul@pc-solar1.lab-lpp.local
|
r1 | QSpinBox *linkNumber_SPINBOX; | ||
QGridLayout *connection_LAYOUT; | ||||
r10 | QGridLayout *starDundeeStatusQueryDialogLayout; | |||
QDialog *starDundeeStatusQueryDialog; | ||||
QPushButton *starDundeeStatusQueryRetryButton; | ||||
QPushButton *starDundeeStatusQueryAbortButton; | ||||
QTimer *timer; | ||||
paul@pc-solar1.lab-lpp.local
|
r1 | |||
r11 | unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data | |||
USB_SPACEWIRE_ID pIdentifierRead; // A pointer to a variable which will be set to contain a unique identifier for the read | ||||
USB_SPACEWIRE_ID pIdentifier; | ||||
paul@pc-solar1.lab-lpp.local
|
r1 | |||
star_device_handle hDevice; // Handle to the SpaceWire device | ||||
USB_SPACEWIRE_STATUS result; // The result of the send operation | ||||
r0 | ||||
r3 | // Packet receiver | |||
QSemaphore *rmapPacketSEMAPHORE; | ||||
QSemaphore *ccsdsPacketSEMAPHORE; | ||||
char* rmapPacket; // The buffer to receive RMAP READ packets | ||||
unsigned char *ccsdsPacket; | ||||
char *spwPacket; | ||||
unsigned int rmapPacketSize; | ||||
unsigned int ccsdsPacketSize; | ||||
r0 | }; | |||
#endif // STARDUNDEE_H | ||||