Skip to content

Commit

Permalink
Added support 25xx SPI EEPROM chips
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbigmdm committed Feb 12, 2024
1 parent 9bf1493 commit 2463fae
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 508 deletions.
Binary file modified IMSProg_programmer/database/IMSProg.Dat
Binary file not shown.
44 changes: 33 additions & 11 deletions IMSProg_programmer/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include <stddef.h>
#include <stdint.h>


#include<QDebug>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
Expand Down Expand Up @@ -61,6 +58,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->comboBox_type->addItem("SPI_FLASH", 0);
ui->comboBox_type->addItem("24_EEPROM", 1);
ui->comboBox_type->addItem("93_EEPROM", 2);
ui->comboBox_type->addItem("25_EEPROM", 3);
ui->comboBox_type->addItem("95_EEPROM", 4);

ui->comboBox_addr4bit->addItem("No", 0);
Expand Down Expand Up @@ -160,15 +158,19 @@ void MainWindow::on_pushButton_clicked()
if (statusCH341 == 0)
{
ui->crcEdit->setText("");
if (((currentNumBlocks > 0) && (currentBlockSize >0) && (currentChipType == 0)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 1)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 2)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 4)))
if (((currentNumBlocks > 0) && (currentBlockSize >0) && (currentChipType == 0)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 1)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 2)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 3)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 4)))
{
doNotDisturb();
if (currentChipType == 1)
{
currentBlockSize = 128;
currentNumBlocks = currentChipSize / currentBlockSize;
}
if ((currentChipType == 2) || (currentChipType == 4))
if ((currentChipType == 2) ||(currentChipType == 3) || (currentChipType == 4))
{
currentBlockSize = currentPageSize;
currentNumBlocks = currentChipSize / currentBlockSize;
Expand Down Expand Up @@ -205,6 +207,8 @@ void MainWindow::on_pushButton_clicked()
res = Read_EEPROM_3wire_param(buf, static_cast<int>(curBlock * currentBlockSize), static_cast<int>(currentBlockSize), static_cast<int>(currentChipSize), currentAlgorithm);
if (res==0) res = 1;
break;
case 3:
//25xxx
case 4:
//95xxx
res = s95_read_param(buf,curBlock * currentBlockSize, currentBlockSize, currentBlockSize, currentAlgorithm);
Expand Down Expand Up @@ -463,7 +467,7 @@ void MainWindow::on_actionErase_triggered()
full_erase_chip();
sleep(1);
}
if (currentChipType == 4)
if ((currentChipType == 4) || ((currentChipType == 3) && ((currentAlgorithm & 0x20) == 0)))
{
uint32_t curBlock = 0;
uint32_t k;
Expand Down Expand Up @@ -501,12 +505,17 @@ void MainWindow::on_actionErase_triggered()
}
}
}
if ((currentChipType == 3) && ((currentAlgorithm & 0x20) > 0))
{
ui->progressBar->setValue(50);
s95_full_erase();
sleep(1);
}
if (currentChipType == 2)
{
config_stream(1);
mw_gpio_init();
ui->progressBar->setValue(50);
//mw_eeprom_erase(0, currentChipSize);
Erase_EEPROM_3wire_param(currentAlgorithm);
sleep(1);
}
Expand Down Expand Up @@ -657,15 +666,19 @@ void MainWindow::on_actionWrite_triggered()
statusCH341 = ch341a_init(currentChipType);
if (statusCH341 == 0)
{
if (((currentNumBlocks > 0) && (currentBlockSize >0) && (currentChipType == 0)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 1)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 2)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 4)))
if (((currentNumBlocks > 0) && (currentBlockSize >0) && (currentChipType == 0)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 1)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 2)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 3)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 4)))
{
doNotDisturb();
if (currentChipType == 1)
{
currentBlockSize = 128;
currentNumBlocks = currentChipSize / currentBlockSize;
}
if ((currentChipType == 2) || (currentChipType == 4))
if ((currentChipType == 2) || (currentChipType == 3) || (currentChipType == 4))
{
currentBlockSize = currentPageSize;
currentNumBlocks = currentChipSize / currentBlockSize;
Expand Down Expand Up @@ -705,6 +718,8 @@ void MainWindow::on_actionWrite_triggered()
res = Write_EEPROM_3wire_param(buf, static_cast<int>(curBlock * currentBlockSize), static_cast<int>(currentBlockSize), static_cast<int>(currentChipSize), currentAlgorithm);
if (res==0) res = 1;
break;
case 3:
//25xxx
case 4:
//M95xx
res = s95_write_param(buf, addr, currentBlockSize, currentBlockSize, currentAlgorithm);
Expand Down Expand Up @@ -873,7 +888,11 @@ void MainWindow::on_actionVerify_triggered()
statusCH341 = ch341a_init(currentChipType);
if (statusCH341 == 0)
{
if (((currentNumBlocks > 0) && (currentBlockSize >0) && (currentChipType == 0)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 1)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 2)) || ((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 4)))
if (((currentNumBlocks > 0) && (currentBlockSize >0) && (currentChipType == 0)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 1)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 2)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 3)) ||
((currentNumBlocks > 0) && (currentPageSize >0) && (currentChipType == 4)))
{
ui->crcEdit->setText("");
doNotDisturb();
Expand All @@ -882,7 +901,7 @@ void MainWindow::on_actionVerify_triggered()
currentBlockSize = 128;
currentNumBlocks = currentChipSize / currentBlockSize;
}
if ((currentChipType == 2) || (currentChipType == 4))
if ((currentChipType == 2) || (currentChipType == 3) || (currentChipType == 4))
{
currentBlockSize = currentPageSize;
currentNumBlocks = currentChipSize / currentBlockSize;
Expand Down Expand Up @@ -918,6 +937,8 @@ void MainWindow::on_actionVerify_triggered()
res = Read_EEPROM_3wire_param(buf, static_cast<int>(curBlock * currentBlockSize), static_cast<int>(currentBlockSize), static_cast<int>(currentChipSize), currentAlgorithm);
if (res==0) res = 1;
break;
case 3:
//25xxx
case 4:
//95xxx
res = s95_read_param(buf,curBlock * currentBlockSize, currentBlockSize, currentBlockSize, currentAlgorithm);
Expand Down Expand Up @@ -1312,6 +1333,7 @@ void MainWindow::on_pushButton_4_clicked()
if ((currentChipType == 0) && (ui->comboBox_vcc->currentIndex() == 2)) infoDialog->setChip(3);
if ((currentChipType == 1) && (ui->comboBox_vcc->currentIndex() == 1)) infoDialog->setChip(1);
if ((currentChipType == 2) && (ui->comboBox_vcc->currentIndex() == 1)) infoDialog->setChip(4);
if ((currentChipType == 3) && (ui->comboBox_vcc->currentIndex() == 1)) infoDialog->setChip(2);
if ((currentChipType == 4) && (ui->comboBox_vcc->currentIndex() == 1)) infoDialog->setChip(2);
}

Expand Down
2 changes: 2 additions & 0 deletions IMSProg_programmer/snorcmd_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ void support_snor_list(void);
int snor_read_devid(u8 *rxbuf, int n_rx);
int s95_read_param(unsigned char *buf, unsigned long from, unsigned long len, unsigned int sector_size, unsigned char currentAlgorithm);
int s95_write_param(unsigned char *buf, unsigned long to, unsigned long len, unsigned int sector_size, unsigned char currentAlgorithm);
int s95_unprotect(void);
int s95_full_erase(void);
#endif /* __SNORCMD_API_H__ */
/* End of [snorcmd_api.h] package */
Loading

0 comments on commit 2463fae

Please sign in to comment.