1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

GCS/qymodem: Replace uintxx_t with quintxx to make it compile on Linux.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@444 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
ephy 2010-04-09 07:34:26 +00:00 committed by ephy
parent 1ec4775be6
commit 0668c7e01f
6 changed files with 21 additions and 23 deletions

View File

@ -21,10 +21,10 @@
#include "qymodem.h"
uint16_t QymodemBase::UpdateCRC16(uint16_t crcIn, uint8_t byte)
quint16 QymodemBase::UpdateCRC16(quint16 crcIn, quint8 byte)
{
uint32_t crc = crcIn;
uint32_t in = byte|0x100;
quint32 crc = crcIn;
quint32 in = byte|0x100;
do
{
crc <<= 1;
@ -39,9 +39,9 @@ uint16_t QymodemBase::UpdateCRC16(uint16_t crcIn, uint8_t byte)
}
uint16_t QymodemBase::CRC16(const char* data, size_t size)
quint16 QymodemBase::CRC16(const char* data, size_t size)
{
uint32_t crc = 0;
quint32 crc = 0;
const char* dataEnd = data+size;
while(data<dataEnd)
crc = UpdateCRC16(crc,*data++);
@ -51,7 +51,7 @@ uint16_t QymodemBase::CRC16(const char* data, size_t size)
}
uint8_t QymodemBase::Checksum(const char* data, size_t size)
quint8 QymodemBase::Checksum(const char* data, size_t size)
{
int sum = 0;
const char* dataEnd = data+size;

View File

@ -41,7 +41,7 @@ protected:
@return Sum of bytes in data, modulo 256.
*/
uint8_t Checksum(const char* data, size_t size);
quint8 Checksum(const char* data, size_t size);
/**
Calculate CRC for a block of data.
@ -51,7 +51,7 @@ protected:
@return CRC of data.
*/
uint16_t CRC16(const char* data, size_t size);
quint16 CRC16(const char* data, size_t size);
/**
Update CRC value by accumulating another byte of data.
@ -61,7 +61,7 @@ protected:
@return Updated CRC value.
*/
uint16_t UpdateCRC16(uint16_t crcIn, uint8_t byte);
quint16 UpdateCRC16(quint16 crcIn, quint8 byte);
/**
Receive a single character.

View File

@ -155,14 +155,14 @@ change_mode:
// append checksum/crc...
if(SendCRC)
{
uint16_t crc = CRC16(block+3,blockSize);
quint16 crc = CRC16(block+3,blockSize);
blockSize += 3;
block[blockSize++] = (uint8_t)(crc>>8);
block[blockSize++] = (uint8_t)crc;
block[blockSize++] = (quint8)(crc>>8);
block[blockSize++] = (quint8)crc;
}
else
{
uint8_t sum = Checksum(block+3,blockSize);
quint8 sum = Checksum(block+3,blockSize);
blockSize += 3;
block[blockSize++] = sum;
}

View File

@ -115,7 +115,7 @@ private:
bool SendCRC;
bool WaitForBlockACK;
bool Use1KBlocks;
uint8_t ModeChar;
quint8 ModeChar;
int CancelCount;
};

View File

@ -97,9 +97,9 @@ public:
*/
int In(char* data, size_t size, int * percent)
{
*percent = TotalSize ? ((uint64_t)TransferredSize*(uint64_t)100)/(uint64_t)TotalSize : 0;
*percent = TotalSize ? ((quint64)TransferredSize*(qint64)100)/(quint64)TotalSize : 0;
fflush(stdout);
size=fread(data,sizeof(uint8_t),size,File);
size=fread(data,sizeof(quint8),size,File);
if(size)
{
TransferredSize += size;

View File

@ -1,8 +1,10 @@
include(../../../openpilotgcslibrary.pri)
PROJECT = qymodem
TEMPLATE = lib
TARGET = QYModem
DEFINES += QYMODEM_LIBRARY
TARGET = Qymodem
include(../../../openpilotgcslibrary.pri)
include(../../../libs/qextserialport/qextserialport.pri)
# CONFIG += staticlib
SOURCES += qymodem.cpp \
qymodem_TX.cpp \
@ -11,9 +13,5 @@ HEADERS += qymodem_TX.h \
qymodem.h \
qymodemsend.h
CONFIG(debug, debug|release):LIBS += -lqextserialportd
else:LIBS += -lqextserialport
win32:LIBS += -lsetupapi