2017-10-21 06:11:49 +01:00
|
|
|
#ifndef WINUSBDRIVER_H
|
|
|
|
#define WINUSBDRIVER_H
|
|
|
|
|
|
|
|
//libusbK includes
|
|
|
|
#include <windows.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <conio.h>
|
|
|
|
#include "libusbk.h"
|
|
|
|
|
|
|
|
#include "genericusbdriver.h"
|
|
|
|
|
|
|
|
//winUsbDriver handles the Windows-specific parts of USB communication, through libusbK.
|
|
|
|
//See genericUsbDriver for the non-platform-specific parts.
|
|
|
|
class winUsbDriver : public genericUsbDriver
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
//Generic Functions
|
|
|
|
explicit winUsbDriver(QWidget *parent = 0);
|
|
|
|
~winUsbDriver();
|
|
|
|
void usbSendControl(uint8_t RequestType, uint8_t Request, uint16_t Value, uint16_t Index, uint16_t Length, unsigned char *LDATA);
|
|
|
|
char *isoRead(unsigned int *newLength);
|
2017-12-30 01:44:08 +00:00
|
|
|
void manualFirmwareRecovery(void);
|
2017-10-21 06:11:49 +01:00
|
|
|
private:
|
|
|
|
//USB Vars
|
|
|
|
KUSB_HANDLE handle = NULL;
|
|
|
|
//USBIso Vars
|
|
|
|
PKISO_CONTEXT isoCtx[NUM_ISO_ENDPOINTS][NUM_FUTURE_CTX];
|
|
|
|
KOVL_HANDLE ovlkHandle[NUM_ISO_ENDPOINTS][NUM_FUTURE_CTX];
|
|
|
|
KOVL_POOL_HANDLE ovlPool;
|
|
|
|
unsigned char dataBuffer[NUM_ISO_ENDPOINTS][NUM_FUTURE_CTX][ISO_PACKET_SIZE*ISO_PACKETS_PER_CTX];
|
|
|
|
//Generic Functions
|
|
|
|
unsigned char usbInit(unsigned long VIDin, unsigned long PIDin);
|
2018-09-10 23:46:15 +01:00
|
|
|
int usbIsoInit(void);
|
2017-10-21 06:11:49 +01:00
|
|
|
int flashFirmware(void);
|
|
|
|
bool allEndpointsComplete(int n);
|
|
|
|
signals:
|
|
|
|
public slots:
|
|
|
|
void isoTimerTick(void);
|
|
|
|
void recoveryTick();
|
|
|
|
void shutdownProcedure(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WINUSBDRIVER_H
|