Skip to content

Commit 49783ae

Browse files
committed
Moved HAL type to chip info structure
1 parent ca16c0c commit 49783ae

11 files changed

+15
-25
lines changed

qt/chip_db.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
#include "chip_info.h"
1010
#include <QStringList>
1111

12-
enum CHIP_HAL
13-
{
14-
CHIP_HAL_PARALLEL = 0,
15-
CHIP_HAL_SPI = 1
16-
};
17-
1812
class ChipDb
1913
{
2014
public:
@@ -26,7 +20,6 @@ class ChipDb
2620
virtual uint32_t extendedPageSizeGetByName(const QString &name) = 0;
2721
virtual uint32_t totalSizeGetByName(const QString &name) = 0;
2822
virtual uint32_t extendedTotalSizeGetByName(const QString &name) = 0;
29-
virtual uint8_t getHal() = 0;
3023
virtual ChipInfo *getChipInfo(int chipIndex) = 0;
3124
QString getChipName(int chipIndex);
3225
int setChipName(int chipIndex, const QString &name);

qt/chip_info.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ enum
5050
CHIP_PARAM_NUM,
5151
};
5252

53+
enum CHIP_HAL
54+
{
55+
CHIP_HAL_PARALLEL = 0,
56+
CHIP_HAL_SPI = 1
57+
};
58+
5359
class ChipInfo
5460
{
5561
protected:
@@ -64,6 +70,7 @@ class ChipInfo
6470
uint32_t spareSize;
6571
uint32_t bbMarkOffset;
6672
uint32_t params[CHIP_PARAM_NUM];
73+
uint32_t hal;
6774

6875
virtual const QByteArray &getHalConf() = 0;
6976
};

qt/main_window.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ void MainWindow::slotSelectChip(int selectedChipNum)
515515
SLOT(slotProgSelectCompleted(int)));
516516

517517
if (chipInfo)
518-
prog->confChip(chipInfo, currentChipDb->getHal());
518+
prog->confChip(chipInfo);
519519
}
520520

521521
void MainWindow::slotProgDetectChipReadChipIdCompleted(int status)
@@ -545,7 +545,7 @@ void MainWindow::slotProgDetectChipReadChipIdCompleted(int status)
545545

546546
if (chipName.isEmpty())
547547
{
548-
if (currentChipDb->getHal() == spiChipDb.getHal())
548+
if (currentChipDb == &spiChipDb)
549549
qInfo() << "Chip not found in database";
550550
else
551551
{
@@ -591,7 +591,7 @@ void MainWindow::detectChip(ChipDb *chipDb)
591591

592592
connect(prog, SIGNAL(confChipCompleted(int)), this,
593593
SLOT(slotProgDetectChipConfCompleted(int)));
594-
prog->confChip(chipInfo, currentChipDb->getHal());
594+
prog->confChip(chipInfo);
595595
}
596596

597597
void MainWindow::slotDetectChip()

qt/parallel_chip_db.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,3 @@ int ParallelChipDb::setChipParam(int chipIndex, int paramIndex,
560560

561561
return 0;
562562
}
563-
564-
uint8_t ParallelChipDb::getHal()
565-
{
566-
return CHIP_HAL_PARALLEL;
567-
}

qt/parallel_chip_db.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class ParallelChipDb : public ChipDb
6161
bool isOptParamValid(uint32_t param, uint32_t min, uint32_t max);
6262
uint32_t getChipParam(int chipIndex, int paramIndex);
6363
int setChipParam(int chipIndex, int paramIndex, uint32_t paramValue);
64-
uint8_t getHal();
6564
};
6665

6766
#endif // PARALLEL_CHIP_DB_H

qt/parallel_chip_info.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ typedef struct __attribute__((__packed__))
3333

3434
ParallelChipInfo::ParallelChipInfo()
3535
{
36+
hal = CHIP_HAL_PARALLEL;
3637
}
3738

3839
ParallelChipInfo::~ParallelChipInfo()

qt/programmer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,12 @@ void Programmer::confChipCb(int ret)
295295
emit confChipCompleted(ret);
296296
}
297297

298-
void Programmer::confChip(ChipInfo *chipInfo, uint8_t hal)
298+
void Programmer::confChip(ChipInfo *chipInfo)
299299
{
300300
ConfCmd confCmd;
301301

302302
confCmd.cmd.code = CMD_NAND_CONF;
303-
confCmd.hal = hal;
303+
confCmd.hal = chipInfo->hal;
304304
confCmd.pageSize = chipInfo->pageSize;
305305
confCmd.blockSize = chipInfo->blockSize;
306306
confCmd.totalSize = chipInfo->totalSize;

qt/programmer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Programmer : public QObject
8282
void writeChip(uint8_t *buf, uint32_t addr, uint32_t len,
8383
uint32_t pageSize);
8484
void readChipBadBlocks();
85-
void confChip(ChipInfo *chipInfo, uint8_t hal);
85+
void confChip(ChipInfo *chipInfo);
8686
void detectChip();
8787
QString fwVersionToString(FwVersion fwVersion);
8888
void firmwareUpdate(const QString &fileName);

qt/spi_chip_db.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,3 @@ int SpiChipDb::setChipParam(int chipIndex, int paramIndex,
560560

561561
return 0;
562562
}
563-
564-
uint8_t SpiChipDb::getHal()
565-
{
566-
return CHIP_HAL_SPI;
567-
}

qt/spi_chip_db.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class SpiChipDb : public ChipDb
6161
bool isOptParamValid(uint32_t param, uint32_t min, uint32_t max);
6262
uint32_t getChipParam(int chipIndex, int paramIndex);
6363
int setChipParam(int chipIndex, int paramIndex, uint32_t paramValue);
64-
uint8_t getHal();
6564
};
6665

6766
#endif // SPI_CHIP_DB_H

0 commit comments

Comments
 (0)