stardundee.h
134 lines
| 4.4 KiB
| text/x-c
|
CLexer
r69 | #ifndef STARDUNDEE_H | |||
#define STARDUNDEE_H | ||||
#include <QWidget> | ||||
#include <QPushButton> | ||||
#include <QGridLayout> | ||||
#include <QSpinBox> | ||||
#include <QLabel> | ||||
#include <QSemaphore> | ||||
#include <QTimer> | ||||
#include <QDialog> | ||||
#include <arbitrarytime.h> | ||||
#include <TC_types.h> | ||||
#include <paulcommoncrc.h> | ||||
#include "rmapoperations.h" | ||||
#include "spw_usb_api.h" | ||||
#include "spw_config_library.h" | ||||
#include "ccsds.h" | ||||
#include "tmpackettoread.h" | ||||
#define BWAIT_0 0 | ||||
#define BWAIT_1 1 | ||||
#define PATH_ADDRESSING_OFFSET 1 | ||||
class StarDundee : public QWidget | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
explicit StarDundee(QWidget *parent = 0); | ||||
~StarDundee(); | ||||
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); | ||||
unsigned int storeCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size); | ||||
void initializeTimecodeGeneration(); | ||||
void sendUpdateTime(long time); | ||||
signals: | ||||
void sendMessage(QString message); | ||||
void sendPacket(TMPacketToRead*); | ||||
void isOpen(bool); | ||||
void RMAP_write_reply_setText(QString); | ||||
void appendToLog(QString); | ||||
public slots: | ||||
bool Open(); | ||||
void Close(); | ||||
void reTestSPWLink(); | ||||
int receiveSPWPacketLoop(unsigned char requestID=0); | ||||
int receiveSPWPacket(unsigned char requestID=0); | ||||
void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;} | ||||
void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;} | ||||
void sourceHasChanged(int source) {rmapSourceLogicalAddress = (unsigned char) source;} | ||||
void spaceWireLinkHasChanged(unsigned char spaceWireLink); | ||||
void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();} | ||||
// | ||||
void receivePollingLoop(); | ||||
// TIMECODES | ||||
void sendOneTimecode(); | ||||
void sendTimecodePeriodically(); | ||||
void startSendingTimecodePeriodically( unsigned char onOff ); | ||||
void sendOneTimePacketAndOneTimecode(); | ||||
void sendOneTimePacketAndTimecodePeriodically(); | ||||
void updateTimeToSend(long timeToSend); | ||||
private: | ||||
unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0); | ||||
unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0); | ||||
void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();} | ||||
void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();} | ||||
unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts); | ||||
unsigned int GetRoutingTableEntry(int tableEntry); | ||||
unsigned int getLinkStatus(unsigned char link); | ||||
unsigned char getPacketFirstByte(); | ||||
unsigned char rmapTargetLogicalAddress ; | ||||
unsigned char rmapSourceLogicalAddress ; | ||||
RMAP_command_codes commandCode; | ||||
QLabel *usbDeviceNumber_LABEL; | ||||
QLabel *linkNumber_LABEL; | ||||
QLabel *starDundeeStatusQueryDialogLabel; | ||||
QLabel *statusLink1; | ||||
QLabel *statusLink2; | ||||
QSpinBox *usbDeviceNumber_SPINBOX; | ||||
QSpinBox *linkNumber_SPINBOX; | ||||
QGridLayout *connection_LAYOUT; | ||||
QGridLayout *starDundeeStatusQueryDialogLayout; | ||||
QDialog *starDundeeStatusQueryDialog; | ||||
QPushButton *starDundeeStatusQueryRetryButton; | ||||
QPushButton *starDundeeStatusQueryAbortButton; | ||||
QPushButton *starDundeeStatusQueryContinueButton; | ||||
QPushButton *starDundeeSendOneTimecode; | ||||
QPushButton *starDundeeSendOneTimePacketAndOneTimecode; | ||||
QPushButton *starDundeeSendTimecodePeriodically; | ||||
QPushButton *starDundeeSendOneTimePacketAndTimecodePeriodically; | ||||
ArbitraryTime *arbitraryTime; | ||||
long arbitraryTimeToSend; | ||||
PaulCommonCRC *paulCommonCRC; | ||||
bool flag_sendTimecodePeriodically; | ||||
QTimer *timer; | ||||
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; | ||||
star_device_handle hDevice; // Handle to the SpaceWire device | ||||
USB_SPACEWIRE_STATUS result; // The result of the send operation | ||||
// 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; | ||||
}; | ||||
#endif // STARDUNDEE_H | ||||