├── IMSProg_editor ├── 1.txt ├── CMakeLists.txt ├── IMSProg_editor.pro ├── IMSProg_editor.pro.user ├── LICENSE ├── README.md ├── delegates.cpp ├── delegates.h ├── ezp_chip_editor.cpp ├── ezp_chip_editor.h ├── ezp_chip_editor.ui ├── img │ ├── arrow.png │ ├── chipEdit64.png │ ├── del.png │ ├── excel.png │ ├── exit.png │ ├── ezp_editor.png │ ├── import.png │ ├── open.png │ ├── plus.jpeg │ ├── plus.png │ ├── redo.png │ ├── save.png │ ├── tocsv.png │ └── undo.png ├── language │ ├── chipEditor_de_DE.qm │ ├── chipEditor_de_DE.ts │ ├── chipEditor_es_ES.qm │ ├── chipEditor_es_ES.ts │ ├── chipEditor_ru_RU.qm │ └── chipEditor_ru_RU.ts ├── main.cpp ├── other │ └── IMSProg_editor.desktop └── resources.qrc ├── IMSProg_programmer ├── 99-ch341a-prog.rules ├── CH341a.pro.user ├── CMakeLists.txt ├── IMSProg.pro ├── IMSProg.pro.user ├── LICENSE ├── Makefile ├── QHexEditPlugin.cpp ├── QHexEditPlugin.h ├── README.md ├── bitbang_microwire.c ├── bitbang_microwire.h ├── ch341a_gpio.c ├── ch341a_gpio.h ├── ch341a_i2c.c ├── ch341a_i2c.h ├── ch341a_spi.c ├── ch341a_spi.h ├── ch341funcs.c ├── ch341funcs.h ├── chunks.cpp ├── chunks.h ├── cmake │ └── FindLibUSB.cmake ├── commands.cpp ├── commands.h ├── database │ └── IMSProg.Dat ├── dialogabout.cpp ├── dialogabout.h ├── dialogabout.ui ├── dialogrp.cpp ├── dialogrp.h ├── dialogrp.ui ├── dialogsp.cpp ├── dialogsp.h ├── dialogsp.ui ├── flashcmd_api.c ├── flashcmd_api.h ├── i2c_eeprom.c ├── i2c_eeprom_api.h ├── img │ ├── CH341_icons.psd │ ├── CH341_icons64.psd │ ├── IMSProg.png │ ├── ch341_black150.png │ ├── ch341_green150.png │ ├── checkSum64.png │ ├── chipEdit64.png │ ├── erase64.png │ ├── exit64.png │ ├── hexsearch64.png │ ├── loadBlock64.png │ ├── open64.png │ ├── read64.png │ ├── redo64.png │ ├── save64.png │ ├── saveBlock64.png │ ├── test64.png │ ├── undo.png │ ├── unprotect64.png │ ├── verify64.png │ └── write64.png ├── language │ ├── chipProgrammer_de_DE.qm │ ├── chipProgrammer_de_DE.ts │ ├── chipProgrammer_es_ES.qm │ ├── chipProgrammer_es_ES.ts │ ├── chipProgrammer_ru_RU.qm │ └── chipProgrammer_ru_RU.ts ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── mw_eeprom.c ├── mw_eeprom_api.h ├── nandcmd_api.h ├── other │ ├── 99-CH341.rules │ └── IMSProg.desktop ├── qhexedit.cpp ├── qhexedit.h ├── qhexedit.sip ├── recource.qrc ├── res.h ├── res.qrc ├── searchdialog.cpp ├── searchdialog.h ├── searchdialog.ui ├── snander.rc ├── snorcmd_api.h ├── spi_controller.c ├── spi_controller.h ├── spi_eeprom.c ├── spi_eeprom.h ├── spi_eeprom_api.h ├── spi_nand_flash.c ├── spi_nand_flash.h ├── spi_nor_flash.c ├── timer.c ├── timer.h └── types.h ├── LICENSE ├── README.md ├── build ├── IMSProg .appimage ├── IMSProg.Dat ├── IMSProg.appimage └── IMSProg_editor.appimage └── img ├── 1_8_adapter.png ├── 93xxx_adapter.png ├── CH341_icons.psd ├── CH341_icons64.psd ├── IMSProg.png ├── ch341_black150.png ├── ch341_green150.png ├── checkSum64.png ├── chipEdit64.png ├── erase64.png ├── exit64.png ├── hexsearch64.png ├── loadBlock64.png ├── open64.png ├── read64.png ├── redo64.png ├── save64.png ├── saveBlock64.png ├── test64.png ├── undo.png ├── unprotect64.png ├── verify64.png └── write64.png /IMSProg_editor/1.txt: -------------------------------------------------------------------------------- 1 | итого 144 2 | -rw-rw-r-- 1 mimi mimi 0 авг 18 08:44 1.txt 3 | -rw-rw-r-- 1 mimi mimi 2384 авг 18 08:27 CmakeList.txt 4 | -rw-rw-r-- 1 mimi mimi 6082 авг 2 12:46 delegates.cpp 5 | -rw-rw-r-- 1 mimi mimi 3424 авг 2 12:46 delegates.h 6 | -rw-rw-r-- 1 mimi mimi 31727 авг 2 12:46 ezp_chip_editor.cpp 7 | -rw-rw-r-- 1 mimi mimi 3136 авг 2 12:46 ezp_chip_editor.h 8 | -rw-rw-r-- 1 mimi mimi 6384 авг 18 07:41 ezp_chip_editor.ui 9 | drwxrwxr-x 2 mimi mimi 4096 авг 18 08:28 img 10 | -rw-rw-r-- 1 mimi mimi 2236 авг 18 07:38 IMSProg_editor.pro 11 | -rw-rw-r-- 1 mimi mimi 24153 авг 18 08:14 IMSProg_editor.pro.user 12 | -rw-rw-r-- 1 mimi mimi 35149 авг 2 12:46 LICENSE 13 | -rw-rw-r-- 1 mimi mimi 177 авг 2 12:46 main.cpp 14 | drwxrwxr-x 2 mimi mimi 4096 авг 18 08:39 other 15 | -rw-rw-r-- 1 mimi mimi 1198 авг 2 12:46 README.md 16 | -rw-rw-r-- 1 mimi mimi 396 авг 2 12:46 resources.qrc 17 | -------------------------------------------------------------------------------- /IMSProg_editor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10.0) 2 | 3 | set(CMAKE_CXX_STANDARD 17) 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 5 | 6 | set(CMAKE_AUTOMOC ON) 7 | set(CMAKE_AUTORCC ON) 8 | set(CMAKE_AUTOUIC ON) 9 | 10 | project(IMSProg_editor LANGUAGES CXX) 11 | 12 | # Set the CMAKE_INSTALL_PREFIX to /usr if not specified 13 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 14 | set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "The default install prefix" FORCE) 15 | endif() 16 | 17 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 18 | 19 | find_package(Qt5 REQUIRED COMPONENTS Core Widgets) 20 | find_package(Qt5Widgets REQUIRED) 21 | 22 | add_executable(${PROJECT_NAME} 23 | ezp_chip_editor.h 24 | ezp_chip_editor.cpp 25 | ezp_chip_editor.ui 26 | main.cpp 27 | delegates.h 28 | delegates.cpp 29 | resources.qrc 30 | ) 31 | target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 32 | target_link_libraries(${PROJECT_NAME} Qt5::Core) 33 | target_link_libraries(${PROJECT_NAME} Qt5::Widgets) 34 | 35 | install(TARGETS ${PROJECT_NAME} DESTINATION /opt/IMSProg) 36 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/IMSProg_editor.desktop" DESTINATION /opt/IMSProg) 37 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/IMSProg_editor.desktop" DESTINATION /usr/share/applications) 38 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/language/chipEditor_ru_RU.qm" DESTINATION /opt/IMSProg/language) 39 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/language/chipEditor_de_DE.qm" DESTINATION /opt/IMSProg/language) 40 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/language/chipEditor_es_ES.qm" DESTINATION /opt/IMSProg/language) 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /IMSProg_editor/IMSProg_editor.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2023-05-26T10:45:36 4 | # 5 | #------------------------------------------------- 6 | # 7 | # This file is part of the EZP_Chip_Editor project. 8 | # 9 | # Copyright (C) 2023 Mikhail Medvedev (e-ink-reader@yandex.ru) 10 | # 11 | # This program is free software; you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation; either version 2 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program; if not, write to the Free Software 23 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 | # 25 | # verbose functionality forked from https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor 26 | # 27 | # 28 | QT += core gui 29 | 30 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 31 | 32 | TARGET = IMSProg_editor 33 | TEMPLATE = app 34 | 35 | # The following define makes your compiler emit warnings if you use 36 | # any feature of Qt which has been marked as deprecated (the exact warnings 37 | # depend on your compiler). Please consult the documentation of the 38 | # deprecated API in order to know how to port your code away from it. 39 | DEFINES += QT_DEPRECATED_WARNINGS 40 | 41 | # You can also make your code fail to compile if you use deprecated APIs. 42 | # In order to do so, uncomment the following line. 43 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 44 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 45 | 46 | CONFIG += c++11 47 | 48 | SOURCES += \ 49 | main.cpp \ 50 | ezp_chip_editor.cpp \ 51 | delegates.cpp 52 | 53 | HEADERS += \ 54 | ezp_chip_editor.h \ 55 | delegates.h 56 | 57 | FORMS += \ 58 | ezp_chip_editor.ui 59 | 60 | TRANSLATIONS += language/chipEditor_ru_RU.ts \ 61 | language/chipEditor_es_ES.ts \ 62 | language/chipEditor_de_DE.ts 63 | 64 | # Default rules for deployment. 65 | qnx: target.path = /tmp/$${TARGET}/bin 66 | else: unix:!android: target.path = /opt/$${TARGET}/bin 67 | !isEmpty(target.path): INSTALLS += target 68 | 69 | RESOURCES += \ 70 | resources.qrc 71 | 72 | DISTFILES += 73 | -------------------------------------------------------------------------------- /IMSProg_editor/README.md: -------------------------------------------------------------------------------- 1 | # EZP2019-EZP2025_chip_data_editor 2 | QT based editor chip database for EZP2019, EZP2019+, EZP2020, EZP2023, EZP2025, MinPro, XP866+, MinproI programmer devices. 3 | 4 | ![Screenshot editor](https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor/blob/main/img/ezp_editor.png) 5 | 6 | Press the button ![read](img/open.png) for open the database file (Depending on the name of your programmer device EZP2019.Dat, EZP2020.Dat, EZP2023+.Dat, EZP2025.Dat, XP866+.Dat, MinproI.Dat). 7 | 8 | For save the changes to binary file press the button save ![save](img/save.png). 9 | 10 | For deleting the strings select one or more strings and press the delete button ![delete](img/del.png). 11 | 12 | You can moving the selected string use the arrow buttons (![undo](img/undo.png) and ![redo](img/redo.png)). 13 | 14 | You can copying the selected string use the plus button ![plus](img/plus.png). 15 | 16 | The selected strings may be converted info .CSV format by pressing the button ![tocsv](img/tocsv.png). 17 | 18 | If you want convert all strings in to .CSV file use the `Export to CSV` ![tocsv](img/tocsv.png) in `File` menu. 19 | 20 | If you want import .CSV database in to program use `Import from CSV` ![import](img/import.png) in `File` menu. 21 | 22 | Any cell is editable. 23 | 24 | ## Building 25 | 26 | ``` 27 | mkdir build 28 | cd build 29 | cmake .. 30 | make -j4 31 | sudo make install 32 | ``` 33 | -------------------------------------------------------------------------------- /IMSProg_editor/delegates.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the EZP_Chip_Editor project. 3 | * 4 | * Copyright (C) 2023 Mikhail Medvedev (e-ink-reader@yandex.ru) 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * verbose functionality forked from https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor 21 | * 22 | */ 23 | #include "delegates.h" 24 | #include 25 | #include 26 | 27 | 28 | chTypeDelegate::chTypeDelegate(QObject *parent): QItemDelegate(parent) { } 29 | QWidget *chTypeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const 30 | { 31 | QComboBox *editor = new QComboBox(parent); 32 | editor->addItem("SPI_FLASH"); 33 | editor->addItem("25_EEPROM"); 34 | editor->addItem("93_EEPROM"); 35 | editor->addItem("24_EEPROM"); 36 | editor->addItem("95_EEPROM"); 37 | return editor; 38 | } 39 | void chTypeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const 40 | { 41 | QString text = index.model()->data(index, Qt::EditRole).toString(); 42 | QComboBox *comboBox = static_cast(editor); 43 | int tindex = comboBox->findText(text); 44 | comboBox->setCurrentIndex(tindex); 45 | } 46 | void chTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, 47 | const QModelIndex &index) const 48 | { 49 | QComboBox *comboBox = static_cast(editor); 50 | QString text = comboBox->currentText(); 51 | model->setData(index, text, Qt::EditRole); 52 | } 53 | void chTypeDelegate::updateEditorGeometry(QWidget *editor, 54 | const QStyleOptionViewItem &option, const QModelIndex &index) const 55 | { 56 | editor->setGeometry(option.rect); 57 | } 58 | 59 | chVCCDelegate::chVCCDelegate(QObject *parent): QItemDelegate(parent) { } 60 | QWidget *chVCCDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const 61 | { 62 | QComboBox *editor = new QComboBox(parent); 63 | editor->addItem("5.0 V"); 64 | editor->addItem("3.3 V"); 65 | editor->addItem("1.8 V"); 66 | return editor; 67 | } 68 | void chVCCDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const 69 | { 70 | QString text = index.model()->data(index, Qt::EditRole).toString(); 71 | QComboBox *comboBox = static_cast(editor); 72 | int tindex = comboBox->findText(text); 73 | comboBox->setCurrentIndex(tindex); 74 | } 75 | void chVCCDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, 76 | const QModelIndex &index) const 77 | { 78 | QComboBox *comboBox = static_cast(editor); 79 | QString text = comboBox->currentText(); 80 | model->setData(index, text, Qt::EditRole); 81 | } 82 | void chVCCDelegate::updateEditorGeometry(QWidget *editor, 83 | const QStyleOptionViewItem &option, const QModelIndex &index) const 84 | { 85 | editor->setGeometry(option.rect); 86 | } 87 | chPagesDelegate::chPagesDelegate(QObject *parent): QItemDelegate(parent) { } 88 | QWidget *chPagesDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const 89 | { 90 | QComboBox *editor = new QComboBox(parent); 91 | editor->addItem("0x00"); 92 | editor->addItem("0x01"); 93 | editor->addItem("0x02"); 94 | editor->addItem("0x04"); 95 | return editor; 96 | } 97 | void chPagesDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const 98 | { 99 | QString text = index.model()->data(index, Qt::EditRole).toString(); 100 | QComboBox *comboBox = static_cast(editor); 101 | int tindex = comboBox->findText(text); 102 | comboBox->setCurrentIndex(tindex); 103 | } 104 | void chPagesDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, 105 | const QModelIndex &index) const 106 | { 107 | QComboBox *comboBox = static_cast(editor); 108 | QString text = comboBox->currentText(); 109 | model->setData(index, text, Qt::EditRole); 110 | } 111 | void chPagesDelegate::updateEditorGeometry(QWidget *editor, 112 | const QStyleOptionViewItem &option, const QModelIndex &index) const 113 | { 114 | editor->setGeometry(option.rect); 115 | } 116 | chBlSizeDelegate::chBlSizeDelegate(QObject *parent): QItemDelegate(parent) { } 117 | QWidget *chBlSizeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const 118 | { 119 | QComboBox *editor = new QComboBox(parent); 120 | editor->addItem("8"); 121 | editor->addItem("16"); 122 | editor->addItem("32"); 123 | editor->addItem("64"); 124 | editor->addItem("128"); 125 | editor->addItem("256"); 126 | return editor; 127 | } 128 | void chBlSizeDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const 129 | { 130 | QString text = index.model()->data(index, Qt::EditRole).toString(); 131 | QComboBox *comboBox = static_cast(editor); 132 | int tindex = comboBox->findText(text); 133 | comboBox->setCurrentIndex(tindex); 134 | } 135 | void chBlSizeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, 136 | const QModelIndex &index) const 137 | { 138 | QComboBox *comboBox = static_cast(editor); 139 | QString text = comboBox->currentText(); 140 | model->setData(index, text, Qt::EditRole); 141 | } 142 | void chBlSizeDelegate::updateEditorGeometry(QWidget *editor, 143 | const QStyleOptionViewItem &option, const QModelIndex &index) const 144 | { 145 | editor->setGeometry(option.rect); 146 | } 147 | -------------------------------------------------------------------------------- /IMSProg_editor/delegates.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the EZP_Chip_Editor project. 3 | * 4 | * Copyright (C) 2023 Mikhail Medvedev (e-ink-reader@yandex.ru) 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * verbose functionality forked from https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor 21 | * 22 | */ 23 | #ifndef DELEGATES_H 24 | #define DELEGATES_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | class chTypeDelegate : public QItemDelegate 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit chTypeDelegate(QObject *parent); 35 | QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 36 | const QModelIndex &index) const; 37 | void setEditorData(QWidget *editor, const QModelIndex &index) const; 38 | void setModelData(QWidget *editor, QAbstractItemModel *model, 39 | const QModelIndex &index) const; 40 | void updateEditorGeometry(QWidget *editor, 41 | const QStyleOptionViewItem &option, const QModelIndex &index) const; 42 | 43 | signals: 44 | 45 | public slots: 46 | //virtual ~chTypeDelegate() {} 47 | }; 48 | 49 | class chVCCDelegate : public QItemDelegate 50 | { 51 | Q_OBJECT 52 | public: 53 | explicit chVCCDelegate(QObject *parent); 54 | QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 55 | const QModelIndex &index) const; 56 | void setEditorData(QWidget *editor, const QModelIndex &index) const; 57 | void setModelData(QWidget *editor, QAbstractItemModel *model, 58 | const QModelIndex &index) const; 59 | void updateEditorGeometry(QWidget *editor, 60 | const QStyleOptionViewItem &option, const QModelIndex &index) const; 61 | 62 | signals: 63 | 64 | public slots: 65 | //virtual ~chVCCDelegate() {} 66 | }; 67 | class chPagesDelegate : public QItemDelegate 68 | { 69 | Q_OBJECT 70 | public: 71 | explicit chPagesDelegate(QObject *parent); 72 | QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 73 | const QModelIndex &index) const; 74 | void setEditorData(QWidget *editor, const QModelIndex &index) const; 75 | void setModelData(QWidget *editor, QAbstractItemModel *model, 76 | const QModelIndex &index) const; 77 | void updateEditorGeometry(QWidget *editor, 78 | const QStyleOptionViewItem &option, const QModelIndex &index) const; 79 | 80 | signals: 81 | 82 | public slots: 83 | //virtual ~chPagesDelegate() {} 84 | }; 85 | class chBlSizeDelegate : public QItemDelegate 86 | { 87 | Q_OBJECT 88 | public: 89 | explicit chBlSizeDelegate(QObject *parent); 90 | QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, 91 | const QModelIndex &index) const; 92 | void setEditorData(QWidget *editor, const QModelIndex &index) const; 93 | void setModelData(QWidget *editor, QAbstractItemModel *model, 94 | const QModelIndex &index) const; 95 | void updateEditorGeometry(QWidget *editor, 96 | const QStyleOptionViewItem &option, const QModelIndex &index) const; 97 | 98 | signals: 99 | 100 | public slots: 101 | //virtual ~chBlSizeDelegate() {} 102 | }; 103 | #endif // DELEGATES_H 104 | -------------------------------------------------------------------------------- /IMSProg_editor/ezp_chip_editor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the EZP_Chip_Editor project. 3 | * 4 | * Copyright (C) 2023 Mikhail Medvedev (e-ink-reader@yandex.ru) 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * verbose functionality forked from https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor 21 | * 22 | */ 23 | #ifndef EZP_CHIP_EDITOR_H 24 | #define EZP_CHIP_EDITOR_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | namespace Ui { 40 | class MainWindow; 41 | } 42 | 43 | class MainWindow : public QMainWindow 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | explicit MainWindow(QWidget *parent = nullptr); 49 | ~MainWindow(); 50 | QStandardItemModel *model = new QStandardItemModel; 51 | QStandardItem *item; 52 | const QString csvHeader = "Type;Manufacture;IC Name;JEDEC ID;SIZE;Block size;Type HEX;Algorithm;Delay;Extend;EEPROM;EEPROM pages;VCC\n"; 53 | const QString csvHeader2 = "Type,Manufacture,IC Name,JEDEC ID,SIZE,Block size,Type HEX,Algorithm,Delay,Extend,EEPROM,EEPROM pages,VCC\n"; 54 | QVector chType = {"SPI_FLASH","25_EEPROM","93_EEPROM","24_EEPROM","95_EEPROM"}; 55 | struct chip_data { 56 | QString chipManuf; 57 | QString chipTypeTxt; 58 | QString chipName; 59 | QString chipJedecID; 60 | QString chipSize; 61 | QString blockSize; 62 | QString chipTypeHex; 63 | QString algorithmCode; 64 | QString delay; 65 | QString extend; 66 | QString eeprom; 67 | QString eepromPages; 68 | QString chipVCC; 69 | }; 70 | chip_data chips[2000]; 71 | QString bytePrint(unsigned char z); 72 | QString sizeConvert(int a); 73 | unsigned char dualDigitToByte(QString q, int poz); 74 | 75 | private: 76 | Ui::MainWindow *ui; 77 | 78 | signals: 79 | void dataChanged(QModelIndex, QModelIndex); 80 | 81 | private slots: 82 | void on_actionOpen_triggered(); 83 | void on_actionExit_triggered(); 84 | void onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); 85 | void on_actionDelete_string_triggered(); 86 | void on_actionSave_triggered(); 87 | void on_actionAdd_string_triggered(); 88 | void on_actionMove_up_triggered(); 89 | void on_actionMove_down_triggered(); 90 | void on_actionExport_to_CSV_triggered(); 91 | void on_actionExport_to_CSV_2_triggered(); 92 | void on_actionImport_from_CSV_triggered(); 93 | bool correctChipTyte(QString str); 94 | }; 95 | 96 | #endif // EZP_CHIP_EDITOR_H 97 | -------------------------------------------------------------------------------- /IMSProg_editor/ezp_chip_editor.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 880 10 | 394 11 | 12 | 13 | 14 | IMSProg chip database editor 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 0 27 | 28 | 29 | 30 | 31 | 9 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 0 42 | 0 43 | 880 44 | 24 45 | 46 | 47 | 48 | 49 | File 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Edit 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | TopToolBarArea 76 | 77 | 78 | false 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | :/img/open.png:/img/open.png 96 | 97 | 98 | Open 99 | 100 | 101 | Ctrl+O 102 | 103 | 104 | 105 | 106 | 107 | :/img/exit.png:/img/exit.png 108 | 109 | 110 | Exit 111 | 112 | 113 | Ctrl+X 114 | 115 | 116 | 117 | 118 | 119 | :/img/save.png:/img/save.png 120 | 121 | 122 | Save 123 | 124 | 125 | Ctrl+S 126 | 127 | 128 | 129 | 130 | 131 | :/img/del.png:/img/del.png 132 | 133 | 134 | Delete lines 135 | 136 | 137 | Delete selected lines 138 | 139 | 140 | Del 141 | 142 | 143 | 144 | 145 | 146 | :/img/plus.png:/img/plus.png 147 | 148 | 149 | Add line 150 | 151 | 152 | Add selected lines and duplicate data 153 | 154 | 155 | Ins 156 | 157 | 158 | 159 | 160 | 161 | :/img/undo.png:/img/undo.png 162 | 163 | 164 | Move up 165 | 166 | 167 | Move lines up 168 | 169 | 170 | Ctrl+Up 171 | 172 | 173 | 174 | 175 | 176 | :/img/redo.png:/img/redo.png 177 | 178 | 179 | Move down 180 | 181 | 182 | Move lines down 183 | 184 | 185 | Ctrl+Down 186 | 187 | 188 | 189 | 190 | 191 | :/img/tocsv.png:/img/tocsv.png 192 | 193 | 194 | Export selected lines to CSV file 195 | 196 | 197 | 198 | 199 | 200 | :/img/tocsv.png:/img/tocsv.png 201 | 202 | 203 | Export to CSV 204 | 205 | 206 | Ctrl+X 207 | 208 | 209 | 210 | 211 | 212 | :/img/import.png:/img/import.png 213 | 214 | 215 | Import from CSV 216 | 217 | 218 | , Ctrl+Shift+X 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /IMSProg_editor/img/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/arrow.png -------------------------------------------------------------------------------- /IMSProg_editor/img/chipEdit64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/chipEdit64.png -------------------------------------------------------------------------------- /IMSProg_editor/img/del.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/del.png -------------------------------------------------------------------------------- /IMSProg_editor/img/excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/excel.png -------------------------------------------------------------------------------- /IMSProg_editor/img/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/exit.png -------------------------------------------------------------------------------- /IMSProg_editor/img/ezp_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/ezp_editor.png -------------------------------------------------------------------------------- /IMSProg_editor/img/import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/import.png -------------------------------------------------------------------------------- /IMSProg_editor/img/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/open.png -------------------------------------------------------------------------------- /IMSProg_editor/img/plus.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/plus.jpeg -------------------------------------------------------------------------------- /IMSProg_editor/img/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/plus.png -------------------------------------------------------------------------------- /IMSProg_editor/img/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/redo.png -------------------------------------------------------------------------------- /IMSProg_editor/img/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/save.png -------------------------------------------------------------------------------- /IMSProg_editor/img/tocsv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/tocsv.png -------------------------------------------------------------------------------- /IMSProg_editor/img/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/img/undo.png -------------------------------------------------------------------------------- /IMSProg_editor/language/chipEditor_de_DE.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/language/chipEditor_de_DE.qm -------------------------------------------------------------------------------- /IMSProg_editor/language/chipEditor_de_DE.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MainWindow 6 | 7 | 8 | IMSProg chip database editor 9 | IMSProg-Chipdatenbank-Editor 10 | 11 | 12 | 13 | File 14 | Datei 15 | 16 | 17 | 18 | Edit 19 | Bearbeiten 20 | 21 | 22 | 23 | Open 24 | Öffnen Sie 25 | 26 | 27 | 28 | Ctrl+O 29 | Ctrl+O 30 | 31 | 32 | 33 | Exit 34 | Ausfahrt 35 | 36 | 37 | 38 | 39 | Ctrl+X 40 | Ctrl+X 41 | 42 | 43 | 44 | Save 45 | Speichern Sie 46 | 47 | 48 | 49 | Ctrl+S 50 | Ctrl+S 51 | 52 | 53 | 54 | Delete lines 55 | Zeilen löschen 56 | 57 | 58 | 59 | Delete selected lines 60 | Ausgewählte Zeilen löschen 61 | 62 | 63 | 64 | Del 65 | Del 66 | 67 | 68 | 69 | Add line 70 | Zeile hinzufügen 71 | 72 | 73 | 74 | Add selected lines and duplicate data 75 | Hinzufügen ausgewählter Zeilen und Duplizieren von Daten 76 | 77 | 78 | 79 | Ins 80 | Ins 81 | 82 | 83 | 84 | Move up 85 | Nachrücken 86 | 87 | 88 | 89 | Move lines up 90 | Zeilen nach oben verschieben 91 | 92 | 93 | 94 | Ctrl+Up 95 | Ctrl+Up 96 | 97 | 98 | 99 | Move down 100 | Nach unten gehen 101 | 102 | 103 | 104 | Move lines down 105 | Zeilen nach unten verschieben 106 | 107 | 108 | 109 | Ctrl+Down 110 | Ctrl+Down 111 | 112 | 113 | 114 | Export selected lines to CSV file 115 | Ausgewählte Zeilen in eine CSV-Datei exportieren 116 | 117 | 118 | 119 | Export to CSV 120 | Exportieren nach CSV 121 | 122 | 123 | 124 | Import from CSV 125 | Aus CSV importieren 126 | 127 | 128 | 129 | , Ctrl+Shift+X 130 | , Ctrl+Shift+X 131 | 132 | 133 | 134 | 135 | 136 | 137 | Open the file 138 | Öffnen Sie die Datei 139 | 140 | 141 | 142 | 143 | 144 | 145 | Current file: 146 | Aktuelle Datei: 147 | 148 | 149 | 150 | Type 151 | Typ 152 | 153 | 154 | 155 | Manufacture 156 | Herstellung 157 | 158 | 159 | 160 | IC Name 161 | IC Name 162 | 163 | 164 | 165 | JEDEC ID 166 | JEDEC ID 167 | 168 | 169 | 170 | Size 171 | Größe 172 | 173 | 174 | 175 | Sector 176 | size 177 | Sektor 178 | Größe 179 | 180 | 181 | 182 | Type 183 | HEX 184 | Typ 185 | HEX 186 | 187 | 188 | 189 | Algo- 190 | rithm 191 | Algo- 192 | rithmus 193 | 194 | 195 | 196 | Delay 197 | Verzögerung 198 | 199 | 200 | 201 | 4 bit 202 | address 203 | 4 Bit 204 | Adresse 205 | 206 | 207 | 208 | Block 209 | size K 210 | Block 211 | Größe K 212 | 213 | 214 | 215 | EEPROM 216 | pages 217 | EEPROM 218 | Seiten 219 | 220 | 221 | 222 | VCC 223 | VCC 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | Warning 234 | Warnung 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | No string selected. 243 | Keine Zeichenfolge ausgewählt. 244 | 245 | 246 | 247 | Saving file 248 | Speichern der Datei 249 | 250 | 251 | 252 | Save file 253 | Datei speichern 254 | 255 | 256 | 257 | Opening file 258 | Datei öffnen 259 | 260 | 261 | 262 | Invalid CSV data file format. 263 | Ungültiges CSV-Dateiformat. 264 | 265 | 266 | 267 | Invalid CSV header file format. 268 | Ungültiges CSV-Header-Dateiformat. 269 | 270 | 271 | 272 | -------------------------------------------------------------------------------- /IMSProg_editor/language/chipEditor_es_ES.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/language/chipEditor_es_ES.qm -------------------------------------------------------------------------------- /IMSProg_editor/language/chipEditor_es_ES.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MainWindow 6 | 7 | 8 | IMSProg chip database editor 9 | Editor de bases de datos de chips IMSProg 10 | 11 | 12 | 13 | File 14 | Archivo 15 | 16 | 17 | 18 | Edit 19 | Editar 20 | 21 | 22 | 23 | Open 24 | Abrir 25 | 26 | 27 | 28 | Ctrl+O 29 | Ctrl+O 30 | 31 | 32 | 33 | Exit 34 | Salida 35 | 36 | 37 | 38 | 39 | Ctrl+X 40 | Ctrl+X 41 | 42 | 43 | 44 | Save 45 | Guardar 46 | 47 | 48 | 49 | Ctrl+S 50 | Ctrl+S 51 | 52 | 53 | 54 | Delete lines 55 | Borrar líneas 56 | 57 | 58 | 59 | Delete selected lines 60 | Borrar las líneas seleccionadas 61 | 62 | 63 | 64 | Del 65 | Del 66 | 67 | 68 | 69 | Add line 70 | Añadir línea 71 | 72 | 73 | 74 | Add selected lines and duplicate data 75 | Añadir líneas seleccionadas y duplicar datos 76 | 77 | 78 | 79 | Ins 80 | Ins 81 | 82 | 83 | 84 | Move up 85 | Sube 86 | 87 | 88 | 89 | Move lines up 90 | Subir líneas 91 | 92 | 93 | 94 | Ctrl+Up 95 | Ctrl+Up 96 | 97 | 98 | 99 | Move down 100 | Baja 101 | 102 | 103 | 104 | Move lines down 105 | Bajar líneas 106 | 107 | 108 | 109 | Ctrl+Down 110 | Ctrl+Down 111 | 112 | 113 | 114 | Export selected lines to CSV file 115 | Exportar las líneas seleccionadas a un archivo CSV 116 | 117 | 118 | 119 | Export to CSV 120 | Exportar a CSV 121 | 122 | 123 | 124 | Import from CSV 125 | Importar desde CSV 126 | 127 | 128 | 129 | , Ctrl+Shift+X 130 | , Ctrl+Shift+X 131 | 132 | 133 | 134 | 135 | 136 | 137 | Open the file 138 | Abrir el expediente 139 | 140 | 141 | 142 | 143 | 144 | 145 | Current file: 146 | Archivo actual: 147 | 148 | 149 | 150 | Type 151 | Tipo 152 | 153 | 154 | 155 | Manufacture 156 | Fabricación 157 | 158 | 159 | 160 | IC Name 161 | Nombre IC 162 | 163 | 164 | 165 | JEDEC ID 166 | JEDEC ID 167 | 168 | 169 | 170 | Size 171 | Talla 172 | 173 | 174 | 175 | Sector 176 | size 177 | Sector 178 | tamaño 179 | 180 | 181 | 182 | Type 183 | HEX 184 | Tipo 185 | HEX 186 | 187 | 188 | 189 | Algo- 190 | rithm 191 | Algo- 192 | ritmo 193 | 194 | 195 | 196 | Delay 197 | Retraso 198 | 199 | 200 | 201 | 4 bit 202 | address 203 | 4 bits 204 | dirección 205 | 206 | 207 | 208 | Block 209 | size K 210 | Bloque 211 | tamaño K 212 | 213 | 214 | 215 | EEPROM 216 | pages 217 | EEPROM 218 | páginas 219 | 220 | 221 | 222 | VCC 223 | Питание 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | Warning 234 | Advertencia 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | No string selected. 243 | No se ha seleccionado ninguna cadena. 244 | 245 | 246 | 247 | Saving file 248 | Guardar archivo 249 | 250 | 251 | 252 | Save file 253 | Guardar archivo 254 | 255 | 256 | 257 | Opening file 258 | Abrir expediente 259 | 260 | 261 | 262 | Invalid CSV data file format. 263 | Formato de archivo de datos CSV no válido. 264 | 265 | 266 | 267 | Invalid CSV header file format. 268 | Formato de archivo de cabecera CSV no válido. 269 | 270 | 271 | 272 | -------------------------------------------------------------------------------- /IMSProg_editor/language/chipEditor_ru_RU.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_editor/language/chipEditor_ru_RU.qm -------------------------------------------------------------------------------- /IMSProg_editor/language/chipEditor_ru_RU.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MainWindow 6 | 7 | 8 | IMSProg chip database editor 9 | Редактор базы микросхем для программы IMSProg 10 | 11 | 12 | 13 | File 14 | Файл 15 | 16 | 17 | 18 | Edit 19 | Редактировать 20 | 21 | 22 | 23 | Open 24 | Открыть 25 | 26 | 27 | 28 | Ctrl+O 29 | Ctrl+O 30 | 31 | 32 | 33 | Exit 34 | Выход 35 | 36 | 37 | 38 | 39 | Ctrl+X 40 | Ctrl+X 41 | 42 | 43 | 44 | Save 45 | Сохранить 46 | 47 | 48 | 49 | Ctrl+S 50 | Ctrl+S 51 | 52 | 53 | 54 | Delete lines 55 | Удалить строки 56 | 57 | 58 | 59 | Delete selected lines 60 | Удалить выделенные строки 61 | 62 | 63 | 64 | Del 65 | Del 66 | 67 | 68 | 69 | Add line 70 | Добавить строку 71 | 72 | 73 | 74 | Add selected lines and duplicate data 75 | Добавить строку и клонировать данные 76 | 77 | 78 | 79 | Ins 80 | Ins 81 | 82 | 83 | 84 | Move up 85 | Переместить вверх 86 | 87 | 88 | 89 | Move lines up 90 | Переместить строку вверх 91 | 92 | 93 | 94 | Ctrl+Up 95 | Ctrl+Up 96 | 97 | 98 | 99 | Move down 100 | Переместить вниз 101 | 102 | 103 | 104 | Move lines down 105 | Переместить строку вниз 106 | 107 | 108 | 109 | Ctrl+Down 110 | Ctrl+Down 111 | 112 | 113 | 114 | Export selected lines to CSV file 115 | Экспорт выделенных строк в файл в CSV формате 116 | 117 | 118 | 119 | Export to CSV 120 | Экспорт в SCV формат 121 | 122 | 123 | 124 | Import from CSV 125 | Импорт из CSV файла 126 | 127 | 128 | 129 | , Ctrl+Shift+X 130 | , Ctrl+Shift+X 131 | 132 | 133 | 134 | 135 | 136 | 137 | Open the file 138 | Открыть файл 139 | 140 | 141 | 142 | 143 | 144 | 145 | Current file: 146 | Текущий файл: 147 | 148 | 149 | 150 | Type 151 | Тип 152 | 153 | 154 | 155 | Manufacture 156 | Произв. 157 | 158 | 159 | 160 | IC Name 161 | Название МС 162 | 163 | 164 | 165 | JEDEC ID 166 | JEDEC ID 167 | 168 | 169 | 170 | Size 171 | Объем 172 | 173 | 174 | 175 | Sector 176 | size 177 | Размер 178 | сектора 179 | 180 | 181 | 182 | Type 183 | HEX 184 | Тип 185 | (HEX) 186 | 187 | 188 | 189 | Algo- 190 | rithm 191 | Алго- 192 | ритм 193 | 194 | 195 | 196 | Delay 197 | Задержка 198 | 199 | 200 | 201 | 4 bit 202 | address 203 | 4 bit 204 | адрес 205 | 206 | 207 | 208 | Block 209 | size K 210 | Размер 211 | блока К 212 | 213 | 214 | 215 | EEPROM 216 | pages 217 | EEPROM 218 | листов 219 | 220 | 221 | 222 | VCC 223 | Питание 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | Warning 234 | Предупреждение 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | No string selected. 243 | Не выделена ни одна строка 244 | 245 | 246 | 247 | Saving file 248 | Сохраняется файл 249 | 250 | 251 | 252 | Save file 253 | Сохранить файл 254 | 255 | 256 | 257 | Opening file 258 | Открывается файл 259 | 260 | 261 | 262 | Invalid CSV data file format. 263 | Неверный формат CSV файла 264 | 265 | 266 | 267 | Invalid CSV header file format. 268 | Неверный формат заголовка CSV файла 269 | 270 | 271 | 272 | -------------------------------------------------------------------------------- /IMSProg_editor/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ezp_chip_editor.h" 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication a(argc, argv); 9 | QTranslator translator; 10 | QString translateName = "chipEditor_" + QLocale::system().name(); 11 | if(translator.load(translateName, "language/")) a.installTranslator(&translator); 12 | a.installTranslator(&translator); 13 | MainWindow w; 14 | w.show(); 15 | 16 | return a.exec(); 17 | } 18 | -------------------------------------------------------------------------------- /IMSProg_editor/other/IMSProg_editor.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=IMSProg_editor 5 | Comment=Chip Database Editor 6 | Exec=/opt/IMSProg/IMSProg_editor 7 | Icon=/opt/IMSProg/chipEdit64.png 8 | Path=/opt/IMSProg 9 | Terminal=false 10 | Encoding=UTF-8 11 | Categories=Electronics;Development; 12 | StartupNotify=false 13 | Comment=Chip editor database for IMSProg 14 | Comment[en]=Chip database editor for IMSProg 15 | Comment[ru]=Редактор базы микросхем для IMSProg 16 | Comment[es]=Editor de bases de datos de chips para IMSProg 17 | Comment[de]=Chipdatenbank-Editor für IMSProg 18 | GenericName=Chip database editor for IMSProg 19 | GenericName[en]=Chip database editor for IMSProg 20 | GenericName[ru]=Редактор базы микросхем для IMSProg 21 | GenericName[es]=Editor de bases de datos de chips para IMSProg 22 | GenericName[de]=Chipdatenbank-Editor für IMSProg 23 | -------------------------------------------------------------------------------- /IMSProg_editor/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | img/redo.png 5 | img/open.png 6 | img/save.png 7 | img/exit.png 8 | img/del.png 9 | img/undo.png 10 | img/plus.png 11 | img/tocsv.png 12 | img/import.png 13 | 14 | 15 | -------------------------------------------------------------------------------- /IMSProg_programmer/99-ch341a-prog.rules: -------------------------------------------------------------------------------- 1 | # udev rule that sets permissions for CH341A programmer in Linux. 2 | # Put this file in /etc/udev/rules.d and reload udev rules or reboot to install 3 | SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666" 4 | -------------------------------------------------------------------------------- /IMSProg_programmer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10.0) 2 | 3 | set(CMAKE_CXX_STANDARD 17) 4 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 5 | 6 | set(CMAKE_AUTOMOC ON) 7 | set(CMAKE_AUTORCC ON) 8 | set(CMAKE_AUTOUIC ON) 9 | 10 | project(IMSProg LANGUAGES C CXX) 11 | 12 | # Set the CMAKE_INSTALL_PREFIX to /usr if not specified 13 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 14 | set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "The default install prefix" FORCE) 15 | endif() 16 | 17 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 18 | 19 | find_package(Qt5 REQUIRED COMPONENTS Core Widgets) 20 | find_package(Qt5Widgets REQUIRED) 21 | find_package(LibUSB REQUIRED) 22 | 23 | add_executable(${PROJECT_NAME} 24 | 25 | main.cpp 26 | mainwindow.cpp 27 | qhexedit.cpp 28 | chunks.cpp 29 | commands.cpp 30 | dialogsp.cpp 31 | dialogrp.cpp 32 | searchdialog.cpp 33 | bitbang_microwire.c 34 | ch341a_gpio.c 35 | ch341a_i2c.c 36 | ch341a_spi.c 37 | flashcmd_api.c 38 | i2c_eeprom.c 39 | mw_eeprom.c 40 | spi_controller.c 41 | spi_eeprom.c 42 | spi_nand_flash.c 43 | spi_nor_flash.c 44 | timer.c 45 | dialogabout.cpp 46 | mainwindow.h 47 | qhexedit.h 48 | chunks.h 49 | commands.h 50 | dialogsp.h 51 | dialogrp.h 52 | searchdialog.h 53 | bitbang_microwire.h 54 | ch341a_gpio.h 55 | ch341a_i2c.h 56 | ch341a_spi.h 57 | flashcmd_api.h 58 | i2c_eeprom_api.h 59 | mw_eeprom_api.h 60 | nandcmd_api.h 61 | res.h 62 | snorcmd_api.h 63 | spi_controller.h 64 | spi_eeprom.h 65 | spi_eeprom_api.h 66 | spi_nand_flash.h 67 | timer.h 68 | types.h 69 | dialogabout.h 70 | mainwindow.ui 71 | dialogsp.ui 72 | dialogrp.ui 73 | searchdialog.ui 74 | dialogabout.ui 75 | recource.qrc 76 | ) 77 | target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 78 | target_link_libraries(${PROJECT_NAME} Qt5::Core) 79 | #target_link_libraries(${PROJECT_NAME} Qt5::Widgets) 80 | target_link_libraries(${PROJECT_NAME} Qt5::Widgets ${LibUSB_LIBRARIES}) 81 | 82 | install(TARGETS ${PROJECT_NAME} DESTINATION /opt/IMSProg) 83 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/IMSProg.desktop" DESTINATION /opt/IMSProg) 84 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/IMSProg.desktop" DESTINATION /usr/share/applications) 85 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/write64.png" DESTINATION /opt/IMSProg) 86 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/database/IMSProg.Dat" DESTINATION /opt/IMSProg) 87 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/other/99-CH341.rules" DESTINATION /etc/udev/rules.d) 88 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/language/chipProgrammer_ru_RU.qm" DESTINATION /opt/IMSProg/language) 89 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/language/chipProgrammer_es_ES.qm" DESTINATION /opt/IMSProg/language) 90 | install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/language/chipProgrammer_de_DE.qm" DESTINATION /opt/IMSProg/language) 91 | 92 | -------------------------------------------------------------------------------- /IMSProg_programmer/IMSProg.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2023-07-14T12:38:17 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | LIBS += -lusb-1.0 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = IMSProg 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which has been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | CONFIG += c++11 26 | 27 | SOURCES += \ 28 | main.cpp \ 29 | mainwindow.cpp \ 30 | qhexedit.cpp \ 31 | chunks.cpp \ 32 | commands.cpp \ 33 | dialogsp.cpp \ 34 | dialogrp.cpp \ 35 | searchdialog.cpp \ 36 | bitbang_microwire.c \ 37 | ch341a_gpio.c \ 38 | ch341a_i2c.c \ 39 | ch341a_spi.c \ 40 | flashcmd_api.c \ 41 | i2c_eeprom.c \ 42 | mw_eeprom.c \ 43 | spi_controller.c \ 44 | spi_eeprom.c \ 45 | spi_nand_flash.c \ 46 | spi_nor_flash.c \ 47 | timer.c \ 48 | dialogabout.cpp 49 | 50 | HEADERS += \ 51 | mainwindow.h \ 52 | qhexedit.h \ 53 | chunks.h \ 54 | commands.h \ 55 | dialogsp.h \ 56 | dialogrp.h \ 57 | searchdialog.h \ 58 | bitbang_microwire.h \ 59 | ch341a_gpio.h \ 60 | ch341a_i2c.h \ 61 | ch341a_spi.h \ 62 | flashcmd_api.h \ 63 | i2c_eeprom_api.h \ 64 | mw_eeprom_api.h \ 65 | nandcmd_api.h \ 66 | res.h \ 67 | snorcmd_api.h \ 68 | spi_controller.h \ 69 | spi_eeprom.h \ 70 | spi_eeprom_api.h \ 71 | spi_nand_flash.h \ 72 | timer.h \ 73 | types.h \ 74 | dialogabout.h 75 | 76 | 77 | FORMS += \ 78 | mainwindow.ui \ 79 | dialogsp.ui \ 80 | dialogrp.ui \ 81 | searchdialog.ui \ 82 | dialogabout.ui 83 | 84 | TRANSLATIONS += language/chipProgrammer_ru_RU.ts \ 85 | language/chipProgrammer_es_ES.ts \ 86 | language/chipProgrammer_de_DE.ts 87 | 88 | # Default rules for deployment. 89 | qnx: target.path = /tmp/$${TARGET}/bin 90 | else: unix:!android: target.path = /opt/$${TARGET}/bin 91 | !isEmpty(target.path): INSTALLS += target 92 | 93 | RESOURCES += \ 94 | recource.qrc 95 | 96 | DISTFILES += 97 | -------------------------------------------------------------------------------- /IMSProg_programmer/Makefile: -------------------------------------------------------------------------------- 1 | PKG=ch341prog 2 | 3 | prefix = /usr/local 4 | bindir = $(prefix)/bin 5 | sharedir = $(prefix)/share 6 | mandir = $(sharedir)/man 7 | man1dir = $(mandir)/man1 8 | 9 | CFLAGS=-std=gnu99 -Wall 10 | $(PKG): main.c ch341a.c ch341a.h 11 | gcc $(CFLAGS) ch341a.c main.c -o $(PKG) -lusb-1.0 12 | clean: 13 | rm *.o $(PKG) -f 14 | install-udev-rule: 15 | cp 99-ch341a-prog.rules /etc/udev/rules.d/ 16 | udevadm control --reload-rules 17 | .PHONY: clean install-udev-rule 18 | 19 | install: $(PKG) 20 | install $(PKG) $(DESTDIR)$(bindir) 21 | install -m 0664 99-ch341a-prog.rules $(DESTDIR)/etc/udev/rules.d/99-ch341a-prog.rules 22 | 23 | debian/changelog: 24 | #gbp dch --debian-tag='%(version)s' -S -a --ignore-branch -N '$(VERSION)' 25 | dch --create -v 1.0-1 --package $(PKG) 26 | 27 | deb: 28 | dpkg-buildpackage -b -us -uc 29 | .PHONY: install debian/changelog deb 30 | -------------------------------------------------------------------------------- /IMSProg_programmer/QHexEditPlugin.cpp: -------------------------------------------------------------------------------- 1 | #include "QHexEditPlugin.h" 2 | #include "qhexedit.h" 3 | 4 | #include 5 | 6 | QHexEditPlugin::QHexEditPlugin(QObject * parent) : QObject(parent) 7 | { 8 | initialized = false; 9 | } 10 | 11 | 12 | bool QHexEditPlugin::isContainer() const 13 | { 14 | return false; 15 | } 16 | 17 | bool QHexEditPlugin::isInitialized() const 18 | { 19 | return initialized; 20 | } 21 | 22 | QIcon QHexEditPlugin::icon() const 23 | { 24 | return QIcon(); 25 | } 26 | 27 | QString QHexEditPlugin::domXml() const 28 | { 29 | return "\n" 30 | " \n" 31 | " \n" 32 | " \n" 33 | " 0\n" 34 | " 0\n" 35 | " 100\n" 36 | " 100\n" 37 | " \n" 38 | " \n" 39 | " \n" 40 | " QHexEditWidget\n" 41 | " \n" 42 | " \n" 43 | " QHexEdit widget allow to edit the data in hex view.\n" 44 | " \n" 45 | " \n" 46 | "\n"; 47 | } 48 | 49 | QString QHexEditPlugin::group() const 50 | { 51 | return "Input Widgets"; 52 | } 53 | 54 | QString QHexEditPlugin::includeFile() const 55 | { 56 | return "qhexedit.h"; 57 | } 58 | 59 | QString QHexEditPlugin::name() const 60 | { 61 | return "QHexEdit"; 62 | } 63 | 64 | QString QHexEditPlugin::toolTip() const 65 | { 66 | return ""; 67 | } 68 | 69 | QString QHexEditPlugin::whatsThis() const 70 | { 71 | return ""; 72 | } 73 | 74 | QWidget * QHexEditPlugin::createWidget(QWidget *parent) 75 | { 76 | return new QHexEdit(parent); 77 | } 78 | 79 | void QHexEditPlugin::initialize(QDesignerFormEditorInterface * /*core*/) 80 | { 81 | if (initialized) 82 | return; 83 | 84 | initialized = true; 85 | } 86 | 87 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 88 | Q_EXPORT_PLUGIN2(QHexEditPlugin, QHexEditPlugin) 89 | #endif 90 | -------------------------------------------------------------------------------- /IMSProg_programmer/QHexEditPlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef QHEXEDITPLUGIN_H 2 | #define QHEXEDITPLUGIN_H 3 | 4 | #include 5 | 6 | #if QT_VERSION < QT_VERSION_CHECK(5,0,0) 7 | #include 8 | #else 9 | #include 10 | #endif 11 | 12 | class QHexEditPlugin : public QObject, public QDesignerCustomWidgetInterface 13 | { 14 | Q_OBJECT 15 | Q_INTERFACES(QDesignerCustomWidgetInterface) 16 | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) 17 | Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QHexEditPlugin") 18 | #endif 19 | 20 | public: 21 | QHexEditPlugin(QObject * parent = 0); 22 | 23 | bool isContainer() const; 24 | bool isInitialized() const; 25 | QIcon icon() const; 26 | QString domXml() const; 27 | QString group() const; 28 | QString includeFile() const; 29 | QString name() const; 30 | QString toolTip() const; 31 | QString whatsThis() const; 32 | QWidget *createWidget(QWidget *parent); 33 | void initialize(QDesignerFormEditorInterface *core); 34 | 35 | private: 36 | bool initialized; 37 | 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /IMSProg_programmer/README.md: -------------------------------------------------------------------------------- 1 | # IMSProg 2 | IMSProg - Linux IMSProg - I2C, SPI and MicroWire EEPROM/Flash chip programmer for CH341a devices. 3 | The IMSProm is a free I2C EEPROM programmer tool for CH341A device based on [QhexEdit2](https://github.com/Simsys/qhexedit2) and 4 | modify [SNANDer programmer]([https://github.com/setarcos/ch341prog](https://github.com/McMCCRU/SNANDer). 5 | 6 | This is a GUI program used widget QhexEditor. For setting the SPI chip parameters you can use the `Detect` button for reading chip parameters (JEDEC information reading) or manually setting it. The I2C and MicroWire EEPROM only manually selected. 7 | 8 | The chip database format is clone with EZP2019, EZP2020, EZP2023, Minpro I, XP866+ programmers. You can edit the database use the [EZP Chip data Editor](https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor) 9 | 10 | ![CH341A EEPROM programmer](img/IMSProg.png) 11 | -------------------------------------------------------------------------------- /IMSProg_programmer/bitbang_microwire.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2005-2021 Mokrushin I.V. aka McMCC mcmcc@mail.ru 2 | * Copyright (C) 2023 Mikhail Medvedev e-ink-reader@yandex.ru 3 | A simple bitbang protocol for Microwire 8-pin serial EEPROMs 4 | (93XX devices). Support organization 8bit and 16bit(8bit emulation). 5 | 6 | bitbang_microwire.h 7 | 8 | This program is free software; you can redistribute it and/or modify 9 | it under the terms of the GNU General Public License as published by 10 | the Free Software Foundation; either version 2 of the License, or 11 | (at your option) any later version. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software 20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 21 | /* ------------------------------------------------------------------------- */ 22 | 23 | #ifndef _BITBANG_MICROWIRE_H 24 | #define _BITBANG_MICROWIRE_H 25 | 26 | #if 0 27 | extern unsigned char ORG; /* organization 0 = 8 bit and 1 = 16 bit */ 28 | #endif 29 | extern unsigned char CLK; 30 | extern unsigned char DO; 31 | extern unsigned char DI; 32 | extern unsigned char CSEL; 33 | 34 | extern int org; 35 | extern int mw_eepromsize; 36 | extern int fix_addr_len; 37 | 38 | struct MW_EEPROM { 39 | char *name; 40 | unsigned int size; 41 | }; 42 | 43 | struct gpio_cmd { 44 | int (*gpio_setdir)(void); 45 | int (*gpio_setbits)(unsigned char bit); 46 | int (*gpio_getbits)(unsigned char *data); 47 | }; 48 | 49 | //void Erase_EEPROM_3wire(int size_eeprom); 50 | //int Read_EEPROM_3wire(unsigned char *buffer, int size_eeprom); 51 | //int Write_EEPROM_3wire(unsigned char *buffer, int size_eeprom); 52 | //int deviceSize_3wire(char *eepromname); 53 | int Read_EEPROM_3wire_param(unsigned char *buffer, int start_addr, int block_size, int size_eeprom, unsigned char algorithm); 54 | int Write_EEPROM_3wire_param(unsigned char *buffer, int start_addr, int block_size, int size_eeprom, unsigned char algorithm); 55 | void Erase_EEPROM_3wire_param(unsigned char algorithm); 56 | 57 | /*const static struct MW_EEPROM mw_eepromlist[] = { 58 | { "93c06", 32 }, 59 | { "93c16", 64 }, 60 | { "93c46", 128 }, 61 | { "93c56", 256 }, 62 | { "93c66", 512 }, 63 | { "93c76", 1024 }, 64 | { "93c86", 2048 }, 65 | { "93c96", 4096 }, 66 | { 0, 0 } 67 | }; 68 | */ 69 | #define MAX_MW_EEPROM_SIZE 4096 70 | 71 | #endif /* _BITBANG_MICROWIRE_H */ 72 | /* End of [bitbang_microwire.h] package */ 73 | -------------------------------------------------------------------------------- /IMSProg_programmer/ch341a_gpio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * ch341a_gpio.c 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #define DEFAULT_TIMEOUT 1000 28 | #define BULK_WRITE_ENDPOINT 0x02 29 | #define BULK_READ_ENDPOINT 0x82 30 | 31 | #define CH341A_CMD_UIO_STREAM 0xAB 32 | #define CH341A_CMD_UIO_STM_IN 0x00 33 | #define CH341A_CMD_UIO_STM_DIR 0x40 34 | #define CH341A_CMD_UIO_STM_OUT 0x80 35 | #define CH341A_CMD_UIO_STM_US 0xC0 36 | #define CH341A_CMD_UIO_STM_END 0x20 37 | 38 | #define DIR_MASK 0x3F /* D6,D7 - input, D0-D5 - output */ 39 | 40 | extern struct libusb_device_handle *handle; 41 | 42 | static int usb_transf(const char *func, uint8_t type, uint8_t *buf, int len) 43 | { 44 | int ret, actuallen = 0; 45 | 46 | if (handle == NULL) 47 | return -1; 48 | 49 | ret = libusb_bulk_transfer(handle, type, buf, len, &actuallen, DEFAULT_TIMEOUT); 50 | if (ret < 0) { 51 | printf("%s: Failed to %s %d bytes '%s'\n", func, 52 | (type == BULK_WRITE_ENDPOINT) ? "write" : "read", len, strerror(-ret)); 53 | return -1; 54 | } 55 | 56 | return actuallen; 57 | } 58 | 59 | int ch341a_gpio_setdir(void) 60 | { 61 | uint8_t buf[] = { 62 | CH341A_CMD_UIO_STREAM, 63 | CH341A_CMD_UIO_STM_DIR | DIR_MASK, 64 | CH341A_CMD_UIO_STM_END 65 | }; 66 | 67 | return usb_transf(__func__, BULK_WRITE_ENDPOINT, buf, 3); 68 | } 69 | 70 | int ch341a_gpio_setbits(uint8_t bits) 71 | { 72 | uint8_t buf[] = { 73 | CH341A_CMD_UIO_STREAM, 74 | CH341A_CMD_UIO_STM_OUT | bits, 75 | CH341A_CMD_UIO_STM_END 76 | }; 77 | 78 | return usb_transf(__func__, BULK_WRITE_ENDPOINT, buf, 3); 79 | } 80 | 81 | int ch341a_gpio_getbits(uint8_t *data) 82 | { 83 | int ret; 84 | uint8_t buf[] = { 85 | CH341A_CMD_UIO_STREAM, 86 | CH341A_CMD_UIO_STM_IN, 87 | CH341A_CMD_UIO_STM_END 88 | }; 89 | 90 | ret = usb_transf(__func__, BULK_WRITE_ENDPOINT, buf, 3); 91 | if (ret < 0) 92 | return -1; 93 | 94 | ret = usb_transf(__func__, BULK_READ_ENDPOINT, buf, 1); 95 | if (ret < 0) 96 | return -1; 97 | 98 | *data = buf[0]; 99 | 100 | return ret; 101 | } 102 | /* End of [ch341a_gpio.c] package */ 103 | -------------------------------------------------------------------------------- /IMSProg_programmer/ch341a_gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * ch341a_gpio.h 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | #ifndef __CH341A_GPIO_H__ 20 | #define __CH341A_GPIO_H__ 21 | 22 | #include 23 | 24 | int ch341a_gpio_setdir(void); 25 | int ch341a_gpio_setbits(uint8_t bits); 26 | int ch341a_gpio_getbits(uint8_t *data); 27 | 28 | #endif /* __CH341A_GPIO_H__ */ 29 | /* End of [ch341a_gpio.h] package */ 30 | -------------------------------------------------------------------------------- /IMSProg_programmer/ch341a_spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2021 McMCC 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | #ifndef __CH341_SPI_H__ 19 | #define __CH341_SPI_H__ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | #define min(a,b) (((a)<(b))?(a):(b)) 28 | #define max(a,b) (((a)>(b))?(a):(b)) 29 | 30 | int ch341a_spi_init(void); 31 | int ch341a_spi_shutdown(void); 32 | int ch341a_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr); 33 | int enable_pins(bool enable); 34 | int config_stream(unsigned int speed); 35 | int ch341a_init_i2c(void); 36 | int ch341a_init(uint8_t chipType); 37 | #endif /* __CH341_SPI_H__ */ 38 | /* End of [ch341a_spi.h] package */ 39 | -------------------------------------------------------------------------------- /IMSProg_programmer/chunks.cpp: -------------------------------------------------------------------------------- 1 | #include "chunks.h" 2 | #include 3 | 4 | #define NORMAL 0 5 | #define HIGHLIGHTED 1 6 | 7 | #define BUFFER_SIZE 0x10000 8 | #define CHUNK_SIZE 0x1000 9 | #define READ_CHUNK_MASK Q_INT64_C(0xfffffffffffff000) 10 | 11 | // ***************************************** Constructors and file settings 12 | 13 | Chunks::Chunks(QObject *parent): QObject(parent) 14 | { 15 | QBuffer *buf = new QBuffer(this); 16 | setIODevice(*buf); 17 | } 18 | 19 | Chunks::Chunks(QIODevice &ioDevice, QObject *parent): QObject(parent) 20 | { 21 | setIODevice(ioDevice); 22 | } 23 | 24 | bool Chunks::setIODevice(QIODevice &ioDevice) 25 | { 26 | _ioDevice = &ioDevice; 27 | bool ok = _ioDevice->open(QIODevice::ReadOnly); 28 | if (ok) // Try to open IODevice 29 | { 30 | _size = _ioDevice->size(); 31 | _ioDevice->close(); 32 | } 33 | else // Fallback is an empty buffer 34 | { 35 | QBuffer *buf = new QBuffer(this); 36 | _ioDevice = buf; 37 | _size = 0; 38 | } 39 | _chunks.clear(); 40 | _pos = 0; 41 | return ok; 42 | } 43 | 44 | 45 | // ***************************************** Getting data out of Chunks 46 | 47 | QByteArray Chunks::data(qint64 pos, qint64 maxSize, QByteArray *highlighted) 48 | { 49 | qint64 ioDelta = 0; 50 | int chunkIdx = 0; 51 | 52 | Chunk chunk; 53 | QByteArray buffer; 54 | 55 | // Do some checks and some arrangements 56 | if (highlighted) 57 | highlighted->clear(); 58 | 59 | if (pos >= _size) 60 | return buffer; 61 | 62 | if (maxSize < 0) 63 | maxSize = _size; 64 | else 65 | if ((pos + maxSize) > _size) 66 | maxSize = _size - pos; 67 | 68 | _ioDevice->open(QIODevice::ReadOnly); 69 | 70 | while (maxSize > 0) 71 | { 72 | chunk.absPos = LLONG_MAX; 73 | bool chunksLoopOngoing = true; 74 | while ((chunkIdx < _chunks.count()) && chunksLoopOngoing) 75 | { 76 | // In this section, we track changes before our required data and 77 | // we take the editdet data, if availible. ioDelta is a difference 78 | // counter to justify the read pointer to the original data, if 79 | // data in between was deleted or inserted. 80 | 81 | chunk = _chunks[chunkIdx]; 82 | if (chunk.absPos > pos) 83 | chunksLoopOngoing = false; 84 | else 85 | { 86 | chunkIdx += 1; 87 | qint64 count; 88 | qint64 chunkOfs = pos - chunk.absPos; 89 | if (maxSize > ((qint64)chunk.data.size() - chunkOfs)) 90 | { 91 | count = (qint64)chunk.data.size() - chunkOfs; 92 | ioDelta += CHUNK_SIZE - chunk.data.size(); 93 | } 94 | else 95 | count = maxSize; 96 | if (count > 0) 97 | { 98 | buffer += chunk.data.mid(chunkOfs, (int)count); 99 | maxSize -= count; 100 | pos += count; 101 | if (highlighted) 102 | *highlighted += chunk.dataChanged.mid(chunkOfs, (int)count); 103 | } 104 | } 105 | } 106 | 107 | if ((maxSize > 0) && (pos < chunk.absPos)) 108 | { 109 | // In this section, we read data from the original source. This only will 110 | // happen, whe no copied data is available 111 | 112 | qint64 byteCount; 113 | QByteArray readBuffer; 114 | if ((chunk.absPos - pos) > maxSize) 115 | byteCount = maxSize; 116 | else 117 | byteCount = chunk.absPos - pos; 118 | 119 | maxSize -= byteCount; 120 | _ioDevice->seek(pos + ioDelta); 121 | readBuffer = _ioDevice->read(byteCount); 122 | buffer += readBuffer; 123 | if (highlighted) 124 | *highlighted += QByteArray(readBuffer.size(), NORMAL); 125 | pos += readBuffer.size(); 126 | } 127 | } 128 | _ioDevice->close(); 129 | return buffer; 130 | } 131 | 132 | bool Chunks::write(QIODevice &iODevice, qint64 pos, qint64 count) 133 | { 134 | if (count == -1) 135 | count = _size; 136 | bool ok = iODevice.open(QIODevice::WriteOnly); 137 | if (ok) 138 | { 139 | for (qint64 idx=pos; idx < count; idx += BUFFER_SIZE) 140 | { 141 | QByteArray ba = data(idx, BUFFER_SIZE); 142 | iODevice.write(ba); 143 | } 144 | iODevice.close(); 145 | } 146 | return ok; 147 | } 148 | 149 | 150 | // ***************************************** Set and get highlighting infos 151 | 152 | void Chunks::setDataChanged(qint64 pos, bool dataChanged) 153 | { 154 | if ((pos < 0) || (pos >= _size)) 155 | return; 156 | int chunkIdx = getChunkIndex(pos); 157 | qint64 posInBa = pos - _chunks[chunkIdx].absPos; 158 | _chunks[chunkIdx].dataChanged[(int)posInBa] = char(dataChanged); 159 | } 160 | 161 | bool Chunks::dataChanged(qint64 pos) 162 | { 163 | QByteArray highlighted; 164 | data(pos, 1, &highlighted); 165 | return bool(highlighted.at(0)); 166 | } 167 | 168 | 169 | // ***************************************** Search API 170 | 171 | qint64 Chunks::indexOf(const QByteArray &ba, qint64 from) 172 | { 173 | qint64 result = -1; 174 | QByteArray buffer; 175 | 176 | for (qint64 pos=from; (pos < _size) && (result < 0); pos += BUFFER_SIZE) 177 | { 178 | buffer = data(pos, BUFFER_SIZE + ba.size() - 1); 179 | int findPos = buffer.indexOf(ba); 180 | if (findPos >= 0) 181 | result = pos + (qint64)findPos; 182 | } 183 | return result; 184 | } 185 | 186 | qint64 Chunks::lastIndexOf(const QByteArray &ba, qint64 from) 187 | { 188 | qint64 result = -1; 189 | QByteArray buffer; 190 | 191 | for (qint64 pos=from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE) 192 | { 193 | qint64 sPos = pos - BUFFER_SIZE - (qint64)ba.size() + 1; 194 | if (sPos < 0) 195 | sPos = 0; 196 | buffer = data(sPos, pos - sPos); 197 | int findPos = buffer.lastIndexOf(ba); 198 | if (findPos >= 0) 199 | result = sPos + (qint64)findPos; 200 | } 201 | return result; 202 | } 203 | 204 | 205 | // ***************************************** Char manipulations 206 | 207 | bool Chunks::insert(qint64 pos, char b) 208 | { 209 | if ((pos < 0) || (pos > _size)) 210 | return false; 211 | int chunkIdx; 212 | if (pos == _size) 213 | chunkIdx = getChunkIndex(pos-1); 214 | else 215 | chunkIdx = getChunkIndex(pos); 216 | qint64 posInBa = pos - _chunks[chunkIdx].absPos; 217 | _chunks[chunkIdx].data.insert(posInBa, b); 218 | _chunks[chunkIdx].dataChanged.insert(posInBa, char(1)); 219 | for (int idx=chunkIdx+1; idx < _chunks.size(); idx++) 220 | _chunks[idx].absPos += 1; 221 | _size += 1; 222 | _pos = pos; 223 | return true; 224 | } 225 | 226 | bool Chunks::overwrite(qint64 pos, char b) 227 | { 228 | if ((pos < 0) || (pos >= _size)) 229 | return false; 230 | int chunkIdx = getChunkIndex(pos); 231 | qint64 posInBa = pos - _chunks[chunkIdx].absPos; 232 | _chunks[chunkIdx].data[(int)posInBa] = b; 233 | _chunks[chunkIdx].dataChanged[(int)posInBa] = char(1); 234 | _pos = pos; 235 | return true; 236 | } 237 | 238 | bool Chunks::removeAt(qint64 pos) 239 | { 240 | if ((pos < 0) || (pos >= _size)) 241 | return false; 242 | int chunkIdx = getChunkIndex(pos); 243 | qint64 posInBa = pos - _chunks[chunkIdx].absPos; 244 | _chunks[chunkIdx].data.remove(posInBa, 1); 245 | _chunks[chunkIdx].dataChanged.remove(posInBa, 1); 246 | for (int idx=chunkIdx+1; idx < _chunks.size(); idx++) 247 | _chunks[idx].absPos -= 1; 248 | _size -= 1; 249 | _pos = pos; 250 | return true; 251 | } 252 | 253 | 254 | // ***************************************** Utility functions 255 | 256 | char Chunks::operator[](qint64 pos) 257 | { 258 | return data(pos, 1).at(0); 259 | } 260 | 261 | qint64 Chunks::pos() 262 | { 263 | return _pos; 264 | } 265 | 266 | qint64 Chunks::size() 267 | { 268 | return _size; 269 | } 270 | 271 | int Chunks::getChunkIndex(qint64 absPos) 272 | { 273 | // This routine checks, if there is already a copied chunk available. If os, it 274 | // returns a reference to it. If there is no copied chunk available, original 275 | // data will be copied into a new chunk. 276 | 277 | int foundIdx = -1; 278 | int insertIdx = 0; 279 | qint64 ioDelta = 0; 280 | 281 | 282 | for (int idx=0; idx < _chunks.size(); idx++) 283 | { 284 | Chunk chunk = _chunks[idx]; 285 | if ((absPos >= chunk.absPos) && (absPos < (chunk.absPos + chunk.data.size()))) 286 | { 287 | foundIdx = idx; 288 | break; 289 | } 290 | if (absPos < chunk.absPos) 291 | { 292 | insertIdx = idx; 293 | break; 294 | } 295 | ioDelta += chunk.data.size() - CHUNK_SIZE; 296 | insertIdx = idx + 1; 297 | } 298 | 299 | if (foundIdx == -1) 300 | { 301 | Chunk newChunk; 302 | qint64 readAbsPos = absPos - ioDelta; 303 | qint64 readPos = (readAbsPos & READ_CHUNK_MASK); 304 | _ioDevice->open(QIODevice::ReadOnly); 305 | _ioDevice->seek(readPos); 306 | newChunk.data = _ioDevice->read(CHUNK_SIZE); 307 | _ioDevice->close(); 308 | newChunk.absPos = absPos - (readAbsPos - readPos); 309 | newChunk.dataChanged = QByteArray(newChunk.data.size(), char(0)); 310 | _chunks.insert(insertIdx, newChunk); 311 | foundIdx = insertIdx; 312 | } 313 | return foundIdx; 314 | } 315 | 316 | 317 | #ifdef MODUL_TEST 318 | int Chunks::chunkSize() 319 | { 320 | return _chunks.size(); 321 | } 322 | 323 | #endif 324 | -------------------------------------------------------------------------------- /IMSProg_programmer/chunks.h: -------------------------------------------------------------------------------- 1 | #ifndef CHUNKS_H 2 | #define CHUNKS_H 3 | 4 | /** \cond docNever */ 5 | 6 | /*! The Chunks class is the storage backend for QHexEdit. 7 | * 8 | * When QHexEdit loads data, Chunks access them using a QIODevice interface. When the app uses 9 | * a QByteArray interface, QBuffer is used to provide again a QIODevice like interface. No data 10 | * will be changed, therefore Chunks opens the QIODevice in QIODevice::ReadOnly mode. After every 11 | * access Chunks closes the QIODevice, that's why external applications can overwrite files while 12 | * QHexEdit shows them. 13 | * 14 | * When the the user starts to edit the data, Chunks creates a local copy of a chunk of data (4 15 | * kilobytes) and notes all changes there. Parallel to that chunk, there is a second chunk, 16 | * which keep track of which bytes are changed and which not. 17 | * 18 | */ 19 | 20 | #include 21 | 22 | struct Chunk 23 | { 24 | QByteArray data; 25 | QByteArray dataChanged; 26 | qint64 absPos; 27 | }; 28 | 29 | class Chunks: public QObject 30 | { 31 | Q_OBJECT 32 | public: 33 | // Constructors and file settings 34 | Chunks(QObject *parent); 35 | Chunks(QIODevice &ioDevice, QObject *parent); 36 | bool setIODevice(QIODevice &ioDevice); 37 | 38 | // Getting data out of Chunks 39 | QByteArray data(qint64 pos=0, qint64 count=-1, QByteArray *highlighted=0); 40 | bool write(QIODevice &iODevice, qint64 pos=0, qint64 count=-1); 41 | 42 | // Set and get highlighting infos 43 | void setDataChanged(qint64 pos, bool dataChanged); 44 | bool dataChanged(qint64 pos); 45 | 46 | // Search API 47 | qint64 indexOf(const QByteArray &ba, qint64 from); 48 | qint64 lastIndexOf(const QByteArray &ba, qint64 from); 49 | 50 | // Char manipulations 51 | bool insert(qint64 pos, char b); 52 | bool overwrite(qint64 pos, char b); 53 | bool removeAt(qint64 pos); 54 | 55 | // Utility functions 56 | char operator[](qint64 pos); 57 | qint64 pos(); 58 | qint64 size(); 59 | 60 | 61 | private: 62 | int getChunkIndex(qint64 absPos); 63 | 64 | QIODevice * _ioDevice; 65 | qint64 _pos; 66 | qint64 _size; 67 | QList _chunks; 68 | 69 | #ifdef MODUL_TEST 70 | public: 71 | int chunkSize(); 72 | #endif 73 | }; 74 | 75 | /** \endcond docNever */ 76 | 77 | #endif // CHUNKS_H 78 | -------------------------------------------------------------------------------- /IMSProg_programmer/cmake/FindLibUSB.cmake: -------------------------------------------------------------------------------- 1 | # - Find libusb for portable USB support 2 | # 3 | # If the LibUSB_ROOT environment variable 4 | # is defined, it will be used as base path. 5 | # The following standard variables get defined: 6 | # LibUSB_FOUND: true if LibUSB was found 7 | # LibUSB_INCLUDE_DIR: the directory that contains the include file 8 | # LibUSB_LIBRARIES: the libraries 9 | 10 | find_package(PkgConfig) 11 | 12 | IF(PKG_CONFIG_FOUND) 13 | IF(DEPENDS_DIR) #Otherwise use System pkg-config path 14 | SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPENDS_DIR}/libusb/lib/pkgconfig") 15 | ENDIF() 16 | SET(MODULE "libusb-1.0") 17 | IF(CMAKE_SYSTEM_NAME MATCHES "Linux") 18 | SET(MODULE "libusb-1.0>=1.0.20") 19 | ENDIF() 20 | IF(LibUSB_FIND_REQUIRED) 21 | SET(LibUSB_REQUIRED "REQUIRED") 22 | ENDIF() 23 | PKG_CHECK_MODULES(LibUSB ${LibUSB_REQUIRED} ${MODULE}) 24 | 25 | FIND_LIBRARY(LibUSB_LIBRARY 26 | NAMES ${LibUSB_LIBRARIES} 27 | HINTS ${LibUSB_LIBRARY_DIRS} 28 | ) 29 | SET(LibUSB_LIBRARIES ${LibUSB_LIBRARY}) 30 | 31 | RETURN() 32 | ENDIF() 33 | 34 | FIND_PATH(LibUSB_INCLUDE_DIRS 35 | NAMES libusb.h 36 | PATHS 37 | "${DEPENDS_DIR}/libusb" 38 | "${DEPENDS_DIR}/libusbx" 39 | ENV LibUSB_ROOT 40 | PATH_SUFFIXES 41 | include 42 | libusb 43 | include/libusb-1.0 44 | ) 45 | 46 | SET(LIBUSB_NAME libusb) 47 | 48 | FIND_LIBRARY(LibUSB_LIBRARIES 49 | NAMES ${LIBUSB_NAME}-1.0 50 | PATHS 51 | "${DEPENDS_DIR}/libusb" 52 | "${DEPENDS_DIR}/libusbx" 53 | ENV LibUSB_ROOT 54 | PATH_SUFFIXES 55 | x64/Release/dll 56 | x64/Debug/dll 57 | Win32/Release/dll 58 | Win32/Debug/dll 59 | MS64 60 | MS64/dll 61 | ) 62 | 63 | IF(WIN32) 64 | FIND_FILE(LibUSB_DLL 65 | ${LIBUSB_NAME}-1.0.dll 66 | PATHS 67 | "${DEPENDS_DIR}/libusb" 68 | "${DEPENDS_DIR}/libusbx" 69 | ENV LibUSB_ROOT 70 | PATH_SUFFIXES 71 | x64/Release/dll 72 | x64/Debug/dll 73 | Win32/Release/dll 74 | Win32/Debug/dll 75 | MS64 76 | MS64/dll 77 | ) 78 | ENDIF() 79 | 80 | INCLUDE(FindPackageHandleStandardArgs) 81 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUSB FOUND_VAR LibUSB_FOUND 82 | REQUIRED_VARS LibUSB_LIBRARIES LibUSB_INCLUDE_DIRS) 83 | -------------------------------------------------------------------------------- /IMSProg_programmer/commands.cpp: -------------------------------------------------------------------------------- 1 | #include "commands.h" 2 | #include 3 | 4 | 5 | // Helper class to store single byte commands 6 | class CharCommand : public QUndoCommand 7 | { 8 | public: 9 | enum CCmd {insert, removeAt, overwrite}; 10 | 11 | CharCommand(Chunks * chunks, CCmd cmd, qint64 charPos, char newChar, 12 | QUndoCommand *parent=0); 13 | 14 | void undo(); 15 | void redo(); 16 | bool mergeWith(const QUndoCommand *command); 17 | int id() const { return 1234; } 18 | 19 | private: 20 | Chunks * _chunks; 21 | qint64 _charPos; 22 | bool _wasChanged; 23 | char _newChar; 24 | char _oldChar; 25 | CCmd _cmd; 26 | }; 27 | 28 | CharCommand::CharCommand(Chunks * chunks, CCmd cmd, qint64 charPos, char newChar, QUndoCommand *parent) 29 | : QUndoCommand(parent) 30 | , _chunks(chunks) 31 | , _charPos(charPos) 32 | , _wasChanged(false) 33 | , _newChar(newChar) 34 | , _oldChar('\0') 35 | , _cmd(cmd) 36 | { 37 | } 38 | 39 | bool CharCommand::mergeWith(const QUndoCommand *command) 40 | { 41 | const CharCommand *nextCommand = static_cast(command); 42 | bool result = false; 43 | 44 | if (_cmd != CharCommand::removeAt) 45 | { 46 | if (nextCommand->_cmd == overwrite) 47 | if (nextCommand->_charPos == _charPos) 48 | { 49 | _newChar = nextCommand->_newChar; 50 | result = true; 51 | } 52 | } 53 | return result; 54 | } 55 | 56 | void CharCommand::undo() 57 | { 58 | switch (_cmd) 59 | { 60 | case insert: 61 | _chunks->removeAt(_charPos); 62 | break; 63 | case overwrite: 64 | _chunks->overwrite(_charPos, _oldChar); 65 | _chunks->setDataChanged(_charPos, _wasChanged); 66 | break; 67 | case removeAt: 68 | _chunks->insert(_charPos, _oldChar); 69 | _chunks->setDataChanged(_charPos, _wasChanged); 70 | break; 71 | } 72 | } 73 | 74 | void CharCommand::redo() 75 | { 76 | switch (_cmd) 77 | { 78 | case insert: 79 | _chunks->insert(_charPos, _newChar); 80 | break; 81 | case overwrite: 82 | _oldChar = (*_chunks)[_charPos]; 83 | _wasChanged = _chunks->dataChanged(_charPos); 84 | _chunks->overwrite(_charPos, _newChar); 85 | break; 86 | case removeAt: 87 | _oldChar = (*_chunks)[_charPos]; 88 | _wasChanged = _chunks->dataChanged(_charPos); 89 | _chunks->removeAt(_charPos); 90 | break; 91 | } 92 | } 93 | 94 | UndoStack::UndoStack(Chunks * chunks, QObject * parent) 95 | : QUndoStack(parent) 96 | { 97 | _chunks = chunks; 98 | _parent = parent; 99 | this->setUndoLimit(1000); 100 | } 101 | 102 | void UndoStack::insert(qint64 pos, char c) 103 | { 104 | if ((pos >= 0) && (pos <= _chunks->size())) 105 | { 106 | QUndoCommand *cc = new CharCommand(_chunks, CharCommand::insert, pos, c); 107 | this->push(cc); 108 | } 109 | } 110 | 111 | void UndoStack::insert(qint64 pos, const QByteArray &ba) 112 | { 113 | if ((pos >= 0) && (pos <= _chunks->size())) 114 | { 115 | QString txt = QString(tr("Inserting %1 bytes")).arg(ba.size()); 116 | beginMacro(txt); 117 | for (int idx=0; idx < ba.size(); idx++) 118 | { 119 | QUndoCommand *cc = new CharCommand(_chunks, CharCommand::insert, pos + idx, ba.at(idx)); 120 | this->push(cc); 121 | } 122 | endMacro(); 123 | } 124 | } 125 | 126 | void UndoStack::removeAt(qint64 pos, qint64 len) 127 | { 128 | if ((pos >= 0) && (pos < _chunks->size())) 129 | { 130 | if (len==1) 131 | { 132 | QUndoCommand *cc = new CharCommand(_chunks, CharCommand::removeAt, pos, char(0)); 133 | this->push(cc); 134 | } 135 | else 136 | { 137 | QString txt = QString(tr("Delete %1 chars")).arg(len); 138 | beginMacro(txt); 139 | for (qint64 cnt=0; cnt= 0) && (pos < _chunks->size())) 152 | { 153 | QUndoCommand *cc = new CharCommand(_chunks, CharCommand::overwrite, pos, c); 154 | this->push(cc); 155 | } 156 | } 157 | 158 | void UndoStack::overwrite(qint64 pos, int len, const QByteArray &ba) 159 | { 160 | if ((pos >= 0) && (pos < _chunks->size())) 161 | { 162 | QString txt = QString(tr("Overwrite %1 chars")).arg(len); 163 | beginMacro(txt); 164 | removeAt(pos, len); 165 | insert(pos, ba); 166 | endMacro(); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /IMSProg_programmer/commands.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMANDS_H 2 | #define COMMANDS_H 3 | 4 | /** \cond docNever */ 5 | 6 | #include 7 | 8 | #include "chunks.h" 9 | 10 | /*! CharCommand is a class to provid undo/redo functionality in QHexEdit. 11 | A QUndoCommand represents a single editing action on a document. CharCommand 12 | is responsable for manipulations on single chars. It can insert. overwrite and 13 | remove characters. A manipulation stores allways two actions 14 | 1. redo (or do) action 15 | 2. undo action. 16 | 17 | CharCommand also supports command compression via mergeWith(). This enables 18 | the user to perform an undo command e.g. 3 steps in a single command. 19 | If you for example insert a new byt "34" this means for the editor doing 3 20 | steps: insert a "00", overwrite it with "03" and the overwrite it with "34". These 21 | 3 steps are combined into a single step, insert a "34". 22 | 23 | The byte array oriented commands are just put into a set of single byte commands, 24 | which are pooled together with the macroBegin() and macroEnd() functionality of 25 | Qt's QUndoStack. 26 | */ 27 | 28 | class UndoStack : public QUndoStack 29 | { 30 | Q_OBJECT 31 | 32 | public: 33 | UndoStack(Chunks *chunks, QObject * parent=0); 34 | void insert(qint64 pos, char c); 35 | void insert(qint64 pos, const QByteArray &ba); 36 | void removeAt(qint64 pos, qint64 len=1); 37 | void overwrite(qint64 pos, char c); 38 | void overwrite(qint64 pos, int len, const QByteArray &ba); 39 | 40 | private: 41 | Chunks * _chunks; 42 | QObject * _parent; 43 | }; 44 | 45 | /** \endcond docNever */ 46 | 47 | #endif // COMMANDS_H 48 | -------------------------------------------------------------------------------- /IMSProg_programmer/database/IMSProg.Dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/database/IMSProg.Dat -------------------------------------------------------------------------------- /IMSProg_programmer/dialogabout.cpp: -------------------------------------------------------------------------------- 1 | #include "dialogabout.h" 2 | #include "ui_dialogabout.h" 3 | 4 | DialogAbout::DialogAbout(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::DialogAbout) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | DialogAbout::~DialogAbout() 12 | { 13 | delete ui; 14 | } 15 | 16 | void DialogAbout::on_pushButton_clicked() 17 | { 18 | DialogAbout::close(); 19 | } 20 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogabout.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOGABOUT_H 2 | #define DIALOGABOUT_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class DialogAbout; 8 | } 9 | 10 | class DialogAbout : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit DialogAbout(QWidget *parent = nullptr); 16 | ~DialogAbout(); 17 | 18 | private slots: 19 | void on_pushButton_clicked(); 20 | 21 | private: 22 | Ui::DialogAbout *ui; 23 | }; 24 | 25 | #endif // DIALOGABOUT_H 26 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogabout.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogAbout 4 | 5 | 6 | 7 | 0 8 | 0 9 | 515 10 | 440 11 | 12 | 13 | 14 | About IMSProg 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | IMSProg - free software I2C, SPI and MicroWire EEPROM/Flash chip programmer for CH341a devices. 23 | 24 | 25 | true 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | :/res/img/ch341_green150.png 38 | 39 | 40 | 41 | 42 | 43 | 44 | OR 45 | 46 | 47 | Qt::AlignCenter 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | :/res/img/ch341_black150.png 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | In this program QhexEditor widget (https://github.com/Simsys/qhexedit2) and modified programmer SNANDer (https://github.com/McMCCRU/SNANDer) were used. 67 | 68 | 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Qt::Vertical 79 | 80 | 81 | 82 | 20 83 | 112 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | Written by 2023 Mikhail Medvedev 96 | 97 | 98 | 99 | 100 | 101 | 102 | Version: 1.0.22 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | Qt::Horizontal 112 | 113 | 114 | 115 | 40 116 | 20 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 90 126 | 25 127 | 128 | 129 | 130 | color: rgb(255, 255, 255); 131 | background-color: rgb(120, 183, 140); 132 | border-radius: 20px; 133 | border: 2px solid #094065;border-radius:8px;font-weight:600; 134 | 135 | 136 | Close 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogrp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Mikhail Medvedev 3 | * 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #include "dialogrp.h" 16 | #include "ui_dialogrp.h" 17 | #include "mainwindow.h" 18 | #include 19 | #include 20 | #include 21 | #include 22 | DialogRP::DialogRP(QWidget *parent) : 23 | QDialog(parent), 24 | ui(new Ui::DialogRP) 25 | { 26 | ui->setupUi(this); 27 | QRegExp reHex( "[A-Fa-f0-9]{1,8}" ); 28 | QRegExpValidator *validator = new QRegExpValidator(reHex, this); 29 | ui->lineEditStart->setValidator(validator); 30 | } 31 | 32 | DialogRP::~DialogRP() 33 | { 34 | delete ui; 35 | } 36 | 37 | void DialogRP::on_pushButton_clicked() 38 | { 39 | 40 | addrData = QString(ui->lineEditStart->text()); 41 | emit sendAddr2(addrData); 42 | DialogRP::close(); 43 | } 44 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogrp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Mikhail Medvedev 3 | * 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef DIALOGRP_H 16 | #define DIALOGRP_H 17 | 18 | #include 19 | #include 20 | 21 | namespace Ui { 22 | class DialogRP; 23 | } 24 | 25 | class DialogRP : public QDialog 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DialogRP(QWidget *parent = nullptr); 31 | ~DialogRP(); 32 | 33 | private slots: 34 | void on_pushButton_clicked(); 35 | 36 | signals: 37 | void sendAddr2(QString); 38 | 39 | private: 40 | Ui::DialogRP *ui; 41 | QString addrData; 42 | }; 43 | 44 | #endif // DIALOGRP_H 45 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogrp.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogRP 4 | 5 | 6 | 7 | 0 8 | 0 9 | 269 10 | 121 11 | 12 | 13 | 14 | Load block from file 15 | 16 | 17 | 18 | 12 19 | 20 | 21 | 22 | 23 | All values in HEX format! 24 | 25 | 26 | Qt::AlignCenter 27 | 28 | 29 | 30 | 31 | 32 | 33 | 13 34 | 35 | 36 | 37 | 38 | Start address: 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 120 47 | 0 48 | 49 | 50 | 51 | border: 2px solid gray;border-radius: 5px;color:#000;font-weight:600;border-style: inset; 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 31 61 | 62 | 63 | 9 64 | 65 | 66 | 67 | 68 | Qt::Horizontal 69 | 70 | 71 | 72 | 128 73 | 20 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 60 83 | 22 84 | 85 | 86 | 87 | color: rgb(255, 255, 255); 88 | background-color: rgb(120, 183, 140); 89 | border-radius: 20px; 90 | border: 2px solid #094065;border-radius:8px;font-weight:600; 91 | 92 | 93 | Load 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogsp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Mikhail Medvedev 3 | * 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #include "dialogsp.h" 16 | #include "ui_dialogsp.h" 17 | #include "mainwindow.h" 18 | #include 19 | #include 20 | #include 21 | #include 22 | DialogSP::DialogSP(QWidget *parent) : 23 | QDialog(parent), 24 | ui(new Ui::DialogSP) 25 | { 26 | ui->setupUi(this); 27 | ui->comboBox_end->addItem("End address", 0); 28 | ui->comboBox_end->addItem("Lenght", 1); 29 | QRegExp reHex( "[A-Fa-f0-9]{1,8}" ); 30 | QRegExpValidator *validator = new QRegExpValidator(reHex, this); 31 | ui->lineEditStart->setValidator(validator); 32 | ui->lineEditEnd->setValidator(validator); 33 | } 34 | 35 | DialogSP::~DialogSP() 36 | { 37 | delete ui; 38 | } 39 | 40 | void DialogSP::on_pushButton_clicked() 41 | { 42 | 43 | if (ui->comboBox_end->currentData() == 0) addrData = QString(ui->lineEditStart->text() + "-" + ui->lineEditEnd->text() + "*"); 44 | else addrData = QString(ui->lineEditStart->text() + "-" + ui->lineEditEnd->text() + "#"); 45 | emit sendAddr(addrData); 46 | DialogSP::close(); 47 | } 48 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogsp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Mikhail Medvedev 3 | * 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef DIALOGSP_H 16 | #define DIALOGSP_H 17 | 18 | #include 19 | #include 20 | 21 | namespace Ui { 22 | class DialogSP; 23 | } 24 | 25 | class DialogSP : public QDialog 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | explicit DialogSP(QWidget *parent = nullptr); 31 | ~DialogSP(); 32 | 33 | private slots: 34 | void on_pushButton_clicked(); 35 | 36 | signals: 37 | void sendAddr(QString); 38 | 39 | private: 40 | Ui::DialogSP *ui; 41 | QString addrData; 42 | }; 43 | 44 | #endif // DIALOGSP_H 45 | -------------------------------------------------------------------------------- /IMSProg_programmer/dialogsp.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogSP 4 | 5 | 6 | 7 | 0 8 | 0 9 | 272 10 | 160 11 | 12 | 13 | 14 | Save part of image 15 | 16 | 17 | 18 | 13 19 | 20 | 21 | 22 | 23 | All values in HEX format! 24 | 25 | 26 | Qt::AlignCenter 27 | 28 | 29 | 30 | 31 | 32 | 33 | 12 34 | 35 | 36 | 37 | 38 | Start address: 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 120 47 | 0 48 | 49 | 50 | 51 | border: 2px solid gray;border-radius: 5px;color:#000;font-weight:600;border-style: inset; 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 120 60 | 0 61 | 62 | 63 | 64 | border: 2px solid gray;border-radius: 5px;color:#000;font-weight:600;border-style: inset; 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 120 73 | 0 74 | 75 | 76 | 77 | border: 2px solid gray;border-radius: 5px;color:#000;font-weight:600;border-style: inset; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Qt::Horizontal 89 | 90 | 91 | 92 | 118 93 | 20 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 80 103 | 22 104 | 105 | 106 | 107 | color: rgb(255, 255, 255); 108 | background-color: rgb(120, 183, 140); 109 | border-radius: 20px; 110 | border: 2px solid #094065;border-radius:8px;font-weight:600; 111 | 112 | 113 | Save 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /IMSProg_programmer/flashcmd_api.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2021 McMCC 3 | * flashcmd_api.c 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | 16 | #include 17 | #include "flashcmd_api.h" 18 | 19 | #ifdef EEPROM_SUPPORT 20 | #define __EEPROM___ "or EEPROM" 21 | extern int eepromsize; 22 | extern int mw_eepromsize; 23 | extern int seepromsize; 24 | #else 25 | #define __EEPROM___ "" 26 | #endif 27 | 28 | long flash_cmd_init(struct flash_cmd *cmd) 29 | { 30 | long flen = -1; 31 | 32 | #ifdef EEPROM_SUPPORT 33 | if ((eepromsize <= 0) && (mw_eepromsize <= 0) && (seepromsize <= 0)) { 34 | #endif 35 | if ((flen = snand_init()) > 0) { 36 | cmd->flash_erase = snand_erase; 37 | cmd->flash_write = snand_write; 38 | cmd->flash_read = snand_read; 39 | } else if ((flen = snor_init()) > 0) { 40 | cmd->flash_erase = snor_erase; 41 | cmd->flash_write = snor_write; 42 | cmd->flash_read = snor_read; 43 | } 44 | #ifdef EEPROM_SUPPORT 45 | } else if ((eepromsize > 0) || (mw_eepromsize > 0) || (seepromsize > 0)) { 46 | if ((eepromsize > 0) && (flen = i2c_init()) > 0) { 47 | cmd->flash_erase = i2c_eeprom_erase; 48 | cmd->flash_write = i2c_eeprom_write; 49 | cmd->flash_read = i2c_eeprom_read; 50 | } else if ((mw_eepromsize > 0) && (flen = mw_init()) > 0) { 51 | cmd->flash_erase = mw_eeprom_erase; 52 | cmd->flash_write = mw_eeprom_write; 53 | cmd->flash_read = mw_eeprom_read; 54 | } else if ((seepromsize > 0) && (flen = spi_eeprom_init()) > 0) { 55 | cmd->flash_erase = spi_eeprom_erase; 56 | cmd->flash_write = spi_eeprom_write; 57 | cmd->flash_read = spi_eeprom_read; 58 | } 59 | } 60 | #endif 61 | else 62 | printf("\nFlash" __EEPROM___ " not found!!!!\n\n"); 63 | 64 | return flen; 65 | } 66 | 67 | void support_flash_list(void) 68 | { 69 | support_snand_list(); 70 | printf("\n"); 71 | support_snor_list(); 72 | #ifdef EEPROM_SUPPORT 73 | printf("\n"); 74 | support_i2c_eeprom_list(); 75 | printf("\n"); 76 | support_mw_eeprom_list(); 77 | printf("\n"); 78 | support_spi_eeprom_list(); 79 | #endif 80 | } 81 | /* End of [flashcmd.c] package */ 82 | -------------------------------------------------------------------------------- /IMSProg_programmer/flashcmd_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2021 McMCC 3 | * flashcmd_api.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __FLASHCMD_API_H__ 16 | #define __FLASHCMD_API_H__ 17 | 18 | #include "nandcmd_api.h" 19 | #include "snorcmd_api.h" 20 | #ifdef EEPROM_SUPPORT 21 | #include "i2c_eeprom_api.h" 22 | #include "mw_eeprom_api.h" 23 | #include "spi_eeprom_api.h" 24 | #endif 25 | 26 | struct flash_cmd { 27 | int (*flash_read)(unsigned char *buf, unsigned long from, unsigned long len); 28 | int (*flash_erase)(unsigned long offs, unsigned long len); 29 | int (*flash_write)(unsigned char *buf, unsigned long to, unsigned long len); 30 | }; 31 | 32 | long flash_cmd_init(struct flash_cmd *cmd); 33 | void support_flash_list(void); 34 | 35 | #endif /* __FLASHCMD_API_H__ */ 36 | /* End of [flashcmd_api.h] package */ 37 | -------------------------------------------------------------------------------- /IMSProg_programmer/i2c_eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * i2c_eeprom.c 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | 16 | #include "ch341a_spi.h" 17 | #include "ch341a_i2c.h" 18 | #include "timer.h" 19 | 20 | extern unsigned int bsize; 21 | struct EEPROM eeprom_info; 22 | char eepromname[12]; 23 | int eepromsize = 0; 24 | 25 | /*int i2c_eeprom_read(unsigned char *buf, unsigned long from, unsigned long len) 26 | { 27 | unsigned char *pbuf, ebuf[MAX_EEPROM_SIZE]; 28 | 29 | if (len == 0) 30 | return -1; 31 | 32 | timer_start(); 33 | memset(ebuf, 0, sizeof(ebuf)); 34 | pbuf = ebuf; 35 | 36 | if (ch341readEEPROM(pbuf, eepromsize, &eeprom_info) < 0) { 37 | printf("Couldnt read [%d] bytes from [%s] EEPROM address 0x%08lu\n", (int)len, eepromname, from); 38 | return -1; 39 | } 40 | 41 | memcpy(buf, pbuf + from, len); 42 | 43 | printf("Read [%d] bytes from [%s] EEPROM address 0x%08lu\n", (int)len, eepromname, from); 44 | timer_end(); 45 | 46 | return (int)len; 47 | } 48 | */ 49 | /*int i2c_eeprom_erase(unsigned long offs, unsigned long len) 50 | { 51 | unsigned char *pbuf, ebuf[MAX_EEPROM_SIZE]; 52 | 53 | if (len == 0) 54 | return -1; 55 | 56 | timer_start(); 57 | memset(ebuf, 0xff, sizeof(ebuf)); 58 | pbuf = ebuf; 59 | 60 | if (offs || len < eepromsize) { 61 | if (ch341readEEPROM(pbuf, eepromsize, &eeprom_info) < 0) { 62 | printf("Couldnt read [%d] bytes from [%s] EEPROM\n", eepromsize, eepromname); 63 | return -1; 64 | } 65 | memset(pbuf + offs, 0xff, len); 66 | } 67 | 68 | if(ch341writeEEPROM(pbuf, eepromsize, &eeprom_info) < 0) { 69 | printf("Failed to erase [%d] bytes of [%s] EEPROM address 0x%08lu\n", (int)len, eepromname, offs); 70 | return -1; 71 | } 72 | 73 | printf("Erased [%d] bytes of [%s] EEPROM address 0x%08lu\n", (int)len, eepromname, offs); 74 | timer_end(); 75 | 76 | return 0; 77 | } 78 | */ 79 | /*int i2c_eeprom_write(unsigned char *buf, unsigned long to, unsigned long len) 80 | { 81 | unsigned char *pbuf, ebuf[MAX_EEPROM_SIZE]; 82 | 83 | if (len == 0) 84 | return -1; 85 | 86 | timer_start(); 87 | memset(ebuf, 0xff, sizeof(ebuf)); 88 | pbuf = ebuf; 89 | 90 | if (to || len < eepromsize) { 91 | if (ch341readEEPROM(pbuf, eepromsize, &eeprom_info) < 0) { 92 | printf("Couldnt read [%d] bytes from [%s] EEPROM\n", (int)len, eepromname); 93 | return -1; 94 | } 95 | } 96 | memcpy(pbuf + to, buf, len); 97 | 98 | if(ch341writeEEPROM(pbuf, eepromsize, &eeprom_info) < 0) { 99 | printf("Failed to write [%d] bytes of [%s] EEPROM address 0x%08lu\n", (int)len, eepromname, to); 100 | return -1; 101 | } 102 | 103 | printf("Wrote [%d] bytes to [%s] EEPROM address 0x%08lu\n", (int)len, eepromname, to); 104 | timer_end(); 105 | 106 | return (int)len; 107 | } 108 | 109 | long i2c_init(void) 110 | { 111 | if (config_stream(CH341_I2C_STANDARD_SPEED) < 0) 112 | return -1; 113 | 114 | if (eepromsize <= 0) { 115 | printf("I2C EEPROM Not Detected!\n"); 116 | return -1; 117 | } 118 | 119 | bsize = 1; 120 | 121 | printf("I2C EEPROM chip: %s, Size: %d bytes\n", eepromname, eepromsize); 122 | 123 | return (long)eepromsize; 124 | } 125 | 126 | void support_i2c_eeprom_list(void) 127 | { 128 | int i; 129 | 130 | printf("I2C EEPROM Support List:\n"); 131 | for ( i = 0; i < (sizeof(eepromlist)/sizeof(struct EEPROM)); i++) 132 | { 133 | if (!eepromlist[i].size) 134 | break; 135 | printf("%03d. %s\n", i + 1, eepromlist[i].name); 136 | } 137 | } 138 | */ 139 | /* End of [i2c_eeprom.c] package */ 140 | -------------------------------------------------------------------------------- /IMSProg_programmer/i2c_eeprom_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * i2c_eeprom_api.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __I2C_EEPROM_API_H__ 16 | #define __I2C_EEPROM_API_H__ 17 | 18 | //int i2c_eeprom_read(unsigned char *buf, unsigned long from, unsigned long len); 19 | int i2c_eeprom_erase(unsigned long offs, unsigned long len); 20 | int i2c_eeprom_write(unsigned char *buf, unsigned long to, unsigned long len); 21 | long i2c_init(void); 22 | void support_i2c_eeprom_list(void); 23 | 24 | #endif /* __I2C_EEPROM_API_H__ */ 25 | /* End of [i2c_eeprom_api.h] package */ 26 | -------------------------------------------------------------------------------- /IMSProg_programmer/img/CH341_icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/CH341_icons.psd -------------------------------------------------------------------------------- /IMSProg_programmer/img/CH341_icons64.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/CH341_icons64.psd -------------------------------------------------------------------------------- /IMSProg_programmer/img/IMSProg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/IMSProg.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/ch341_black150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/ch341_black150.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/ch341_green150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/ch341_green150.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/checkSum64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/checkSum64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/chipEdit64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/chipEdit64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/erase64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/erase64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/exit64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/exit64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/hexsearch64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/hexsearch64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/loadBlock64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/loadBlock64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/open64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/open64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/read64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/read64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/redo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/redo64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/save64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/save64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/saveBlock64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/saveBlock64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/test64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/test64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/undo.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/unprotect64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/unprotect64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/verify64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/verify64.png -------------------------------------------------------------------------------- /IMSProg_programmer/img/write64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/img/write64.png -------------------------------------------------------------------------------- /IMSProg_programmer/language/chipProgrammer_de_DE.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/language/chipProgrammer_de_DE.qm -------------------------------------------------------------------------------- /IMSProg_programmer/language/chipProgrammer_es_ES.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/language/chipProgrammer_es_ES.qm -------------------------------------------------------------------------------- /IMSProg_programmer/language/chipProgrammer_ru_RU.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/IMSProg_programmer/language/chipProgrammer_ru_RU.qm -------------------------------------------------------------------------------- /IMSProg_programmer/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Mikhail Medvedev 3 | * 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #include "mainwindow.h" 16 | #include 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 21 | QApplication a(argc, argv); 22 | QTranslator translator; 23 | QString translateName = "chipProgrammer_" + QLocale::system().name(); 24 | if(translator.load(translateName, "language/")) a.installTranslator(&translator); 25 | a.installTranslator(&translator); 26 | MainWindow w; 27 | w.show(); 28 | 29 | return a.exec(); 30 | } 31 | -------------------------------------------------------------------------------- /IMSProg_programmer/mainwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Mikhail Medvedev 3 | * 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef MAINWINDOW_H 16 | #define MAINWINDOW_H 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "qhexedit.h" 24 | #include "dialogsp.h" 25 | #include "dialogabout.h" 26 | #include "searchdialog.h" 27 | extern "C" { 28 | #include "bitbang_microwire.h" 29 | #include "ch341a_gpio.h" 30 | #include "ch341a_i2c.h" 31 | #include "ch341a_spi.h" 32 | #include "flashcmd_api.h" 33 | #include "i2c_eeprom_api.h" 34 | #include "mw_eeprom_api.h" 35 | #include "nandcmd_api.h" 36 | #include "res.h" 37 | #include "snorcmd_api.h" 38 | #include "spi_controller.h" 39 | #include "spi_eeprom.h" 40 | #include "spi_eeprom_api.h" 41 | #include "spi_nand_flash.h" 42 | #include "timer.h" 43 | #include "types.h" 44 | } 45 | 46 | 47 | namespace Ui { 48 | class MainWindow; 49 | } 50 | 51 | class MainWindow : public QMainWindow 52 | { 53 | Q_OBJECT 54 | 55 | public: 56 | explicit MainWindow(QWidget *parent = nullptr); 57 | ~MainWindow(); 58 | 59 | public slots: 60 | 61 | void receiveAddr(QString); 62 | void receiveAddr2(QString); 63 | 64 | private slots: 65 | void on_pushButton_clicked(); 66 | void on_pushButton_2_clicked(); 67 | void on_comboBox_size_currentIndexChanged(int index); 68 | void on_comboBox_page_currentIndexChanged(int index); 69 | void on_actionDetect_triggered(); 70 | void on_actionSave_triggered(); 71 | void on_actionErase_triggered(); 72 | void on_actionUndo_triggered(); 73 | void on_actionRedo_triggered(); 74 | void on_actionOpen_triggered(); 75 | void on_actionWrite_triggered(); 76 | void on_actionRead_triggered(); 77 | void on_actionExit_triggered(); 78 | void on_comboBox_man_currentIndexChanged(int index); 79 | void on_comboBox_name_currentIndexChanged(const QString &arg1); 80 | void on_actionVerify_triggered(); 81 | void on_pushButton_3_clicked(); 82 | void on_actionSave_Part_triggered(); 83 | void on_actionLoad_Part_triggered(); 84 | void on_actionFind_Replace_triggered(); 85 | void on_comboBox_type_currentIndexChanged(int index); 86 | void on_actionAbout_triggered(); 87 | 88 | void on_actionChecksum_calculate_triggered(); 89 | 90 | void on_actionEdit_chips_Database_triggered(); 91 | 92 | private: 93 | Ui::MainWindow *ui; 94 | int statusCH341; 95 | QByteArray chipData; 96 | uint32_t currentChipSize, currentNumBlocks, currentBlockSize, currentPageSize; 97 | uint8_t currentAlgorithm, currentChipType; 98 | unsigned int currentAddr4bit; 99 | QString bytePrint(unsigned char z); 100 | QVector chType = {"SPI_FLASH","25_EEPROM","93_EEPROM","24_EEPROM","95_EEPROM"}; 101 | struct chip_data { 102 | QString chipManuf; 103 | QString chipTypeTxt; 104 | QString chipName; 105 | uint8_t chipJedecIDMan; 106 | uint8_t chipJedecIDDev; 107 | uint8_t chipJedecIDCap; 108 | uint32_t chipSize; 109 | uint16_t sectorSize; 110 | uint8_t chipTypeHex; 111 | uint8_t algorithmCode; 112 | int delay; 113 | uint8_t addr4bit; 114 | uint32_t blockSize; 115 | uint8_t eepromPages; 116 | QString chipVCC; 117 | }; 118 | chip_data chips[2000]; 119 | int max_rec; 120 | QString fileName; 121 | QHexEdit *hexEdit; 122 | QString sizeConvert(int a); 123 | QString hexiAddr(uint32_t a); 124 | uint32_t hexToInt(QString str); 125 | QString getCRC32(); 126 | void ch341StatusFlashing(); 127 | QByteArray block; 128 | uint32_t blockStartAddr, blockLen; 129 | }; 130 | 131 | #endif // MAINWINDOW_H 132 | -------------------------------------------------------------------------------- /IMSProg_programmer/mw_eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * mw_eeprom.c 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "bitbang_microwire.h" 26 | #include "ch341a_gpio.h" 27 | #include "timer.h" 28 | 29 | extern struct gpio_cmd bb_func; 30 | extern char eepromname[12]; 31 | extern unsigned int bsize; 32 | 33 | /*int mw_eeprom_read(unsigned char *buf, unsigned long from, unsigned long len) 34 | { 35 | unsigned char *pbuf, ebuf[MAX_MW_EEPROM_SIZE]; 36 | 37 | if (len == 0) 38 | return -1; 39 | 40 | timer_start(); 41 | memset(ebuf, 0, sizeof(ebuf)); 42 | pbuf = ebuf; 43 | 44 | Read_EEPROM_3wire(pbuf, mw_eepromsize); 45 | memcpy(buf, pbuf + from, len); 46 | 47 | printf("Read [%lu] bytes from [%s] EEPROM address 0x%08lu\n", len, eepromname, from); 48 | timer_end(); 49 | 50 | return (int)len; 51 | } 52 | */ 53 | /*int mw_eeprom_erase(unsigned long offs, unsigned long len) 54 | { 55 | unsigned char *pbuf, ebuf[MAX_MW_EEPROM_SIZE]; 56 | 57 | if (len == 0) 58 | return -1; 59 | 60 | timer_start(); 61 | memset(ebuf, 0xff, sizeof(ebuf)); 62 | pbuf = ebuf; 63 | 64 | if (offs || len < mw_eepromsize) { 65 | Read_EEPROM_3wire(pbuf, mw_eepromsize); 66 | memset(pbuf + offs, 0xff, len); 67 | } 68 | 69 | Erase_EEPROM_3wire(mw_eepromsize); 70 | 71 | if (offs || len < mw_eepromsize) { 72 | if (Write_EEPROM_3wire(pbuf, mw_eepromsize) < 0) { 73 | printf("Failed to erase [%lu] bytes of [%s] EEPROM address 0x%08lu\n", len, eepromname, offs); 74 | return -1; 75 | } 76 | } 77 | 78 | printf("Erased [%lu] bytes of [%s] EEPROM address 0x%08lu\n", len, eepromname, offs); 79 | timer_end(); 80 | 81 | return 0; 82 | } 83 | 84 | int mw_eeprom_write(unsigned char *buf, unsigned long to, unsigned long len) 85 | { 86 | unsigned char *pbuf, ebuf[MAX_MW_EEPROM_SIZE]; 87 | 88 | if (len == 0) 89 | return -1; 90 | 91 | timer_start(); 92 | memset(ebuf, 0xff, sizeof(ebuf)); 93 | pbuf = ebuf; 94 | 95 | if (to || len < mw_eepromsize) { 96 | Read_EEPROM_3wire(pbuf, mw_eepromsize); 97 | } 98 | memcpy(pbuf + to, buf, len); 99 | 100 | Erase_EEPROM_3wire(mw_eepromsize); 101 | 102 | if (Write_EEPROM_3wire(pbuf, mw_eepromsize) < 0) { 103 | printf("Failed to write [%lu] bytes of [%s] EEPROM address 0x%08lu\n", len, eepromname, to); 104 | return -1; 105 | } 106 | 107 | printf("Wrote [%lu] bytes to [%s] EEPROM address 0x%08lu\n", len, eepromname, to); 108 | timer_end(); 109 | 110 | return (int)len; 111 | } 112 | */ 113 | /* 114 | 25xx 93xx 115 | PIN 22 - D7 - MISO DO 116 | PIN 21 - D6 - 117 | PIN 20 - D5 - MOSI DI 118 | PIN 19 - D4 - 119 | PIN 18 - D3 - CLK CLK 120 | PIN 17 - D2 - 121 | PIN 16 - D1 - 122 | PIN 15 - D0 - CS CS 123 | */ 124 | 125 | int mw_gpio_init(void) 126 | { 127 | int ret = 0; 128 | 129 | CLK = 1 << 3; 130 | DO = 1 << 7; 131 | DI = 1 << 5; 132 | CSEL = 1 << 0; 133 | 134 | bb_func.gpio_setdir = ch341a_gpio_setdir; 135 | bb_func.gpio_setbits = ch341a_gpio_setbits; 136 | bb_func.gpio_getbits = ch341a_gpio_getbits; 137 | 138 | if(bb_func.gpio_setdir) 139 | ret = bb_func.gpio_setdir(); 140 | else 141 | return -1; 142 | 143 | if(ret < 0) 144 | return -1; 145 | 146 | return 0; 147 | } 148 | 149 | /*static char *__itoa(int a) 150 | { 151 | char *p, tmp[32]; 152 | p = tmp; 153 | snprintf(p, sizeof(tmp), "%d", a); 154 | return p; 155 | } 156 | */ 157 | 158 | /*long mw_init(void) 159 | { 160 | if (mw_eepromsize <= 0) { 161 | printf("Microwire EEPROM Not Detected!\n"); 162 | return -1; 163 | } 164 | 165 | if (mw_gpio_init() < 0) 166 | return -1; 167 | 168 | bsize = 1; 169 | 170 | printf("Microwire EEPROM chip: %s, Size: %d bytes, Org: %d bits, fix addr len: %s\n", eepromname, mw_eepromsize / (org ? 2 : 1), 171 | org ? 16 : 8, fix_addr_len ? __itoa(fix_addr_len) : "Auto"); 172 | 173 | return (long)mw_eepromsize; 174 | } 175 | */ 176 | /*void support_mw_eeprom_list(void) 177 | { 178 | int i; 179 | 180 | printf("Microwire EEPROM Support List:\n"); 181 | for ( i = 0; i < (sizeof(mw_eepromlist)/sizeof(struct MW_EEPROM)); i++) 182 | { 183 | if (!mw_eepromlist[i].size) 184 | break; 185 | printf("%03d. %s\n", i + 1, mw_eepromlist[i].name); 186 | } 187 | } 188 | */ 189 | /* End of [mw_eeprom.c] package */ 190 | -------------------------------------------------------------------------------- /IMSProg_programmer/mw_eeprom_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * mw_eeprom_api.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __MW_EEPROM_API_H__ 16 | #define __MW_EEPROM_API_H__ 17 | 18 | //int mw_eeprom_read(unsigned char *buf, unsigned long from, unsigned long len); 19 | //int mw_eeprom_erase(unsigned long offs, unsigned long len); 20 | //int mw_eeprom_write(unsigned char *buf, unsigned long to, unsigned long len); 21 | //long mw_init(void); 22 | int mw_gpio_init(void); 23 | //void support_mw_eeprom_list(void); 24 | 25 | #endif /* __MW_EEPROM_API_H__ */ 26 | /* End of [mw_eeprom_api.h] package */ 27 | -------------------------------------------------------------------------------- /IMSProg_programmer/nandcmd_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2021 McMCC 3 | * nandcmd_api.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __NANDCMD_API_H__ 16 | #define __NANDCMD_API_H__ 17 | 18 | int snand_read(unsigned char *buf, unsigned long from, unsigned long len); 19 | int snand_erase(unsigned long offs, unsigned long len); 20 | int snand_write(unsigned char *buf, unsigned long to, unsigned long len); 21 | long snand_init(void); 22 | void support_snand_list(void); 23 | 24 | extern int ECC_fcheck; 25 | extern int ECC_ignore; 26 | extern int OOB_size; 27 | extern int Skip_BAD_page; 28 | extern unsigned char _ondie_ecc_flag; 29 | 30 | #endif /* __NANDCMD_API_H__ */ 31 | /* End of [nandcmd_api.h] package */ 32 | -------------------------------------------------------------------------------- /IMSProg_programmer/other/99-CH341.rules: -------------------------------------------------------------------------------- 1 | /* This file should be copyed on /etc/udev/rules.d on GNU/Linux OS and derived */ 2 | /* Add permission to all user to have complete acces to eeprom programmer CH341 */ 3 | SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE:="0666" 4 | -------------------------------------------------------------------------------- /IMSProg_programmer/other/IMSProg.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name=IMSProg 5 | Icon=/opt/IMSProg/write64.png 6 | Exec=/opt/IMSProg/IMSProg 7 | Path=/opt/IMSProg/ 8 | NoDisplay=false 9 | Categories=Electronics;Development; 10 | StartupNotify=true 11 | Terminal=false 12 | Comment=i2C,SPI,MW programmer for CH341a devices 13 | Comment[en]=i2c,SPI,MW chips programmer for CH341a devices 14 | Comment[ru]=Программатор i2c,SPI,MW микросхем для CH341a 15 | Comment[es]=Programador de chips i2c, SPI, MW para dispositivos CH341a 16 | Comment[de]=i2c,SPI,MW Chips Programmierer für CH341a Geräte 17 | GenericName=i2c,SPI,MW chips programmer for CH341a devices 18 | GenericName[en]=i2c,SPI,MW chips programmer for CH341a devices 19 | GenericName[ru]=Программатор i2c,SPI,MW микросхем для CH341a 20 | GenericName[es]=Programador de chips i2c, SPI, MW para dispositivos CH341a 21 | GenericName[de]=i2c,SPI,MW Chips Programmierer für CH341a Geräte 22 | -------------------------------------------------------------------------------- /IMSProg_programmer/qhexedit.sip: -------------------------------------------------------------------------------- 1 | %Module(name=qhexedit) 2 | 3 | %Import QtCore/QtCoremod.sip 4 | %Import QtGui/QtGuimod.sip 5 | 6 | %If (Qt_5_0_0 -) 7 | %Import QtWidgets/QtWidgetsmod.sip 8 | %End 9 | 10 | class QHexEdit : QAbstractScrollArea 11 | { 12 | %TypeHeaderCode 13 | #include "../src/qhexedit.h" 14 | %End 15 | 16 | public: 17 | explicit QHexEdit(QWidget *parent /TransferThis/ = 0); 18 | virtual ~QHexEdit(); 19 | 20 | bool setData(QIODevice &); 21 | QByteArray dataAt(qint64, qint64=-1); 22 | bool write(QIODevice &iODevice, qint64=0, qint64=-1); 23 | 24 | void insert(qint64, char); 25 | void remove(qint64, qint64); 26 | void replace(qint64, char); 27 | 28 | void insert(qint64, QByteArray &); 29 | void replace(qint64, qint64, QByteArray &); 30 | 31 | bool addressArea(); 32 | bool addressWidth(); 33 | bool asciiArea(); 34 | qint64 cursorPosition(QPoint); 35 | void ensureVisible(); 36 | qint64 indexOf(QByteArray &, qint64); 37 | bool isModified(); 38 | bool highlighting(); 39 | qint64 lastIndexOf(QByteArray &, qint64); 40 | QString selectionToReadableString(); 41 | QString selectedData(); 42 | void setFont(const QFont &); 43 | QString toReadableString(); 44 | 45 | QColor addressAreaColor(); 46 | void setAddressAreaColor(const QColor &); 47 | 48 | QColor addressFontColor(); 49 | void setAddressFontColor(const QColor &); 50 | 51 | QColor asciiAreaColor(); 52 | void setAsciiAreaColor(const QColor &); 53 | 54 | QColor asciiFontColor(); 55 | void setAsciiFontColor(const QColor &); 56 | 57 | QColor hexFontColor(); 58 | void setHexFontColor(const QColor &); 59 | 60 | qint64 addressOffset(); 61 | void setAddressOffset(qint64); 62 | 63 | qint64 cursorPosition(); 64 | void setCursorPosition(qint64); 65 | 66 | QByteArray data(); 67 | void setData(const QByteArray &); 68 | 69 | QColor highlightingColor(); 70 | void setHighlightingColor(const QColor &); 71 | 72 | bool overwriteMode(); 73 | void setOverwriteMode(bool); 74 | 75 | bool isReadOnly(); 76 | void setReadOnly(bool); 77 | 78 | QColor selectionColor(); 79 | void setSelectionColor(const QColor &); 80 | 81 | public slots: 82 | void redo(); 83 | void setAddressArea(bool); 84 | void setAddressWidth(int); 85 | void setAsciiArea(bool); 86 | void setHighlighting(bool); 87 | void undo(); 88 | 89 | signals: 90 | void currentAddressChanged(qint64); 91 | void currentSizeChanged(qint64); 92 | void dataChanged(); 93 | void overwriteModeChanged(bool); 94 | }; 95 | -------------------------------------------------------------------------------- /IMSProg_programmer/recource.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | img/verify64.png 5 | img/erase64.png 6 | img/read64.png 7 | img/write64.png 8 | img/redo64.png 9 | img/undo.png 10 | img/save64.png 11 | img/open64.png 12 | img/exit64.png 13 | img/test64.png 14 | img/unprotect64.png 15 | img/saveBlock64.png 16 | img/loadBlock64.png 17 | img/hexsearch64.png 18 | img/ch341_black150.png 19 | img/ch341_green150.png 20 | img/chipEdit64.png 21 | img/checkSum64.png 22 | 23 | 24 | -------------------------------------------------------------------------------- /IMSProg_programmer/res.h: -------------------------------------------------------------------------------- 1 | #define snander 128 2 | -------------------------------------------------------------------------------- /IMSProg_programmer/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | img/open64.png 5 | img/save64.png 6 | img/exit64.png 7 | img/detect64.png 8 | img/read64.png 9 | img/erase64.png 10 | img/write64.png 11 | img/verify64.png 12 | img/undo64.png 13 | img/redo64.png 14 | 15 | 16 | -------------------------------------------------------------------------------- /IMSProg_programmer/searchdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "searchdialog.h" 2 | #include "ui_searchdialog.h" 3 | 4 | #include 5 | 6 | SearchDialog::SearchDialog(QHexEdit *hexEdit, QWidget *parent) : 7 | QDialog(parent), 8 | ui(new Ui::SearchDialog) 9 | { 10 | ui->setupUi(this); 11 | _hexEdit = hexEdit; 12 | } 13 | 14 | SearchDialog::~SearchDialog() 15 | { 16 | delete ui; 17 | } 18 | 19 | qint64 SearchDialog::findNext() 20 | { 21 | qint64 from = _hexEdit->cursorPosition() / 2; 22 | _findBa = getContent(ui->cbFindFormat->currentIndex(), ui->cbFind->currentText()); 23 | qint64 idx = -1; 24 | 25 | if (_findBa.length() > 0) 26 | { 27 | if (ui->cbBackwards->isChecked()) 28 | idx = _hexEdit->lastIndexOf(_findBa, from); 29 | else 30 | idx = _hexEdit->indexOf(_findBa, from); 31 | } 32 | return idx; 33 | } 34 | 35 | void SearchDialog::on_pbFind_clicked() 36 | { 37 | findNext(); 38 | } 39 | 40 | void SearchDialog::on_pbReplace_clicked() 41 | { 42 | int idx = findNext(); 43 | if (idx >= 0) 44 | { 45 | QByteArray replaceBa = getContent(ui->cbReplaceFormat->currentIndex(), ui->cbReplace->currentText()); 46 | replaceOccurrence(idx, replaceBa); 47 | } 48 | } 49 | 50 | void SearchDialog::on_pbReplaceAll_clicked() 51 | { 52 | int replaceCounter = 0; 53 | int idx = 0; 54 | int goOn = QMessageBox::Yes; 55 | 56 | while ((idx >= 0) && (goOn == QMessageBox::Yes)) 57 | { 58 | idx = findNext(); 59 | if (idx >= 0) 60 | { 61 | QByteArray replaceBa = getContent(ui->cbReplaceFormat->currentIndex(), ui->cbReplace->currentText()); 62 | int result = replaceOccurrence(idx, replaceBa); 63 | 64 | if (result == QMessageBox::Yes) 65 | replaceCounter += 1; 66 | 67 | if (result == QMessageBox::Cancel) 68 | goOn = result; 69 | } 70 | } 71 | 72 | if (replaceCounter > 0) 73 | QMessageBox::information(this, tr("QHexEdit"), QString(tr("%1 occurrences replaced.")).arg(replaceCounter)); 74 | } 75 | 76 | 77 | QByteArray SearchDialog::getContent(int comboIndex, const QString &input) 78 | { 79 | QByteArray findBa; 80 | switch (comboIndex) 81 | { 82 | case 0: // hex 83 | findBa = QByteArray::fromHex(input.toLatin1()); 84 | break; 85 | case 1: // text 86 | findBa = input.toUtf8(); 87 | break; 88 | } 89 | return findBa; 90 | } 91 | 92 | qint64 SearchDialog::replaceOccurrence(qint64 idx, const QByteArray &replaceBa) 93 | { 94 | int result = QMessageBox::Yes; 95 | if (replaceBa.length() >= 0) 96 | { 97 | if (ui->cbPrompt->isChecked()) 98 | { 99 | result = QMessageBox::question(this, tr("QHexEdit"), 100 | tr("Replace occurrence?"), 101 | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); 102 | 103 | if (result == QMessageBox::Yes) 104 | { 105 | _hexEdit->replace(idx, replaceBa.length(), replaceBa); 106 | _hexEdit->update(); 107 | } 108 | } 109 | else 110 | { 111 | _hexEdit->replace(idx, _findBa.length(), replaceBa); 112 | } 113 | } 114 | return result; 115 | } 116 | 117 | void SearchDialog::on_pb_png_clicked() 118 | { 119 | ui->cbFind->setCurrentText("89504e470d0a1a0a"); 120 | } 121 | 122 | void SearchDialog::on_pb_jpg_clicked() 123 | { 124 | ui->cbFind->setCurrentText("ffd8ff"); 125 | } 126 | 127 | 128 | void SearchDialog::on_pb_gif_clicked() 129 | { 130 | ui->cbFind->setCurrentText("47494638"); 131 | } 132 | 133 | 134 | void SearchDialog::on_pb_zip_clicked() 135 | { 136 | ui->cbFind->setCurrentText("504b0304"); 137 | } 138 | 139 | 140 | void SearchDialog::on_pb_tar_clicked() 141 | { 142 | ui->cbFind->setCurrentText("7573746172003030"); 143 | } 144 | 145 | 146 | void SearchDialog::on_pb_bios_clicked() 147 | { 148 | ui->cbFind->setCurrentText("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5AA5F00F"); 149 | } 150 | 151 | 152 | void SearchDialog::on_pb_uefi_clicked() 153 | { 154 | ui->cbFind->setCurrentText("0000000000000000000000000000000078E58C8C3D8A1C4F9935896185C32DD3"); 155 | } 156 | 157 | 158 | void SearchDialog::on_pb_gpt_clicked() 159 | { 160 | ui->cbFind->setCurrentText("4546492050415254"); 161 | } 162 | 163 | -------------------------------------------------------------------------------- /IMSProg_programmer/searchdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef SEARCHDIALOG_H 2 | #define SEARCHDIALOG_H 3 | 4 | #include 5 | #include 6 | #include "qhexedit.h" 7 | 8 | namespace Ui { 9 | class SearchDialog; 10 | } 11 | 12 | class SearchDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit SearchDialog(QHexEdit *hexEdit, QWidget *parent = 0); 17 | ~SearchDialog(); 18 | qint64 findNext(); 19 | Ui::SearchDialog *ui; 20 | 21 | private slots: 22 | void on_pbFind_clicked(); 23 | void on_pbReplace_clicked(); 24 | void on_pbReplaceAll_clicked(); 25 | void on_pb_png_clicked(); 26 | void on_pb_jpg_clicked(); 27 | void on_pb_gif_clicked(); 28 | void on_pb_zip_clicked(); 29 | void on_pb_tar_clicked(); 30 | void on_pb_bios_clicked(); 31 | void on_pb_uefi_clicked(); 32 | void on_pb_gpt_clicked(); 33 | 34 | private: 35 | QByteArray getContent(int comboIndex, const QString &input); 36 | qint64 replaceOccurrence(qint64 idx, const QByteArray &replaceBa); 37 | 38 | QHexEdit *_hexEdit; 39 | QByteArray _findBa; 40 | }; 41 | 42 | #endif // SEARCHDIALOG_H 43 | -------------------------------------------------------------------------------- /IMSProg_programmer/snander.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #include "res.h" 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 1, 7, 8, 0 6 | PRODUCTVERSION 1, 7, 8, 0 7 | FILEOS VOS_NT_WINDOWS32 8 | FILETYPE VFT_APP 9 | FILESUBTYPE 0 10 | BEGIN 11 | BLOCK "StringFileInfo" 12 | BEGIN 13 | BLOCK "040904E4" 14 | BEGIN 15 | VALUE "FileDescription", "SNANDer - Serial Nor/nAND/Eeprom programmeR\0" 16 | VALUE "OriginalFilename", "SNANDer.exe\0" 17 | VALUE "CompanyName", "-= (c) 2018-2022 Igor Mokrushin aka McMCC =-\0" 18 | VALUE "FileVersion", "1.7.8.0\0" 19 | VALUE "InternalName", "SNANDer\0" 20 | VALUE "LegalCopyright", "Copyright (c) 2018-2022 by McMCC \0" 21 | VALUE "ProductName","SNANDer\0" 22 | VALUE "ProductVersion","1.7.8.0\0" 23 | END 24 | END 25 | BLOCK "VarFileInfo" 26 | BEGIN 27 | VALUE "Translation", 0x0409, 1252 28 | END 29 | END 30 | 31 | snander ICON DISCARDABLE "snander.ico" 32 | -------------------------------------------------------------------------------- /IMSProg_programmer/snorcmd_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2021 McMCC 3 | * snorcmd_api.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __SNORCMD_API_H__ 16 | #define __SNORCMD_API_H__ 17 | #include "types.h" 18 | int snor_read(unsigned char *buf, unsigned long from, unsigned long len); 19 | int snor_read_param(unsigned char *buf, unsigned long from, unsigned long len, unsigned int sector_size, unsigned int addr4b); 20 | int snor_write_param(unsigned char *buf, unsigned long to, unsigned long len, unsigned int sector_size, unsigned int addr4b); 21 | int snor_erase(unsigned long offs, unsigned long len); 22 | int snor_erase_param(unsigned long offs, unsigned long len, unsigned int sector_size, unsigned int n_sectors); 23 | int snor_write(unsigned char *buf, unsigned long to, unsigned long len); 24 | long snor_init(void); 25 | void support_snor_list(void); 26 | int snor_read_devid(u8 *rxbuf, int n_rx); 27 | #endif /* __SNORCMD_API_H__ */ 28 | /* End of [snorcmd_api.h] package */ 29 | -------------------------------------------------------------------------------- /IMSProg_programmer/spi_controller.c: -------------------------------------------------------------------------------- 1 | /*====================================================================================== 2 | * MODULE NAME: spi 3 | * FILE NAME: spi_controller.c 4 | * 5 | * FUNCTIONS 6 | * 7 | * SPI_CONTROLLER_Enable_Manual_Mode To provide interface for Enable SPI Controller Manual Mode. 8 | * SPI_CONTROLLER_Write_One_Byte To provide interface for write one byte to SPI bus. 9 | * SPI_CONTROLLER_Write_NByte To provide interface for write N bytes to SPI bus. 10 | * SPI_CONTROLLER_Read_NByte To provide interface for read N bytes from SPI bus. 11 | * SPI_CONTROLLER_Chip_Select_Low To provide interface for set chip select low in SPI bus. 12 | * SPI_CONTROLLER_Chip_Select_High To provide interface for set chip select high in SPI bus. 13 | * 14 | * DEPENDENCIES 15 | * 16 | * * $History: $ 17 | * MODIFICTION HISTORY: 18 | * 19 | *====================================================================================== 20 | */ 21 | #include "ch341a_spi.h" 22 | #include "spi_controller.h" 23 | 24 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Enable_Manual_Mode( void ) 25 | { 26 | return 0; 27 | } 28 | 29 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Write_One_Byte( u8 data ) 30 | { 31 | return (SPI_CONTROLLER_RTN_T)ch341a_spi_send_command(1, 0, &data, NULL); 32 | } 33 | 34 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Chip_Select_High( void ) 35 | { 36 | return (SPI_CONTROLLER_RTN_T)enable_pins(false); 37 | } 38 | 39 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Chip_Select_Low( void ) 40 | { 41 | return (SPI_CONTROLLER_RTN_T)enable_pins(true); 42 | } 43 | 44 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Read_NByte( u8 *ptr_rtn_data, u32 len, SPI_CONTROLLER_SPEED_T speed ) 45 | { 46 | return (SPI_CONTROLLER_RTN_T)ch341a_spi_send_command(0, len, NULL, ptr_rtn_data); 47 | } 48 | 49 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Write_NByte( u8 *ptr_data, u32 len, SPI_CONTROLLER_SPEED_T speed ) 50 | { 51 | return (SPI_CONTROLLER_RTN_T)ch341a_spi_send_command(len, 0, ptr_data, NULL); 52 | } 53 | 54 | #if 0 55 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Xfer_NByte( u8 *ptr_data_in, u32 len_in, u8 *ptr_data_out, u32 len_out, SPI_CONTROLLER_SPEED_T speed ) 56 | { 57 | return (SPI_CONTROLLER_RTN_T)ch341a_spi_send_command(len_out, len_in, ptr_data_out, ptr_data_in); 58 | } 59 | #endif 60 | /* End of [spi_controller.c] package */ 61 | -------------------------------------------------------------------------------- /IMSProg_programmer/spi_controller.h: -------------------------------------------------------------------------------- 1 | /*====================================================================================== 2 | * MODULE NAME: spi 3 | * FILE NAME: spi_controller.h 4 | * 5 | * FUNCTIONS 6 | * 7 | * SPI_CONTROLLER_Enable_Manual_Mode To provide interface for Enable SPI Controller Manual Mode. 8 | * SPI_CONTROLLER_Write_One_Byte To provide interface for write one byte to SPI bus. 9 | * SPI_CONTROLLER_Write_NByte To provide interface for write N bytes to SPI bus. 10 | * SPI_CONTROLLER_Read_NByte To provide interface for read N bytes from SPI bus. 11 | * SPI_CONTROLLER_Chip_Select_Low To provide interface for set chip select low in SPI bus. 12 | * SPI_CONTROLLER_Chip_Select_High To provide interface for set chip select high in SPI bus. 13 | * 14 | * DEPENDENCIES 15 | * 16 | * * $History: $ 17 | * MODIFICTION HISTORY: 18 | * 19 | *====================================================================================== 20 | */ 21 | 22 | #ifndef __SPI_CONTROLLER_H__ 23 | #define __SPI_CONTROLLER_H__ 24 | 25 | /* INCLUDE FILE DECLARATIONS --------------------------------------------------------- */ 26 | #include "types.h" 27 | 28 | /* NAMING CONSTANT DECLARATIONS ------------------------------------------------------ */ 29 | 30 | /* MACRO DECLARATIONS ---------------------------------------------------------------- */ 31 | 32 | /* TYPE DECLARATIONS ----------------------------------------------------------------- */ 33 | typedef enum{ 34 | SPI_CONTROLLER_SPEED_SINGLE = 0, 35 | SPI_CONTROLLER_SPEED_DUAL, 36 | SPI_CONTROLLER_SPEED_QUAD 37 | 38 | } SPI_CONTROLLER_SPEED_T; 39 | 40 | typedef enum{ 41 | SPI_CONTROLLER_RTN_NO_ERROR = 0, 42 | SPI_CONTROLLER_RTN_SET_OPFIFO_ERROR, 43 | SPI_CONTROLLER_RTN_READ_DATAPFIFO_ERROR, 44 | SPI_CONTROLLER_RTN_WRITE_DATAPFIFO_ERROR, 45 | SPI_CONTROLLER_RTN_DEF_NO 46 | } SPI_CONTROLLER_RTN_T; 47 | 48 | 49 | typedef enum{ 50 | SPI_CONTROLLER_MODE_AUTO = 0, 51 | SPI_CONTROLLER_MODE_MANUAL, 52 | SPI_CONTROLLER_MODE_NO 53 | } SPI_CONTROLLER_MODE_T; 54 | 55 | /*------------------------------------------------------------------------------------ 56 | * FUNCTION: SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Enable_Manual_Mode( void ) 57 | * PURPOSE : To provide interface for enable SPI Controller Manual Mode Enable. 58 | * AUTHOR : 59 | * CALLED BY 60 | * - 61 | * CALLS 62 | * - 63 | * PARAMs : 64 | * INPUT : None 65 | * OUTPUT: None 66 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 67 | * NOTES : 68 | * MODIFICTION HISTORY: 69 | *------------------------------------------------------------------------------------ 70 | */ 71 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Enable_Manual_Mode( void ); 72 | 73 | /*------------------------------------------------------------------------------------ 74 | * FUNCTION: SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Write_One_Byte( u8 data ) 75 | * PURPOSE : To provide interface for write one byte to SPI bus. 76 | * AUTHOR : 77 | * CALLED BY 78 | * - 79 | * CALLS 80 | * - 81 | * PARAMs : 82 | * INPUT : data - The data variable of this function. 83 | * OUTPUT: None 84 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 85 | * NOTES : 86 | * MODIFICTION HISTORY: 87 | *------------------------------------------------------------------------------------ 88 | */ 89 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Write_One_Byte( u8 data ); 90 | 91 | /*------------------------------------------------------------------------------------ 92 | * FUNCTION: SPI_CONTROLLER_RTN_T SPI_CONTROLLER_WRITE_NBYTES( u8 *ptr_data, 93 | * u32 len, 94 | * SPI_CONTROLLER_SPEED_T speed ) 95 | * PURPOSE : To provide interface for write N bytes to SPI bus. 96 | * AUTHOR : 97 | * CALLED BY 98 | * - 99 | * CALLS 100 | * - 101 | * PARAMs : 102 | * INPUT : ptr_data - The data variable of this function. 103 | * len - The len variable of this function. 104 | * speed - The speed variable of this function. 105 | * OUTPUT: None 106 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 107 | * NOTES : 108 | * MODIFICTION HISTORY: 109 | *------------------------------------------------------------------------------------ 110 | */ 111 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Write_NByte( u8 *ptr_data, u32 len, SPI_CONTROLLER_SPEED_T speed ); 112 | 113 | /*------------------------------------------------------------------------------------ 114 | * FUNCTION: SPI_CONTROLLER_RTN_T SPI_CONTROLLER_READ_NBYTES( u8 *ptr_rtn_data, 115 | * u8 len, 116 | * SPI_CONTROLLER_SPEED_T speed ) 117 | * PURPOSE : To provide interface for read N bytes from SPI bus. 118 | * AUTHOR : 119 | * CALLED BY 120 | * - 121 | * CALLS 122 | * - 123 | * PARAMs : 124 | * INPUT : len - The len variable of this function. 125 | * speed - The speed variable of this function. 126 | * OUTPUT: ptr_rtn_data - The ptr_rtn_data variable of this function. 127 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 128 | * NOTES : 129 | * MODIFICTION HISTORY: 130 | *------------------------------------------------------------------------------------ 131 | */ 132 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Read_NByte( u8 *ptr_rtn_data, u32 len, SPI_CONTROLLER_SPEED_T speed ); 133 | 134 | /*------------------------------------------------------------------------------------ 135 | * FUNCTION: SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Chip_Select_Low( void ) 136 | * PURPOSE : To provide interface for set chip select low in SPI bus. 137 | * AUTHOR : 138 | * CALLED BY 139 | * - 140 | * CALLS 141 | * - 142 | * PARAMs : 143 | * INPUT : None 144 | * OUTPUT: None 145 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 146 | * NOTES : 147 | * MODIFICTION HISTORY: 148 | *------------------------------------------------------------------------------------ 149 | */ 150 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Chip_Select_Low( void ); 151 | 152 | /*------------------------------------------------------------------------------------ 153 | * FUNCTION: SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Chip_Select_High( void ) 154 | * PURPOSE : To provide interface for set chip select high in SPI bus. 155 | * AUTHOR : 156 | * CALLED BY 157 | * - 158 | * CALLS 159 | * - 160 | * PARAMs : 161 | * INPUT : None 162 | * OUTPUT: None 163 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 164 | * NOTES : 165 | * MODIFICTION HISTORY: 166 | *------------------------------------------------------------------------------------ 167 | */ 168 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Chip_Select_High( void ); 169 | 170 | #if 0 171 | SPI_CONTROLLER_RTN_T SPI_CONTROLLER_Xfer_NByte( u8 *ptr_data_in, u32 len_in, u8 *ptr_data_out, u32 len_out, SPI_CONTROLLER_SPEED_T speed ); 172 | #endif 173 | 174 | #endif /* ifndef __SPI_CONTROLLER_H__ */ 175 | /* End of [spi_controller.h] package */ 176 | -------------------------------------------------------------------------------- /IMSProg_programmer/spi_eeprom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 McMCC 3 | * spi_eeprom.c 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "timer.h" 22 | #include "spi_eeprom.h" 23 | #include "spi_controller.h" 24 | 25 | extern unsigned int bsize; 26 | extern char eepromname[12]; 27 | struct spi_eeprom seeprom_info; 28 | int seepromsize = 0; 29 | int spage_size = 0; 30 | 31 | static void wait_ready(void) 32 | { 33 | uint8_t data[1]; 34 | 35 | while (1) { 36 | SPI_CONTROLLER_Chip_Select_Low(); 37 | SPI_CONTROLLER_Write_One_Byte(SEEP_RDSR_CMD); 38 | SPI_CONTROLLER_Read_NByte(data, 1, SPI_CONTROLLER_SPEED_SINGLE); 39 | SPI_CONTROLLER_Chip_Select_High(); 40 | 41 | if ((data[0] & 0x01) == 0) break; 42 | usleep(1); 43 | } 44 | } 45 | 46 | static void write_enable(void) 47 | { 48 | uint8_t data[1]; 49 | 50 | while (1) { 51 | SPI_CONTROLLER_Chip_Select_Low(); 52 | SPI_CONTROLLER_Write_One_Byte(SEEP_WREN_CMD); 53 | SPI_CONTROLLER_Chip_Select_High(); 54 | usleep(1); 55 | 56 | SPI_CONTROLLER_Chip_Select_Low(); 57 | SPI_CONTROLLER_Write_One_Byte(SEEP_RDSR_CMD); 58 | SPI_CONTROLLER_Read_NByte(data, 1, SPI_CONTROLLER_SPEED_SINGLE); 59 | SPI_CONTROLLER_Chip_Select_High(); 60 | 61 | if (data[0] == 0x02) break; 62 | usleep(1); 63 | } 64 | } 65 | 66 | static void eeprom_write_byte(struct spi_eeprom *dev, uint32_t address, uint8_t data) 67 | { 68 | uint8_t buf[5]; 69 | 70 | write_enable(); 71 | 72 | buf[0] = SEEP_WRITE_CMD; 73 | if (dev->addr_bits == 9 && address > 0xFF) 74 | buf[0] = buf[0] | 0x08; 75 | 76 | SPI_CONTROLLER_Chip_Select_Low(); 77 | if (dev->addr_bits > 16) { 78 | buf[1] = (address & 0xFF0000) >> 16; 79 | buf[2] = (address & 0xFF00) >> 8; 80 | buf[3] = (address & 0xFF); 81 | buf[4] = data; 82 | SPI_CONTROLLER_Write_NByte(buf, 5, SPI_CONTROLLER_SPEED_SINGLE); 83 | } else if (dev->addr_bits < 10) { 84 | buf[1] = (address & 0xFF); 85 | buf[2] = data; 86 | SPI_CONTROLLER_Write_NByte(buf, 3, SPI_CONTROLLER_SPEED_SINGLE); 87 | } else { 88 | buf[1] = (address & 0xFF00) >> 8; 89 | buf[2] = (address & 0xFF); 90 | buf[3] = data; 91 | SPI_CONTROLLER_Write_NByte(buf, 4, SPI_CONTROLLER_SPEED_SINGLE); 92 | } 93 | SPI_CONTROLLER_Chip_Select_High(); 94 | 95 | wait_ready(); 96 | } 97 | 98 | static void eeprom_write_page(struct spi_eeprom *dev, uint32_t address, int page_size, uint8_t *data) 99 | { 100 | uint8_t buf[MAX_SEEP_PSIZE]; 101 | uint8_t offs = 0; 102 | 103 | memset(buf, 0, sizeof(buf)); 104 | 105 | buf[0] = SEEP_WRITE_CMD; 106 | if (dev->addr_bits == 9 && address > 0xFF) 107 | buf[0] = buf[0] | 0x08; 108 | 109 | if (dev->addr_bits > 16) { 110 | buf[1] = (address & 0xFF0000) >> 16; 111 | buf[2] = (address & 0xFF00) >> 8; 112 | buf[3] = (address & 0xFF); 113 | offs = 4; 114 | } else if (dev->addr_bits < 10) { 115 | buf[1] = (address & 0xFF); 116 | offs = 2; 117 | } else { 118 | buf[1] = (address & 0xFF00) >> 8; 119 | buf[2] = (address & 0xFF); 120 | offs = 3; 121 | } 122 | 123 | memcpy(&buf[offs], data, page_size); 124 | 125 | write_enable(); 126 | 127 | SPI_CONTROLLER_Chip_Select_Low(); 128 | SPI_CONTROLLER_Write_NByte(buf, offs + page_size, SPI_CONTROLLER_SPEED_SINGLE); 129 | SPI_CONTROLLER_Chip_Select_High(); 130 | 131 | wait_ready(); 132 | } 133 | 134 | static uint8_t eeprom_read_byte(struct spi_eeprom *dev, uint32_t address) 135 | { 136 | uint8_t buf[4]; 137 | uint8_t data; 138 | buf[0] = SEEP_READ_CMD; 139 | 140 | if (dev->addr_bits == 9 && address > 0xFF) 141 | buf[0] = buf[0] | 0x08; 142 | 143 | SPI_CONTROLLER_Chip_Select_Low(); 144 | if (dev->addr_bits > 16) { 145 | buf[1] = (address & 0xFF0000) >> 16; 146 | buf[2] = (address & 0xFF00) >> 8; 147 | buf[3] = (address & 0xFF); 148 | SPI_CONTROLLER_Write_NByte(buf, 4, SPI_CONTROLLER_SPEED_SINGLE); 149 | SPI_CONTROLLER_Read_NByte(buf, 1, SPI_CONTROLLER_SPEED_SINGLE); 150 | data = buf[0]; 151 | } else if (dev->addr_bits < 10) { 152 | buf[1] = (address & 0xFF); 153 | SPI_CONTROLLER_Write_NByte(buf, 2, SPI_CONTROLLER_SPEED_SINGLE); 154 | SPI_CONTROLLER_Read_NByte(buf, 1, SPI_CONTROLLER_SPEED_SINGLE); 155 | data = buf[0]; 156 | } else { 157 | buf[1] = (address & 0xFF00) >> 8; 158 | buf[2] = (address & 0xFF); 159 | SPI_CONTROLLER_Write_NByte(buf, 3, SPI_CONTROLLER_SPEED_SINGLE); 160 | SPI_CONTROLLER_Read_NByte(buf, 1, SPI_CONTROLLER_SPEED_SINGLE); 161 | data = buf[0]; 162 | } 163 | SPI_CONTROLLER_Chip_Select_High(); 164 | 165 | return data; 166 | } 167 | 168 | int32_t parseSEEPsize(char *seepromname, struct spi_eeprom *seeprom) 169 | { 170 | int i; 171 | 172 | for (i = 0; seepromlist[i].total_bytes; i++) { 173 | if (strstr(seepromlist[i].name, seepromname)) { 174 | memcpy(seeprom, &(seepromlist[i]), sizeof(struct spi_eeprom)); 175 | return (seepromlist[i].total_bytes); 176 | } 177 | } 178 | 179 | return -1; 180 | } 181 | 182 | int spi_eeprom_read(unsigned char *buf, unsigned long from, unsigned long len) 183 | { 184 | unsigned char *pbuf, ebuf[MAX_SEEP_SIZE]; 185 | uint32_t i; 186 | 187 | if (len == 0) 188 | return -1; 189 | 190 | timer_start(); 191 | memset(ebuf, 0, sizeof(ebuf)); 192 | pbuf = ebuf; 193 | 194 | for (i = 0; i < seepromsize; i++) { 195 | pbuf[i] = eeprom_read_byte(&seeprom_info, i); 196 | if( timer_progress() ) 197 | { 198 | printf("\bRead %d%% [%d] of [%d] bytes ", 100 * i / seepromsize, i, seepromsize); 199 | printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); 200 | fflush(stdout); 201 | } 202 | } 203 | memcpy(buf, pbuf + from, len); 204 | 205 | printf("Read 100%% [%lu] bytes from [%s] EEPROM address 0x%08lu\n", len, eepromname, from); 206 | timer_end(); 207 | 208 | return (int)len; 209 | } 210 | 211 | int spi_eeprom_erase(unsigned long offs, unsigned long len) 212 | { 213 | unsigned char *pbuf, ebuf[MAX_SEEP_SIZE]; 214 | uint32_t i; 215 | 216 | if (len == 0) 217 | return -1; 218 | 219 | timer_start(); 220 | memset(ebuf, 0xff, sizeof(ebuf)); 221 | pbuf = ebuf; 222 | 223 | if (offs || len < seepromsize) { 224 | for (i = 0; i < seepromsize; i++) 225 | pbuf[i] = eeprom_read_byte(&seeprom_info, i); 226 | memset(pbuf + offs, 0xff, len); 227 | } 228 | 229 | for (i = 0; i < seepromsize; i++) { 230 | if (spage_size) { 231 | eeprom_write_page(&seeprom_info, i, spage_size, pbuf + i); 232 | i = (spage_size + i) - 1; 233 | } else 234 | eeprom_write_byte(&seeprom_info, i, pbuf[i]); 235 | if( timer_progress() ) 236 | { 237 | printf("\bErase %d%% [%d] of [%d] bytes ", 100 * i / seepromsize, i, seepromsize); 238 | printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); 239 | fflush(stdout); 240 | } 241 | } 242 | 243 | printf("Erased 100%% [%lu] bytes of [%s] EEPROM address 0x%08lu\n", len, eepromname, offs); 244 | timer_end(); 245 | 246 | return 0; 247 | } 248 | 249 | int spi_eeprom_write(unsigned char *buf, unsigned long to, unsigned long len) 250 | { 251 | unsigned char *pbuf, ebuf[MAX_SEEP_SIZE]; 252 | uint32_t i; 253 | 254 | if (len == 0) 255 | return -1; 256 | 257 | timer_start(); 258 | memset(ebuf, 0xff, sizeof(ebuf)); 259 | pbuf = ebuf; 260 | 261 | if (to || len < seepromsize) { 262 | for (i = 0; i < seepromsize; i++) 263 | pbuf[i] = eeprom_read_byte(&seeprom_info, i); 264 | } 265 | memcpy(pbuf + to, buf, len); 266 | 267 | for (i = 0; i < seepromsize; i++) { 268 | if (spage_size) { 269 | eeprom_write_page(&seeprom_info, i, spage_size, pbuf + i); 270 | i = (spage_size + i) - 1; 271 | } else 272 | eeprom_write_byte(&seeprom_info, i, pbuf[i]); 273 | if( timer_progress() ) 274 | { 275 | printf("\bWritten %d%% [%d] of [%d] bytes ", 100 * i / seepromsize, i, seepromsize); 276 | printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); 277 | fflush(stdout); 278 | } 279 | } 280 | 281 | printf("Written 100%% [%lu] bytes to [%s] EEPROM address 0x%08lu\n", len, eepromname, to); 282 | timer_end(); 283 | 284 | return (int)len; 285 | } 286 | 287 | long spi_eeprom_init(void) 288 | { 289 | if (seepromsize <= 0) { 290 | printf("SPI EEPROM Not Detected!\n"); 291 | return -1; 292 | } 293 | 294 | bsize = 1; 295 | 296 | printf("SPI EEPROM chip: %s, Size: %d bytes\n", eepromname, seepromsize); 297 | 298 | return (long)seepromsize; 299 | } 300 | 301 | void support_spi_eeprom_list(void) 302 | { 303 | unsigned int i; 304 | 305 | printf("SPI EEPROM Support List:\n"); 306 | for ( i = 0; i < (sizeof(seepromlist)/sizeof(struct spi_eeprom)); i++) 307 | { 308 | if (!seepromlist[i].total_bytes) 309 | break; 310 | printf("%03d. %s\n", i + 1, seepromlist[i].name); 311 | } 312 | } 313 | /* End of [spi_eeprom.c] package */ 314 | -------------------------------------------------------------------------------- /IMSProg_programmer/spi_eeprom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 McMCC 3 | * spi_eeprom.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __SPI_EEPROM_H__ 16 | #define __SPI_EEPROM_H__ 17 | 18 | #define SEEP_WREN_CMD 0x06 /* Set Write Enable Instruction */ 19 | #define SEEP_WRDI_CMD 0x04 /* Reset Write Enable Instruction */ 20 | #define SEEP_RDSR_CMD 0x05 /* Read Status Register */ 21 | #define SEEP_WRSR_CMD 0x01 /* Write Status Register */ 22 | #define SEEP_READ_CMD 0x03 /* Read Data from Memory Array */ 23 | #define SEEP_WRITE_CMD 0x02 /* Write Data to Memory Array */ 24 | 25 | struct spi_eeprom 26 | { 27 | char *name; 28 | uint32_t total_bytes; /* EEPROM total memory size */ 29 | uint8_t addr_bits; /* Number of address bit */ 30 | }; 31 | 32 | const static struct spi_eeprom seepromlist[] = { 33 | { "25010", 128, 7 }, 34 | { "25020", 256, 8 }, 35 | { "25040", 512, 9 }, 36 | { "25080", 1024, 10 }, 37 | { "25160", 2048, 11 }, 38 | { "25320", 4096, 12 }, 39 | { "25640", 8192, 13 }, 40 | { "25128", 16384, 14 }, 41 | { "25256", 32768, 15 }, 42 | { "25512", 65536, 16 }, 43 | { "251024", 131072, 17 }, 44 | { 0, 0, 0 } 45 | }; 46 | 47 | #define MAX_SEEP_SIZE 131072 48 | #define MAX_SEEP_PSIZE 1024 49 | 50 | int32_t parseSEEPsize(char *seepromname, struct spi_eeprom *seeprom); 51 | 52 | #endif /* __SPI_EEPROM_H__ */ 53 | /* End of [spi_eeprom.h] package */ 54 | -------------------------------------------------------------------------------- /IMSProg_programmer/spi_eeprom_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 McMCC 3 | * spi_eeprom_api.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __SPI_EEPROM_API_H__ 16 | #define __SPI_EEPROM_API_H__ 17 | 18 | int spi_eeprom_read(unsigned char *buf, unsigned long from, unsigned long len); 19 | int spi_eeprom_erase(unsigned long offs, unsigned long len); 20 | int spi_eeprom_write(unsigned char *buf, unsigned long to, unsigned long len); 21 | long spi_eeprom_init(void); 22 | void support_spi_eeprom_list(void); 23 | 24 | #endif /* __SPI_EEPROM_API_H__ */ 25 | /* End of [spi_eeprom_api.h] package */ 26 | -------------------------------------------------------------------------------- /IMSProg_programmer/spi_nand_flash.h: -------------------------------------------------------------------------------- 1 | /*====================================================================================== 2 | * MODULE NAME: spi 3 | * FILE NAME: spi_nand_flash.h 4 | * DATE: 5 | * VERSION: 1.00 6 | * PURPOSE: To Provide SPI NAND Access interface. 7 | * NOTES: 8 | * 9 | * AUTHOR : 10 | * 11 | * FUNCTIONS 12 | * SPI_NAND_Flash_Init To provide interface for SPI NAND init. 13 | * SPI_NAND_Flash_Get_Flash_Info To get system current flash info. 14 | * SPI_NAND_Flash_Write_Nbyte To provide interface for Write N Bytes into SPI NAND Flash. 15 | * SPI_NAND_Flash_Read_NByte To provide interface for Read N Bytes from SPI NAND Flash. 16 | * SPI_NAND_Flash_Erase To provide interface for Erase SPI NAND Flash. 17 | * SPI_NAND_Flash_Read_Byte To provide interface for read 1 Bytes from SPI NAND Flash. 18 | * SPI_NAND_Flash_Read_DWord To provide interface for read Double Word from SPI NAND Flash. 19 | * 20 | * DEPENDENCIES 21 | * 22 | * * $History: $ 23 | * MODIFICTION HISTORY: 24 | *====================================================================================== 25 | */ 26 | 27 | #ifndef __SPI_NAND_FLASH_H__ 28 | #define __SPI_NAND_FLASH_H__ 29 | 30 | /* INCLUDE FILE DECLARATIONS --------------------------------------------------------- */ 31 | #include "types.h" 32 | #include "ch341a_spi.h" 33 | 34 | /* MACRO DECLARATIONS ---------------------------------------------------------------- */ 35 | #define SPI_NAND_FLASH_OOB_FREE_ENTRY_MAX 32 36 | 37 | /* TYPE DECLARATIONS ----------------------------------------------------------------- */ 38 | typedef enum{ 39 | SPI_NAND_FLASH_READ_DUMMY_BYTE_PREPEND, 40 | SPI_NAND_FLASH_READ_DUMMY_BYTE_APPEND, 41 | SPI_NAND_FLASH_READ_DUMMY_BYTE_DEF_NO 42 | } SPI_NAND_FLASH_READ_DUMMY_BYTE_T; 43 | 44 | typedef enum{ 45 | SPI_NAND_FLASH_RTN_NO_ERROR = 0, 46 | SPI_NAND_FLASH_RTN_PROBE_ERROR, 47 | SPI_NAND_FLASH_RTN_ALIGNED_CHECK_FAIL, 48 | SPI_NAND_FLASH_RTN_DETECTED_BAD_BLOCK, 49 | SPI_NAND_FLASH_RTN_ERASE_FAIL, 50 | SPI_NAND_FLASH_RTN_PROGRAM_FAIL, 51 | SPI_NAND_FLASH_RTN_DEF_NO 52 | } SPI_NAND_FLASH_RTN_T; 53 | 54 | typedef enum{ 55 | SPI_NAND_FLASH_READ_SPEED_MODE_SINGLE = 0, 56 | SPI_NAND_FLASH_READ_SPEED_MODE_DUAL, 57 | SPI_NAND_FLASH_READ_SPEED_MODE_QUAD, 58 | SPI_NAND_FLASH_READ_SPEED_MODE_DEF_NO 59 | } SPI_NAND_FLASH_READ_SPEED_MODE_T; 60 | 61 | 62 | typedef enum{ 63 | SPI_NAND_FLASH_WRITE_SPEED_MODE_SINGLE = 0, 64 | SPI_NAND_FLASH_WRITE_SPEED_MODE_QUAD, 65 | SPI_NAND_FLASH_WRITE_SPEED_MODE_DEF_NO 66 | } SPI_NAND_FLASH_WRITE_SPEED_MODE_T; 67 | 68 | 69 | typedef enum{ 70 | SPI_NAND_FLASH_DEBUG_LEVEL_0 = 0, 71 | SPI_NAND_FLASH_DEBUG_LEVEL_1, 72 | SPI_NAND_FLASH_DEBUG_LEVEL_2, 73 | SPI_NAND_FLASH_DEBUG_LEVEL_DEF_NO 74 | } SPI_NAND_FLASH_DEBUG_LEVEL_T; 75 | 76 | /* Bitwise */ 77 | #define SPI_NAND_FLASH_FEATURE_NONE ( 0x00 ) 78 | #define SPI_NAND_FLASH_PLANE_SELECT_HAVE ( 0x01 << 0 ) 79 | #define SPI_NAND_FLASH_DIE_SELECT_1_HAVE ( 0x01 << 1 ) 80 | #define SPI_NAND_FLASH_DIE_SELECT_2_HAVE ( 0x01 << 2 ) 81 | 82 | struct SPI_NAND_FLASH_INFO_T { 83 | u8 mfr_id; 84 | u8 dev_id; 85 | u8 dev_id_2; 86 | const char *ptr_name; 87 | u32 device_size; /* Flash total Size */ 88 | u32 page_size; /* Page Size */ 89 | u32 erase_size; /* Block Size */ 90 | u32 oob_size; /* Spare Area (OOB) Size */ 91 | SPI_NAND_FLASH_READ_DUMMY_BYTE_T dummy_mode; 92 | SPI_NAND_FLASH_READ_SPEED_MODE_T read_mode; 93 | SPI_NAND_FLASH_WRITE_SPEED_MODE_T write_mode; 94 | u32 feature; 95 | }; 96 | 97 | struct nand_info { 98 | int mfr_id; 99 | int dev_id; 100 | char *name; 101 | int numchips; 102 | int chip_shift; 103 | int page_shift; 104 | int erase_shift; 105 | int oob_shift; 106 | int badblockpos; 107 | int opcode_type; 108 | }; 109 | 110 | struct ra_nand_chip { 111 | struct nand_info *flash; 112 | }; 113 | 114 | /* EXPORTED SUBPROGRAM SPECIFICATION ------------------------------------------------- */ 115 | 116 | /*------------------------------------------------------------------------------------ 117 | * FUNCTION: SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Init( long rom_base ) 118 | * PURPOSE : To provide interface for SPI NAND init. 119 | * AUTHOR : 120 | * CALLED BY 121 | * - 122 | * CALLS 123 | * - 124 | * PARAMs : 125 | * INPUT : rom_base - The rom_base variable of this function. 126 | * OUTPUT: None 127 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 128 | * NOTES : 129 | * MODIFICTION HISTORY: 130 | * 131 | *------------------------------------------------------------------------------------ 132 | */ 133 | SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Init( u32 rom_base ); 134 | 135 | /*------------------------------------------------------------------------------------ 136 | * FUNCTION: SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Get_Flash_Info( struct SPI_NAND_FLASH_INFO_T *ptr_rtn_into_t ) 137 | * PURPOSE : To get system current flash info. 138 | * AUTHOR : 139 | * CALLED BY 140 | * - 141 | * CALLS 142 | * - 143 | * PARAMs : 144 | * INPUT : None 145 | * OUTPUT: ptr_rtn_into_t - A pointer to the structure of the ptr_rtn_into_t variable. 146 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 147 | * NOTES : 148 | * MODIFICTION HISTORY: 149 | * 150 | *------------------------------------------------------------------------------------ 151 | */ 152 | SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Get_Flash_Info( struct SPI_NAND_FLASH_INFO_T *ptr_rtn_into_t); 153 | 154 | /*------------------------------------------------------------------------------------ 155 | * FUNCTION: SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Write_Nbyte( u32 dst_addr, 156 | * u32 len, 157 | * u32 *ptr_rtn_len, 158 | * u8* ptr_buf ) 159 | * PURPOSE : To provide interface for Write N Bytes into SPI NAND Flash. 160 | * AUTHOR : 161 | * CALLED BY 162 | * - 163 | * CALLS 164 | * - 165 | * PARAMs : 166 | * INPUT : dst_addr - The dst_addr variable of this function. 167 | * len - The len variable of this function. 168 | * buf - The buf variable of this function. 169 | * OUTPUT: rtn_len - The rtn_len variable of this function. 170 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 171 | * NOTES : 172 | * MODIFICTION HISTORY: 173 | * 174 | *------------------------------------------------------------------------------------ 175 | */ 176 | SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Write_Nbyte( u32 dst_addr, 177 | u32 len, 178 | u32 *ptr_rtn_len, 179 | u8 *ptr_buf, 180 | SPI_NAND_FLASH_WRITE_SPEED_MODE_T speed_mode ); 181 | 182 | /*------------------------------------------------------------------------------------ 183 | * FUNCTION: int SPI_NAND_Flash_Read_NByte( long addr, 184 | * long len, 185 | * long *retlen, 186 | * char *buf ) 187 | * PURPOSE : To provide interface for Read N Bytes from SPI NAND Flash. 188 | * AUTHOR : 189 | * CALLED BY 190 | * - 191 | * CALLS 192 | * - 193 | * PARAMs : 194 | * INPUT : addr - The addr variable of this function. 195 | * len - The len variable of this function. 196 | * retlen - The retlen variable of this function. 197 | * buf - The buf variable of this function. 198 | * OUTPUT: None 199 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 200 | * NOTES : 201 | * MODIFICTION HISTORY: 202 | * 203 | *------------------------------------------------------------------------------------ 204 | */ 205 | u32 SPI_NAND_Flash_Read_NByte( u32 addr, 206 | u32 len, 207 | u32 *retlen, 208 | u8 *buf, 209 | SPI_NAND_FLASH_READ_SPEED_MODE_T speed_mode, 210 | SPI_NAND_FLASH_RTN_T *status ); 211 | 212 | /*------------------------------------------------------------------------------------ 213 | * FUNCTION: SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Erase( u32 dst_addr, 214 | * u32 len ) 215 | * PURPOSE : To provide interface for Erase SPI NAND Flash. 216 | * AUTHOR : 217 | * CALLED BY 218 | * - 219 | * CALLS 220 | * - 221 | * PARAMs : 222 | * INPUT : dst_addr - The dst_addr variable of this function. 223 | * len - The len variable of this function. 224 | * OUTPUT: None 225 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 226 | * NOTES : 227 | * MODIFICTION HISTORY: 228 | * 229 | *------------------------------------------------------------------------------------ 230 | */ 231 | SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Erase( u32 dst_addr, 232 | u32 len ); 233 | 234 | /*------------------------------------------------------------------------------------ 235 | * FUNCTION: char SPI_NAND_Flash_Read_Byte( long addr ) 236 | * PURPOSE : To provide interface for read 1 Bytes from SPI NAND Flash. 237 | * AUTHOR : 238 | * CALLED BY 239 | * - 240 | * CALLS 241 | * - 242 | * PARAMs : 243 | * INPUT : addr - The addr variable of this function. 244 | * OUTPUT: None 245 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 246 | * NOTES : 247 | * MODIFICTION HISTORY: 248 | * 249 | *------------------------------------------------------------------------------------ 250 | */ 251 | unsigned char SPI_NAND_Flash_Read_Byte( unsigned long addr, SPI_NAND_FLASH_RTN_T *status); 252 | 253 | /*------------------------------------------------------------------------------------ 254 | * FUNCTION: long SPI_NAND_Flash_Read_DWord( long addr ) 255 | * PURPOSE : To provide interface for read Double Word from SPI NAND Flash. 256 | * AUTHOR : 257 | * CALLED BY 258 | * - 259 | * CALLS 260 | * - 261 | * PARAMs : 262 | * INPUT : addr - The addr variable of this function. 263 | * OUTPUT: None 264 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 265 | * NOTES : 266 | * MODIFICTION HISTORY: 267 | * 268 | *------------------------------------------------------------------------------------ 269 | */ 270 | unsigned long SPI_NAND_Flash_Read_DWord( unsigned long addr, SPI_NAND_FLASH_RTN_T *status); 271 | 272 | /*------------------------------------------------------------------------------------ 273 | * FUNCTION: void SPI_NAND_Flash_Clear_Read_Cache_Data( void ) 274 | * PURPOSE : To clear the cache data for read. 275 | * (The next time to read data will get data from flash chip certainly.) 276 | * AUTHOR : 277 | * CALLED BY 278 | * - 279 | * CALLS 280 | * - 281 | * PARAMs : 282 | * INPUT : None 283 | * OUTPUT: None 284 | * RETURN : SPI_RTN_NO_ERROR - Successful. Otherwise - Failed. 285 | * NOTES : 286 | * MODIFICTION HISTORY: 287 | * 288 | *------------------------------------------------------------------------------------ 289 | */ 290 | void SPI_NAND_Flash_Clear_Read_Cache_Data( void ); 291 | 292 | SPI_NAND_FLASH_RTN_T SPI_NAND_Flash_Enable_OnDie_ECC( void ); 293 | 294 | SPI_NAND_FLASH_RTN_T spi_nand_erase_block ( u32 block_index); 295 | 296 | #endif /* ifndef __SPI_NAND_FLASH_H__ */ 297 | /* End of [spi_nand_flash.h] package */ 298 | -------------------------------------------------------------------------------- /IMSProg_programmer/timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * timer.c 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | 16 | #include 17 | #include 18 | 19 | #include "timer.h" 20 | 21 | static time_t start_time = 0; 22 | static time_t print_time = 0; 23 | 24 | void timer_start(void) 25 | { 26 | start_time = time(0); 27 | } 28 | 29 | void timer_end(void) 30 | { 31 | time_t end_time = 0, elapsed_seconds = 0; 32 | 33 | time(&end_time); 34 | elapsed_seconds = difftime(end_time, start_time); 35 | printf("Elapsed time: %d seconds\n", (int)elapsed_seconds); 36 | print_time = 0; 37 | } 38 | 39 | int timer_progress(void) 40 | { 41 | time_t end_time = 0; 42 | int elapsed_seconds = 0; 43 | 44 | if (!print_time) 45 | print_time = time(0); 46 | 47 | time(&end_time); 48 | 49 | elapsed_seconds = (int)difftime(end_time, print_time); 50 | 51 | if (elapsed_seconds == 1) { 52 | print_time = 0; 53 | return 1; 54 | } 55 | return 0; 56 | } 57 | /* End of [timer.c] package */ 58 | -------------------------------------------------------------------------------- /IMSProg_programmer/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 McMCC 3 | * timer.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __TIMER_H__ 16 | #define __TIMER_H__ 17 | 18 | void timer_start(void); 19 | void timer_end(void); 20 | int timer_progress(void); 21 | 22 | #endif /* __TIMER_H__ */ 23 | /* End of [timer.h] package */ 24 | -------------------------------------------------------------------------------- /IMSProg_programmer/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2021 McMCC 3 | * types.h 4 | * 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License 7 | * as published by the Free Software Foundation; either version 2 8 | * of the License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | */ 15 | #ifndef __TYPES_H__ 16 | #define __TYPES_H__ 17 | 18 | typedef unsigned char u8; 19 | typedef unsigned short u16; 20 | typedef unsigned int u32; 21 | typedef unsigned long long u64; 22 | typedef u16 __le16; 23 | typedef u16 __be16; 24 | typedef u32 __le32; 25 | typedef u32 __be32; 26 | 27 | #endif /* __TYPES_H__ */ 28 | /* End of [types.h] package */ 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IMSProg 2 | IMSProg - Linux IMSProg - I2C, SPI and MicroWire EEPROM/Flash chip programmer for CH341a devices. 3 | The IMSProm is a free I2C EEPROM programmer tool for CH341A device based on [QhexEdit2](https://github.com/Simsys/qhexedit2) and 4 | modify [SNANDer programmer](https://github.com/McMCCRU/SNANDer). 5 | 6 | ![CH341A black](img/ch341_black150.png) ![CH341A green](/img/ch341_green150.png) 7 | 8 | This is a GUI program used widget QhexEditor. For setting the SPI chip parameters you can use the `Detect` button for reading chip parameters (JEDEC information reading) or manually setting it. The I2C and MicroWire EEPROM only manually selected. 9 | 10 | The chip database format is clone with EZP2019, EZP2020, EZP2023, Minpro I, XP866+ programmers. You can edit the database use the [EZP Chip data Editor](https://github.com/bigbigmdm/EZP2019-EZP2025_chip_data_editor) 11 | 12 | ![CH341A EEPROM programmer](img/IMSProg.png) 13 | 14 | ## Building programmer 15 | ``` 16 | cd IMSProg_programmer 17 | mkdir build 18 | cd build 19 | cmake .. 20 | make -j4 21 | sudo make install 22 | ``` 23 | ## Building editor 24 | ``` 25 | cd IMSProg_editor 26 | mkdir build 27 | cd build 28 | cmake .. 29 | make -j4 30 | sudo make install 31 | ``` 32 | 33 | 34 | ## System software requirements 35 | - cmake library 36 | 37 | `sudo apt install cmake` 38 | 39 | - libusb library 40 | 41 | `sudo apt-get install libusb-1.0-0 libusb-dev libusb-1.0-0-dev` 42 | 43 | - Qt5 library 44 | 45 | `sudo apt-get install qtbase5-dev` 46 | 47 | ## How to use: 48 | 49 | ### Connecting 50 | - Insert the chip into the appropriate slot of the CH341a programmer. The `24xxx` and `25xxx` series chips must be inserted directly, according to the markings on the PCB of the CH341a programmer. The `93xxx` series chips must be inserted into the `93xxx adapter` and the adapter into the marking `25xxx` programmer slot. 51 | 52 | ![Adapter](img/93xxx_adapter.png) 53 | 54 | - If the chip supply voltage is 1.8 volt he must be insreted in `1.8 volt adapter` and the adapter into needed programmer slot. 55 | 56 | ![Adapter](img/1_8_adapter.png) 57 | 58 | - Plug the CH341a programmer into the USB socket your computer and running the `IMSProg`. 59 | - You can plug and unplug the programmer device (CH341a) to the USB port at any time when basic operations (reading, checking, and programming) are not in progress. 60 | 61 | ### Chip type selecting 62 | Select the type of chip used from the `Type` pop-up menu: `SPI FLASH` when using SPI NOR FLASH chips of the `25xxx` series, `24_EEPROM` when using i2c EEPROM of the `24xxx` series, `93_EEPROM` when using MicroWire EEPROM of the `93xxx` series. 63 | When using `25xxx` series SPI NOR FLASH chips, the `Detect` button will be available. When the `Detect` button or ![Detect](img/test64.png) or `` is pressed, the JEDEC information is read from the chip and all parameters of that chip are loaded from the chip database. Any parameter (`size`, `page size`, `block size`, `VCC voltage`, `and 4-bit address length`) can be changed manually. You can manually enter the `Manufacture` and `Name` pop-up menu data - all other parameters will be automatically loaded from the chip database. 64 | When using `24xxx` or `93xxx` series chips, it is necessary to manually enter the `Manufacture` and `Name` pop-up menu data - all other parameters will be automatically loaded from the chip database. 65 | 66 | ### Basic programmer operations 67 | - Pressing `Read` or ![Read](img/read64.png) or `` to read data from the chip into the computer buffer. 68 | 69 | - Pressing ![Write](img/write64.png) or `` to write data from the computer buffer into the chip. 70 | 71 | - Pressing ![Erase](img/erase64.png) or `` will erase all data in the chip. 72 | - Pressing the ![Verify](img/verify64.png) or `` button causes the data in the chip and in the computer buffer to be compared. 73 | 74 | The progress bar shows the progress of the read, erase, and verify operations. 75 | 76 | - The `Auto' button is used to perform erase, write and verify operations in sequence. If one of these operations is not needed, you can uncheck the checkbox for that operation. 77 | 78 | ### File operations 79 | - The ![Save](img/save64.png) or `` button is used to save the computer buffer to a file. 80 | 81 | - The ![Open](img/open64.png) or `` button is used to save the file in the computer buffer. 82 | 83 | - The ![SavePart](img/saveBlock64.png) or `` button is used to save a part of the computer buffer to a file (the start address and length of the part must be entered). This operation can be used when splitting a binary data image into parts. 84 | 85 | - The ![LoadPart](img/loadBlock64.png) or `` button is used to load a small file to a certain address in the buffer. The data fragment in the buffer will be replaced with new data from the file. 86 | 87 | - The ![Edit](img/chipEdit64.png) or `` button is used to invoke the chip database editor. 88 | 89 | ### Buffer (Hex editor) operations 90 | The hexadecimal chip editor (right side of the screen) is used to display and modify buffer data. 91 | 92 | It contains the following controls: ![Undo](img/undo.png) undo, ![Redo](img/redo64.png) redo, and the ![Search](img/hexsearch64.png) search/replace. The `[Ctrl+A]` key used to update the CRC24 checksum. 93 | 94 | ## List of supported chips 95 | 96 | ### i2C EEPROM 97 | 24C01, 24C02, 24C04, 24C08, 24C16, 24C32, 24C64, 24C128, 24C256, 24C512, 24C1024 98 | 99 | ### MicroWire EEPROM 100 | 93C46, 93C56, 93C66, 93C76, 93C86 101 | 102 | ### SPI NOR Flash 103 | - SPANSION 104 | 105 | FL016AIF, S25FL016P, S25FL032P, FL064AIF, S25FL064P, S25FL256S, S25FL128P, S25FL129P, S25FL116K, S25FL132K, S25FL164K 106 | 107 | - XTX 108 | 109 | XT25F02E, XT25F04D, XT25F08B, XT25F16B, XT25F32F, XT25F64F, XT25F128F, XT25W02E, XT25W04D, XT25Q08D(1.8V), XT25Q16D(1.8V), XT25Q64D(1.8V), XT25F128D(1.8V) 110 | 111 | - EON 112 | 113 | EN25B10T, EN25B20T, EN25B40T, EN25B80T 114 | EN25B16T, EN25B32T, EN25B64T, EN25F64, EN25Q40A, EN25Q80B, EN25Q16, EN25Q32C, EN25Q64, EN25Q128, EN25F10A, EN25F20A, EN25F40, EN25F80, EN25F16, EN25F32, EN25S10A(1.8V), EN25S20A(1.8V), EN25S40A(1.8V), EN25S80B(1.8V), EN25S16B(1.8V), EN25S64A(1.8V), EN25QE32A, EN25E10A, EN25E40A, EN25SE16A(1.8V), EN25SE32A(1.8V), EN25T80, EN25QA32B, EN25QA64A, EN25QA128A, EN25QW16A, EN25QW32A, EN25QH16, EN25QH32B, EN25QH64A, EN25QH128A, EN25Q256, EN25QX64A, EN25QX128A, EN25QX256A, EN25QY256A, EN25SX64A(1.8V), EN25SX128A(1.8V) 115 | 116 | - ATMEL 117 | 118 | AT26DF161, AT25DF321 119 | 120 | - MICRON 121 | 122 | M25P10, M25P20, M25P40, M25P80, M25P016, M25P32, M25P64, M25P128, N25Q032A, N25Q064A, MT25QL64AB, N25Q128A, MT25QL128AB, N25Q256A, MT25QL256AB, MT25QL512AB, N25Q032A(1.8V), N25Q064A(1.8V), MT25QU64AB(1.8V), N25Q128A(1.8V), MT25QU128AB(1.8V), MT25QU256AB(1.8V), MT25QU512AB(1.8V) 123 | 124 | - XMC 125 | 126 | XM25QH10B, XM25QH20B, XM25QH40B, XM25QH80B, XM25QH16C, XM25QH32B, XM25QH64C, XM25QH128C, XM25QH256C, XM25QH512C, XM25LU64C(1.8V), XM25LU128C(1.8V), XM25QU256C(1.8V), XM25QU512C(1.8V), XM25QW16C, XM25QW32C, XM25QW64C, XM25QW128C, XM25QW256C, XM25QW512C, XM25QU41B(1.8V), XM25QU80B(1.8V), XM25QU16C(1.8V), XM25LU32C(1.8V), XM25QH32A, XM25QH64A, XM25QH128A 127 | 128 | - AMIC 129 | 130 | A25L10PU, A25L20PU, A25L40PU, A25L80PU, A25L16PU, A25L10PT, A25L20PT, A25L40PT, A25L80PT, A25L16PT, A25L010, A25L020, A25L040, A25L040, A25L080, A25L016, A25L032, A25LQ080, A25LQ16, A25LQ32, A25LQ64 131 | 132 | - EXCELSEMI 133 | 134 | ES25P10, ES25P20, ES25P40, ES25P80, ES25P16, ES25P32, ES25M40A, ES25M80A, ES25M16A 135 | 136 | - DOUQI 137 | 138 | DQ25Q64AS 139 | 140 | - Zbit 141 | 142 | ZB25LD10A(1.8V), ZB25LD20A(1.8V), ZB25LD40B(1.8V), ZB25LD80(1.8V), ZB25D10A, ZB25D20A, ZB25D40B, ZB25D80B, ZB25VQ16, ZB25VQ32, ZB25VQ64, ZB25VQ128, ZB25LQ16(1.8V), ZB25LQ32(1.8V), ZB25LQ64(1.8V), ZB25LQ128(1.8V), ZB25VQ20A, ZB25VQ40A, ZB25VQ80A, ZB25VQ16A 143 | 144 | - ONSemi 145 | 146 | LE25U20AMB, LE25U40CMC 147 | 148 | - Boya 149 | 150 | BY25Q05AW, BY25Q10AW, BY25Q20BL(1.8V), BY25Q40BL(1.8V), BY25Q80AW(1.8V), BY25Q16BL(1.8V), BY25D05AS, BY25D10AS, BY25D20AS, BY25D40AS, BY25Q80BS, BY25Q16BS, BY25Q32BS, BY25Q64AS, BY25Q128AS, BY25Q256ES, BY25Q10AL(1.8V), BY25Q20AL(1.8V), BY25Q40AL(1.8V), BY25Q32AL(1.8V), BY25Q64AL(1.8V), BY25Q128EL(1.8V) 151 | 152 | - PFLASH 153 | 154 | Pm25LQ512B, Pm25LQ010B, Pm25LQ020B, PM25LQ016, PM25LQ032, PM25LQ064, PM25LQ128, Pm25LQ040B 155 | 156 | - Puya 157 | 158 | P25Q06H, P25Q40H, P25Q11H, P25Q21H, P25Q10H, P25Q20H, P25Q40H, P25Q80H, P25Q16H, P25Q32H, P25Q64H, P25Q128H 159 | 160 | - ESMT 161 | 162 | F25L004A, F25L008A, F25L016, F25L032, F25L064, F25L16QA, F25L32QA, F25L64QA 163 | 164 | - ISSI 165 | 166 | IS25LQ010, IS25LQ020, IS25LP080D, IS25LP016D, IS25LP032D, IS25LP064D, IS25LP128F, IS25LP256D, IS25LP512D, IS25WP040D(1.8V), IS25WP080D(1.8V), IS25WP016D(1.8V), IS25WP032D(1.8V), IS25WP064D(1.8V), IS25WP128F(1.8V), IS25WP256D(1.8V), IS25WP512D(1.8V) 167 | 168 | - Fudan 169 | 170 | FM25W04, FM25W16, FM25W32, FM25W64, FM25W128, FM25Q04, FM25Q08, FM25Q16, FS25Q32, FS25Q64, FS25Q128 171 | 172 | - Zetta 173 | 174 | ZD25Q64B, ZD25LQ128(1.8V), ZD25LQ64(1.8V), ZD25WD20B, ZD25WD40B, ZD25Q80C, ZD25Q16B, ZD25Q32C 175 | 176 | - PCT 177 | 178 | PCT25VF016B, PCT25VF032B, PCT25VF064C, PCT25VF020B, PCT25VF040B, PCT25VF080B, PCT26VF016, PCT26VF032, PCT25VF010A 179 | 180 | - MXIC 181 | 182 | MX25L8005M, MX25L1605D, MX25L3205D, MX25L6405D, MX25L12805D, MX25L25635E, MX25L51245G, MX25U5121E(1.8V), MX25U1001E(1.8V), MX25U2035F(1.8V), MX25U4035F(1.8V), MX25U80356(1.8V), MX25U1632F(1.8V), MX25U3232F(1.8V), MX25U6432F(1.8V), MX25U12832F(1.8V), MX25U25643G(1.8V), MX25U51245G(1.8V), MX25R2035F, MX25R4035F, MX25R8035F, MX25R1635F, MX25R3235F, MX25R6435F 183 | 184 | - GigaDevice 185 | 186 | GD25F40, GD25F80, GD25D40, GD25D80, GD25D05C, GD25D10C, GD25Q20C, GD25Q40C, GD25Q80C, GD25Q16C, GD25Q32, GD25Q64CSIG, GD25Q128CSIG, GD25Q256CSIG, GD25LD05C(1.8V), GD25LD10C(1.8V), GD25LD20C(1.8V), GD25LD40C(1.8V), GD25LQ80C(1.8V), GD25LQ16C(1.8V), GD25LQ32E(1.8V), GD25LQ64E(1.8V), GD25LQ128(1.8V), GD25LQ256D(1.8V), GD25WD05C, GD25WD10C, GD25WD20E, GD25WD40E, GD25WD80C, GD25WQ20E, GD25WQ40E, GD25WQ80E, GD25WQ16E, GD25WQ32E, GD25WQ64E, GD25WQ128E, GD25WB256E, GD25LB512ME(1.8V), YC25Q128 187 | 188 | - PARAGON 189 | 190 | PN25F08, PN25F16, PN25F32, PN25F64, PN25F128 191 | 192 | - WINBOND 193 | 194 | W25P80, W25P16, W25P32, W25X05, W25X10, W25X20, W25X40, W25X80, W25X16, W25X32VS, W25X64, W25Q20CL, W25Q40BV, W25Q80BL, W25Q16DV, W25Q32BV, W25Q64BV, W25Q128BV, W25Q256FV, W25Q20BW(1.8V), W25Q80, W25Q10EW(1.8V), W25Q20EW(1.8V), W25Q40EW(1.8V), W25Q80EW(1.8V), W25Q16JW(1.8V), W25Q32FW(1.8V), W25Q64DW(1.8V), W25Q128FW(1.8V), W25Q256JW(1.8V), W25M512JW(1.8V), W25Q512JV, W25M512JV, W25Q32JW(1.8V) 195 | 196 | - Fidelix 197 | 198 | FM25Q04A, FM25Q08A, FM25Q16A, FM25Q32A, FM25Q64A, FM25Q128A, FM25M04A(1.8V), FM25M08A(1.8V) 199 | FM25M16A(1.8V), FM25M32B(1.8V), FM25M64A(1.8V) 200 | 201 | -------------------------------------------------------------------------------- /build/IMSProg .appimage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/build/IMSProg .appimage -------------------------------------------------------------------------------- /build/IMSProg.Dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/build/IMSProg.Dat -------------------------------------------------------------------------------- /build/IMSProg.appimage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/build/IMSProg.appimage -------------------------------------------------------------------------------- /build/IMSProg_editor.appimage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/build/IMSProg_editor.appimage -------------------------------------------------------------------------------- /img/1_8_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/1_8_adapter.png -------------------------------------------------------------------------------- /img/93xxx_adapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/93xxx_adapter.png -------------------------------------------------------------------------------- /img/CH341_icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/CH341_icons.psd -------------------------------------------------------------------------------- /img/CH341_icons64.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/CH341_icons64.psd -------------------------------------------------------------------------------- /img/IMSProg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/IMSProg.png -------------------------------------------------------------------------------- /img/ch341_black150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/ch341_black150.png -------------------------------------------------------------------------------- /img/ch341_green150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/ch341_green150.png -------------------------------------------------------------------------------- /img/checkSum64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/checkSum64.png -------------------------------------------------------------------------------- /img/chipEdit64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/chipEdit64.png -------------------------------------------------------------------------------- /img/erase64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/erase64.png -------------------------------------------------------------------------------- /img/exit64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/exit64.png -------------------------------------------------------------------------------- /img/hexsearch64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/hexsearch64.png -------------------------------------------------------------------------------- /img/loadBlock64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/loadBlock64.png -------------------------------------------------------------------------------- /img/open64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/open64.png -------------------------------------------------------------------------------- /img/read64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/read64.png -------------------------------------------------------------------------------- /img/redo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/redo64.png -------------------------------------------------------------------------------- /img/save64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/save64.png -------------------------------------------------------------------------------- /img/saveBlock64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/saveBlock64.png -------------------------------------------------------------------------------- /img/test64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/test64.png -------------------------------------------------------------------------------- /img/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/undo.png -------------------------------------------------------------------------------- /img/unprotect64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/unprotect64.png -------------------------------------------------------------------------------- /img/verify64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/verify64.png -------------------------------------------------------------------------------- /img/write64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cedev935/IMSProg/57143b8435a109317c211a282a65b0f38c865018/img/write64.png --------------------------------------------------------------------------------