Codebase list ponyprog / 924962a
New upstream version 3.1.0+ds Carsten Schoenert 4 years ago
195 changed file(s) with 13611 addition(s) and 8911 deletion(s). Raw diff Collapse all Expand all
00 .directory
1 Thumbs.db
12 .kdev4
23 build*
34 *.kdev4
45 CMakeLists.txt.user*
56 ponyprog.pro.user*
7 doxygen/html
8 doxygen/latex
9 SrcPony/version.h
00 language: cpp
11 compiler: gcc
2 dist: trusty
2 dist: xenial
33
4 before_install:
4 addons:
5 apt:
6 packages:
7 - g++-5
8 - pkg-config
9 - libusb-1.0-0
10 - libusb-1.0-0-dev
11 - libftdi1-2
12 - libftdi1-dev
13 - libftdipp1-2v5
14 - libftdipp1-dev
15
16 #before_install:
17 #- gcc -v
18
19 #install:
520 # C++11
6 - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
7 - sudo apt-get update -qq
8
9 install:
10 # C++11
11 - sudo apt-get install -qq g++-5
21 #- sudo apt-get install -qq g++-5 libftdi1-2 libftdi1-dev libftdipp1-2 libftdipp1-dev
1222
1323 script:
1424 - qmake ponyprog.pro -r -spec linux-g++-64 CONFIG+=debug QMAKE_CXX=g++-5 QMAKE_LINK=g++-5
4242
4343
4444 IF(${USE_DEBUGGER})
45 SET(CMAKE_BUILD_TYPE Debug)
4546 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
4647 ELSE()
48 SET(CMAKE_BUILD_TYPE Release)
4749 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
4850 ENDIF()
4951
7173
7274
7375 SET(CURRENT_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
76
77 INCLUDE(FindLibUSB-1.0)
78
79
80 IF(NOT ${LIBUSB_VERSION} LESS "1.0.16")
81 MESSAGE(STATUS "LibUSB version ${LIBUSB_VERSION}")
82 ELSE()
83 MESSAGE(FATAL_ERROR "-- LibUSB version ${LIBUSB_VERSION} TOO OLD! Please Install this library newer as 1.0.16")
84 ENDIF()
7485
7586
7687 # Set the PonyProg version
117128 # ENDIF(MSVC)
118129
119130 IF (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
120 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fno-exceptions -fno-rtti")
121 ELSE()
122 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions -fno-rtti")
131 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fno-exceptions")
132 ELSE()
133 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions")
123134 ENDIF()
124135
125136
166177 ENDIF(NOT Qt5Multimedia_FOUND)
167178 ENDIF()
168179
180 #set ( FTDIPP ON )
181 FIND_PACKAGE ( LibFTDI1 NO_MODULE REQUIRED )
182
183 IF(NOT LibFTDI1_FOUND)
184 MESSAGE(FATAL_ERROR "LibFTDI1 files are not found. "
185 "LibFTDI1 and LibFTDIPP1 development packages are to install.")
186 ENDIF(NOT LibFTDI1_FOUND)
187
188 INCLUDE ( ${LIBFTDI_USE_FILE} )
189
169190 # for this feature install debhelper or
170191 SET(PONYPROG_CPACK_PACKAGE_SHLIBDEPS ON)
171192
172193 IF(${USE_QT_VERSION} MATCHES "4")
173 INCLUDE_DIRECTORIES(${QT_INCLUDES})
194 INCLUDE_DIRECTORIES(${QT_INCLUDES} ${LIBUSB_INCLUDE_DIRS})
174195 MESSAGE(STATUS "QT_INCLUDES ${QT_INCLUDES}")
175196 ELSE()
176 INCLUDE_DIRECTORIES(${QT_INCLUDES} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS})
197 INCLUDE_DIRECTORIES(${QT_INCLUDES} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS} ${LIBUSB_INCLUDE_DIRS})
177198
178199 MESSAGE(STATUS "QT_INCLUDES ${QT_INCLUDES} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS}")
179200
222243
223244
224245 IF(NOT ${USE_DEBUGGER})
225 ADD_DEFINITIONS(${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
226 ENDIF()
246 ADD_DEFINITIONS(${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
247 ELSE()
248 ADD_DEFINITIONS(${QT_DEFINITIONS} -DQT_DEBUG)
249 ENDIF()
250
227251
228252 IF(${USE_QT_VERSION} MATCHES "4")
229253 INCLUDE(${QT_USE_FILE})
230254 ADD_DEFINITIONS(${QT_DEFINITIONS} -DNO_QT3SUPPORT -DDISABLE_QT3SUPPORT -DQT_PROJECT)
231255 ELSE()
232 ADD_DEFINITIONS( ${Qt5Widgets_DEFINITIONS} ${Qt5PrintSupport_DEFINITIONS} ${Qt5Multimedia_DEFINITIONS} -DQT_PROJECT )
256 ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS} ${Qt5PrintSupport_DEFINITIONS} ${Qt5Multimedia_DEFINITIONS} -DQT_PROJECT)
233257 ENDIF()
234258
235259 IF(WIN32)
236260 ADD_DEFINITIONS(-DUNICODE -D_UNICODE)
237261 ENDIF()
262
263
238264
239265 ADD_EXECUTABLE(${CMAKE_PROJECT_NAME}
240266 ${APP_SOURCES}
248274
249275
250276 IF(${USE_QT_VERSION} MATCHES "4")
251 TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} ${QT_LIBRARIES} )
252 ELSE()
253 TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} ${QT_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} )
277 TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} ${QT_LIBRARIES} ${LIBUSB_LIBRARIES})
278 ELSE()
279 TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} ${QT_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ${LIBUSB_LIBRARIES})
254280 MESSAGE(STATUS "QT LIBRARIES: ${QT_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Multimedia_LIBRARIES} ${Qt5PrintSupport_LIBRARIES} ${Qt5Core_LIBRARIES}")
255281 ENDIF()
282
283 #target_link_libraries(${CMAKE_PROJECT_NAME} ${LIBFTDI_LIBRARIES} )
284 target_link_libraries(${CMAKE_PROJECT_NAME} ftdipp1 ${LIBFTDI_LIBRARIES} )
256285
257286 ADD_CUSTOM_TARGET (tags
258287 COMMAND ctags -R -f tags ${CMAKE_SOURCE_DIR}/SrcPony
00 Version history
11
2 3.1.0 Add USB PonyProgFT interface, redesigned interface dialog, several fixes
23 3.0.2 Default build to Qt5, smal fixes to build on non-X86 ARCHs
34 3.0.1 Small fixes, Build scripts, compiler warnings, mispelled words
45 3.0.0 Project converted to Qt framework
0 History
1 PonyProgFT_ProjectLogs
2 __Previews
0 vendor_id=0x0403 # Vendor ID
1 product_id=0x6e38 # Product ID
2
3 max_power=500 # Max. power consumption: value * 2 mA. Use 0 if self_powered = true.
4
5 ###########
6 # Strings #
7 ###########
8 manufacturer="Eurek srl" # Manufacturer
9 product="PonyProgFT" # Product
10 serial="FT000020" # Serial
11
12 ###########
13 # Options #
14 ###########
15 self_powered=false # Turn this off for bus powered
16 remote_wakeup=false # Turn this on for remote wakeup feature
17 use_serial=true # Use the serial number string
18
19 # Normally out don't have to change one of these flags
20 in_is_isochronous=false # In Endpoint is Isochronous
21 out_is_isochronous=false # Out Endpoint is Isochronous
22 suspend_pull_downs=false # Enable suspend pull downs for lower power
23 change_usb_version=false # Change USB Version
24 usb_version=0x0200 # Only used when change_usb_version is enabled
25
26 cha_vcp=false
27 cha_type=FIFO
28
29 # Only used on FT232H chips (when omitted, use chip defaults)
30 # Possible values correspond to enum ftdi_cbush_func.
31 cbush0=TRISTATE
32 cbush1=TRISTATE
33 cbush2=TRISTATE
34 cbush3=TRISTATE
35 cbush4=TRISTATE
36 cbush5=TRISTATE
37 cbush6=TRISTATE
38 cbush7=TRISTATE
39 cbush8=TRISTATE
40 cbush9=DRIVE_0
41
42 group0_drive=8mA
43
44 eeprom_type=0x56
45
46 ########
47 # Misc #
48 ########
49
50 filename="eeprom.bin" # Filename, leave empty to skip file writing
0 #!/bin/bash
1
2 which ftdi_eeprom >/dev/null
3 if [ $? -ne 0 ]; then
4 echo "ftdi_eeprom command not found!"
5 exit 1
6 fi
7
8 set -o errexit
9
10 FILECONF=ponyprogft.conf
11
12 if [ -f "${FILECONF}" ]; then
13 NL=`grep -c -e "serial=\"FT[0-9]\+\"" "${FILECONF}"`
14 if [ "$NL" == "1" ]; then
15 ZNUM=`grep -e "serial=\"FT[0-9]\+\"" "${FILECONF}" | cut -d '=' -f 2 | cut -d '#' -f 1 | cut -d '"' -f 2 | cut -c 3-`
16 #output e` il numero a 6 cifre preceduto da 0 per es. 000002
17 #echo ${ZNUM}
18 #rimuoviamo gli zeri inizali lasciandolo in base 10
19 NUM=$((10#$ZNUM))
20 #echo ${NUM}
21 ((NUM++))
22 NEWSERIAL=`printf "%06u" ${NUM}`
23 echo "NewSerial: ${NEWSERIAL}"
24 sed -i.old "s/serial=\"FT[0-9]\+\"/serial=\"FT${NEWSERIAL}\"/g" "${FILECONF}"
25
26 ftdi_eeprom --device i:0x0403:0x6014 --flash-eeprom "${FILECONF}"
27 if [ "$?" -eq 0 ]; then
28 echo "Success!!!!!"
29 exit 0
30 else
31 echo "Failed"
32 #Restore original
33 mv "${FILECONF}.old" "${FILECONF}"
34 exit 3
35 fi
36 else
37 echo "error NL != 1. $NL"
38 exit 2
39 fi
40 else
41 echo "File non esiste: ${FILECONF}"
42 exit 1
43 fi
00 -----------------
11 PREPARE FOR BUILD
22 -----------------
3 For compiling with Qt4 should be installed libqtcore4, libqtgui4, libqt4-dev, packages
43 Compiling with Qt5 needs qtbase5-dev, qtmultimedia5-dev, libqt5printsupport5, libqt5multimedia5
54 Name of packages can be different on distributions.
65
87 BUILD for Linux
98 ---------------
109 On linux systems you need the following packages installed to build: cmake, make, g++ and selected Qt packages
10 Other packages needed un ubuntu 18.04: libftdi1-dev libftdipp1-dev libusb-1.0.0-dev
1111 To build the executable binary file run the script:
1212
1313 # ./create_elf_binary.sh
1414
1515 In this shell script you can change followed options in the line:
16 cmake -DUSE_DEBUGGER=ON -DUSE_QT5=OFF ..
16 cmake -DUSE_DEBUGGER=ON -DUSE_QT5=ON ..
1717
1818 USE_DEBUGGER ON/OFF: the debug information in binary file
1919 USE_QT5 ON/OFF: select Qt5 or Qt4
0 # 3.0.2 - PonyProg - Serial Device Programmer
0 # 3.1.0 - PonyProg - Serial Device Programmer
11 PonyProg is a serial device programmer software with a user friendly GUI framework available for Windows and Linux. It's purpose is reading and writing every serial device. With PonyProg and SI-Prog you can program Wafercard for SAT, eeprom within GSM, TV or CAR-RADIO. Furthermore it can be used as a low cost starter kit for PIC and AVR.
22 Ponyprog supports AVR, SPI eeprom, AVR micro, 12C bus 8bit eeprom, PIC 16 micro, PIC 12 micro, AT89S micro and SDE2506 eeprom family chips.
33 You can open any HEX, e2p, mot, csm, rom, eep, bin files and burn them to uC or PIC. You can even backup the old program on the chip using Ponyprog. Ponyprog enables the user to write, verify and erase data on the microchip.
55
66 You can find it at [www.LancOS.com](http://www.LancOS.com)
77
8 ![Screenshot](Screenshot.png "Screenshot")
8 ![Screenshot](Screenshot.png "Screenshot")
+0
-3
SrcPony/.gitignore less more
0 .directory
1 ponyprog.qrc.depends
2 version.h
00 #CMakeLists.txt
11
22 SET(PONY_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/aboutmdlg.cpp
3 ${CMAKE_CURRENT_SOURCE_DIR}/usbwatcher.cpp
34 ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
45 ${CMAKE_CURRENT_SOURCE_DIR}/Translator.cpp
56 ${CMAKE_CURRENT_SOURCE_DIR}/e2app.cpp
3435 ${CMAKE_CURRENT_SOURCE_DIR}/pic125xx.cpp
3536 ${CMAKE_CURRENT_SOURCE_DIR}/picbusnew.cpp
3637 # ${CMAKE_CURRENT_SOURCE_DIR}/retrymdlg.cpp
38 # ${CMAKE_CURRENT_SOURCE_DIR}/ch341a.cpp
3739 ${CMAKE_CURRENT_SOURCE_DIR}/spi-bus.cpp
3840 ${CMAKE_CURRENT_SOURCE_DIR}/at250bus2.cpp
3941 ${CMAKE_CURRENT_SOURCE_DIR}/at89sxx.cpp
5658 ${CMAKE_CURRENT_SOURCE_DIR}/filebuf.cpp
5759 ${CMAKE_CURRENT_SOURCE_DIR}/infomdlg.cpp
5860 ${CMAKE_CURRENT_SOURCE_DIR}/lpt_ext_interf.cpp
61 ${CMAKE_CURRENT_SOURCE_DIR}/mpsse_interf.cpp
5962 ${CMAKE_CURRENT_SOURCE_DIR}/motsfbuf.cpp
6063 ${CMAKE_CURRENT_SOURCE_DIR}/pic168xx.cpp
6164 ${CMAKE_CURRENT_SOURCE_DIR}/portint.cpp
7376 ${CMAKE_CURRENT_SOURCE_DIR}/pic16xx.cpp
7477 ${CMAKE_CURRENT_SOURCE_DIR}/x2444bus.cpp
7578 # ${CMAKE_CURRENT_SOURCE_DIR}/profile.cpp
79 ${CMAKE_CURRENT_SOURCE_DIR}/prefdialog.cpp
7680 ${CMAKE_CURRENT_SOURCE_DIR}/sdebus.cpp)
7781
7882
79
8083 SET(PONY_NOMOC_HEADERS
8184 ${CMAKE_CURRENT_SOURCE_DIR}/e2app.h
8285 ${CMAKE_CURRENT_SOURCE_DIR}/e2awinfo.h
9295 ${CMAKE_CURRENT_SOURCE_DIR}/eeptypes.h
9396 ${CMAKE_CURRENT_SOURCE_DIR}/ispinterf.h
9497 ${CMAKE_CURRENT_SOURCE_DIR}/lpt_io_interf.h
98 ${CMAKE_CURRENT_SOURCE_DIR}/mpsse_interf.h
9599 ${CMAKE_CURRENT_SOURCE_DIR}/pgminter.h
96100 ${CMAKE_CURRENT_SOURCE_DIR}/picbus.h
97101 ${CMAKE_CURRENT_SOURCE_DIR}/sde2506.h
144148 ${CMAKE_CURRENT_SOURCE_DIR}/ppuser.h
145149 ${CMAKE_CURRENT_SOURCE_DIR}/rs232int.h
146150 ${CMAKE_CURRENT_SOURCE_DIR}/x2444.h)
147
148
151
152
149153 SET(PONY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/fusemdlg.h
154 ${CMAKE_CURRENT_SOURCE_DIR}/usbwatcher.h
150155 ${CMAKE_CURRENT_SOURCE_DIR}/bitfield.h
151156 ${CMAKE_CURRENT_SOURCE_DIR}/filldlg.h
152157 ${CMAKE_CURRENT_SOURCE_DIR}/blockmdlg.h
153158 ${CMAKE_CURRENT_SOURCE_DIR}/e2cmdw.h
159 # ${CMAKE_CURRENT_SOURCE_DIR}/ch341a.h
154160 ${CMAKE_CURRENT_SOURCE_DIR}/e2dlg.h
155161 ${CMAKE_CURRENT_SOURCE_DIR}/aboutmdlg.h
162 ${CMAKE_CURRENT_SOURCE_DIR}/prefdialog.h
156163 ${CMAKE_CURRENT_SOURCE_DIR}/progoption.h
157164 ${CMAKE_CURRENT_SOURCE_DIR}/sernumdlg.h
158165 ${CMAKE_CURRENT_SOURCE_DIR}/infomdlg.h)
166173 ${CMAKE_CURRENT_SOURCE_DIR}/forms/fusedlg.ui
167174 ${CMAKE_CURRENT_SOURCE_DIR}/forms/mainwindow.ui
168175 ${CMAKE_CURRENT_SOURCE_DIR}/forms/osccalibr.ui
176 ${CMAKE_CURRENT_SOURCE_DIR}/forms/prefdialog.ui
169177 ${CMAKE_CURRENT_SOURCE_DIR}/forms/progoption.ui
170178 ${CMAKE_CURRENT_SOURCE_DIR}/forms/sernumcfg.ui
171179 PARENT_SCOPE)
172180
173
181
174182 SET(PONY_SOURCES ${PONY_SOURCES}
175183 PARENT_SCOPE)
176184
540540 "Refer to device datasheet, please",
541541 "Checked items means programmed",
542542 "UnChecked items means unprogrammed",
543 ""
543 "Save the result in the buffer at given location",
544
545 "Preferences"
544546 };
545547
546548
607609
608610 if (llEng.indexOf(QRegExp("t[0-9]+=")) == 0)
609611 {
610 int num, pos;
611612 QString str;
612 pos = llEng.indexOf("=");
613 int pos = llEng.indexOf("=");
613614
614615 if (pos > 0)
615616 {
616617 str = llEng.mid(pos + 1);
617618 //
618 num = llEng.mid(1, pos - 1).toShort();
619 int num = llEng.mid(1, pos - 1).toShort();
619620
620621 // qDebug() << num << str;
621622 if (num >= vecSize)
478478 STR_LBLFUSEDLGHLP,
479479 STR_FUSEDLGNOTESET,
480480 STR_FUSEDLGNOTECLR,
481 STR_ENUM_SIZE
481 STR_CALIBRENABLED,
482
483 STR_PREFERENCES
482484 };
483485
484486
3939 class AboutModalDialog : public QDialog, public cTranslator, public Ui::AboutDialog
4040 {
4141 Q_OBJECT
42 public: //---------------------------------------- public
42 public:
4343 AboutModalDialog(QWidget *bw = 0, const QString title = "About");
4444 virtual ~AboutModalDialog(); // Destructor
4545
46 protected: //--------------------------------------- protected
46 protected:
4747
4848 private slots:
4949 void onChkStart(bool);
5050 void onHelp();
5151
52 private: //--------------------------------------- private
52 private:
5353
5454 e2CmdWindow *cmdw;
5555 };
3232 #include "errcode.h"
3333 #include "eeptypes.h"
3434
35 //=====>>> Costruttore <<<======
3635 At17xxx::At17xxx(e2AppWinInfo *wininfo, BusIO *busp)
3736 : E24xx(wininfo, busp, 8, 1)
3837 {
5453
5554 for (j = addr_bytes - 1; j >= 0; j--)
5655 {
57 rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, 0);
56 rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, false);
5857
5958 if (rval < 0)
6059 {
6463
6564 for (j = 0; j < len; j++)
6665 {
67 rval = GetBus()->WriteByte(buf[j], 1);
66 rval = GetBus()->WriteByte(buf[j], true);
6867
6968 if (rval < 0)
7069 {
169168
170169 for (j = addr_bytes - 1; j >= 0; j--)
171170 {
172 rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, 0);
171 rval = GetBus()->WriteByte((addr >> (j * 8)) & 0xFF, false);
173172
174173 if (rval < 0)
175174 {
187186
188187 for (j = 0; j < len - 1; j++)
189188 {
190 rval = GetBus()->ReadByte(0, 1);
189 rval = GetBus()->ReadByte(0, true);
191190
192191 if (rval < 0)
193192 {
198197 }
199198
200199 //ultimo byte senza ACK
201 rval = GetBus()->ReadByte(1, 1);
200 rval = GetBus()->ReadByte(1, true);
202201
203202 if (rval < 0)
204203 {
3030
3131 class At17xxx : public E24xx
3232 {
33 public: //---------------------------------------- public
33 public:
3434
3535 At17xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
3636
3939 int Write(int probe = 1, int type = ALL_TYPE);
4040 int Verify(int type = ALL_TYPE);
4141
42 protected: //--------------------------------------- protected
42 protected:
4343
4444 int WritePage(long addr, int addr_bytes, uint8_t *buf, int len);
4545 int ReadPage(long addr, int addr_bytes, uint8_t *buf, int len);
4646
47 private: //--------------------------------------- private
47 private:
4848
4949 };
5050 #endif
3030 #include <QDebug>
3131 #include <QtCore>
3232
33 #ifdef Q_OS_LINUX
34 # include <unistd.h>
35 #else
36 # ifdef __BORLANDC__
37 # define __inline__
38 # else // _MICROSOFT_ VC++
39 # define __inline__ __inline
40 # define _export
41 # endif
42 #endif
43
44 // Costruttore
4533 At250Bus::At250Bus(BusInterface *ptr)
4634 : SPIBus(ptr),
4735 WriteEnable(0x06),
5947
6048 void At250Bus::EndCycle()
6149 {
62 // WaitUsec(1);
50 //WaitUsec(1);
6351 setNCS();
64 WaitUsec(shot_delay * 2);
52 ShotDelay(2);
6553 clearNCS();
66 WaitUsec(shot_delay);
54 ShotDelay();
6755 }
6856
6957 int At250Bus::ReadEEPByte(int addr)
7361 SendDataByte(ReadData | (((addr >> 8) & 1) << 3));
7462 SendDataByte(addr);
7563
76 WaitUsec(shot_delay);
64 ShotDelay();
7765
7866 rv = RecDataByte();
7967
126114 int k;
127115
128116 for (k = timeout; k > 0 && (ReadEEPStatus() & NotReadyFlag); k--)
129 ;
117 {
118 WaitUsec(50);
119 }
130120
131121 return (k != 0);
132122 }
133123
134124 int At250Bus::Reset(void)
135125 {
136 qDebug() << "At250Bus::Reset()";
126 qDebug() << Q_FUNC_INFO;
137127
138128 SPIBus::Reset();
139
140 WaitUsec(shot_delay);
141
142 // SendDataByte(WriteEnable);
143 // EndCycle();
129 ShotDelay();
130
131 //SendDataByte(WriteEnable);
132 //EndCycle();
144133
145134 return OK;
146135 }
147136
148
149137 long At250Bus::Read(int addr, uint8_t *data, long length, int page_size)
150138 {
151 qDebug() << "At250Bus::Read(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
139 qDebug() << Q_FUNC_INFO << "(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
152140
153141 long len;
154142
166154 }
167155 }
168156 }
157 WaitMsec(1); //Flush
169158
170159 ReadEnd();
171160
172 qDebug() << "At250Bus::Read() = " << len;
161 qDebug() << Q_FUNC_INFO << "=" << len;
173162
174163 return len;
175164 }
196185
197186 if (!WaitEndOfWrite())
198187 {
199 return 0; //Must return 0, because > 0 (and != length) means "Abort by user"
188 return 0; //Must return 0, because > 0 (and != length) means "Abort by user"
200189 }
201190
202191 if ((len & 1))
207196 }
208197 }
209198 }
199 WaitMsec(1); //Flush
210200
211201 WriteEnd();
212202
3030
3131 class At250Bus : public SPIBus
3232 {
33 public: //------------------------------- public
33 public:
3434 At250Bus(BusInterface *ptr = 0);
35 // virtual ~At250Bus();
35 //virtual ~At250Bus();
3636
3737 long Read(int addr, uint8_t *data, long length, int page_size = 0);
3838 long Write(int addr, uint8_t const *data, long length, int page_size = 0);
3939
4040 int Reset();
4141
42 protected: //------------------------------- protected
43
42 protected:
4443 virtual int ReadEEPByte(int addr);
4544 virtual void WriteEEPByte(int addr, int data);
4645 int ReadEEPStatus();
4746 int WriteEEPStatus(int data);
4847 void EndCycle(void);
4948
50 int WaitEndOfWrite(int timeout = 0); // 07/08/99
49 int WaitEndOfWrite(int timeout = 0); // 07/08/99
5150
5251 //Programming commands
5352 const uint8_t WriteEnable;
6463
6564 const int loop_timeout;
6665
67 private: //------------------------------- private
68
66 private:
6967 void setNCS()
7068 {
71 ClearReset(); //27/05/98
69 ClearReset(); //27/05/98
7270 }
7371
7472 void clearNCS()
7573 {
76 SetReset(); //27/05/98
74 SetReset(); //27/05/98
7775 }
7876 };
7977
3232
3333 #include "e2cmdw.h"
3434
35 #ifdef Q_OS_WIN32
36 # ifdef __BORLANDC__
37 # define __inline__
38 # else // _MICROSOFT_ VC++
39 # define __inline__ __inline
40 # define _export
41 # endif
42 #endif
43
44 // Costruttore
4535 At250BigBus::At250BigBus(BusInterface *ptr)
4636 : At250Bus(ptr)
4737 {
48 qDebug() << "At250BigBus::At250BigBus(" << (hex) << ptr << (dec) << ")";
38 qDebug() << Q_FUNC_INFO << "(" << (hex) << ptr << (dec) << ")";
4939 }
5040
5141 long At250BigBus::Read(int addr, uint8_t *data, long length, int page_size)
5242 {
53 qDebug() << "At250BigBus::Read(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
43 qDebug() << Q_FUNC_INFO << "(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
5444 ReadStart();
5545
5646 long len;
5747
5848 SendDataByte(ReadData);
59 SendDataByte((addr >> 8) & 0xFF); //MSB
60 SendDataByte(addr & 0xFF); //LSB
49 SendDataByte((addr >> 8) & 0xFF); //MSB
50 SendDataByte(addr & 0xFF); //LSB
6151
62 WaitUsec(shot_delay);
52 ShotDelay();
6353
6454 for (len = 0; len < length; len++)
6555 {
7363 }
7464 }
7565 }
66 WaitMsec(1); //Flush
7667
7768 EndCycle();
7869
7970 ReadEnd();
80 qDebug() << "At250BigBus::Read() = " << len;
71 qDebug() << Q_FUNC_INFO << "=" << len;
8172
8273 return len;
8374 }
84
8575
8676 long At250BigBus::Write(int addr, uint8_t const *data, long length, int page_size)
8777 {
9080 WriteStart();
9181
9282 int writepage_size = E2Profile::GetSPIPageWrite();
93 // E2Profile::SetSPIPageWrite(writepage_size);
9483
9584 WriteEEPStatus(0);
9685
10796 EndCycle();
10897
10998 SendDataByte(WriteData);
110 SendDataByte((addr >> 8) & 0xFF); //MSB
111 SendDataByte(addr & 0xFF); //LSB
99 SendDataByte((addr >> 8) & 0xFF); //MSB
100 SendDataByte(addr & 0xFF); //LSB
112101
113102 int j;
114103
121110
122111 if (!WaitEndOfWrite())
123112 {
124 return 0; //Must return 0, because > 0 (and != length) means "Abort by user"
113 return 0; //Must return 0, because > 0 (and != length) means "Abort by user"
125114 }
126115
127116 if ((++count & 1))
132121 }
133122 }
134123 }
124 WaitMsec(1); //Flush
135125
136126 WriteEnd();
137127
3030
3131 class At250BigBus: public At250Bus
3232 {
33 public: //------------------------------- public
33 public:
3434 At250BigBus(BusInterface *ptr = 0);
3535
3636 long Read(int addr, uint8_t *data, long length, int page_size = 0);
3838
3939 // int Reset();
4040
41 protected: //------------------------------- protected
41 protected:
4242
4343 // int ReadEEPByte(int addr);
4444 // void WriteEEPByte(int addr, int data);
4545
46 private: //------------------------------- private
46 private:
4747
4848 //Programming commands
4949 // const uint8_t WriteEnable;
3030
3131 #include <QDebug>
3232
33 //=====>>> Costruttore <<<======
3433 At250xx::At250xx(e2AppWinInfo *wininfo, BusIO *busp)
3534 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
3635 {
3736 }
3837
39 //--- Distruttore
4038 At250xx::~At250xx()
4139 {
4240 }
4341
4442 // determina il numero di banchi (dimensione) dell'eeprom
45 //---
4643 int At250xx::Probe(int probe_size)
4744 {
4845 qDebug() << "At250xx::Probe(" << probe_size << ")";
3434
3535 class At250xx : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 At250xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~At250xx();
4444 virtual int Write(int probe = 1, int type = ALL_TYPE);
4545 virtual int Verify(int type = ALL_TYPE);
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 At250Bus *GetBus()
5050 {
5151 return static_cast<At250Bus *>(Device::GetBus());
5252 }
5353
54 private: //--------------------------------------- private
54 private:
5555
5656 };
5757 #endif
2828 #include "errcode.h"
2929 #include "eeptypes.h"
3030
31 //=====>>> Costruttore <<<======
3231 At25xxx::At25xxx(e2AppWinInfo *wininfo, BusIO *busp)
3332 : At250xx(wininfo, busp)
3433 {
3534 }
3635
37 //--- Distruttore
3836 At25xxx::~At25xxx()
3937 {
4038 }
3434
3535 class At25xxx : public At250xx
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 At25xxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~At25xxx();
4141
42 protected: //--------------------------------------- protected
42 protected:
4343
4444 At250BigBus *GetBus()
4545 {
4646 return static_cast<At250BigBus *>(Device::GetBus());
4747 }
4848
49 private: //--------------------------------------- private
49 private:
5050
5151 };
5252 #endif
2929 #include "errcode.h"
3030 #include "eeptypes.h"
3131 #include "e2profil.h"
32
3332 #include "e2cmdw.h"
3433
3534 #include <QtCore>
3635 #include <QDebug>
3736
38 /*Attenzione!! il format Intel Hex e` Little Endian */
37 // NB: Intel Hex format is Little Endian
3938 #undef _BIG_ENDIAN_
4039
41 #ifdef Q_OS_WIN32
42 # ifdef __BORLANDC__
43 # define __inline__
44 # else // _MICROSOFT_ VC++
45 # define __inline__ __inline
46 # define _export
47 # endif
48 #endif
49
50 // Costruttore
5140 At89sBus::At89sBus(BusInterface *ptr)
5241 : SPIBus(ptr),
5342 EnableProg0(0xAC), EnableProg1(0x53),
10594 break;
10695 }
10796
108 BusIO::SetDelay(n);
109
110 qDebug() << "At89sBus::SetDelay() = " << n;
97 Q_CHECK_PTR(busI);
98 busI->SetDelay(n);
99
100 qDebug() << Q_FUNC_INFO << "=" << n;
111101 }
112102
113103 int At89sBus::ReadDataByte(long addr)
142132 SendDataByte(data);
143133 }
144134
145
146135 int At89sBus::ReadProgByte(long addr)
147136 {
148137 if (oldmode)
188177 }
189178
190179 //align addr to page boundary
191 addr &= ~(page_size - 1); //0xFFFFFF00
180 addr &= ~(page_size - 1); //0xFFFFFF00
192181
193182 SendDataByte(WriteProgPageMem);
194183 SendDataByte(addr >> 8);
203192
204193 if (enable_progpage_polling)
205194 {
195 long polling_loc = addr + page_size - 1; //Read back last loaded byte
196 uint8_t polling_data = data[page_size - 1];
197 WaitUsec(100);
198
199 okflag = false;
200
201 for (k = timeout; k > 0; k--)
202 {
203 if (ReadProgByte(polling_loc) == polling_data)
204 {
205 okflag = true;
206 break;
207 }
208 }
209 }
210 else
211 {
212 okflag = true;
213 WaitMsec(twd_prog);
214 }
215
216 return okflag ? OK : E2P_TIMEOUT;
217 }
218
219 int At89sBus::WriteDataPage(long addr, uint8_t const *data, long page_size, long timeout)
220 {
221 long k;
222 bool okflag;
223
224 //align addr to page boundary
225 addr &= ~(page_size - 1); //0xFFFFFF00
226
227 SendDataByte(WriteDataPageMem);
228 SendDataByte(addr >> 8);
229 SendDataByte(addr & 0xff);
230
231 for (k = 0; k < page_size; k++)
232 {
233 SendDataByte(data[k]);
234 }
235
236 if (enable_datapage_polling)
237 {
206238 long polling_loc = addr + page_size - 1; //Read back last loaded byte
207239 uint8_t polling_data = data[page_size - 1];
208240 WaitUsec(100);
211243
212244 for (k = timeout; k > 0; k--)
213245 {
214 if (ReadProgByte(polling_loc) == polling_data)
215 {
216 okflag = true;
217 break;
218 }
219 }
220 }
221 else
222 {
223 okflag = true;
224 WaitMsec(twd_prog);
225 }
226
227 return okflag ? OK : E2P_TIMEOUT;
228 }
229
230 int At89sBus::WriteDataPage(long addr, uint8_t const *data, long page_size, long timeout)
231 {
232 long k;
233 bool okflag;
234
235 //align addr to page boundary
236 addr &= ~(page_size - 1); //0xFFFFFF00
237
238 SendDataByte(WriteDataPageMem);
239 SendDataByte(addr >> 8);
240 SendDataByte(addr & 0xff);
241
242 for (k = 0; k < page_size; k++)
243 {
244 SendDataByte(data[k]);
245 }
246
247 if (enable_datapage_polling)
248 {
249 long polling_loc = addr + page_size - 1; //Read back last loaded byte
250 uint8_t polling_data = data[page_size - 1];
251 WaitUsec(100);
252
253 okflag = false;
254
255 for (k = timeout; k > 0; k--)
256 {
257246 if (ReadDataByte(polling_loc) == polling_data)
258247 {
259248 okflag = true;
316305 }
317306
318307 SPIBus::Reset();
319 WaitMsec(E2Profile::GetAT89DelayAfterReset()); // Almeno 20msec dai datasheet AVR atmel
308 WaitMsec(E2Profile::GetAT89DelayAfterReset()); //At least 20msec (from AVR atmel datasheet)
320309
321310 SendDataByte(EnableProg0);
322311 SendDataByte(EnableProg1);
566555 }
567556 }
568557 }
558 WaitMsec(1); //Flush
569559
570560 ReadEnd();
571561
724714 }
725715 }
726716 }
717 WaitMsec(1); //Flush
727718
728719 WriteEnd();
729720
3030
3131 class At89sBus : public SPIBus
3232 {
33 public: //------------------------------- public
33 public:
3434 At89sBus(BusInterface *ptr = 0);
35 // virtual ~At89sBus();
35 //virtual ~At89sBus();
3636
3737 long Read(int addr, uint8_t *data, long length, int page_size = 0);
3838 long Write(int addr, uint8_t const *data, long length, int page_size = 0);
6767 oldmode = old;
6868 }
6969
70 protected: //------------------------------- protected
70 protected:
7171
7272 //Programming commands
7373 const uint8_t EnableProg0, EnableProg1;
9898 int WaitReadyAfterWrite(int type, long addr, int data, long timeout = 5000);
9999 bool CheckBlankPage(uint8_t const *data, long length);
100100
101 private: //------------------------------- private
101 private:
102102
103103 bool enable_datapage_polling, enable_progpage_polling;
104104
3333
3434 #include <QDebug>
3535
36 //=====>>> Costruttore <<<======
3736 At89sxx::At89sxx(e2AppWinInfo *wininfo, BusIO *busp)
3837 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
3938 {
3434
3535 class At89sxx : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 At89sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 // virtual ~At89sxx();
5757 return static_cast<At89sBus *>(Device::GetBus());
5858 }
5959
60 protected: //--------------------------------------- protected
60 protected:
6161
6262 int QueryType(long &type);
6363
64 private: //--------------------------------------- private
64 private:
6565
6666 };
6767 #endif
5959 ReadCalib0(0x38), ReadCalib1(0),
6060 p1_a(0x80), p2_a(0x7F), pflash_a(0x7F),
6161 p1_b(0x00), p2_b(0xFF), pflash_b(0xFF),
62 old1200mode(false)
63 {
64 qDebug() << "At90sBus::At90sBus()";
62 old1200mode(false),
63 enable_flashpage_polling(false)
64 {
65 qDebug() << Q_FUNC_INFO;
6566
6667 //With this values the AVR can be programmed even at low voltage (3.2V)
6768 twd_erase = 30;
7273 int At90sBus::ReadEEPByte(long addr)
7374 {
7475 SendDataByte(ReadEEPMem0);
75 SendDataByte(ReadEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999 -- the bug is due to an error in the original Atmel datasheet
76 SendDataByte(ReadEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999 -- the bug is due to an error in the original Atmel datasheet
7677 SendDataByte(addr);
7778
7879 return RecDataByte();
8182 void At90sBus::WriteEEPByte(long addr, int data)
8283 {
8384 SendDataByte(WriteEEPMem0);
84 SendDataByte(WriteEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999
85 SendDataByte(WriteEEPMem1 | ((addr & 0xFFFF) >> 8)); //19/01/1999
8586 SendDataByte(addr);
8687 SendDataByte(data);
8788 }
8889
89
9090 int At90sBus::ReadProgByte(long addr)
9191 {
9292 int lsb = addr & 1;
93 addr >>= 1; //convert to word address
93 addr >>= 1; //convert to word address
9494
9595 //Se fosse little-endian sarebbe l'inverso
9696 #ifdef _BIG_ENDIAN_
97
9897 if (!lsb)
9998 #else
10099 if (lsb)
119118 SetLastProgrammedAddress(addr);
120119
121120 int lsb = addr & 1;
122 addr >>= 1; //convert to word address
121 addr >>= 1; //convert to word address
123122
124123 //Se fosse little-endian sarebbe l'inverso
125124 #ifdef _BIG_ENDIAN_
126
127125 if (!lsb)
128126 #else
129127 if (lsb)
146144 {
147145 bool success_flag = false;
148146
149 qDebug() << "At90sBus::Reset() I";
147 qDebug() << Q_FUNC_INFO << "I";
150148
151149 RefreshParameters();
152150
158156 {
159157 SPIBus::Reset();
160158
161 WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
162
163 qDebug() << "Avr1200Bus::Reset() ** SendDataByte";
159 WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
160
161 qDebug() << Q_FUNC_INFO << "() ** SendDataByte";
164162
165163 SendDataByte(EnableProg0);
166164 SendDataByte(EnableProg1);
179177
180178 for (j = 0; j < 4 && !success_flag; j++)
181179 {
182 int val = 0;
183
184180 SPIBus::Reset();
185181
186 WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
187
188 int k;
189
190 for (k = 0; k < 32 && !success_flag; k++)
191 {
192 qDebug() << "At90sBus::Reset() ** SendEnableProg";
182 WaitMsec(E2Profile::GetAVRDelayAfterReset()); // At least 20msec (AVR datasheets)
183
184 for (int k = 0; k < 32 && !success_flag; k++)
185 {
186 qDebug() << Q_FUNC_INFO << "() ** SendEnableProg";
193187
194188 SendDataByte(EnableProg0);
195189 SendDataByte(EnableProg1);
196 val = RecDataByte();
190 int val = RecDataByte();
197191 SendDataByte(0);
198192
199 if (val != EnableProg1) //Echo expected
193 if (val != EnableProg1) //Echo expected
200194 {
201 RecDataBit(); //Give a pulse on SCK (as AVR datasheets suggest)
195 RecDataBit(); //Give a pulse on SCK (as AVR datasheets suggest)
202196 }
203197 else
204198 {
244238 break;
245239
246240 case ATtiny2313:
241 case ATtiny4313: // new ATtiny4313 16.09.2015 @RG
247242 case ATtiny26:
248243 case ATtiny13:
244 case ATtiny24:
245 case ATtiny44:
246 case ATtiny84: //new 08.01.2015 @RG
249247 case ATtiny25:
250248 case ATtiny45:
251249 case ATtiny85:
277275 case ATmega164:
278276 case ATmega324:
279277 case ATmega644:
278 case ATmega1284: // new ATmega1284P (RG 10.06.2017)
280279 case ATmega640:
281280 case ATmega1280:
282281 case ATmega1281:
391390
392391 //Three byte fuse
393392 case ATtiny2313:
393 case ATtiny4313: // new ATtiny4313 16.09.2015 @RG
394 case ATtiny24:
395 case ATtiny44:
396 case ATtiny84: // new 08.01.2015 @RG
394397 case ATtiny25:
395398 case ATtiny45:
396399 case ATtiny85:
408411 case ATmega164:
409412 case ATmega324:
410413 case ATmega644:
414 case ATmega1284: // new ATmega1284P (RG 10.06.2017)
411415 case AT90CAN32:
412416 case AT90CAN64:
413417 case AT90CAN128:
545549
546550 //Three byte fuse
547551 case ATtiny2313:
552 case ATtiny4313: // new ATtiny4313 16.09.2015 @RG
553 case ATtiny24:
554 case ATtiny44:
555 case ATtiny84: // new 08.01.2015 @RG
548556 case ATtiny25:
549557 case ATtiny45:
550558 case ATtiny85:
562570 case ATmega164:
563571 case ATmega324:
564572 case ATmega644:
573 case ATmega1284: // new ATmega1284 (RG 10.06.2017)
565574 case AT90CAN32:
566575 case AT90CAN64:
567576 case AT90CAN128:
658667 case ATtiny13:
659668 case ATtiny26:
660669 case ATtiny2313:
670 case ATtiny4313: // new ATtiny4313 16.09.2015 @RG
671 case ATtiny24:
672 case ATtiny44:
673 case ATtiny84: // new 08.01.2015 @RG
661674 case ATtiny25:
662675 case ATtiny45:
663676 case ATtiny85:
690703 case ATmega164:
691704 case ATmega324:
692705 case ATmega644:
706 case ATmega1284: // new ATmega1284 (RG 10.06.2017)
693707 case AT90CAN32:
694708 case AT90CAN64:
695709 case AT90CAN128:
737751
738752 ReadStart();
739753
740 // int code[3];
741
742 // code[0] = ReadDeviceCode(0);
743 // code[1] = ReadDeviceCode(1);
744 // code[2] = ReadDeviceCode(2);
754 //int code[3];
755
756 //code[0] = ReadDeviceCode(0);
757 //code[1] = ReadDeviceCode(1);
758 //code[2] = ReadDeviceCode(2);
745759
746760 if (addr)
747761 {
772786 break;
773787 }
774788 }
775
776 }
789 }
790 WaitMsec(1); //Flush()
777791
778792 ReadEnd();
779793
877891
878892 WaitMsec(twd_erase);
879893 Reset();
880 /****/
881894
882895 EraseEnd();
883896
962975 }
963976 }
964977 }
978 WaitMsec(1); //Flush()
965979
966980 WriteEnd();
967981
3030
3131 class At90sBus : public SPIBus
3232 {
33 public: //------------------------------- public
33 public:
3434 At90sBus(BusInterface *ptr = 0);
35 // virtual ~At90sBus();
35 //virtual ~At90sBus();
3636
3737 long Read(int addr, uint8_t *data, long length, int page_size = 0);
3838 long Write(int addr, uint8_t const *data, long length, int page_size = 0);
5454 old1200mode = val;
5555 }
5656
57 protected: //------------------------------- protected
57 protected:
5858
5959 //Programming commands
6060 const uint8_t EnableProg0, EnableProg1;
9797
9898 bool old1200mode;
9999
100 private: //------------------------------- private
100 private:
101101
102102 bool enable_flashpage_polling;
103103 };
3434 #include "e2awinfo.h"
3535 #include "e2cmdw.h"
3636
37 //=====>>> Costruttore <<<======
3837 At90sxx::At90sxx(e2AppWinInfo *wininfo, BusIO *busp)
3938 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
4039 {
4140 qDebug() << "At90sxx::At90sxx()";
4241 }
4342
44 //--- Distruttore
4543 At90sxx::~At90sxx()
4644 {
4745 qDebug() << "At90sxx::~At90sxx()";
210208 {0x91, 0x07, ATtiny28}, //only HV parallel prog
211209
212210 {0x91, 0x0A, ATtiny2313},
211 {0x92, 0x0D, ATtiny4313}, // new 16.09.2015 @RG
212
213 {0x91, 0x0B, ATtiny24}, // new 08.01.2015 @RG
214 {0x92, 0x07, ATtiny44}, // new 08.01.2015 @RG
215 {0x93, 0x0C, ATtiny84}, // new 08.01.2015 @RG
213216
214217 {0x91, 0x08, ATtiny25},
215218 {0x92, 0x06, ATtiny45},
243246 {0x96, 0x08, ATmega640},
244247 {0x97, 0x03, ATmega1280},
245248 {0x97, 0x04, ATmega1281},
249 {0x97, 0x05, ATmega1284}, // new ATmega1284P (RG 10.06.2017)
246250 {0x98, 0x01, ATmega2560},
247251 {0x98, 0x02, ATmega2561},
248252
317321 // device is locked, the probe don't work and returns the
318322 // error DEVICE_LOCKED.
319323 // If the device is missing return 0.
320 //---
321324 int At90sxx::Probe(int probe_size)
322325 {
323326 int rv;
3434
3535 class At90sxx : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 At90sxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~At90sxx();
5757 return static_cast<At90sBus *>(Device::GetBus());
5858 }
5959
60 protected: //--------------------------------------- protected
60 protected:
6161
6262 int QueryType(long &type);
6363
64 private: //--------------------------------------- private
64 private:
6565
6666 };
6767 #endif
3535 //Siamo sicuri BIGENDIAN?? Il formato HexIntel e` little-endian
3636 // e quindi anche le AT90S1200
3737 #define _BIG_ENDIAN_
38
39 #ifdef Q_OS_LINUX
40 # include <unistd.h>
41 #else
42 # ifdef __BORLANDC__
43 # define __inline__
44 # else // _MICROSOFT_ VC++
45 # define __inline__ __inline
46 # define _export
47 # endif
48 #endif
4938
5039 // Costruttore
5140 At93cBus::At93cBus(BusInterface *ptr)
5645 EraseAllCode(04),
5746 PrClearCode(07),
5847 loop_timeout(8000),
59 address_len(6), //9346
48 address_len(6), //9346
6049 organization(ORG16)
6150 {
62 qDebug() << "At93cBus::At93cBus()";
51 qDebug() << Q_FUNC_INFO;
6352 }
6453
6554 int At93cBus::Erase(int type)
153142 {
154143 //17/08/98 -- now repeat the command every word
155144 clearCS();
145 ShotDelay();
156146 setCS();
147 ShotDelay();
157148
158149 //Send command opcode
159150 SendCmdOpcode(ReadCode);
184175 }
185176 }
186177 }
178 WaitMsec(1); //Flush
187179
188180 ReadEnd();
189181
190 qDebug() << "At93cBus::Read() = " << len;
182 qDebug() << Q_FUNC_INFO << "=" << len;
191183
192184 return len;
193185 }
263255
264256 SendCmdOpcode(WriteEnableCode);
265257 SendDataWord(0, address_len);
258 WaitMsec(1); //Flush
266259
267260 WriteEnd();
268261
3030
3131 class At93cBus : public MicroWireBus
3232 {
33 public: //------------------------------- public
33 public:
3434 At93cBus(BusInterface *ptr = 0);
35 // virtual ~At93cBus();
35 //virtual ~At93cBus();
3636
3737 long Read(int addr, uint8_t *data, long length, int page_size = 0);
3838 long Write(int addr, uint8_t const *data, long length, int page_size = 0);
5656 // return MicroWireBus::CalcAddressSize(mem_size);
5757 //}
5858
59
60 protected: //------------------------------- protected
59 protected:
6160
6261 int SendCmdOpcode(int opcode)
6362 {
6463 return SendDataWord(opcode, 3);
6564 }
6665
67 private: //------------------------------- private
66 private:
6867
6968 //Command Opcode
7069 const uint8_t ReadCode;
7776
7877 void setCS()
7978 {
80 SetReset(); //27/05/98
79 SetReset(); //27/05/98
8180 }
8281
8382 void clearCS()
8483 {
85 ClearReset(); //27/05/98
84 ClearReset(); //27/05/98
8685 }
8786
8887 int address_len;
3333
3434 #define BANK_SIZE 2 //16 bit organization
3535
36 //=====>>> Costruttore <<<======
3736 At93cxx::At93cxx(e2AppWinInfo *wininfo, BusIO *busp)
3837 : Device(wininfo, busp, BANK_SIZE)
3938 {
4039 qDebug() << "At93cxx::At93cxx()";
4140 }
4241
43 //--- Distruttore
4442 At93cxx::~At93cxx()
4543 {
4644 qDebug() << "At93cxx::~At93cxx()";
3535
3636 class At93cxx : public Device
3737 {
38 public: //---------------------------------------- public
38 public:
3939
4040 At93cxx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4141 virtual ~At93cxx();
4545 int Write(int probe = 1, int type = ALL_TYPE);
4646 int Verify(int type = ALL_TYPE);
4747
48 protected: //--------------------------------------- protected
48 protected:
4949
5050 At93cBus *GetBus()
5151 {
5252 return static_cast<At93cBus *>(Device::GetBus());
5353 }
5454
55 private: //--------------------------------------- private
55 private:
5656
5757 };
5858 #endif
3030
3131 #include <QDebug>
3232
33 //=====>>> Costruttore <<<======
3433 At93cxx8::At93cxx8(e2AppWinInfo *wininfo, BusIO *busp)
3534 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
3635 {
3736 qDebug() << "At93cxx8::At93cxx8()";
3837 }
3938
40 //--- Distruttore
4139 At93cxx8::~At93cxx8()
4240 {
4341 qDebug() << "At93cxx8::~At93cxx8()";
4442 }
4543
4644 // determina il numero di banchi (dimensione) dell'eeprom
47 //---
4845 int At93cxx8::Probe(int probe_size)
4946 {
5047 qDebug() << "At93cxx8::Probe()";
3333
3434 class At93cxx8 : public Device
3535 {
36 public: //---------------------------------------- public
36 public:
3737
3838 At93cxx8(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
3939 virtual ~At93cxx8();
4343 int Write(int probe = 1, int type = ALL_TYPE);
4444 int Verify(int type = ALL_TYPE);
4545
46 protected: //--------------------------------------- protected
46 protected:
4747
4848 At93cBus *GetBus()
4949 {
5050 return static_cast<At93cBus *>(Device::GetBus());
5151 }
5252
53 private: //--------------------------------------- private
53 private:
5454
5555 };
5656 #endif
3131 #include "errcode.h"
3232
3333
34 //======================>>> binFileBuf::binFileBuf <<<=======================
3534 binFileBuf::binFileBuf(e2AppWinInfo *wininfo)
3635 : FileBuf(wininfo)
3736 {
3837 file_type = BIN;
3938 }
4039
41 //======================>>> binFileBuf::~binFileBuf <<<=======================
4240 binFileBuf::~binFileBuf()
4341 {
4442 }
4543
4644 #include "crc.h"
4745
48 //======================>>> binFileBuf::Load <<<=======================
4946 int binFileBuf::Load(int loadtype, long relocation_offset)
5047 {
5148 QFile fh(GetFileName());
119116 return rval;
120117 }
121118
122 //======================>>> binFileBuf::Save <<<=======================
123119 int binFileBuf::Save(int savetype, long relocation_offset)
124120 {
125121 QFile fh(FileBuf::GetFileName());
3434
3535 class binFileBuf : public FileBuf
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 binFileBuf(e2AppWinInfo *wininfo = 0);
4040 virtual ~binFileBuf();
4242 virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0);
4343 virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0);
4444
45 protected: //--------------------------------------- protected
45 protected:
4646
47 private: //--------------------------------------- private
47 private:
4848
4949 };
5050 #endif
3131 #include "bitfield.h"
3232
3333
34 //=========================>>> BitFieldWidget::BitFieldWidget <<<====================
35 BitFieldWidget::BitFieldWidget(QWidget *parent, QVector<BitInfo> &vInfo, QVector<MaskDescr> &vMask, unsigned int field) :
34 BitFieldWidget::BitFieldWidget(QWidget *parent, QVector<BitInfo> &vInfo, QVector<MaskDescr> &vMask, unsigned int field, const QString &chipNm) :
3635 QWidget(parent)
3736 {
3837 setupUi(this);
3938
39 chipName = chipNm;
40
4041 vecInfo = &vInfo;
4142
4243 vecDescr = &vMask;
5455 }
5556
5657
57 //======================>>> BitFieldWidget::~BitFieldWidget <<<======================
5858 BitFieldWidget::~BitFieldWidget()
5959 {
6060 qDebug() << "BitFieldWidget::~BitFieldWidget()";
103103 }
104104
105105 // reset not used bits
106 for (int i = (lastBit + 1); i < 32; i++)
107 {
108 bField &= ~(1 << i);
106 for (unsigned int i = (lastBit + 1); i < 32; i++)
107 {
108 bField &= ~(1U << i);
109109 }
110110
111111 treeWidget->expandAll();
146146 {
147147 if (mdes.mask.indexOf(QRegExp(currentMask)) >= 0)
148148 {
149 lst << mdes.LongDescr;
149 int posBeg = mdes.LongDescr.indexOf("=$n");
150 if (posBeg > 0)
151 {
152 QString tStr = mdes.LongDescr;
153 // TODO replace text with text from mdes.ExtDescr
154 int posExtText = mdes.ExtDescr.indexOf(chipName + ": ");
155 if (posExtText >= 0)
156 {
157 posExtText += chipName.length();
158 QString addrTxt = mdes.ExtDescr.simplified().mid(posExtText + 2, 5);
159
160 tStr.replace(posBeg + 1, 5, addrTxt);
161 }
162
163 lst << tStr;
164 }
165 else
166 {
167 lst << mdes.LongDescr;
168 }
150169 }
151170 }
152171
507526 }
508527 }
509528 }
510
511
512
3939 */
4040 typedef struct
4141 {
42 int bit;
43 const QString ShortDescr;
44 const QString LongDescr;
42 int bit; // bit number
43 const QString ShortDescr; // first column
44 const QString LongDescr; // second column
45 const QString ExtDescr; // for additional infos
4546 } BitInfo;
4647
4748 /**
4950 */
5051 typedef struct
5152 {
52 const QString mask;
53 const QString LongDescr;
53 const QString mask; // in mask are coded name of mask and bits
54 const QString LongDescr; //
55 const QString ExtDescr; // for additional infos
5456 } MaskDescr;
5557
5658
5759 class BitFieldWidget : public QWidget, public Ui::FormBitField
5860 {
5961 Q_OBJECT
60 public: //---------------------------------------- public
61 BitFieldWidget(QWidget *parent, QVector<BitInfo> &vInfo, QVector<MaskDescr> &vMask, unsigned int field);
62 public:
63 BitFieldWidget(QWidget *parent, QVector<BitInfo> &vInfo, QVector<MaskDescr> &vMask, unsigned int field, const QString &chipNm);
6264 virtual ~BitFieldWidget(); // Destructor
6365
6466 unsigned int getBitfield();
6567
6668
67 protected: //--------------------------------------- protected
69 protected:
6870
6971 signals:
7072 void displayBitFields(int field);
8082 void setMaskBits(const QString &m);//, unsigned int bits);
8183 bool isExp(unsigned int a);
8284
83 private: //--------------------------------------- private
85 private:
8486 QVector<QComboBox *> lstComboBoxes;
8587
8688 QVector<BitInfo> *vecInfo;
8789 QVector<MaskDescr> *vecDescr;
90
91 QString chipName;
8892
8993 unsigned int bField;
9094
2929 #include <QDebug>
3030
3131
32 //=========================>>> blockDialog::blockDialog <<<====================
3332 blockDialog::blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
3433 QDialog(bw)
3534 {
8180 }
8281
8382
84 //======================>>> blockDialog::~blockDialog <<<======================
8583 blockDialog::~blockDialog()
8684 {
8785 qDebug() << "blockDialog::~blockDialog()";
4040 class blockDialog : public QDialog, public cTranslator, public Ui::EditDialog
4141 {
4242 Q_OBJECT
43 public: //---------------------------------------- public
43 public:
4444 blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly = false, const QString &msg = "");
4545 virtual ~blockDialog(); // Destructor
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 private slots:
5050 void onOk();
5151
52 private: //--------------------------------------- private
52 private:
5353 e2AppWinInfo *awip;
5454 uint32_t lock, fuse;
5555 };
2323 // //
2424 //=========================================================================//
2525
26 #ifndef _I2CINTERFACE_H
27 #define _I2CINTERFACE_H
26 #ifndef _BUSINTERFACE_H
27 #define _BUSINTERFACE_H
2828
2929 #include "types.h"
3030 #include "errcode.h"
31 #include "wait.h"
32 #include "globals.h"
33 #include "interfconv.h"
3134
3235 #include <QDebug>
3336
37 //Some useful flags
38 #define SPIMODE_CPHA 0x01 // clock phase/edge
39 #define SPIMODE_CPOL 0x02 // clock polarity
40 #define SPIMODE_MASK 0x03
41
42 #define xMODE_RDONLY 0x04
43 #define xMODE_WRONLY 0x08
44
45 //#define I2CMODE_MASK 0x10
46
47 enum
48 {
49 SPI_MODE_0 = (0 | 0),
50 SPI_MODE_1 = (0 | SPIMODE_CPHA),
51 SPI_MODE_2 = (SPIMODE_CPOL | 0),
52 SPI_MODE_3 = (SPIMODE_CPOL | SPIMODE_CPHA)
53 };
54
55 #define SCLTIMEOUT 900 // enable SCL check and timing (for slaves that hold down the SCL line to slow the transfer)
3456
3557 class BusInterface
3658 {
37 public: //------------------------------- public
59 public:
3860 BusInterface()
39 {
40 cmd2cmd_delay = 0;
41 installed = -1;
42 old_portno = -1;
43 }
44 // virtual ~BusInterface();
61 : old_portno(-1),
62 usb_vp(0),
63 installed(-1),
64 cmd2cmd_delay(0),
65 shot_delay(5),
66 i2c_mode(false)
67 {
68 }
4569
4670 virtual int Open(int port) = 0;
4771 virtual void Close() = 0;
4872
4973 virtual int TestOpen(int port)
5074 {
51 qDebug() << "BusInterface::TestOpen(" << port << ") IN";
75 qDebug() << Q_FUNC_INFO << "(" << port << ") IN";
5276
5377 int ret_val = TestSave(port);
5478
5579 TestRestore();
5680
57 qDebug() << "BusInterface::TestOpen() = " << ret_val << " OUT";
81 qDebug() << Q_FUNC_INFO << "=" << ret_val << " OUT";
5882
5983 return ret_val;
6084 }
6185 virtual int TestPort(int port)
6286 {
63 qDebug() << "BusInterface::TestPort(" << port << ") IN";
87 qDebug() << Q_FUNC_INFO << "(" << port << ") IN";
6488
6589 return TestOpen(port);
6690 }
6892 {
6993 int ret_val;
7094
71 qDebug() << "BusInterface::TestSave(" << port << ") IN";
95 qDebug() << Q_FUNC_INFO << "(" << port << ") IN";
7296
7397 old_portno = installed;
7498
78102 {
79103 }
80104
81 qDebug() << "BusInterface::TestSave() = " << ret_val << " OUT";
105 qDebug() << Q_FUNC_INFO << "=" << ret_val << " OUT";
82106
83107 return ret_val;
84108 }
85109 virtual void TestRestore()
86110 {
87 qDebug() << "BusInterface::TestRestore() IN *** Inst=" << installed;
111 qDebug() << Q_FUNC_INFO << "IN *** Inst=" << installed;
88112
89113 if (IsInstalled())
90114 {
97121 old_portno = -1;
98122 }
99123
100 qDebug() << "BusInterface::TestRestore() OUT";
124 qDebug() << Q_FUNC_INFO << "OUT";
101125 }
102126
103127 virtual int SetPower(bool onoff)
122146 virtual int IsClockDataUP() = 0;
123147 virtual int IsClockDataDOWN() = 0;
124148
149 virtual bool CheckDataLines(int len = 1, int sda = -1, int scl = -1)
150 {
151 bool test = false;
152
153 if (len > 0)
154 {
155 do {
156 if (sda == 0 && scl == 0)
157 {
158 test = IsClockDataDOWN();
159 }
160 else if (sda > 0 && scl > 0)
161 {
162 test = IsClockDataUP();
163 }
164 else
165 {
166 bool test_sda = true, test_scl = true;
167
168 if (sda > 0)
169 {
170 test_sda = GetDataIn();
171 }
172 else if (sda == 0)
173 {
174 test_sda = !GetDataIn();
175 }
176
177 if (scl > 0)
178 {
179 test_scl = GetClock();
180 }
181 else if (scl == 0)
182 {
183 test_scl = !GetClock();
184 }
185
186 test = (test_sda && test_scl);
187 }
188 } while (test && --len > 0);
189 }
190
191 return test;
192 }
193
125194 int GetCmd2CmdDelay() const
126195 {
127196 return cmd2cmd_delay;
139208 return (installed >= 0) ? true : false;
140209 }
141210
142 protected: //------------------------------- protected
211 void SetUSBVidPid(VidPid vp)
212 {
213 usb_vp = vp;
214 }
215 VidPid GetUSBVid()
216 {
217 return usb_vp;
218 }
219
220 virtual void WaitMsec(unsigned int msec)
221 {
222 Flush();
223 w.WaitMsec(msec);
224 }
225
226 virtual void WaitUsec(unsigned int usec)
227 {
228 Flush();
229 w.WaitUsec(usec);
230 }
231
232 virtual void ShotDelay(int n = 1)
233 {
234 w.WaitUsec(shot_delay * n);
235 }
236
237 virtual int xferBit(int &err, int b, int mode = 0)
238 {
239 int ret = 0;
240
241 if (!i2c_mode) //(mode & I2CMODE_MASK) == 0)
242 {
243 switch (mode & SPIMODE_MASK)
244 {
245 case 3:
246 SetClock(0);
247 SetDataOut(b);
248 ShotDelay();
249 SetClock(1);
250 if ((mode & xMODE_WRONLY) == 0)
251 {
252 ret = GetDataIn();
253 }
254 ShotDelay();
255 break;
256 case 2:
257 SetDataOut(b);
258 ShotDelay();
259 SetClock(0);
260 if ((mode & xMODE_WRONLY) == 0)
261 {
262 ret = GetDataIn();
263 }
264 ShotDelay();
265 SetClock(1);
266 break;
267 case 1:
268 SetClock(1);
269 SetDataOut(b);
270 ShotDelay();
271 SetClock(0);
272 if ((mode & xMODE_WRONLY) == 0)
273 {
274 ret = GetDataIn();
275 }
276 ShotDelay();
277 break;
278 case 0:
279 default:
280 SetDataOut(b);
281 ShotDelay();
282 SetClock(1);
283 if ((mode & xMODE_WRONLY) == 0)
284 {
285 ret = GetDataIn();
286 }
287 ShotDelay();
288 SetClock(0);
289 break;
290 }
291 }
292 else
293 {
294 //I2CBus
295 SetDataOut(b); // SDA must be high to receive data (low dominant)
296 ShotDelay(); // tSU;DAT = 250 nsec (tLOW / 2 = 2 usec)
297 SetClock(1);
298 #ifdef SCLTIMEOUT
299 for (int k = SCLTIMEOUT; GetClock() == 0 && k > 0; k--)
300 {
301 WaitUsec(1);
302 }
303 if (GetClock() == 0)
304 {
305 return IICERR_SCLCONFLICT;
306 }
307 #endif
308 ShotDelay(); // tHIGH / 2 = 2 usec
309 if ((mode & xMODE_WRONLY) == 0)
310 {
311 ret = GetDataIn();
312 }
313 ShotDelay(); // tHIGH / 2 = 2 usec
314 SetClock(0);
315 ShotDelay(); // tHD;DATA = 300 nsec (tLOW / 2 = 2 usec)
316 }
317 err = OK;
318 return ret;
319 }
320
321 virtual uint8_t xferByte(int &err, uint8_t by, int mode = 0, int bpw = 8, bool lsb_first = false)
322 {
323 return (uint8_t)xferWord(err, by, mode, bpw, lsb_first);
324 }
325
326 virtual unsigned long xferWord(int &err, unsigned long word_out, int mode = 0, int bpw = 8, bool lsb_first = false)
327 {
328 uint32_t word_in = 0;
329 uint32_t bitmask;
330 err = OK;
331
332 if (!i2c_mode) //if ((mode & I2CMODE_MASK) == 0)
333 {
334 switch (mode & SPIMODE_MASK)
335 {
336 case 3:
337 case 2:
338 SetClock(1);
339 break;
340 case 1:
341 case 0:
342 default:
343 SetClock(0);
344 break;
345 }
346 }
347
348 if (lsb_first)
349 {
350 bitmask = 1;
351 }
352 else
353 {
354 bitmask = 1 << (bpw - 1);
355 }
356
357 for (int k = 0; k < bpw; k++)
358 {
359 if (xferBit(err, word_out & bitmask, mode))
360 {
361 word_in |= bitmask;
362 }
363
364 if (lsb_first)
365 {
366 bitmask <<= 1;
367 }
368 else
369 {
370 bitmask >>= 1;
371 }
372 }
373 SetDataOut(1);
374
375 return word_in;
376 }
377
378 virtual void SetDelay(int delay)
379 {
380 if (delay >= 0)
381 {
382 shot_delay = delay;
383 }
384 }
385 int GetDelay() const
386 {
387 return shot_delay;
388 }
389
390 void SetI2CMode(bool mode)
391 {
392 i2c_mode = mode;
393 }
394 bool GetI2CMode() const
395 {
396 return i2c_mode;
397 }
398
399 virtual void ConfigPins(int pinum_ctrl = -1, int pinum_datain = -1, int pinum_dataout = -1, int pinum_clock = -1, int pinum_clockin = -1, int pinum_poweron = -1, int pinum_enbus = -1, int pinnum_ctrlin = -1)
400 {
401 pins.ctrl = pinum_ctrl;
402 pins.datain = pinum_datain;
403 pins.dataout = pinum_dataout;
404 pins.clock = pinum_clock;
405 pins.ctrlin = pinnum_ctrlin;
406 pins.clockin = pinum_clockin;
407 pins.poweron = pinum_poweron;
408 pins.enbus = pinum_enbus;
409 }
410 virtual void ConfigPins(InterfPins p)
411 {
412 ConfigPins(p.ctrl, p.datain, p.dataout, p.clock, p.clockin, p.poweron, p.enbus, p.ctrlin);
413 }
414
415 protected:
143416 void Install(int val)
144417 {
145418 installed = val;
146419 }
420
147421 void DeInstall()
148422 {
149423 installed = -1;
150424 }
425
151426 int GetInstalled() const
152427 {
153428 return installed;
154429 }
155430
156 int old_portno; // TestSave() save the status here
157
158 private: //------------------------------- private
159 int installed; // -1 --> not installed, >= 0 number if the installed port
160 int cmd2cmd_delay; // <> 0 if a delay between commands is needed
431 virtual int Flush()
432 {
433 return OK;
434 }
435
436 int old_portno; // TestSave() save the status here
437 VidPid usb_vp;
438 Wait w;
439 InterfPins pins;
440
441 private:
442 int installed; // -1 --> not installed, >= 0 number if the installed port
443 int cmd2cmd_delay; // <> 0 if a delay between commands is needed
444 unsigned int shot_delay; //delay unit to perform bus timing
445 bool i2c_mode;
161446 };
162447
163448 #endif
3030 BusIO::BusIO(BusInterface *p)
3131 : err_no(0),
3232 last_addr(0),
33 shot_delay(5),
3433 busI(p),
3534 old_progress(0),
3635 last_programmed_addr(0)
6059 err_no = 0;
6160 return old_val;
6261 }
63
64 void BusIO::SetDelay()
65 {
66 shot_delay = 5; //basic timing of 5usec
67 }
68
69 void BusIO::SetDelay(int delay)
70 {
71 if (delay >= 0)
72 {
73 shot_delay = delay;
74 }
75 }
2727 #define _BUSIO_H
2828
2929 #include "types.h"
30 #include "wait.h"
3130 #include "businter.h"
3231 #include "errcode.h"
3332
3433 //Formato di bus generico seriale
35 class BusIO : public Wait
34 class BusIO
3635 {
37 public: //------------------------------- public
36 public:
3837 BusIO(BusInterface *p = 0);
39 // virtual ~BusIO() { }
38 //virtual ~BusIO() { }
4039
4140 virtual int Open(int port)
4241 {
43 return (err_no = busI->Open(port));
42 Q_CHECK_PTR(busI);
43 err_no = busI->Open(port);
44 return err_no;
4445 }
4546 virtual void Close()
4647 {
48 Q_CHECK_PTR(busI);
4749 busI->Close();
4850 }
4951 virtual int Error();
155157 }
156158 }
157159
158 virtual void SetDelay();
159 virtual void SetDelay(int delay);
160160 int GetDelay() const
161161 {
162 return shot_delay;
162 Q_CHECK_PTR(busI);
163 return busI->GetDelay();
163164 }
164165
165166 long GetLastProgrammedAddress() const
180181 }
181182 }
182183
183 protected: //------------------------------- protected
184 void WaitMsec(unsigned int msec)
185 {
186 Q_CHECK_PTR(busI);
187 busI->WaitMsec(msec);
188 }
189
190 protected:
184191
185192 int err_no; //error code
186193 int last_addr;
187194
188 int shot_delay; //delay unit to perform bus timing
189
190195 BusInterface *busI;
191196
192 private: //------------------------------- private
197 void WaitUsec(unsigned int usec)
198 {
199 Q_CHECK_PTR(busI);
200 busI->WaitUsec(usec);
201 }
202
203 void ShotDelay(int n = 1)
204 {
205 Q_CHECK_PTR(busI);
206 busI->ShotDelay(n);
207 }
208
209 private:
193210
194211 int CheckAbort(int progress = 0);
195212
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // https://github.com/lancos/ponyprog //
7 // //
8 // LibUSB implementation for PonyProg (C) 2019 Eduard Kalinowski //
9 // //
10 // sources: //
11 // Copyright (C) 2014 Pluto Yang (yangyj.ee@gmail.com) //
12 // https://github.com/setarcos/ch341prog //
13 // //
14 // Copyright (C) 2016 Eugene Hutorny (eugene@hutorny.in.ua) //
15 // https://github.com/hutorny/usbuart //
16 // //
17 // Copyright (c) 2017 Gunar Schorcht (gunar@schorcht.net) //
18 // https://github.com/gschorcht/spi-ch341-usb //
19 // https://github.com/gschorcht/i2c-ch341-usb //
20 // //
21 // Copyright (c) 2018 Sarim Khan (sarim2005@gmail.com) //
22 // https://github.com/sarim/ch341a-bitbang-userland //
23 // //
24 //-------------------------------------------------------------------------//
25 // //
26 // This program is free software; you can redistribute it and/or //
27 // modify it under the terms of the GNU General Public License //
28 // as published by the Free Software Foundation; either version2 of //
29 // the License, or (at your option) any later version. //
30 // //
31 // This program is distributed in the hope that it will be useful, //
32 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
33 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
34 // General Public License for more details. //
35 // //
36 // You should have received a copy of the GNU General Public License //
37 // along with this program (see LICENSE); if not, write to the //
38 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
39 // //
40 //=========================================================================//
41
42
43
44 #include <QDebug>
45
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <stdint.h>
49 #include <stdbool.h>
50 #include <string.h>
51 #include <signal.h>
52 #include <unistd.h>
53 #include "ch341a.h"
54
55 // int32_t bulkin_count; // set by the callback function
56
57 #define DEBUG_CH341 0
58
59 struct sigaction saold;
60 int force_stop = 0;
61 uint32_t syncackpkt; // synch / ack flag used by BULK OUT cb function
62 uint16_t byteoffset; // for read eeprom function
63
64 int16_t ch341::read_completed = 0;
65 int16_t ch341::write_completed = 0;
66
67
68 /* SIGINT handler */
69 void sig_int(int signo)
70 {
71 force_stop = 1;
72 }
73
74 /**
75 * ch341 requres LSB first, reverse the bit order before send and after receive
76 * for more tricks, see https://graphics.stanford.edu/~seander/bithacks.html
77 */
78 inline uint8_t ReverseByte(uint8_t c)
79 {
80 uint8_t result = 0;
81
82 for (int i = 0; i < 8; ++i)
83 {
84 result = result << 1;
85 result |= (c & 1);
86 c = c >> 1;
87 }
88
89 return result;
90 }
91
92
93 inline uint16_t ReverseWord(uint16_t c)
94 {
95 uint16_t result = 0;
96
97 for (int i = 0; i < 16; ++i)
98 {
99 result = result << 1;
100 result |= (c & 1);
101 c = c >> 1;
102 }
103
104 return result;
105 }
106
107 #if 0
108 static void read_cb(libusb_transfer *transfer) noexcept
109 {
110 switch (transfer->status)
111 {
112 case LIBUSB_TRANSFER_COMPLETED:
113 if (transfer->user_data != NULL)
114 {
115 // TODO ReverseByte ???
116 }
117 ch341::read_completed = 1;
118 // bulkin_count++;
119 break;
120 default:
121 qCritical("broken callback in transfer %p", transfer);
122 ch341::read_completed = -1;
123 // bulkin_count = -1;
124 break;
125 }
126 }
127
128 static void write_cb(libusb_transfer *transfer) noexcept
129 {
130 // file_channel *chnl = (file_channel *) transfer->user_data;
131 if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
132 {
133 qCritical("broken callback in transfer %p", transfer);
134 ch341::write_completed = -1;
135 }
136 else
137 {
138 ch341::write_completed = 1;
139 }
140 }
141
142 void ch34x_callback(libusb_transfer *transfer)
143 {
144 delete (unsigned char *)transfer->user_data;
145 libusb_free_transfer(transfer);
146 }
147 #endif
148
149 /**
150 * @brief callback function from control transport change event
151 */
152
153 #if 0
154 static void cb_ctrl_changed(struct libusb_transfer *transfer)
155 {
156 if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
157 {
158 qCritical("broken callback in transfer %p stat %d", transfer, transfer->status);
159 }
160
161 qCritical("async cb_ctrl_changed length=%d actual_length=%d state %d\n", transfer->length, transfer->actual_length, transfer->status);
162
163 //libusb_free_transfer(transfer);
164
165 // if (next_state() < 0)
166 // request_exit(2);
167 }
168 #endif
169
170
171 #if 0
172 /**
173 * callback for bulk out async transfer
174 */
175 void cbBulkOut(struct libusb_transfer *transfer)
176 {
177 if (transfer->status != LIBUSB_TRANSFER_COMPLETED)
178 {
179 qCritical("cbBulkOut() error : %d", transfer->status);
180 }
181 syncackpkt = 1;
182 }
183
184 /**
185 * callback for bulk in async transfer
186 */
187 void cbBulkIn(struct libusb_transfer *transfer)
188 {
189 switch (transfer->status)
190 {
191 case LIBUSB_TRANSFER_COMPLETED:
192
193 /* the first package has cmd and address info, so discard 4 bytes */
194 if (transfer->user_data != NULL)
195 {
196 for (int i = (bulkin_count == 0) ? 4 : 0; i < transfer->actual_length; ++i)
197 {
198 *((uint8_t *)transfer->user_data++) = ReverseByte(transfer->buffer[i]);
199 }
200 }
201
202 bulkin_count++;
203 break;
204
205 default:
206 qCritical("cbBulkIn() error : %d", transfer->status);
207 libusb_free_transfer(transfer);
208 bulkin_count = -1;
209 }
210
211 return;
212 }
213 #endif
214
215
216 ch341::ch341(QObject *parent)
217 {
218 verbose = false;
219 dtr = 0;
220 rts = 0;
221
222 baudRate = DEFAULT_BAUD_RATE;
223
224 parity = 'N';
225 bits = 8;
226 stops = 1;
227
228 timeout = DEFAULT_TIMEOUT;
229
230 devHandle = NULL;
231
232 rtsCtsEnabled = 0;
233 dtrDsrEnabled = 0;
234 };
235
236
237 ch341::~ch341()
238 {
239 Release();
240 }
241
242 void ch341::Close()
243 {
244 libusb_close(devHandle);
245 devHandle = 0;
246 }
247 #if 0
248 void ch341::sendData(const uint8_t &data, size_t len)
249 {
250 struct libusb_transfer *transfer = libusb_alloc_transfer(0);
251 unsigned char *buffer = new unsigned char[len];
252 memcpy(buffer, (const void *)data, len);
253
254 libusb_fill_bulk_transfer(transfer, devHandle, CH341_DATA_OUT, buffer,
255 len, ch34x_callback, buffer, 0);
256
257 libusb_submit_transfer(transfer);
258 }
259 #endif
260
261 void ch341::triggerBreak(uint msecs)
262 {
263 SetBreakControl(1);
264
265 if (breakTimer)
266 {
267 breakTimer->stop();
268 delete breakTimer;
269 }
270
271 breakTimer = new QTimer(this);
272 breakTimer->setSingleShot(true);
273 connect(breakTimer, SIGNAL(timeout()), this, SLOT(breakTimeout()));
274 breakTimer->start(msecs);
275 }
276
277
278 void ch341::breakTimeout()
279 {
280 SetBreakControl(0);
281 }
282
283 #if 0
284 void ch341::allocTransfer()
285 {
286 ctrl_transfer = libusb_alloc_transfer(0);
287 // TODO is it right???
288 libusb_fill_control_setup(ctrl_buf, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS |
289 LIBUSB_RECIPIENT_INTERFACE, CH341_REQ_WRITE_REG, CH341_REG_STAT, 0, 0);
290
291 printf("go2: ctrlbuf0-7]=0x%X-%X-%X-%X-%X-%X-%X-%X\n",
292 ctrl_buf[0],
293 ctrl_buf[1],
294 ctrl_buf[2],
295 ctrl_buf[3],
296 ctrl_buf[4],
297 ctrl_buf[5],
298 ctrl_buf[6],
299 ctrl_buf[7]);
300
301 libusb_fill_control_transfer(ctrl_transfer, devHandle, ctrl_buf,
302 cb_ctrl_changed, NULL, 0);
303
304 ctrl_transfer->flags = LIBUSB_TRANSFER_FREE_BUFFER | LIBUSB_TRANSFER_FREE_TRANSFER;
305 }
306 #endif
307
308 /**
309 * when 'verbose' enabled, print debug information
310 */
311 void ch341::v_print(int mode, int len) // mode: begin=0, progress = 1
312 {
313 static int size = 0;
314 static time_t started, reported;
315 int dur, done;
316
317 if (!verbose)
318 {
319 return;
320 }
321
322 time_t now;
323 time(&now);
324
325 switch (mode)
326 {
327 case 0: // setup
328 size = len;
329 started = reported = now;
330 break;
331
332 case 1: // progress
333 if (now == started)
334 {
335 return;
336 }
337
338 dur = now - started;
339 done = size - len;
340
341 if (done > 0 && reported != now)
342 {
343 qDebug("Bytes: %d (%d%c), Time: %d, ETA: %d ", done,
344 (done * 100) / size, '%', dur, (int)((1.0 * dur * size) / done - dur));
345 fflush(stdout);
346 reported = now;
347 }
348
349 break;
350
351 case 2: // done
352 dur = now - started;
353
354 if (dur < 1)
355 {
356 dur = 1;
357 }
358
359 qDebug("Total: %d sec, average speed %d bytes per second.", dur, size / dur);
360 break;
361
362 break;
363 }
364 }
365
366
367 int32_t ch341::GetStatusRx()
368 {
369 return read_completed;
370 }
371
372
373 int32_t ch341::GetStatusTx()
374 {
375 return write_completed;
376 }
377
378
379 int32_t ch341::Probe()
380 {
381 int32_t ret;
382 uint8_t lcr = CH341_LCR_ENABLE_RX | CH341_LCR_ENABLE_TX | CH341_LCR_CS8;
383
384 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_LCR, lcr, NULL, 0, timeout);
385 if (ret < 0)
386 {
387 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_LCR\n");
388 return ret;
389 }
390
391 ret = SetBaudRate(baudRate);
392 if (ret < 0)
393 {
394 return ret;
395 }
396
397 return 0;
398 }
399
400 #if 0
401
402 /* Helper function for libusb_bulk_transfer, display error message with the caller name */
403 int32_t ch341::Read(uint8_t *buf, size_t len)
404 {
405 int32_t ret;
406 int transfered;
407 if (devHandle == NULL)
408 {
409 return -1;
410 }
411
412 read_completed = 0;
413
414 ret = libusb_bulk_transfer(devHandle, CONTROL_READ_ENDPOINT, buf, len, &transfered, timeout);
415 if (ret < 0)
416 {
417 qCritical("libusb_bulk_transfer read error %d\n", ret);
418 return -1;
419 }
420 return transfered;
421 }
422
423 /* Helper function for libusb_bulk_transfer, display error message with the caller name */
424 int32_t ch341::Write(uint8_t *buf, size_t len)
425 {
426 int32_t ret;
427 int transfered;
428 if (devHandle == NULL)
429 {
430 return -1;
431 }
432
433 write_completed = 0;
434
435 ret = libusb_bulk_transfer(devHandle, CONTROL_WRITE_ENDPOINT, buf, len, &transfered, timeout);
436 if (ret < 0)
437 {
438 qCritical("libusb_bulk_transfer write error %d\n", ret);
439 return -1;
440 }
441 return transfered;
442 }
443 #endif
444 /**
445 * @breif timeouts in milliseconds
446 */
447 int32_t ch341::SetTimeouts(int16_t t)
448 {
449 if (t >= 50 && t <= 2000)
450 {
451 timeout = t;
452 return 0;
453 }
454
455 return -1;
456 }
457
458 void ch341::SetParity(uint8_t p)
459 {
460 parity = p;
461 }
462
463 void ch341::SetBits(uint8_t b)
464 {
465 bits = b;
466 }
467
468 void ch341::SetStops(uint8_t s)
469 {
470 stops = s;
471 }
472
473
474 // TODO
475 void ch341::SetFlowControl(uint8_t f)
476 {
477 flow_control = f;
478
479 // check state
480 uint8_t r[LIBUSB_CONTROL_SETUP_SIZE];
481
482 int ret = libusb_control_transfer(devHandle, CTRL_IN, CH341_REQ_READ_REG, CH341_REG_STAT, 0, &r[0], 0, timeout);
483 // to check buffer 0x9f, 0xee
484
485 // TODO check this
486 switch (flow_control)
487 {
488 case 0: // NONE
489 libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, CH34X_FLOW_CONTROL_NONE, NULL, 0, timeout);
490
491 break;
492
493 case 1: // RTS_CTS
494 libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, CH34X_FLOW_CONTROL_RTS_CTS, NULL, 0, timeout);
495
496 break;
497
498 case 2: // DSR_DTR
499 libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, CH34X_FLOW_CONTROL_DSR_DTR, NULL, 0, timeout);
500
501 break;
502 }
503 }
504
505 void ch341::SetVerbose()
506 {
507 verbose = true;
508 }
509
510 /**
511 * ch341a modem connections:
512 *
513 * rs232 -> ch341 description
514 * 1 -> 18 data carrier detect
515 * 2 -> 6 Rx
516 * 3 -> 5 Tx
517 * 4 -> 20 Data Terminal Ready
518 * 5 Signal Ground
519 * 6 -> 16 Data Set Ready
520 * 7 -> 21 Request To Send
521 * 8 -> 15 Clear To Send
522 * 9 -> 17 Ring Indicator
523 */
524
525 /**
526 * @brief configure DTR, RTS for device
527 *
528 */
529 int32_t ch341::setHandshakeByte(void)
530 {
531 // uint8_t r[CH341_INPUT_BUF_SIZE];
532 // int ret = libusb_control_transfer(devHandle, CTRL_IN, CH341_REQ_MODEM_CTRL, NULL, 0, &r[0], CH341_INPUT_BUF_SIZE, timeout);
533 // if (ret < 0)
534 // {
535 // qCritical("Faild to get handshake byte %d\n", ret);
536 // return -1;
537 // }
538
539 quint8 control = 0;//r[0];
540
541 if (dtr)
542 {
543 control |= CH341_CONTROL_DTR;
544 }
545
546 if (rts)
547 {
548 control |= CH341_CONTROL_RTS;
549 }
550 #if DEBUG_CH341
551 qDebug() << "set dtr " << ((control & CH341_CONTROL_DTR) ? 1 : 0) << "rts" << ((control & CH341_CONTROL_RTS) ? 1 : 0);
552 #endif
553 if (libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_MODEM_CTRL, ~control, 0, NULL, 0, timeout) < 0)
554 {
555 qCritical("Faild to set handshake byte");
556 return -1;
557 }
558
559 return 0;
560 }
561
562 int32_t ch341::getModemState(void)
563 {
564 uint8_t r[2];
565
566 int ret = libusb_control_transfer(devHandle, CTRL_IN, CH341_REQ_READ_REG, CH341_REG_STAT, 0, &r[0], 2, timeout);
567 if (ret < 0)
568 {
569 qCritical("Faild to get handshake byte %d", ret);
570 return -1;
571 }
572
573 uint8_t st = ~r[0]; // invert
574 #if DEBUG_CH341
575 qDebug() << "get cts" << ((st & CH341_UART_CTS) ? 1 : 0) << "dsr" << ((st & CH341_UART_DSR) ? 1 : 0);
576 #endif
577 return (int32_t)(st & CH341_BITS_MODEM_STAT);
578 }
579
580 #if 0
581 int ch341::setAsync(uint8_t data)
582 {
583 int ret = 0;
584 uint8_t *buf = (uint8_t *)malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
585
586 if (!buf)
587 {
588 return -2;
589 }
590
591 transfer = libusb_alloc_transfer(0);
592 if (!transfer)
593 {
594 free(buf);
595 return -2;
596 }
597
598 // qCritical("async set mode %02x\n", data);
599
600 libusb_fill_control_setup(buf, CTRL_IN, CH341_REQ_READ_REG, CH341_REG_STAT, 0, 1);
601 buf[LIBUSB_CONTROL_SETUP_SIZE] = data;
602
603 libusb_fill_control_transfer(transfer, devHandle, buf, cb_ctrl_changed, NULL, timeout);
604
605 transfer->flags = LIBUSB_TRANSFER_SHORT_NOT_OK | LIBUSB_TRANSFER_FREE_BUFFER | LIBUSB_TRANSFER_FREE_TRANSFER;
606
607 ret = libusb_submit_transfer(transfer);
608 return ret;
609 }
610
611
612 void ch341::updateStatus()
613 {
614 uint8_t stat[CH341_INPUT_BUF_SIZE];
615 uint8_t status;
616 uint8_t delta;
617
618 int ret; //libusb_control_transfer(devHandle, CONTROL_REQUEST_TYPE_IN, CH341_REQ_READ_REG, CH341_REG_STAT, 0, &stat[0], CH341_INPUT_BUF_SIZE, timeout);
619 ret = libusb_control_transfer(devHandle, CTRL_IN, CH341_REQ_MODEM_CTRL, NULL, 0, &stat[0], CH341_INPUT_BUF_SIZE, timeout);
620 if (ret < 0)
621 {
622 qCritical("Faild to update status %d\n", ret);
623 return;
624 }
625
626 status = ~stat[2] & CH341_BITS_MODEM_STAT;
627 delta = msr ^ status;
628 msr = status;
629
630 if (delta & CH341_UART_CTS)
631 {
632 ctsState != ctsState;
633 }
634
635 if (delta & CH341_UART_DSR)
636 {
637 dsrState != dsrState;
638 }
639
640 if (delta & CH341_UART_RING)
641 {
642 ringState != ringState;
643 }
644
645 if (delta & CH341_UART_DCD)
646 {
647 dcdState != dcdState;
648 }
649 }
650 #endif
651
652
653 int32_t ch341::SetDTR(int32_t state)
654 {
655 #if DEBUG_CH341
656 qDebug() << "ch341::SetDTR(" << state << ") ";
657 #endif
658 if (state)
659 {
660 dtr = 1;
661 }
662 else
663 {
664 dtr = 0;
665 }
666 int32_t r = setHandshakeByte();
667
668 return r;
669 }
670
671 int32_t ch341::SetRTS(int32_t state)
672 {
673 #if DEBUG_CH341
674 qDebug() << "ch341::SetRTS(" << state << ") ";
675 #endif
676 if (state)
677 {
678 rts = 1;
679 }
680 else
681 {
682 rts = 0;
683 }
684 int32_t r = setHandshakeByte();
685
686 return r;
687 }
688
689 int32_t ch341::GetDSR()
690 {
691 int32_t r = getModemState();
692
693 #if DEBUG_CH341
694 qDebug() << "ch341::GetDSR(" << ((r & CH341_UART_DSR) ? 1 : 0) << ") ";
695 #endif
696 return (r & CH341_UART_DSR) ? 1 : 0;
697 }
698
699 int32_t ch341::GetCTS()
700 {
701 int32_t r = getModemState();
702
703 #if DEBUG_CH341
704 qDebug() << "ch341::GetCTS(" << ((r & CH341_UART_CTS) ? 1 : 0) << ") ";
705 #endif
706 return (r & CH341_UART_CTS) ? 1 : 0;
707 }
708
709 int32_t ch341::SetRTSDTR(int st)
710 {
711 quint8 control = 0;
712
713 if (st)
714 {
715 dtr = 1;
716 rts = 1;
717 }
718 else
719 {
720 dtr = 0;
721 rts = 0;
722 }
723
724 #if 0
725 if (dtr)
726 {
727 control |= CH341_CONTROL_DTR;
728 }
729 if (rts)
730 {
731 control |= CH341_CONTROL_RTS;
732 }
733
734
735 qDebug() << "ch341::SetRTSDTR(" << st << ") ";
736
737 if (dev_vers < 0x20)
738 {
739 // TODO for old chips is not tested!
740 if (libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, 0x0606, ~control, NULL, 0, timeout) < 0)
741 {
742 qCritical("Faild to set handshake byte\n");
743 return -1;
744 }
745 }
746 else
747 {
748 if (libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_MODEM_CTRL, ~control, 0, NULL, 0, timeout) < 0)
749 {
750 qCritical("Faild to set handshake byte\n");
751 return -1;
752 }
753 }
754 #endif
755 int32_t r = setHandshakeByte();
756
757 return r;
758 }
759
760
761 // TODO to check this
762 int32_t ch341::SetConfigLCR()
763 {
764 // TODO in case of same bits for all UART devices, to move this lcr into SerialInterface
765 // now set LCR
766 uint8_t lcr = CH341_LCR_ENABLE_RX | CH341_LCR_ENABLE_TX;
767
768 // TODO check this
769 switch (parity)
770 {
771 case 'N':
772 // no change in lcr
773 break;
774
775 case 'O':
776 lcr |= CH341_LCR_ENABLE_PAR;
777 break;
778
779 case 'S':
780 lcr |= (CH341_LCR_ENABLE_PAR | CH341_LCR_MARK_SPACE | CH341_LCR_PAR_EVEN);
781 break;
782
783 case 'E':
784 lcr |= (CH341_LCR_ENABLE_PAR | CH341_LCR_PAR_EVEN);
785 break;
786
787 case 'M':
788 lcr |= (CH341_LCR_ENABLE_PAR | CH341_LCR_MARK_SPACE);
789 break;
790
791 default:
792 break;
793 }
794
795 if (stops == 2)
796 {
797 lcr |= CH341_LCR_STOP_BITS_2;
798 }
799
800 if (bits <= 5)
801 {
802 lcr |= CH341_LCR_CS5;
803 }
804 else if (bits == 6)
805 {
806 lcr |= CH341_LCR_CS6;
807 }
808 else if (bits == 7)
809 {
810 lcr |= CH341_LCR_CS7;
811 }
812 else
813 {
814 lcr |= CH341_LCR_CS8;
815 }
816
817 #if DEBUG_CH341
818 qDebug() << "ch341::SetConfigLCR(" << lcr << ") ";
819 #endif
820 int32_t ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_LCR, lcr, NULL, 0, timeout);
821 if (ret < 0)
822 {
823 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_LCR\n");
824 }
825
826 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, 0, NULL, 0, timeout);
827 if (ret < 0)
828 {
829 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL\n");
830 }
831
832 return ret;
833 }
834
835
836 int32_t ch341::SetBreakControl(int32_t state)
837 {
838
839 #if DEBUG_CH341
840 qDebug() << "ch341::SetBreakControl(" << state << ") ";
841 #endif
842 uint16_t reg_contents;
843 uint8_t break_reg[2] = {0, 0};
844
845 int32_t ret = libusb_control_transfer(devHandle, CTRL_IN, CH341_REQ_READ_REG, CH341_REG_BREAK, 0, (uint8_t *)&reg_contents, 2, timeout);
846 if (ret < 0)
847 {
848 qCritical("failed control transfer CH341_REQ_READ_REG, CH341_REG_BREAK\n");
849 return ret;
850 }
851 if (state)
852 {
853 break_reg[0] &= ~CH341_NBREAK_BITS_REG1;
854 break_reg[1] &= ~CH341_NBREAK_BITS_REG2;
855 }
856 else
857 {
858 break_reg[0] |= CH341_NBREAK_BITS_REG1;
859 break_reg[1] |= CH341_NBREAK_BITS_REG2;
860 }
861 // TODO is it right???
862 //reg_contents = ReverseWord((uint16_t)(break_reg[0] << 8) + break_reg[1]);
863 reg_contents = ((uint16_t)(break_reg[0] << 8) + break_reg[1]);
864
865 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_BREAK, reg_contents, NULL, 0, timeout);
866 if (ret < 0)
867 {
868 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_BREAK\n");
869 return ret;
870 }
871
872 return 0;
873 }
874
875 /**
876 * @brief functions sets the baudrate 'speed'
877 * see BSD Kernel: uchcom.c Source File
878 * supports common baud rates:
879 * 50, 75, 100, 110, 134.5, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 9600, 14400, 19200,
880 * 33600, 38400, 56000, 57600, 76800, 115200, 128000, 153600, 230400, 460800, 921600,
881 * 1500000, 2000000 etc.
882 */
883 int32_t ch341::SetBaudRate(int32_t speed)
884 {
885 int32_t ret;
886 int dv_prescale;
887 int dv_div;
888 int dv_mod;
889
890 static QVector<uart_div> speed_divider = {{307200, 307200, 0, {7, 0xD9, 0}},
891 {921600, 921600, 0, {7, 0xF3, 0}},
892 {2999999, 23530, 6000000, {3, 0, 0}},
893 {23529, 2942, 750000, {2, 0, 0}},
894 {2941, 368, 93750, {1, 0, 0}},
895 {367, 1, 11719, {0, 0, 0}}
896 };
897
898 if (!speed)
899 {
900 return -1;
901 }
902
903 foreach (uart_div d, speed_divider)
904 {
905 if (d.dvr_high >= speed && d.dvr_low <= speed)
906 {
907 dv_prescale = d.dvr_divider.dv_prescaler;
908 if (d.dvr_base_clock == 0)
909 {
910 dv_div = d.dvr_divider.dv_div;
911 }
912 else
913 {
914 uint32_t div = d.dvr_base_clock / speed;
915 uint32_t rem = d.dvr_base_clock % speed;
916 if (div == 0 || div >= 0xFF)
917 {
918 return -1;
919 }
920
921 if ((rem << 1) >= speed)
922 {
923 div += 1;
924 }
925 dv_div = (uint8_t) - div;
926 }
927
928 uint32_t mod = (CH341_BPS_MOD_BASE / speed) + CH341_BPS_MOD_BASE_OFS;
929 mod = mod + (mod / 2);
930
931 dv_mod = (mod + 0xFF) / 0x100;
932
933 // calculated, now send to device
934 qDebug() << "set baudrate" << speed << (hex) << (dv_div << 8) + (dv_prescale) << (uint16_t)(dv_mod) << (dec) ;
935
936 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_BAUD1, (dv_div << 8) + (dv_prescale), NULL, 0, timeout);
937 if (ret < 0)
938 {
939 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_BAUD1\n");
940 return ret;
941 }
942
943 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_BAUD2, (uint16_t)(dv_mod), NULL, 0, timeout);
944 if (ret < 0)
945 {
946 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_BAUD2\n");
947 return ret;
948 }
949
950 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, 0, NULL, 0, timeout);
951 if (ret < 0)
952 {
953 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL\n");
954 }
955
956 return ret;
957 }
958 }
959 // not found
960 return -1;
961 }
962
963 /**
964 * @brief reset chip settings?
965 */
966 int32_t ch341::ResetChip()
967 {
968 return libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_SERIAL_INIT, CH341_RESET_VALUE, CH341_RESET_INDEX, NULL, 0, timeout);
969 }
970
971
972 int32_t ch341::ClearChip()
973 {
974 // return libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_SERIAL_INIT, 0, 0, NULL, 0, timeout);
975 return libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_SERIAL_INIT, 0xc29c, 0xb2b9, NULL, 0, timeout);
976 }
977
978
979 /**
980 * Open CH341A, find the device and set the default interface.
981 */
982 int32_t ch341::Open(uint16_t vid, uint16_t pid)
983 {
984 struct libusb_device *dev;
985 int32_t ret;
986 struct sigaction sa;
987
988 qDebug() << "ch341::Open(" << vid << pid << ") ";
989
990 uint8_t desc[0x12];
991
992 if (devHandle != NULL)
993 {
994 qCritical() << "Call ch341Release before re-configure";
995 return -1;
996 }
997
998 qDebug() << "ch341::Configure()";
999 ret = libusb_init(NULL);
1000
1001 if (ret < 0)
1002 {
1003 qCritical() << "Couldn't initialise libusb";
1004 return -1;
1005 }
1006
1007 #if LIBUSB_API_VERSION < 0x01000106
1008 libusb_set_debug(NULL, 3);
1009 #else
1010 libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_INFO);
1011 #endif
1012
1013 if (!(devHandle = libusb_open_device_with_vid_pid(NULL, vid, pid)))
1014 {
1015 qCritical("Couldn't open device [%04x:%04x].", vid, pid);
1016 return -1;
1017 }
1018 else
1019 {
1020 qDebug("Open device [%04x:%04x].", vid, pid);
1021 }
1022
1023 if (!(dev = libusb_get_device(devHandle)))
1024 {
1025 qCritical() << "Couldn't get bus number and address.";
1026 CloseHandle();
1027 return -1;
1028 }
1029
1030 #ifndef Q_OS_WIN32
1031 if (libusb_kernel_driver_active(devHandle, 0))
1032 {
1033 ret = libusb_detach_kernel_driver(devHandle, 0);
1034
1035 if (ret)
1036 {
1037 qCritical("Failed to detach kernel driver: '%s'", strerror(-ret));
1038 CloseHandle();
1039 return -1;
1040 }
1041 else
1042 {
1043 qDebug() << "Detach kernel driver";
1044 }
1045 }
1046 #endif
1047 ret = libusb_claim_interface(devHandle, 0);
1048
1049 if (ret)
1050 {
1051 qCritical("Failed to claim interface 0: '%s'", strerror(-ret));
1052 CloseHandle();
1053 return -1;
1054 }
1055 else
1056 {
1057 qDebug() << "Claim interface 0";
1058 }
1059
1060 ret = libusb_get_descriptor(devHandle, LIBUSB_DT_DEVICE, 0x00, desc, 0x12);
1061
1062 if (ret < 0)
1063 {
1064 qCritical("Failed to get device descriptor: '%s'", strerror(-ret));
1065 ReleaseInterface();
1066 return -1;
1067 }
1068
1069 qDebug("Device reported its revision [%d.%02d]", desc[12], desc[13]);
1070 sa.sa_handler = &sig_int;
1071 sa.sa_flags = SA_RESTART;
1072 sigfillset(&sa.sa_mask);
1073
1074 if (sigaction(SIGINT, &sa, &saold) == -1)
1075 {
1076 perror("Error: cannot handle SIGINT"); // Should not happen
1077 }
1078
1079 ret = init();
1080 if (ret < 0)
1081 {
1082 qCritical("Failed to init device %d", strerror(-ret));
1083 ReleaseInterface();
1084 return -1;
1085 }
1086
1087 return 0;
1088 }
1089
1090 int32_t ch341::init(void)
1091 {
1092 int32_t ret;
1093
1094 uint8_t buf[2];
1095
1096 /* expect two bytes 0x27 0x00 */
1097 ret = libusb_control_transfer(devHandle, CTRL_IN, CH341_REQ_READ_VERSION, 0, 0, buf, 2, timeout);
1098 if (ret < 0)
1099 {
1100 qCritical("can not read version\n");
1101 return ret;
1102 }
1103
1104 #if DEBUG_CH341
1105 qDebug("Chip version: 0x%02x\n", buf[0]);
1106 #endif
1107 dev_vers = buf[0];
1108
1109 // send init to controller (reset)
1110 ret = ClearChip();
1111 if (ret < 0)
1112 {
1113 qCritical("failed control transfer 0xa1\n");
1114 return ret;
1115 }
1116
1117 dtr = 1;
1118 ret = setHandshakeByte();
1119 if (ret < 0)
1120 {
1121 qCritical("failed set dtr\n");
1122 return ret;
1123 }
1124
1125 rts = 1;
1126 ret = setHandshakeByte();
1127 if (ret < 0)
1128 {
1129 qCritical("failed set rts \n");
1130 return ret;
1131 }
1132
1133 // check state not implemented
1134
1135
1136 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, 0x0000, NULL, 0, 1000);
1137 if (ret < 0)
1138 {
1139 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL\n");
1140 return ret;
1141 }
1142
1143 ret = SetBaudRate(baudRate);
1144 if (ret < 0)
1145 {
1146 return ret;
1147 }
1148
1149 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_LCR, 0x00c3, NULL, 0, 1000);
1150 if (ret < 0)
1151 {
1152 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_LCR\n");
1153 return ret;
1154 }
1155
1156 // check state not implemented
1157
1158 ret = libusb_control_transfer(devHandle, CTRL_OUT, CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL, 0x0000, NULL, 0, 1000);
1159 if (ret < 0)
1160 {
1161 qCritical("failed control transfer CH341_REQ_WRITE_REG, CH341_REG_FLOW_CTRL\n");
1162 return ret;
1163 }
1164
1165 return ret;
1166
1167 }
1168
1169 void ch341::ReleaseInterface(void)
1170 {
1171 if (devHandle)
1172 {
1173 libusb_release_interface(devHandle, 0);
1174 CloseHandle();
1175 }
1176 }
1177
1178
1179 void ch341::CloseHandle(void)
1180 {
1181 if (devHandle)
1182 {
1183 libusb_close(devHandle);
1184 devHandle = NULL;
1185 }
1186 }
1187
1188 // void ch341::updateStatus(uint8_t *data, size_t l)
1189 // {
1190 // }
1191
1192 /**
1193 * release libusb structure and ready to exit
1194 */
1195 int32_t ch341::Release(void)
1196 {
1197 if (devHandle == NULL)
1198 {
1199 return -1;
1200 }
1201
1202 qDebug() << "ch341::Release()";
1203
1204 libusb_release_interface(devHandle, 0);
1205 libusb_close(devHandle);
1206 libusb_exit(NULL);
1207 devHandle = NULL;
1208 sigaction(SIGINT, &saold, NULL);
1209 return 0;
1210 }
1211
1212 #if 0
1213 /**
1214 * Helper function for libusb_bulk_transfer, display error message with the caller name
1215 */
1216 int32_t ch341::usbTransfer(const char *func, uint8_t type, uint8_t *buf, int len)
1217 {
1218 int32_t ret;
1219 int transfered;
1220
1221 if (devHandle == NULL)
1222 {
1223 return -1;
1224 }
1225
1226 qDebug() << "ch341::usbTransfer()";
1227
1228 ret = libusb_bulk_transfer(devHandle, type, buf, len, &transfered, timeout);
1229
1230 if (ret < 0)
1231 {
1232 qCritical("%s: Failed to %s %d bytes '%s'", func,
1233 (type == BULK_WRITE_ENDPOINT) ? "write" : "read", len, strerror(-ret));
1234 return -1;
1235 }
1236
1237 return transfered;
1238 }
1239
1240 // --------------------------------------------------------------------------
1241 // ch341writeEEPROM()
1242 // write n bytes to 24c32/24c64 device (in packets of 32 bytes)
1243 int32_t ch341::writeEEPROM(uint8_t *buffer, uint32_t bytesum)
1244 {
1245
1246 uint8_t ch341outBuffer[EEPROM_WRITE_BUF_SZ], *outptr, *bufptr;
1247 int32_t ret = 0, i;
1248 uint16_t byteoffset = 0, bytes = bytesum;
1249 uint8_t addrbytecount = 3; // 24c32 and 24c64 (and other 24c??) use 3 bytes for addressing
1250 int32_t actuallen = 0;
1251
1252 bufptr = buffer;
1253
1254 while (bytes)
1255 {
1256 outptr = ch341outBuffer;
1257 *outptr++ = CH341_CMD_I2C_STREAM;
1258 *outptr++ = CH341_CMD_I2C_STM_STA;
1259 *outptr++ = CH341_CMD_I2C_STM_OUT + addrbytecount + MIN(bytes, 25);
1260 *outptr++ = 0xa0; // EEPROM device address
1261 *outptr++ = (uint8_t)(byteoffset >> 8 & 0xff); // MSB (big-endian) byte address
1262 *outptr++ = (uint8_t)(byteoffset & 0xff); // LSB of 16-bit byte address
1263
1264 memcpy(outptr, bufptr, MIN(bytes, 25)); // payload has two parts: 25 bytes & up to 7 more bytes
1265
1266 outptr += MIN(bytes, 25);
1267 bufptr += MIN(bytes, 25);
1268 bytes -= MIN(bytes, 25);
1269
1270 *outptr++ = CH341_CMD_I2C_STM_END;
1271
1272 if (bytes)
1273 {
1274 *outptr++ = CH341_CMD_I2C_STREAM;
1275 *outptr++ = CH341_CMD_I2C_STM_OUT + MIN(bytes, 7);
1276 memcpy(outptr, bufptr, MIN(bytes, 7));
1277
1278 outptr += MIN(bytes, 7);
1279 bufptr += MIN(bytes, 7);
1280 bytes -= MIN(bytes, 7);
1281 }
1282
1283 *outptr++ = CH341_CMD_I2C_STM_STO;
1284 *outptr = CH341_CMD_I2C_STM_END;
1285
1286 byteoffset += 0x20;
1287
1288 for (i = 0; i < EEPROM_WRITE_BUF_SZ; i++)
1289 {
1290 if (!(i % 0x10))
1291 {
1292 qDebug("\n%04x : ", i);
1293 }
1294 qDebug("%02x ", ch341outBuffer[i]);
1295 }
1296 qDebug("\n");
1297
1298 ret = libusb_bulk_transfer(devHandle, BULK_WRITE_ENDPOINT,
1299 ch341outBuffer, EEPROM_WRITE_BUF_SZ, &actuallen, timeout);
1300
1301 if (ret < 0)
1302 {
1303 qCritical("Failed to write to EEPROM: '%s'\n", strerror(-ret));
1304 return -1;
1305 }
1306
1307 qDebug("Writing [aa 5a 00] to EEPROM\n"); // Magic CH341a packet! Undocumented, unknown purpose
1308
1309 outptr = ch341outBuffer;
1310 *outptr++ = CH341_CMD_I2C_STREAM;
1311 *outptr++ = 0x5a; // what is this 0x5a??
1312 *outptr++ = CH341_CMD_I2C_STM_END;
1313
1314 ret = libusb_bulk_transfer(devHandle, BULK_WRITE_ENDPOINT, ch341outBuffer, 3, &actuallen, timeout);
1315
1316 if (ret < 0)
1317 {
1318 qCritical("Failed to write to EEPROM: '%s'\n", strerror(-ret));
1319 return -1;
1320 }
1321 qDebug("Written [%d] of [%d] bytes \r", bytes, bytesum);
1322 }
1323 return 0;
1324 }
1325
1326 // --------------------------------------------------------------------------
1327 // ch341readEEPROM()
1328 // read n bytes from device (in packets of 32 bytes)
1329 int32_t ch341::readEEPROM(uint8_t *buffer, uint32_t bytestoread)
1330 {
1331
1332 uint8_t ch341outBuffer[EEPROM_READ_BULKOUT_BUF_SZ];
1333 uint8_t ch341inBuffer[IN_BUF_SZ]; // 0x100 bytes
1334 int32_t ret = 0, readpktcount = 0;
1335 struct libusb_transfer *xferBulkIn, *xferBulkOut;
1336 struct timeval tv = {0, 100}; // our async polling interval
1337
1338 xferBulkIn = libusb_alloc_transfer(0);
1339 xferBulkOut = libusb_alloc_transfer(0);
1340
1341 bulkin_count = 0;
1342
1343 if (!xferBulkIn || !xferBulkOut)
1344 {
1345 qCritical("Couldnt allocate USB transfer structures\n");
1346 return -1;
1347 }
1348
1349 qDebug("Allocated USB transfer structures\n");
1350
1351 memset(ch341inBuffer, 0, EEPROM_READ_BULKIN_BUF_SZ);
1352 memcpy(ch341outBuffer, CH341_EEPROM_READ_SETUP_CMD, EEPROM_READ_BULKOUT_BUF_SZ);
1353
1354 libusb_fill_bulk_transfer(xferBulkIn, devHandle, BULK_READ_ENDPOINT, ch341inBuffer,
1355 EEPROM_READ_BULKIN_BUF_SZ, cbBulkIn, NULL, timeout);
1356
1357 libusb_fill_bulk_transfer(xferBulkOut, devHandle, BULK_WRITE_ENDPOINT,
1358 ch341outBuffer, EEPROM_READ_BULKOUT_BUF_SZ, cbBulkOut, NULL, timeout);
1359
1360 qDebug("Filled USB transfer structures\n");
1361
1362 libusb_submit_transfer(xferBulkIn);
1363 qDebug("Submitted BULK IN start packet\n");
1364
1365 libusb_submit_transfer(xferBulkOut);
1366 qDebug("Submitted BULK OUT setup packet\n");
1367
1368 // readbuf = buffer;
1369
1370 byteoffset = 0;
1371
1372 while (1)
1373 {
1374 qDebug("Read [%d] of [%d] bytes \r", byteoffset, bytestoread);
1375 ret = libusb_handle_events_timeout(NULL, &tv);
1376
1377 if (ret < 0 || bulkin_count == -1) // indicates an error
1378 {
1379 qCritical("ret from libusb_handle_timeout = %d\n", ret);
1380 qCritical("bulkin_count = %d\n", bulkin_count);
1381 if (ret < 0)
1382 {
1383 qCritical("USB read error : %s\n", strerror(-ret));
1384 }
1385 libusb_free_transfer(xferBulkIn);
1386 libusb_free_transfer(xferBulkOut);
1387 return -1;
1388 }
1389 if (bulkin_count) // callback function reports a new BULK IN packet received
1390 {
1391 bulkin_count = 0; // reset the flag
1392 readpktcount++; // increment the read packet counter
1393 byteoffset += EEPROM_READ_BULKIN_BUF_SZ;
1394 if (byteoffset == bytestoread)
1395 {
1396 break;
1397 }
1398
1399 qDebug("\nRe-submitting transfer request to BULK IN endpoint\n");
1400 libusb_submit_transfer(xferBulkIn); // re-submit request for next BULK IN packet of EEPROM data
1401 if (syncackpkt)
1402 {
1403 syncackpkt = 0;
1404 }
1405 // if 4th packet received, we are at end of 0x80 byte data block,
1406 // if it is not the last block, then resubmit request for data
1407 if (readpktcount == 4)
1408 {
1409 qDebug("\nSubmitting next transfer request to BULK OUT endpoint\n");
1410 readpktcount = 0;
1411
1412 memcpy(ch341outBuffer, CH341_EEPROM_READ_NEXT_CMD, CH341_EEPROM_READ_CMD_SZ);
1413 ch341outBuffer[4] = (uint8_t)(byteoffset >> 8 & 0xff); // MSB (big-endian) byte address
1414 ch341outBuffer[5] = (uint8_t)(byteoffset & 0xff); // LSB of 16-bit byte address
1415
1416 libusb_fill_bulk_transfer(xferBulkOut, devHandle, BULK_WRITE_ENDPOINT, ch341outBuffer,
1417 EEPROM_READ_BULKOUT_BUF_SZ, cbBulkOut, NULL, timeout);
1418
1419 libusb_submit_transfer(xferBulkOut);// update transfer struct (with new EEPROM page offset)
1420 // and re-submit next transfer request to BULK OUT endpoint
1421 }
1422 }
1423 }
1424
1425 // out_deinit:
1426 libusb_free_transfer(xferBulkIn);
1427 libusb_free_transfer(xferBulkOut);
1428 return 0;
1429 }
1430
1431
1432 /**
1433 * set the i2c bus speed speed(b1b0):
1434 * 0 = 20kHz CH341_STM_I2C_20K
1435 * 1 = 100kHz CH341_STM_I2C_100K
1436 * 2 = 400kHz CH341_STM_I2C_400K
1437 * 3 = 750kHz CH341_STM_I2C_750K
1438 * set the spi bus data width speed(b2):
1439 * 0 = Single
1440 * 1 = Double CH341_STM_SPI_DBL
1441 */
1442 int32_t ch341::SetStream(uint32_t speed)
1443 {
1444 uint8_t buf[3];
1445
1446 if (devHandle == NULL)
1447 {
1448 return -1;
1449 }
1450
1451 qDebug() << "ch341::SetStream()";
1452
1453 buf[0] = CH341_CMD_I2C_STREAM;
1454 buf[1] = CH341_CMD_I2C_STM_SET | (speed & 0x7);
1455 buf[2] = CH341_CMD_I2C_STM_END;
1456
1457 return usbTransfer(__func__, BULK_WRITE_ENDPOINT, buf, 3);
1458 }
1459
1460
1461 /**
1462 * assert or deassert the chip-select pin of the spi device
1463 */
1464 void ch341::SpiChipSelect(uint8_t *ptr, bool selected)
1465 {
1466 qDebug() << "ch341::SpiChipSelect()";
1467
1468 *ptr++ = CH341_CMD_UIO_STREAM;
1469 *ptr++ = CH341_CMD_UIO_STM_OUT | (selected ? 0x36 : 0x37);
1470
1471 if (selected)
1472 {
1473 *ptr++ = CH341_CMD_UIO_STM_DIR | 0x3F; // pin direction
1474 }
1475
1476 *ptr++ = CH341_CMD_UIO_STM_END;
1477 }
1478
1479 /**
1480 * transfer len bytes of data to the spi device
1481 */
1482 int32_t ch341::SpiStream(uint8_t *out, uint8_t *in, uint32_t len)
1483 {
1484 uint8_t *inBuf, *outBuf, *inPtr, *outPtr;
1485 int32_t ret, packetLen;
1486 bool done;
1487 bool err = false;
1488
1489 if (devHandle == NULL)
1490 {
1491 return -1;
1492 }
1493
1494 qDebug() << "ch341::SpiStream()";
1495
1496 outBuf = new uint8_t[CH341_PACKET_LENGTH];
1497
1498 SpiChipSelect(outBuf, true);
1499 ret = usbTransfer(__func__, BULK_WRITE_ENDPOINT, outBuf, 4);
1500
1501 if (ret < 0)
1502 {
1503 delete outBuf;
1504 return -1;
1505 }
1506
1507 inBuf = new uint8_t[CH341_PACKET_LENGTH];
1508
1509 inPtr = in;
1510
1511 do
1512 {
1513 done = true;
1514 packetLen = len + 1; // STREAM COMMAND + data length
1515
1516 if (packetLen > CH341_PACKET_LENGTH)
1517 {
1518 packetLen = CH341_PACKET_LENGTH;
1519 done = false;
1520 }
1521
1522 outPtr = outBuf;
1523 *outPtr++ = CH341_CMD_SPI_STREAM;
1524
1525 for (int i = 0; i < packetLen - 1; ++i)
1526 {
1527 *outPtr++ = ReverseByte(*out++);
1528 }
1529
1530 ret = usbTransfer(__func__, BULK_WRITE_ENDPOINT, outBuf, packetLen);
1531
1532 if (ret < 0)
1533 {
1534 err = true;
1535 break;
1536 }
1537
1538 ret = usbTransfer(__func__, BULK_READ_ENDPOINT, inBuf, packetLen - 1);
1539
1540 if (ret < 0)
1541 {
1542 err = true;
1543 break;
1544 }
1545
1546 len -= ret;
1547
1548 for (int i = 0; i < ret; ++i) // swap the buffer
1549 {
1550 *inPtr++ = ReverseByte(inBuf[i]);
1551 }
1552 }
1553 while (!done);
1554
1555 if (!err)
1556 {
1557 SpiChipSelect(outBuf, false);
1558 ret = usbTransfer(__func__, BULK_WRITE_ENDPOINT, outBuf, 3);
1559 }
1560 else
1561 {
1562 ret = -1;
1563 }
1564
1565 delete outBuf;
1566 delete inBuf;
1567
1568 if (ret < 0)
1569 {
1570 return -1;
1571 }
1572
1573 return 0;
1574 }
1575
1576 #define JEDEC_ID_LEN 0x52 // additional byte due to SPI shift
1577
1578 /**
1579 * read the JEDEC ID of the SPI Flash
1580 */
1581 int32_t ch341::SpiCapacity(void)
1582 {
1583 uint8_t *outBuf;
1584 uint8_t *inBuf, *ptr, cap;
1585 int32_t ret;
1586
1587 if (devHandle == NULL)
1588 {
1589 return -1;
1590 }
1591
1592 qDebug() << "ch341::SpiCapacity()";
1593
1594 outBuf = new uint8_t[JEDEC_ID_LEN];
1595 ptr = outBuf;
1596 *ptr++ = 0x9F; // Read JEDEC ID
1597
1598 for (int i = 0; i < JEDEC_ID_LEN - 1; ++i)
1599 {
1600 *ptr++ = 0x00;
1601 }
1602
1603 inBuf = new uint8_t[JEDEC_ID_LEN];
1604
1605 ret = SpiStream(outBuf, inBuf, JEDEC_ID_LEN);
1606
1607 if (ret < 0)
1608 {
1609 delete inBuf;
1610 delete outBuf;
1611 return ret;
1612 }
1613
1614 if (!(inBuf[1] == 0xFF && inBuf[2] == 0xFF && inBuf[3] == 0xFF))
1615 {
1616 qDebug("Manufacturer ID: %02x", inBuf[1]);
1617 qDebug("Memory Type: %02x%02x", inBuf[2], inBuf[3]);
1618
1619 if (inBuf[0x11] == 'Q' && inBuf[0x12] == 'R' && inBuf[0x13] == 'Y')
1620 {
1621 cap = inBuf[0x28];
1622 qDebug("Reading device capacity from CFI structure");
1623 }
1624 else
1625 {
1626 cap = inBuf[3];
1627 qDebug("No CFI structure found, trying to get capacity from device ID. Set manually if detection fails.");
1628 }
1629
1630 qDebug("Capacity: %02x", cap);
1631 }
1632 else
1633 {
1634 qDebug("Chip not found or missed in ch341a. Check connection");
1635 delete inBuf;
1636 delete outBuf;
1637 exit(0);
1638 }
1639
1640 delete inBuf;
1641 delete outBuf;
1642
1643 return cap;
1644 }
1645
1646
1647 /**
1648 * read status register
1649 */
1650 int32_t ch341::ReadStatus(void)
1651 {
1652 uint8_t out[2];
1653 uint8_t in[2];
1654 int32_t ret;
1655
1656 if (devHandle == NULL)
1657 {
1658 return -1;
1659 }
1660
1661 qDebug() << "ch341::ReadStatus()";
1662
1663 out[0] = 0x05; // Read status
1664 ret = SpiStream(out, in, 2);
1665
1666 if (ret < 0)
1667 {
1668 return ret;
1669 }
1670
1671 return (in[1]);
1672 }
1673
1674 /**
1675 * write status register
1676 */
1677 int32_t ch341::WriteStatus(uint8_t status)
1678 {
1679 uint8_t out[2];
1680 uint8_t in[2];
1681 int32_t ret;
1682
1683 if (devHandle == NULL)
1684 {
1685 return -1;
1686 }
1687
1688 qDebug() << "ch341::WriteStatus()";
1689
1690 out[0] = 0x06; // Write enable
1691 ret = SpiStream(out, in, 1);
1692
1693 if (ret < 0)
1694 {
1695 return ret;
1696 }
1697
1698 out[0] = 0x01; // Write status
1699 out[1] = status;
1700 ret = SpiStream(out, in, 2);
1701
1702 if (ret < 0)
1703 {
1704 return ret;
1705 }
1706
1707 out[0] = 0x04; // Write disable
1708 ret = SpiStream(out, in, 1);
1709
1710 if (ret < 0)
1711 {
1712 return ret;
1713 }
1714
1715 return 0;
1716 }
1717
1718 /**
1719 * chip erase
1720 */
1721 int32_t ch341::EraseChip(void)
1722 {
1723 uint8_t out[1];
1724 uint8_t in[1];
1725 int32_t ret;
1726
1727 if (devHandle == NULL)
1728 {
1729 return -1;
1730 }
1731
1732 qDebug() << "ch341::EraseChip()";
1733
1734 out[0] = 0x06; // Write enable
1735 ret = SpiStream(out, in, 1);
1736
1737 if (ret < 0)
1738 {
1739 return ret;
1740 }
1741
1742 out[0] = 0xC7; // Chip erase
1743 ret = SpiStream(out, in, 1);
1744
1745 if (ret < 0)
1746 {
1747 return ret;
1748 }
1749
1750 out[0] = 0x04; // Write disable
1751 ret = SpiStream(out, in, 1);
1752
1753 if (ret < 0)
1754 {
1755 return ret;
1756 }
1757
1758 return 0;
1759 }
1760
1761 /**
1762 * read the content of SPI device to buf, make sure the buf is big enough before call
1763 */
1764 int32_t ch341::SpiRead(uint8_t *buf, uint32_t add, uint32_t len)
1765 {
1766 uint8_t *outBuf;
1767 uint8_t *inBuf;
1768
1769 if (devHandle == NULL)
1770 {
1771 return -1;
1772 }
1773
1774 qDebug() << "ch341::SpiRead()";
1775
1776 /* what subtracted is: 1. first cs package, 2. leading command for every other packages,
1777 * 3. second package contains read flash command and 3 bytes address */
1778 const uint32_t max_payload = CH341_MAX_PACKET_LEN - CH341_PACKET_LENGTH - CH341_MAX_PACKETS + 1 - 4;
1779 uint32_t tmp, pkg_len, pkg_count;
1780 struct libusb_transfer *xferBulkIn, *xferBulkOut;
1781 uint32_t idx = 0;
1782 int32_t ret;
1783 int32_t old_counter;
1784 struct timeval tv = {0, 100};
1785 v_print(0, len); // verbose
1786
1787 outBuf = new uint8_t[CH341_MAX_PACKET_LEN];
1788
1789 memset(outBuf, 0xff, CH341_MAX_PACKET_LEN);
1790
1791 for (int i = 1; i < CH341_MAX_PACKETS; ++i) // fill CH341_CMD_SPI_STREAM for every packet
1792 {
1793 outBuf[i * CH341_PACKET_LENGTH] = CH341_CMD_SPI_STREAM;
1794 }
1795
1796 inBuf = new uint8_t[CH341_PACKET_LENGTH];
1797
1798 memset(inBuf, 0x00, CH341_PACKET_LENGTH);
1799 xferBulkIn = libusb_alloc_transfer(0);
1800 xferBulkOut = libusb_alloc_transfer(0);
1801
1802 qDebug("Read started!");
1803
1804 while (len > 0)
1805 {
1806 v_print(1, len); // verbose
1807 fflush(stdout);
1808 SpiChipSelect(outBuf, true);
1809 idx = CH341_PACKET_LENGTH + 1;
1810 outBuf[idx++] = 0xC0; // byte swapped command for Flash Read
1811 tmp = add;
1812
1813 for (int i = 0; i < 3; ++i) // starting address of next read
1814 {
1815 outBuf[idx++] = ReverseByte((tmp >> 16) & 0xFF);
1816 tmp <<= 8;
1817 }
1818
1819 if (len > max_payload)
1820 {
1821 pkg_len = CH341_MAX_PACKET_LEN;
1822 pkg_count = CH341_MAX_PACKETS - 1;
1823 len -= max_payload;
1824 add += max_payload;
1825 }
1826 else
1827 {
1828 pkg_count = (len + 4) / (CH341_PACKET_LENGTH - 1);
1829
1830 if ((len + 4) % (CH341_PACKET_LENGTH - 1))
1831 {
1832 pkg_count ++;
1833 }
1834
1835 pkg_len = (pkg_count) * CH341_PACKET_LENGTH + ((len + 4) % (CH341_PACKET_LENGTH - 1)) + 1;
1836 len = 0;
1837 }
1838
1839 bulkin_count = 0;
1840 libusb_fill_bulk_transfer(xferBulkIn, devHandle, BULK_READ_ENDPOINT, inBuf,
1841 CH341_PACKET_LENGTH, cbBulkIn, buf, timeout);
1842 buf += max_payload; // advance user's pointer
1843 libusb_submit_transfer(xferBulkIn);
1844 libusb_fill_bulk_transfer(xferBulkOut, devHandle, BULK_WRITE_ENDPOINT, outBuf,
1845 pkg_len, cbBulkOut, NULL, timeout);
1846 libusb_submit_transfer(xferBulkOut);
1847 old_counter = bulkin_count;
1848
1849 while (bulkin_count < pkg_count)
1850 {
1851 libusb_handle_events_timeout(NULL, &tv);
1852
1853 if (bulkin_count == -1) // encountered error
1854 {
1855 len = 0;
1856 ret = -1;
1857 break;
1858 }
1859
1860 if (old_counter != bulkin_count) // new package came
1861 {
1862 if (bulkin_count != pkg_count)
1863 {
1864 libusb_submit_transfer(xferBulkIn); // resubmit bulk in request
1865 }
1866
1867 old_counter = bulkin_count;
1868 }
1869 }
1870
1871 SpiChipSelect(outBuf, false);
1872 ret = usbTransfer(__func__, BULK_WRITE_ENDPOINT, outBuf, 3);
1873
1874 if (ret < 0)
1875 {
1876 break;
1877 }
1878
1879 if (force_stop == 1) // user hit ctrl+C
1880 {
1881 force_stop = 0;
1882
1883 if (len > 0)
1884 {
1885 qCritical() << "User hit Ctrl+C, reading unfinished.";
1886 }
1887
1888 break;
1889 }
1890 }
1891
1892 delete outBuf;
1893 delete inBuf;
1894
1895 libusb_free_transfer(xferBulkIn);
1896 libusb_free_transfer(xferBulkOut);
1897 v_print(2, 0);
1898 return ret;
1899 }
1900
1901 #define WRITE_PAYLOAD_LENGTH 301 // 301 is the length of a page(256)'s data with protocol overhead
1902
1903 /**
1904 * write buffer(*buf) to SPI flash
1905 */
1906 int32_t ch341::SpiWrite(uint8_t *buf, uint32_t add, uint32_t len)
1907 {
1908 uint8_t *outBuf;
1909 uint8_t *inBuf;
1910 uint32_t tmp, pkg_count;
1911 struct libusb_transfer *xferBulkIn, *xferBulkOut;
1912 uint32_t idx = 0;
1913 uint32_t ret;
1914 int32_t old_counter;
1915 struct timeval tv = {0, 100};
1916
1917 v_print(0, len); // verbose
1918
1919 if (devHandle == NULL)
1920 {
1921 return -1;
1922 }
1923
1924 qDebug() << "ch341::SpiWrite()";
1925
1926 outBuf = new uint8_t[WRITE_PAYLOAD_LENGTH];
1927
1928 memset(outBuf, 0xff, WRITE_PAYLOAD_LENGTH);
1929 xferBulkIn = libusb_alloc_transfer(0);
1930 xferBulkOut = libusb_alloc_transfer(0);
1931
1932 inBuf = new uint8_t[CH341_PACKET_LENGTH];
1933
1934 qDebug("Write started!");
1935
1936 while (len > 0)
1937 {
1938 v_print(1, len);
1939
1940 outBuf[0] = 0x06; // Write enable
1941 ret = SpiStream(outBuf, inBuf, 1);
1942 SpiChipSelect(outBuf, true);
1943 idx = CH341_PACKET_LENGTH;
1944 outBuf[idx++] = CH341_CMD_SPI_STREAM;
1945 outBuf[idx++] = 0x40; // byte swapped command for Flash Page Write
1946 tmp = add;
1947
1948 for (int i = 0; i < 3; ++i) // starting address of next write
1949 {
1950 outBuf[idx++] = ReverseByte((tmp >> 16) & 0xFF);
1951 tmp <<= 8;
1952 }
1953
1954 tmp = 0;
1955 pkg_count = 1;
1956
1957 while ((idx < WRITE_PAYLOAD_LENGTH) && (len > tmp))
1958 {
1959 if (idx % CH341_PACKET_LENGTH == 0)
1960 {
1961 outBuf[idx++] = CH341_CMD_SPI_STREAM;
1962 pkg_count ++;
1963 }
1964 else
1965 {
1966 outBuf[idx++] = ReverseByte(*buf++);
1967 tmp++;
1968
1969 if (((add + tmp) & 0xFF) == 0) // cross page boundary
1970 {
1971 break;
1972 }
1973 }
1974 }
1975
1976 len -= tmp;
1977 add += tmp;
1978 bulkin_count = 0;
1979 libusb_fill_bulk_transfer(xferBulkIn, devHandle, BULK_READ_ENDPOINT, inBuf,
1980 CH341_PACKET_LENGTH, cbBulkIn, NULL, timeout);
1981 libusb_submit_transfer(xferBulkIn);
1982 libusb_fill_bulk_transfer(xferBulkOut, devHandle, BULK_WRITE_ENDPOINT, outBuf,
1983 idx, cbBulkOut, NULL, timeout);
1984 libusb_submit_transfer(xferBulkOut);
1985 old_counter = bulkin_count;
1986 ret = 0;
1987
1988 while (bulkin_count < pkg_count)
1989 {
1990 libusb_handle_events_timeout(NULL, &tv);
1991
1992 if (bulkin_count == -1) // encountered error
1993 {
1994 ret = -1;
1995 break;
1996 }
1997
1998 if (old_counter != bulkin_count) // new package came
1999 {
2000 if (bulkin_count != pkg_count)
2001 {
2002 libusb_submit_transfer(xferBulkIn); // resubmit bulk in request
2003 }
2004
2005 old_counter = bulkin_count;
2006 }
2007 }
2008
2009 if (ret < 0)
2010 {
2011 break;
2012 }
2013
2014 SpiChipSelect(outBuf, false);
2015 ret = usbTransfer(__func__, BULK_WRITE_ENDPOINT, outBuf, 3);
2016
2017 if (ret < 0)
2018 {
2019 break;
2020 }
2021
2022 outBuf[0] = 0x04; // Write disable
2023 ret = SpiStream(outBuf, inBuf, 1);
2024
2025 do
2026 {
2027 ret = ReadStatus();
2028
2029 if (ret != 0)
2030 {
2031 libusb_handle_events_timeout(NULL, &tv);
2032 }
2033 }
2034 while (ret != 0);
2035
2036 if (force_stop == 1) // user hit ctrl+C
2037 {
2038 force_stop = 0;
2039
2040 if (len > 0)
2041 {
2042 qCritical() << "User hit Ctrl+C, writing unfinished.";
2043 }
2044
2045 break;
2046 }
2047 }
2048
2049 libusb_free_transfer(xferBulkIn);
2050 libusb_free_transfer(xferBulkOut);
2051
2052 delete outBuf;
2053 delete inBuf;
2054
2055 v_print(2, 0);
2056 return ret;
2057 }
2058 #endif
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // https://github.com/lancos/ponyprog //
7 // //
8 // LibUSB implementation for PonyProg (C) 2019 Eduard Kalinowski //
9 // //
10 // sources: //
11 // Copyright (C) 2014 Pluto Yang (yangyj.ee@gmail.com) //
12 // https://github.com/setarcos/ch341prog //
13 // //
14 // Copyright (C) 2016 Eugene Hutorny (eugene@hutorny.in.ua) //
15 // https://github.com/hutorny/usbuart //
16 // //
17 // Copyright (c) 2017 Gunar Schorcht (gunar@schorcht.net) //
18 // https://github.com/gschorcht/spi-ch341-usb //
19 // https://github.com/gschorcht/i2c-ch341-usb //
20 // //
21 // Copyright (c) 2018 Sarim Khan (sarim2005@gmail.com) //
22 // https://github.com/sarim/ch341a-bitbang-userland //
23 // //
24 //-------------------------------------------------------------------------//
25 // //
26 // This program is free software; you can redistribute it and/or //
27 // modify it under the terms of the GNU General Public License //
28 // as published by the Free Software Foundation; either version2 of //
29 // the License, or (at your option) any later version. //
30 // //
31 // This program is distributed in the hope that it will be useful, //
32 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
33 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
34 // General Public License for more details. //
35 // //
36 // You should have received a copy of the GNU General Public License //
37 // along with this program (see LICENSE); if not, write to the //
38 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
39 // //
40 //=========================================================================//
41
42 #ifndef __CH341_H__
43 #define __CH341_H__
44
45 #include <libusb-1.0/libusb.h>
46
47 #include <QObject>
48 #include <QTimer>
49
50 // #define CONTROL_WRITE_ENDPOINT 0x02
51 // #define CONTROL_READ_ENDPOINT 0x82
52
53
54 #define MAX_EEPROM_SIZE 131072 /* For 24c1024*/
55
56 #define DEFAULT_CONFIGURATION 0x01
57 #define DEFAULT_TIMEOUT 300 // 300mS for USB timeouts
58
59 #if 0
60 #define IN_BUF_SZ 0x100
61 #define EEPROM_WRITE_BUF_SZ 0x2b // only for 24c64 / 24c32 ??
62 #define EEPROM_READ_BULKIN_BUF_SZ 0x20
63 #define EEPROM_READ_BULKOUT_BUF_SZ 0x65
64 #endif
65
66 #define CH341_PACKET_LENGTH 0x20
67 #define CH341_MAX_PACKETS 256
68 #define CH341_MAX_PACKET_LEN (CH341_PACKET_LENGTH * CH341_MAX_PACKETS)
69
70 #define CH34x_VENDOR_ID1 0x4348
71 #define CH34x_VENDOR_ID2 0x1A86
72
73 #define CH341A_PRODUCT 0x5512 // for SPI, I2C
74
75 #define CH341_UART_PRODUCT 0x5523
76 #define CH340_UART_PRODUCT 0x7523
77
78
79
80 #if 0
81
82 #define CH341A_CMD_SET_OUTPUT 0xA1
83 #define CH341A_CMD_IO_ADDR 0xA2
84 #define CH341A_CMD_PRINT_OUT 0xA3
85 #define CH341A_CMD_SPI_STREAM 0xA8
86 #define CH341A_CMD_SIO_STREAM 0xA9
87 #define CH341A_CMD_I2C_STREAM 0xAA
88 #define CH341A_CMD_UIO_STREAM 0xAB
89
90 #define CH341A_CMD_I2C_STM_STA 0x74
91 #define CH341A_CMD_I2C_STM_STO 0x75
92 #define CH341A_CMD_I2C_STM_OUT 0x80
93 #define CH341A_CMD_I2C_STM_IN 0xC0
94 #define CH341A_CMD_I2C_STM_MAX ( min( 0x3F, CH341_PACKET_LENGTH ) )
95 #define CH341A_CMD_I2C_STM_SET 0x60
96 #define CH341A_CMD_I2C_STM_US 0x40
97 #define CH341A_CMD_I2C_STM_MS 0x50
98 #define CH341A_CMD_I2C_STM_DLY 0x0F
99 #define CH341A_CMD_I2C_STM_END 0x00
100
101 // GPIO part
102 #define CH341A_CMD_UIO_STM_IN 0x00
103 #define CH341A_CMD_UIO_STM_DIR 0x40
104 #define CH341A_CMD_UIO_STM_OUT 0x80
105 #define CH341A_CMD_UIO_STM_US 0xC0
106 #define CH341A_CMD_UIO_STM_END 0x20
107
108 #define CH341A_STM_I2C_20K 0x00
109 #define CH341A_STM_I2C_100K 0x01
110 #define CH341A_STM_I2C_400K 0x02
111 #define CH341A_STM_I2C_750K 0x03
112 #define CH341A_STM_SPI_DBL 0x04
113
114 #endif
115
116
117 /*******************************/
118 /* baudrate calculation factor */
119 /*******************************/
120 #define CH341_BPS_MOD_BASE 20000000
121 #define CH341_BPS_MOD_BASE_OFS 1100
122
123 //Vendor define
124 #define CH341_REQ_WRITE_TYPE 0x40
125 #define CH341_REQ_READ_TYPE 0xC0
126
127
128 #define CH341_REG_STAT 0x0706
129 #define CH341_REG_BREAK 0x1805
130 #define CH341_REG_LCR 0x2518
131 #define CH341_REG_FLOW_CTRL 0x2727
132 #define CH341_REG_BAUD1 0x1312
133 #define CH341_REG_BAUD2 0x0f2c /*is it right, or 0x0f14 ?? */
134
135 #define CH341_RESET_VALUE 0x501f /* line mode? */
136 #define CH341_RESET_INDEX 0xd90a /* baud rate? */
137
138 #define CH341_REQ_READ_VERSION 0x5F
139 #define CH341_REQ_WRITE_REG 0x9A
140 #define CH341_REQ_READ_REG 0x95
141 #define CH341_REQ_SERIAL_INIT 0xA1
142 #define CH341_REQ_MODEM_CTRL 0xA4 /* DTR and RTS */
143
144 // ??? right
145 #define CH341_NBREAK_BITS_REG 0x4001
146
147 #define CH341_NBREAK_BITS_REG1 0x01
148 #define CH341_NBREAK_BITS_REG2 0x40
149
150 #define CH341_INPUT_BUF_SIZE 0x08
151
152 /* status returned in third interrupt answer byte, inverted in data
153 from irq */
154 //For CMD 0xA4 CH341_REQ_MODEM_CTRL
155 #define CH341_UART_CTS 0x01
156 #define CH341_UART_DSR 0x02
157 #define CH341_UART_RING 0x04
158 #define CH341_UART_DCD 0x08
159 #define CH341_BITS_MODEM_STAT 0x0f /* all bits */
160
161 #define CH341_MULT_STAT 0x04 /* multiple status since last interrupt event */
162
163 #define CH341_CONTROL_OUT 0x10 // TX
164 #define CH341_CONTROL_DTR 0x20 // DTR, 1 << 5
165 #define CH341_CONTROL_RTS 0x40 // RTS, 1 << 6
166
167 //Uart state
168 #define CH341_UART_STATE 0x00
169 #define CH341_UART_OVERRUN_ERROR 0x01
170 #define CH341_UART_BREAK_ERROR //no define
171 #define CH341_UART_PARITY_ERROR 0x02
172 #define CH341_UART_FRAME_ERROR 0x06
173 #define CH341_UART_RECV_ERROR 0x02
174 #define CH341_UART_STATE_TRANSIENT_MASK 0x07
175
176 // LCR
177 #define CH341_LCR_ENABLE_RX 0x80
178 #define CH341_LCR_ENABLE_TX 0x40
179 #define CH341_LCR_MARK_SPACE 0x20
180 #define CH341_LCR_PAR_EVEN 0x10
181 #define CH341_LCR_ENABLE_PAR 0x08
182 #define CH341_LCR_STOP_BITS_2 0x04
183 #define CH341_LCR_CS8 0x03
184 #define CH341_LCR_CS7 0x02
185 #define CH341_LCR_CS6 0x01
186 #define CH341_LCR_CS5 0x00
187
188 //Flow control values
189 #define CH34X_FLOW_CONTROL_NONE 0x0000
190 #define CH34X_FLOW_CONTROL_RTS_CTS 0x0101
191 #define CH34X_FLOW_CONTROL_DSR_DTR 0x0202
192
193 //Port state
194 #if 0
195 #define CH341A_PORTA_STATE 0x01
196 #define CH341A_PORTB_STATE 0x02
197 #define CH341A_PORTC_STATE 0x03
198 #endif
199
200 //CH34x Baud Rate
201 #define CH341_BAUDRATE_FACTOR 1532620800
202 #define CH341_BAUDRATE_DIVMAX 3
203
204 #define CH341_DATA_IN (0x2|LIBUSB_ENDPOINT_IN)
205 #define CH341_DATA_OUT (0x2|LIBUSB_ENDPOINT_OUT)
206 #define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN )
207 #define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT )
208 //#define CTRL_IN (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_IN | LIBUSB_RECIPIENT_INTERFACE)
209 //#define CTRL_OUT (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT | LIBUSB_RECIPIENT_INTERFACE)
210 #define DEFAULT_BAUD_RATE 9600
211
212
213 // das hier ausprobieren
214 #define CONTROL_REQUEST_TYPE_IN ( LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE )
215 #define CONTROL_REQUEST_TYPE_OUT ( LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE )
216
217 #define MAX_CONTROL_IN_TRANSFER_SIZE 2
218 #define MAX_CONTROL_OUT_TRANSFER_SIZE 2
219
220 #if 0
221 // CH341a READ EEPROM setup packet for the 24c64
222 // this needs putting into a struct to allow convenient access to individual elements
223
224 #define CH341_EEPROM_READ_SETUP_CMD \
225 "\xaa\x74\x83\xa0\x00\x00\x74\x81\xa1\xe0\x00\x00\x06\x04\x00\x00" \
226 "\x00\x00\x00\x00\x40\x00\x00\x00\x11\x4d\x40\x77\xcd\xab\xba\xdc" \
227 "\xaa\xe0\x00\x00\xc4\xf1\x12\x00\x11\x4d\x40\x77\xf0\xf1\x12\x00" \
228 "\xd9\x8b\x41\x7e\x00\xf0\xfd\x7f\xf0\xf1\x12\x00\x5a\x88\x41\x7e" \
229 "\xaa\xe0\x00\x00\x2a\x88\x41\x7e\x06\x04\x00\x00\x11\x4d\x40\x77" \
230 "\xe8\xf3\x12\x00\x14\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
231 "\xaa\xdf\xc0\x75\x00"
232
233 // for 24c64
234 #define CH341_EEPROM_READ_NEXT_CMD \
235 "\xaa\x74\x83\xa0\x00\x00\x74\x81\xa1\xe0\x00\x00\x10\x00\x00\x00" \
236 "\x00\x00\x00\x00\x8c\xf1\x12\x00\x01\x00\x00\x00\x00\x00\x00\x00" \
237 "\xaa\xe0\x00\x00\x4c\xf1\x12\x00\x5d\x22\xd7\x5a\xdc\xf1\x12\x00" \
238 "\x8f\x04\x44\x7e\x30\x88\x41\x7e\xff\xff\xff\xff\x2a\x88\x41\x7e" \
239 "\xaa\xe0\x00\x7e\x00\x00\x00\x00\x69\x0e\x3c\x00\x12\x01\x19\x00" \
240 "\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9c\x2e\x68\x00" \
241 "\xaa\xdf\xc0\x75\x00"
242
243 #define CH341_EEPROM_READ_CMD_SZ 0x65
244
245 #endif
246
247 #define MIN(a,b) (((a)<(b))?(a):(b))
248 #define MAX(a,b) (((a)>(b))?(a):(b))
249
250 class ch341;
251
252
253 class ch341 : public QObject
254 {
255 Q_OBJECT
256
257 public:
258 ch341(QObject *parent = 0);
259 ~ch341();
260
261 int32_t Open(uint16_t vid, uint16_t pid);
262 void SetVerbose(void);
263 void Close();
264 #if 0
265 int32_t SetStream(uint32_t speed);
266 int32_t SpiCapacity(void);
267 int32_t SpiRead(uint8_t *buf, uint32_t add, uint32_t len);
268 int32_t ReadStatus(void);
269 int32_t WriteStatus(uint8_t status);
270 int32_t EraseChip(void);
271 int32_t SpiWrite(uint8_t *buf, uint32_t add, uint32_t len);
272 #endif
273
274 int32_t Release(void);
275 #if 0
276 int32_t readEEPROM(uint8_t *buffer, uint32_t bytestoread);
277 int32_t writeEEPROM(uint8_t *buffer, uint32_t bytesum);
278 #endif
279 int32_t SetBaudRate(int32_t baudRate);
280 int32_t SetTimeouts(int16_t t);
281 int32_t SetBreakControl(int32_t state);
282 void SetParity(uint8_t p);
283 void SetBits(uint8_t b);
284 void SetStops(uint8_t s);
285 void SetFlowControl(uint8_t f);
286 int32_t SetDTR(int32_t dtr);
287 int32_t SetRTS(int32_t dtr);
288 int32_t GetDSR();
289 int32_t GetCTS();
290 int32_t SetRTSDTR(int state);
291 int32_t SetConfigLCR();
292 int32_t Probe();
293 int32_t ClearChip();
294 int32_t ResetChip();
295
296 // int32_t GetStatus();
297 int32_t GetStatusRx();
298 int32_t GetStatusTx();
299 // int32_t Read(uint8_t *buf, size_t len);
300 // int32_t Write(uint8_t *buf, size_t len);
301
302 void ReleaseInterface(void);
303 void CloseHandle();
304
305 signals:
306 // void receivedData(uint8_t *data, size_t len);
307 void breakChanged(bool set);
308
309 public slots:
310 // void onRecieiveData(quint8 *data, qint16 len);
311 // void sendData(const uint8_t &data, size_t len);
312 void triggerBreak(uint msecs);
313
314 private slots:
315 void breakTimeout();
316
317 public:
318 // for callback
319 static int16_t read_completed;
320 static int16_t write_completed;
321
322 struct libusb_device_handle *devHandle;
323 // struct libusb_transfer *ctrl_transfer;
324
325 private:
326 int32_t getModemState(void);
327 int32_t setHandshakeByte(void);
328 int32_t init();
329 // void updateStatus();
330 void v_print(int mode, int len);
331 // void allocTransfer();
332
333
334 // int setAsync(unsigned char data);
335 #if 0
336 void updateStatus(uint8_t *data, size_t l);
337
338 void SpiChipSelect(uint8_t *ptr, bool selected);
339 int32_t SpiStream(uint8_t *out, uint8_t *in, uint32_t len);
340 int32_t usbTransfer(const char *func, uint8_t type, uint8_t *buf, int len);
341 #endif
342
343 private:
344 struct dv
345 {
346 uint8_t dv_prescaler;
347 uint8_t dv_div;
348 uint8_t dv_mod;
349 };
350
351 struct uart_div
352 {
353 uint32_t dvr_high;
354 uint32_t dvr_low;
355 uint32_t dvr_base_clock;
356 struct dv dvr_divider;
357 };
358
359 // MODEM output lines
360 uint8_t dtr; // modem line
361 uint8_t rts; // modem line
362
363 uint8_t rtsCtsEnabled;
364 uint8_t dtrDsrEnabled;
365
366 // UART settings
367 uint8_t parity;
368 uint8_t bits;
369 uint8_t stops;
370 uint8_t flow_control;
371 int32_t baudRate;
372 int16_t timeout;
373
374 // struct libusb_transfer *ctrl_transfer;
375
376 // uint8_t ctrl_buf[LIBUSB_CONTROL_SETUP_SIZE];
377
378 // MODEM input lines
379 uint8_t ctsState;
380 uint8_t dsrState;
381 uint8_t dcdState;
382 uint8_t ringState;
383
384 uint8_t lcr; // line control register
385 uint8_t lsr; // line status register
386 uint8_t msr; // modem status register
387 uint8_t mcr; // modem control register
388
389 uint8_t dev_vers;
390
391 bool verbose;
392
393 QTimer *breakTimer;
394 int force_stop = 0;
395 };
396
397
398 #endif
3333 #include "errcode.h"
3434
3535
36 //======================>>> csmFileBuf::csmFileBuf <<<=======================
3736 csmFileBuf::csmFileBuf(e2AppWinInfo *wininfo)
3837 : FileBuf(wininfo)
3938 {
4241
4342 #define MAXLINE 1023
4443
45 //======================>>> csmFileBuf::Load <<<=======================
4644 int csmFileBuf::Load(int loadtype, long relocation_offfset)
4745 {
4846 extern int GetE2PSubType(unsigned long x);
235233 "PHONE NUMBER = =\n"
236234 "CUSTOMER COMPLAINT = =";
237235
238 //======================>>> csmFileBuf::Save <<<=======================
239236 int csmFileBuf::Save(int savetype, long relocation_offfset)
240237 {
241238 int rval = 0;
280277 else
281278 {
282279 QTextStream out(&fh);
283 int addr, value;
280 int addr;
284281
285282 //Write Header
286283 out << "\"\n" << header << "\n\"";
288285 //Write buffer
289286 for (addr = 0; addr < size; addr++)
290287 {
291 value = ptr[addr];
288 int value = ptr[addr];
292289 out << (hex) << addr << " " << value << "\n";
293290 }
294291
3535
3636 class csmFileBuf : public FileBuf
3737 {
38 public: //---------------------------------------- public
38 public:
3939
4040 csmFileBuf(e2AppWinInfo *wininfo = 0);
4141 // virtual ~csmFileBuf();
4343 virtual int Load(int loadtype = ALL_TYPE, long relocation_offfset = 0);
4444 virtual int Save(int savetype = ALL_TYPE, long relocation_offfset = 0);
4545
46 protected: //--------------------------------------- protected
46 protected:
4747
48 private: //--------------------------------------- private
48 private:
4949
5050 };
5151 #endif
2727 #include "device.h" // Header file
2828 #include "e2awinfo.h"
2929
30 //=====>>> Costruttore <<<======
3130 Device::Device(e2AppWinInfo *wininfo, BusIO *busp, int b_size)
3231 : detected_type(0),
3332 awi(wininfo),
4241 DefaultBankSize();
4342 }
4443
45 //--- Distruttore
4644 Device::~Device()
4745 {
4846 }
3636
3737 class Device
3838 {
39 public: //---------------------------------------- public
39 public:
4040
4141 Device(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int b_size = 0);
4242 virtual ~Device();
134134 return detected_signature;
135135 }
136136
137 protected: //--------------------------------------- protected
137 protected:
138138 void SetBankSize(int size)
139139 {
140140 if (size > 0)
167167 long detected_type;
168168 QString detected_signature;
169169
170 private: //--------------------------------------- private
170 private:
171171
172172 e2AppWinInfo *awi; // pointer to container object
173173 BusIO *bus; // bus used by the device
3030
3131 class Dt006Interface : public LptExtInterface
3232 {
33 public: //------------------------------- public
33 public:
3434 Dt006Interface(bool use_io = false);
3535
3636 virtual int Open(int port_no);
5050 int SetPower(bool onoff);
5151 void SetControlLine(int res = 1);
5252
53 protected: //------------------------------- protected
53 protected:
5454
55 private: //------------------------------- private
55 private:
5656 // int GetPresence();
5757
5858 };
3232
3333 #include <QDebug>
3434
35 //=====>>> Costruttore <<<======
3635 mE2401::mE2401(e2AppWinInfo *wininfo, BusIO *busp, int def_banksize)
3736 : Device(wininfo, busp, def_banksize),
3837 timeout_loop(200),
4342
4443 //Determina a quali indirizzi I2C si mappa, e
4544 // se probe_size == 1 anche la dimensione (numero di banchi)
46 //---
4745 int mE2401::Probe(int probe_size)
4846 {
4947 int retval = 1;
3434
3535 class mE2401 : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 mE2401(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int def_banksize = 128);
4040 // virtual ~mE2401();
4444 int Write(int probe = 1, int type = ALL_TYPE);
4545 int Verify(int type = ALL_TYPE);
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 int const timeout_loop; //eeprom timeout
5050
5757 int sequential_read; //1 --> legge un banco in una volta
5858 int writepage_size; //se > 1 scrive una pagina alla volta
5959
60 private: //--------------------------------------- private
60 private:
6161
6262 };
6363 #endif
3333 #include "errcode.h"
3434 #include "eeptypes.h"
3535
36 //=====>>> Costruttore <<<======
3736 E24xx1::E24xx1(e2AppWinInfo *wininfo, BusIO *busp)
3837 : E24xx(wininfo, busp, 8, 128) //Max 8 bank of 128 bytes
3938 {
4039 // SetBankSize(1);
4140 }
4241
43 //--- Distruttore
4442 E24xx1::~E24xx1()
4543 {
4644 }
3030
3131 class E24xx1 : public E24xx
3232 {
33 public: //---------------------------------------- public
33 public:
3434
3535 E24xx1(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
3636 virtual ~E24xx1();
4040 // int Write(int probe = 1, int type = ALL_TYPE);
4141 // int Verify(int type = ALL_TYPE);
4242
43 protected: //--------------------------------------- protected
43 protected:
4444
45 private: //--------------------------------------- private
45 private:
4646
4747 };
4848
3535 #include "errcode.h"
3636 #include "eeptypes.h"
3737
38 //=====>>> Costruttore <<<======
3938 E24xx2::E24xx2(e2AppWinInfo *wininfo, BusIO *busp)
4039 : E24xx(wininfo, busp),
4140 SecurityReadCode(0xC0),
104103 int k;
105104
106105 for (k = timeout_loop; k > 0 && GetBus()->Read(eeprom_addr[0], localbuf, 1) != 1; k--)
107 ;
106 {
107 qApp->processEvents();
108 }
108109
109110 if (k == 0)
110111 {
3131
3232 class E24xx2 : public E24xx
3333 {
34 public: //---------------------------------------- public
34 public:
3535
3636 E24xx2(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
3737 // virtual ~E24xx2();
4848 int HighEnduranceRead(uint32_t &block_no);
4949 int HighEnduranceWrite(uint32_t block_no);
5050
51 protected: //--------------------------------------- protected
51 protected:
5252
53 private: //--------------------------------------- private
53 private:
5454
5555 int const SecurityReadCode;
5656 int const SecurityWriteCode;
3232 #include "eeptypes.h"
3333
3434
35 //=====>>> Costruttore <<<======
3635 E24xx5::E24xx5(e2AppWinInfo *wininfo, BusIO *busp)
3736 : E24xx(wininfo, busp, 128)
3837 {
4443 }
4544
4645
47 //--- Distruttore
4846 E24xx5::~E24xx5()
4947 {
5048 }
8684 int k;
8785
8886 for (k = timeout_loop; k > 0 && GetBus()->Read(eeprom_addr[0], buffer, 1) != 1; k--)
89 ;
87 {
88 qApp->processEvents();
89 }
9090
9191 if (k == 0)
9292 {
3030
3131 class E24xx5 : public E24xx
3232 {
33 public: //---------------------------------------- public
33 public:
3434
3535 E24xx5(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
3636 virtual ~E24xx5();
4040 virtual int Write(int probe = 1, int type = ALL_TYPE);
4141 // int Verify(int type = ALL_TYPE);
4242
43 protected: //--------------------------------------- protected
43 protected:
4444
4545 // int bank_out(uint8_t const *copy_buf, int bank_no, long size = -1);
4646 // int bank_in(uint8_t *copy_buf, int bank_no, long size = -1);
4747
48 private: //--------------------------------------- private
48 private:
4949
5050 };
5151 #endif
3535
3636 #include <QDebug>
3737
38 //=====>>> Costruttore <<<======
3938 E24xx::E24xx(e2AppWinInfo *wininfo, BusIO *busp, int max_no_of_bank, int def_banksize)
4039 : Device(wininfo, busp, def_banksize),
4140 max_bank(max_no_of_bank),
5756 ***/
5857 }
5958
60 //--- Distruttore
6159 E24xx::~E24xx()
6260 {
6361 }
6462
6563 //Determina a quali indirizzi I2C si mappa, e
6664 // se probe_size == 1 anche la dimensione (numero di banchi)
67 //---
6865 int E24xx::Probe(int probe_size)
6966 {
7067 int addr, error, k;
288285 }
289286
290287 for (k = timeout_loop; k > 0 && GetBus()->Read(eeprom_addr[bank], buffer, 1) != 1; k--)
291 ;
288 {
289 qApp->processEvents();
290 }
292291
293292 if (k == 0)
294293 {
354353
355354 #define CMP_LEN 16
356355
357 //====================>>> E24xx::BankRollOverDetect <<<====================
358356 int E24xx::BankRollOverDetect(int force)
359357 {
360358 int rlv = 0;
3535
3636 class E24xx : public Device
3737 {
38 public: //---------------------------------------- public
38 public:
3939
4040 E24xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0, int max_no_of_bank = 8, int def_banksize = 256);
4141 virtual ~E24xx();
4949
5050 int const max_bank; // max number of banks (max eeprom size)
5151
52 protected: //--------------------------------------- protected
52 protected:
5353
5454 int const timeout_loop; //eeprom timeout
5555
7171 int sequential_read; //1 --> legge un banco in una volta
7272 int writepage_size; //se > 1 scrive una pagina alla volta
7373
74 private: //--------------------------------------- private
74 private:
7575
7676 };
7777 #endif
3939 #endif
4040
4141 #include "microbus.h"
42 #include "interfconv.h"
4243
4344 //const int idAskToSave = 100; // Dummy Command
4445
45 //=========================>>> e2App::e2App <<<==========================
4646 e2App::e2App() :
4747 awip(0),
4848 port_number(0)
4949 {
5050 // Constructor
51 qDebug() << "e2App::e2App()";
51 qDebug() << Q_FUNC_INFO;
5252
5353 // awinfo = 0;
5454
8383 busvetp[X2444B - 1] = &x2444B;
8484 busvetp[S2430B - 1] = &s2430B;
8585
86 SetInterfaceType(); //Set default interface
86 //duplicated call in initSettings()
87 //SetInterfaceType(); //Set default interface
8788
8889 initSettings();
8990 }
9091
9192
92 //=========================>>> e2App::e2App <<<==========================
9393 e2App::~e2App()
9494 {
95 qDebug() << "e2App::~e2App()";
96
97 // Destructor
98
99 // if (_e2CmdWin)
100 // delete _e2CmdWin;
95 qDebug() << Q_FUNC_INFO;
10196 }
10297
10398
105100 {
106101 QString str;
107102
108 #ifdef __unix__
109 //QString sp;
110
111 //sp = getenv("HOME");
112
113 //if (sp.length() > 0)
114 //{
115 // str = sp + "/";
116 //}
117
118 //str += QString("." + APPNAME + "rc");
119 //E2Profile::SetConfigFile(str);
120 #endif
121103 qDebug() << "Settings file: " << E2Profile::GetConfigFile(); // << " - Format: " << E2Profile::s->format();
122104
123105 QString currentAppDir = qApp->applicationDirPath();
151133 }
152134
153135 // Read parameters from INI file
154 SetInterfaceType((HInterfaceType) E2Profile::GetParInterfType());
136 SetInterfaceType(E2Profile::GetParInterfType());
155137 SetPort(E2Profile::GetPortNumber());
156 SetPolarity(E2Profile::GetPolarityControl());
138 SetPolarity(E2Profile::GetPolarityLines());
157139 #if 0
158140 // Make sure all parameters (even default values) are written
159141 // to the INI file.
184166 E2Profile::Get8253FallEdge();
185167
186168 #ifdef Q_OS_LINUX
187 E2Profile::GetHtmlBrowseApp();
188169 E2Profile::GetLockDir();
189170 E2Profile::GetDevDir();
190 E2Profile::GetGpioPinClock();
191 E2Profile::GetGpioPinCtrl();
192 E2Profile::GetGpioPinDataIn();
193 E2Profile::GetGpioPinDataOut();
194171 #endif
195172
196173 E2Profile::GetDevName();
203180 //=====================>>> e2App::OpenPort <<<==============================
204181 int e2App::OpenPort(int port)
205182 {
206 qDebug() << "e2App::OpenPort(" << port << ")";
183 qDebug() << Q_FUNC_INFO << "(" << port << ")";
207184
208185 if (port >= 0)
209186 {
218195 //=====================>>> e2App::ClosePort <<<==============================
219196 void e2App::ClosePort()
220197 {
221 qDebug() << "e2App::ClosePort() iniBus=" << (hex) << iniBus << (dec);
198 qDebug() << Q_FUNC_INFO << " iniBus=" << (hex) << iniBus << (dec);
222199 iniBus->Close();
223200 }
224201
225202 //=====================>>> e2App::TestPort <<<==============================
226203 int e2App::TestPort(int port, bool open_only)
227204 {
228 qDebug() << "e2App::TestPort(port=" << port << ", open_only=" << open_only << ")";
205 qDebug() << Q_FUNC_INFO << "(port=" << port << ", open_only=" << open_only << ")";
229206
230207 int rv = (open_only) ?
231208 busIntp->TestOpen(port) :
232209 busIntp->TestPort(port);
233210
234 qDebug() << "e2App::TestPort() = " << rv;
211 qDebug() << Q_FUNC_INFO << " = " << rv;
235212
236213 return rv;
237214 }
239216 //=====================>>> e2App::OpenBus <<<==============================
240217 int e2App::OpenBus(BusIO *p)
241218 {
242 qDebug() << "e2App::OpenBus(" << (hex) << p << (dec) << ")";
219 qDebug() << Q_FUNC_INFO << "(" << (hex) << p << (dec) << ")";
243220
244221 iniBus->Close();
245222
246 qDebug() << "e2App::OpenBus() ** Close";
223 qDebug() << Q_FUNC_INFO << " ** Close";
247224
248225 iniBus = p;
249226 int rv = iniBus->Open(GetPort());
250227
251 qDebug() << "e2App::OpenBus() ** Open = " << rv;
228 qDebug() << Q_FUNC_INFO << " ** Open = " << rv;
252229
253230 if (rv == OK)
254231 {
255232 rv = busIntp->SetPower(true);
256233
257 qDebug() << "e2App::OpenBus() ** SetPower";
234 qDebug() << Q_FUNC_INFO << " ** SetPower";
258235
259236 //Power up delay
260 iniBus->WaitMsec(E2Profile::GetPowerUpDelay());
261
262 qDebug() << "e2App::OpenBus() ** Reset";
237 busIntp->WaitMsec(E2Profile::GetPowerUpDelay());
238
239 qDebug() << Q_FUNC_INFO << " ** Reset";
263240
264241 iniBus->Reset(); //28/10/98
265242 }
266243
267 qDebug() << "e2App::OpenBus() = " << rv;
244 qDebug() << Q_FUNC_INFO << " = " << rv;
268245
269246 return rv;
270247 }
272249 //=====================>>> e2App::SleepBus <<<==============================
273250 void e2App::SleepBus()
274251 {
275 qDebug() << "e2App::CloseBus() iniBus=" << (hex) << iniBus << (dec);
276
277 iniBus->WaitMsec(5); // 08/04/98 -- hold time dell'alimentazione
252 qDebug() << Q_FUNC_INFO << " iniBus=" << (hex) << iniBus << (dec);
253
254 busIntp->WaitMsec(5); // 08/04/98 -- power hold time
278255 busIntp->SetPower(false);
279 iniBus->Close(); // 28/09/98 -- richiude la porta dopo averla usata
256 iniBus->Close(); // 28/09/98 -- richiude la porta dopo averla usata
280257 }
281258
282259
340317
341318 #endif
342319
343 //=====================>>> e2App::Calibration <<<==============================
344320 int e2App::Calibration()
345321 {
346 qDebug() << "e2App::Calibration()";
322 qDebug() << Q_FUNC_INFO;
347323
348324 int rv = OK;
349325 // OpenBus(&iicB); //aggiunto il 06/03/98
353329 return rv;
354330 }
355331
356 #if 0
357 // EK 2017
358 //=====================>>> e2App::AppCommand <<<==============================
359 void e2App::AppCommand(vWindow *win, ItemVal id, ItemVal val, CmdType cType)
360 {
361 // Commands not processed by the window will be passed here
362
363 qDebug() << "e2App::AppCmd(ID: " << id << ")";
364 vApp::AppCommand(win, id, val, cType);
365 }
366 #endif
367
368 //=========================>>> e2App::KeyIn <<<==============================
369 // EK 2017 key event filter
370 #if 0
371 void e2App::KeyIn(vWindow *win, vKey key, unsigned int shift)
372 {
373 // Key strokes not processed by the window will be passed here
374
375 vApp::KeyIn(win, key, shift);
376 }
377 #endif
378
379 //=======================>>> e2App::SetInterface <<<=========================
380332 void e2App::SetInterfaceType(HInterfaceType type)
381333 {
382334 switch (type)
383335 {
384336 //Interface initializers
385 case SIPROG_API:
386 iType = SIPROG_API;
387 busIntp = &siprog_apiI;
388 break;
389
390337 case SIPROG_IO:
391338 iType = SIPROG_IO;
392339 busIntp = &siprog_ioI;
426373 jdm_apiI.SetCmd2CmdDelay(E2Profile::GetJDMCmd2CmdDelay());
427374 break;
428375
429 // case JDM_IO:
430 // iType = JDM_IO;
431 // busIntp = &jdm_ioI;
432 // break;
433376 case DT006_API:
434377 iType = DT006_API;
435378 busIntp = &dt006_apiI;
449392 busIntp = &linuxsysfs_ioI;
450393 break;
451394
452 default:
453 iType = SIPROG_API; //20/07/99 -- to prevent crash
395 case FTDI_JTAGKEY:
396 iType = FTDI_JTAGKEY;
397 busIntp = &jtagkeyI;
398 break;
399
400 case PONYPROG_FT:
401 iType = PONYPROG_FT;
402 busIntp = &ponyprog_ftI;
403 break;
404
405 case SIPROG_API:
406 default: //20/07/99 -- to prevent crash
407 iType = SIPROG_API;
454408 busIntp = &siprog_apiI;
455409 break;
456410 }
457411
458 int k;
459
460 for (k = 0; k < NO_OF_BUSTYPE; k++)
412 busIntp->SetUSBVidPid(TypeToInterfVidPid(iType));
413 InterfPins pins;
414 E2Profile::GetInterfacePins(iType, pins);
415 busIntp->ConfigPins(pins);
416
417 for (int k = 0; k < NO_OF_BUSTYPE; k++)
461418 {
462419 busvetp[k]->SetBusInterface(busIntp);
463420 }
524481 DWORD multiplier = 1;
525482
526483 QString strbuf;
527 strbuf = helpfile;
528
529 int sp = strbuf.lastIndexOf("\\");
530
531 if (sp < 0)
532 {
533 sp = strbuf.lastIndexOf("/");
534 }
535
536 if (sp < 0)
537 {
538 strbuf = "bogomips.out";
484 QFileInfo fi(E2Profile::GetConfigFile());
485 if (fi.exists())
486 {
487 strbuf = fi.canonicalPath();
539488 }
540489 else
541490 {
542 strbuf += "bogomips.out";
543 }
491 strbuf = qApp->applicationDirPath();
492 }
493
494 strbuf.append("/bogomips.out");
544495
545496 QFile fh(strbuf);
546497
5959 //#include "jdmiointer.h"
6060 #include "dt006interf.h"
6161 #include "linuxsysfsint.h"
62 #include "mpsse_interf.h"
6263
6364 #include "e2profil.h"
6465
7273
7374 class e2App : public cTranslator
7475 {
75 public: //---------------------------------------- public
76 public:
7677
7778 e2App();
7879 virtual ~e2App();
135136 return err_soundfile;
136137 }
137138
138 uint8_t GetPolarity() const
139 unsigned int GetPolarity() const
139140 {
140141 return polarity_control;
141142 }
142 void SetPolarity(uint8_t val)
143 void SetPolarity(unsigned int val)
143144 {
144145 polarity_control = val;
145146 }
159160
160161 void SetAWInfo(e2AppWinInfo *awi)
161162 {
162 // qDebug() << "SetAWInfo" << awi;
163 Q_CHECK_PTR(awi);
163164 awip = awi;
164165 }
165166 e2AppWinInfo *GetAWInfo() const
170171 bool scriptMode; //Script Mode
171172 int returnValue; //return value in Command Line mode
172173
173 QString script_name;
174
175 protected: //--------------------------------------- protected
174 protected:
176175 // AppWinInfo associated with this window
177176 e2AppWinInfo *awip;
178177
179 private: //--------------------------------------- private
178 QString script_name;
179
180 private:
180181 void initSettings();
181182 void LookForBogoMips(); //should get bogomips
182183
191192
192193 BusInterface *busIntp; //pointer to current interface type
193194
194 uint8_t polarity_control; //polarity for control lines
195 unsigned int polarity_control; //polarity for control lines
195196
196197 //AutoTag
197198 //List of available interface types
206207 JdmInterface jdm_apiI;
207208 // JdmIOInterface jdm_ioI;
208209 LinuxSysFsInterface linuxsysfs_ioI;
210 MpsseInterface jtagkeyI;
211 MpsseInterface ponyprog_ftI;
209212
210213 int port_number; //port number used
211214 BusIO *iniBus; //pointer to current Bus
3636 #include <QDebug>
3737 #include <QtCore>
3838
39 //======================>>> e2AppWinInfo::e2AppWinInfo <<<=======================
4039 e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO **busvptr) :
4140 hex_per_line(16),
4241 buffer_size(BUFFER_SIZE),
229228 }
230229
231230
232 //======================>>> e2AppWinInfo::~e2AppWinInfo <<<=======================
233231 e2AppWinInfo::~e2AppWinInfo()
234232 {
235233 qDebug() << "e2AppWinInfo::~e2AppWinInfo()";
271269 }
272270
273271
274 //===================>>> e2AppWinInfo::Reset <<<=============
275272 void e2AppWinInfo::Reset()
276273 {
277274 cmdWin->OpenBus(eep->GetBus());
279276 }
280277
281278
282 //======================>>> e2AppWinInfo::SetEEProm <<<=======================
283279 void e2AppWinInfo::SetEEProm(unsigned long id)
284280 {
285281 // extern long BuildE2PType(int x, int y = 0);
535531 SetBlockSize(eep->GetBankSize());
536532 }
537533
538 //======================>>> e2AppWinInfo::Read <<<=======================
539534 int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
540535 {
541536 int probe = !GetE2PSubType(eep_id);
601596 return rval;
602597 }
603598
604 //======================>>> e2AppWinInfo::Write <<<=======================
605599 int e2AppWinInfo::Write(int type, int raise_power, int leave_on)
606600 {
607601 int probe = !GetE2PSubType(eep_id);
637631 return rval;
638632 }
639633
640 //======================>>> e2AppWinInfo::Verify <<<=======================
641634 int e2AppWinInfo::Verify(int type, int raise_power, int leave_on)
642635 {
643636 int rval = OK;
664657 return rval;
665658 }
666659
667 //======================>>> e2AppWinInfo::Erase <<<=======================
668660 int e2AppWinInfo::Erase(int type, int raise_power, int leave_on)
669661 {
670662 int rval = OK;
691683 return rval;
692684 }
693685
694 //===================>>> e2AppWinInfo::BankRollOverDetect <<<=============
695686 int e2AppWinInfo::BankRollOverDetect(int force)
696687 {
697688 if (OpenBus() == OK)
704695 return roll_over;
705696 }
706697
707 //======================>>> e2AppWinInfo::Load <<<=======================
708698 int e2AppWinInfo::Load()
709699 {
710700 int rval;
792782 return rval;
793783 }
794784
795 //======================>>> e2AppWinInfo::LoadFile <<<=======================
796785 int e2AppWinInfo::LoadFile()
797786 {
798787 if (clear_buffer_before_load)
828817 return rval;
829818 }
830819
831 //======================>>> e2AppWinInfo::Save <<<=======================
832820 int e2AppWinInfo::Save()
833821 {
834822 int rval;
947935 return rval;
948936 }
949937
950 //====================>>> e2AppWinInfo::GetLoadRelocation <<<===================
951938 long e2AppWinInfo::GetLoadRelocation() const
952939 {
953940 return load_relocation;
954941 }
955942
956 //===================>>> e2AppWinInfo::SetLoadRelocation <<<====================
957943 void e2AppWinInfo::SetLoadRelocation(long val)
958944 {
959945 if (val >= 0 && val < GetBufSize())
962948 }
963949 }
964950
965 //====================>>> e2AppWinInfo::GetSaveRelocation <<<===================
966951 long e2AppWinInfo::GetSaveRelocation() const
967952 {
968953 return save_relocation;
969954 }
970955
971 //===================>>> e2AppWinInfo::SetSaveRelocation <<<====================
972956 void e2AppWinInfo::SetSaveRelocation(long val)
973957 {
974958 if (val >= 0 && val < GetBufSize())
978962 }
979963
980964
981 //======================>>> e2AppWinInfo::GetLoadType <<<=======================
982965 int e2AppWinInfo::GetLoadType() const
983966 {
984967 return load_type;
985968 }
986969
987 //======================>>> e2AppWinInfo::SetLoadType <<<=======================
988970 int e2AppWinInfo::SetLoadType(int val)
989971 {
990972 int rval = 0;
998980 return rval;
999981 }
1000982
1001 //======================>>> e2AppWinInfo::GetSaveType <<<=======================
1002983 int e2AppWinInfo::GetSaveType() const
1003984 {
1004985 return save_type;
1005986 }
1006987
1007 //======================>>> e2AppWinInfo::SetSaveType <<<=======================
1008988 int e2AppWinInfo::SetSaveType(int val)
1009989 {
1010990 int rval = 0;
1018998 return rval;
1019999 }
10201000
1021 //======================>>> e2AppWinInfo::SetLockBits <<<=======================
10221001 void e2AppWinInfo::SetLockBits(uint32_t bits)
10231002 {
10241003 lock_bits = bits;
10251004 }
10261005
1027 //======================>>> e2AppWinInfo::SetFuseBits <<<=======================
10281006 void e2AppWinInfo::SetFuseBits(uint32_t bits)
10291007 {
10301008 fuse_bits = bits;
10311009 fuse_ok = true;
10321010 }
10331011
1034 //======================>>> e2AppWinInfo::GetSize <<<=======================
10351012 long e2AppWinInfo::GetSize() const
10361013 {
10371014 return (long)GetNoOfBlock() * (long)GetBlockSize();
11771154 {
11781155 long size = GetNoOfBlock() * GetBlockSize();
11791156 long k;
1180 uint8_t tmp;
11811157
11821158 for (k = 0; k < size; k += 2)
11831159 {
1184 tmp = buffer[k];
1160 uint8_t tmp = buffer[k];
11851161 buffer[k] = buffer[k + 1];
11861162 buffer[k + 1] = tmp;
11871163 }
13771353
13781354 // #include <ctype.h>
13791355
1380 //======================>>> e2AppWinInfo::Dump <<<=======================
13811356 QString e2AppWinInfo::Dump(int line, int type)
13821357 {
13831358 long idx;
8585
8686 class e2AppWinInfo // : public QObject
8787 {
88 public: //---------------------------------------- public
88 public:
8989
9090 e2AppWinInfo(e2CmdWindow *p = 0, const QString &name = "", BusIO **busptr = 0);
9191 ~e2AppWinInfo();
274274 return eep ? eep->GetDetectedSignatureStr() : "";
275275 }
276276
277 protected: //--------------------------------------- protected
277 protected:
278278 // e2CmdWindow* cmdWin;
279279
280 private: //--------------------------------------- private
280 private:
281281 int OpenBus();
282282 void SleepBus();
283283 void SetBlockSize(int blk)
5858 #include "sernumdlg.h"
5959 #include "errcode.h"
6060 #include "eeptypes.h"
61
61 #include "prefdialog.h"
6262
6363
6464 #define STATUSBAR_FORM " Size 0 Bytes CRC 0000h "
7575 QVector<menuToGroup> deviceMenu;
7676
7777
78 //==================>>> e2CmdWindow::About <<<=======================
7978 void e2CmdWindow::About()
8079 {
8180 AboutModalDialog about(this, translate(STR_ABOUT) + " " APP_NAME);
8584 about.exec();
8685 }
8786
88 //====================>>> e2CmdWindow::e2CmdWindow <<<====================
8987 e2CmdWindow::e2CmdWindow(QWidget *parent) :
9088 QMainWindow(parent),
9189 e2App(),
9896
9997 setupUi(this);
10098
101 qDebug() << "e2CmdWindow::e2CmdWindow(" APP_NAME ")";
99 qDebug() << Q_FUNC_INFO << "(" APP_NAME ")";
102100
103101 cbxEEPType = NULL;
104102 cbxEEPSubType = NULL;
107105 lblEEPInfo = NULL;
108106
109107 e2Prg = NULL;
108
109 currentMenu = NULL;
110 currentAct = NULL;
110111
111112 // EK 2017
112113 // TODO to remove this to E2Profile init?
114115 // sysFont = sysFont;
115116 // EK 2017
116117 // to check this
117 fontSize = E2Profile::GetFontSize();//sysFont.pointSize();
118 fontSize = E2Profile::GetFontSize(); //sysFont.pointSize();
118119
119120 programStyleSheet = QString().sprintf("font-size: %dpt", fontSize);
120121
128129 {
129130 setStyleSheet(programStyleSheet);
130131 }
131
132132
133133 if (readLangDir() == false) // init from langFiles variable in format "filename:language"
134134 {
136136 msgBox.setStyleSheet(programStyleSheet);
137137 msgBox.setButtonText(QMessageBox::Close, "Close");
138138 msgBox.exec();
139 // QMessageBox::warning(this, "Warning", "Directory with other languages not found\nDefault GUI language is english", QMessageBox::Close);
140 }
141
139 }
142140
143141 createFontSizeMenu();
144142
160158 {
161159 //Switch to script mode
162160 scriptMode = true;
163 script_name = param;// param, MAXPATH);
161 script_name = param;
164162 }
165163 else if (param == "-s" || param == "--script")
166164 {
206204
207205 // The Canvas
208206 qbuf = new QBuffer(this);
209 e2HexEdit = new QHexEdit(this); //e2TextCanvasPane(this);
210 setCentralWidget(e2HexEdit);
207 e2HexEdit = new QHexEdit(this);
208 //e2HexEdit->setMinimumSize(100, 100);
209 qbufSplit = new QBuffer(this);
210 e2HexEditSplit = new QHexEdit(this);
211 splitter = new QSplitter(this);
212 splitter->setOrientation(Qt::Vertical);
213 splitter->setChildrenCollapsible(false);
214 splitter->addWidget(e2HexEdit);
215 splitter->addWidget(e2HexEditSplit);
216
217 setCentralWidget(splitter);
211218 e2HexEdit->setFocus();
212219
213220 // create all signals, from e2HexEdit too
220227 msgBox.setStyleSheet(programStyleSheet);
221228 msgBox.setButtonText(QMessageBox::Close, "Close");
222229 msgBox.exec();
223 // QMessageBox::warning(this, "Language file error",
224 // "Can't open language file!\nDefault GUI language is english", QMessageBox::Close);
225230
226231 E2Profile::SetCurrentLang("english");
227232 }
265270 // UpdateMenuType( GetE2PPriType(E2Profile::GetLastDevType()), GetE2PSubType(E2Profile::GetLastDevType()) );
266271
267272 e2HexEdit->setReadOnly(!actionEditBuferEnabled->isChecked());
273 e2HexEditSplit->setReadOnly(!actionEditBuferEnabled->isChecked());
268274
269275 // e2HexEdit->setHighlightingColor(settings.value("Editor/HighlightingColor").value<QColor>());
270276 // e2HexEdit->setSelectionColor(settings.value("Editor/SelectionColor").value<QColor>());
271277 // e2HexEdit->setAddressAreaColor(settings.value("Editor/AddressAreaColor").value<QColor>());
272278 e2HexEdit->setAddressFontColor(Qt::darkRed);
279 e2HexEditSplit->setAddressFontColor(Qt::darkRed);
273280 // e2HexEdit->setAsciiAreaColor(settings.value("Editor/AsciiAreaColor").value<QColor>());
274281
275282 e2HexEdit->setAsciiFontColor(Qt::darkMagenta);
276 e2HexEdit->setHexFontColor(Qt::darkBlue);
283 e2HexEditSplit->setAsciiFontColor(Qt::darkMagenta);
284 //e2HexEdit->setHexFontColor(Qt::darkGreen);
285 e2HexEditSplit->setHexFontColor(Qt::darkBlue);
277286 e2HexEdit->setHexCaps(true);
287 e2HexEditSplit->setHexCaps(true);
278288 // e2HexEdit->setFont(settings.value("Editor/Font").value<QFont>());
279289 // e2HexEdit->setAddressWidth(settings.value("AddressAreaWidth").toInt());
280290 // e2HexEdit->setBytesPerLine(settings.value("BytesPerLine").toInt());
281291
282292 first_line = 0;
283293 //curIndex = 0;
284 }
285
286 //void e2CmdWindow::SetSubType()
287 //{
288 //}
289
290 //====================>>> e2CmdWindow::~e2CmdWindow <<<====================
294
295 E2Profile::readDialogSettings(this, false);
296 E2Profile::restoreSplitter(splitter);
297 }
298
291299 e2CmdWindow::~e2CmdWindow()
292300 {
293 qDebug() << "e2CmdWindow::~e2CmdWindow()";
301 qDebug() << Q_FUNC_INFO;
294302
295303 // Now put a delete for each new in the constructor.
296304
297 // delete e2Menu;
305 //delete splitter;
298306 delete e2HexEdit;
307 delete e2HexEditSplit;
299308 delete qbuf;
309 delete qbufSplit;
310
300311 // EK 2017
301312 // TODO remove created QAction* lists and other
302313
312323 }
313324 }
314325
315
316
317 #if 0
318 //======================>>> e2CmdWindow::CloseAppWin <<<===========================
319 int e2CmdWindow::CloseAppWin()
320 {
321 if (!IsAppReady())
322 {
323 //06/09/99
324 SetAbortFlag();
325 //SendWindowCommandAll(idCloseAllDialog, 0, C_Button);
326 //CheckEvents();
327
328 SetAppReady();
329 }
330
331 if (IsAppReady())
332 {
333 // This will be called BEFORE a window has been unregistered or
334 // closed. Default behavior: unregister and close the window.
335 int really_close = 0;
336
337 qDebug() << "e2App::CloseAppWin()";
338
339 if (!e2CmdWindow::exit_ok && IsBufChanged())
340 {
341 int ret = QMessageBox::warning(this, "PonyProg",
342 translate(STR_MSGCLOSEWINSAVE),
343 QMessageBox::Yes | QMessageBox::No);
344
345 if (ret == QMessageBox::Yes)
346 {
347 CmdSave();
348 }
349 }
350
351 // EK 2017
352 // TODO now is the winCounter deactivated
353 if (/*winCounter > 1 || */ e2CmdWindow::exit_ok)
354 {
355 really_close = 1;
356 }
357 else
358 {
359 int ret = QMessageBox::warning(this, "PonyProg",
360 translate(STR_MSGCLOSEWINEXIT),
361 QMessageBox::Yes | QMessageBox::No);
362
363 if (ret == QMessageBox::Yes)
364 {
365 really_close = 1;
366 }
367 }
368
369 if (really_close)
370 {
371 // EK 2017
372 // TODO we can do it about program settings: use QSettings
373 #ifdef Q_OS_WIN32
374 HKEY key; // Save window position to Win7-safe, roaming hive of registry
375
376 if (!RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\h#s\\PonyProg",
377 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &key, NULL))
378 {
379 WINDOWPLACEMENT wp;
380 wp.length = sizeof wp;
381
382 if (GetWindowPlacement(theApp->winHwnd(), &wp))
383 {
384 RegSetValueEx(key, "WinPos", 0, REG_BINARY, (LPBYTE)&wp.rcNormalPosition, sizeof wp.rcNormalPosition);
385 }
386
387 RegCloseKey(key);
388 }
389
390 #endif
391 // winCounter--; //decrementa il numero di finestre
392
393 qApp->quit();
394 }
395 else
396 {
397 return 0;
398 }
399 }
400
401 return 0;
402 }
403 #endif
404
405
406326 /**
407327 * @brief create the list of loaded data files
408328 *
453373 load_type = ALL_TYPE;
454374 }
455375
456 QString fname = a->text();
376 //We don't use text() here because some systems (KDE) insert '&' automatically to text. See https://bugs.kde.org/show_bug.cgi?id=337491
377 //don't use fname.remove(Qchar'&') in case there is a '&' in the filename
378 QString fname = a->iconText();
457379 fname.replace("~", QDir().homePath());
458380
459381 if (QFile().exists(fname))
466388 msgBox.setStyleSheet(programStyleSheet);
467389 msgBox.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
468390 msgBox.exec();
469 // QMessageBox::critical(this, "File error", translate(STR_MSGFILENOTFOUND), QMessageBox::Close);
470391 }
471392 }
472393
620541 void e2CmdWindow::setLang(QAction *mnu)
621542 {
622543 QString lngStr;
623 qDebug() << "setLang";
544
624545 //mnu = langGroup->checkedAction();
625546
626547 lngStr = mnu->text();
627 lngStr = lngStr.remove("&");
548 lngStr = lngStr.remove(QChar('&'));
628549 lngStr = lngStr.toLower();
550
551 qDebug() << Q_FUNC_INFO << " lang: " << lngStr;
629552
630553 E2Profile::SetCurrentLang(lngStr);
631554
703626 menuSetup->setTitle(translate(STR_MENUSETUP));
704627 // TODO translation for font size
705628 actionInterfaceSetup->setText(translate(STR_INTERFSETUP));
706 actionCalibration->setText(translate(STR_CALIBRATION));
629 actionCalibration->setText(translate(STR_CALIBRATION) + "...");
630 actionPreferences->setText(translate(STR_PREFERENCES) + "...");
707631 // STR_REMOTEMODE
708632
709633 menuHelp->setTitle(translate(STR_MENUQMARK));
738662
739663 if (fileLang == "")
740664 {
741 return (false);
742 }
743
744 qDebug() << "getLangTable" << fileLang;
665 return false;
666 }
667
668 qDebug() << Q_FUNC_INFO << " " << fileLang;
745669
746670 if (QFile::exists(E2Profile::GetLangDir() + "/" + fileLang) == false)
747671 {
748 QMessageBox msgBox(QMessageBox::Warning, "Warning", "Language file not exists!\n\n"
672 QMessageBox msgBox(QMessageBox::Warning, "Warning", "Language file does not exist!\n\n"
749673 + E2Profile::GetLangDir() + "\n\n" + fileLang, QMessageBox::Close);
750674 msgBox.setStyleSheet(programStyleSheet);
751675 msgBox.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
752676 msgBox.exec();
753 // QMessageBox::warning(this, "Warning", "Language file not exists!\n\n"
754 // + E2Profile::GetLangDir() + "\n\n" + fileLang, QMessageBox::Close);
755677 // not found
756 return (false);
678 return false;
757679 }
758680
759681 return loadTranslation(E2Profile::GetLangDir() + "/" + fileLang);
760682 }
761
762683
763684
764685 int e2CmdWindow::OnError(int err_no, const QString &msgerr)
771692 {
772693 case 0:
773694 {
774 QMessageBox note(QMessageBox::Critical, "Error", translate(STR_DEVNOTRESP), QMessageBox::Close);
695 QMessageBox note(QMessageBox::Critical, "Error", translate(STR_DEVNOTRESP), QMessageBox::Close);
775696 note.setStyleSheet(programStyleSheet);
776697 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
777698 note.exec();
1014935 {
1015936 menuToGroup *mTmp = new menuToGroup();
1016937
1017 mTmp->mnu = new QMenu("I2C Bus 8bit eeprom");
1018 mTmp->grp = new QActionGroup(this);
1019 mTmp->type << E24XX << E24XX1_A << E24XX1_B << E24XX5;
1020
1021 initMenuVector(mTmp);
1022
1023 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectI2C8(QAction *)));
1024 deviceMenu << *mTmp;
938 mTmp->title = "I2C Bus 8bit eeprom";
939 mTmp->pre_type << E24XX << E24XX1_A << E24XX1_B << E24XX5;
940
941 addMenuVector(mTmp);
1025942 }
1026943
1027944 /**
1032949 {
1033950 menuToGroup *mTmp = new menuToGroup();
1034951
1035 mTmp->mnu = new QMenu("I2C Bus 16bit eeprom");
1036 mTmp->grp = new QActionGroup(this);
1037 mTmp->type << E24XX2;
1038
1039 initMenuVector(mTmp);
1040
1041 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectI2C16(QAction *)));
1042 deviceMenu << *mTmp;
952 mTmp->title = "I2C Bus 16bit eeprom";
953 mTmp->pre_type << E24XX2;
954
955 addMenuVector(mTmp);
1043956 }
1044957
1045958 /**
1050963 {
1051964 menuToGroup *mTmp = new menuToGroup();
1052965
1053 mTmp->mnu = new QMenu("I2C Bus AT17 eeprom");
1054 mTmp->grp = new QActionGroup(this);
1055 mTmp->type << AT17XXX;
1056
1057 initMenuVector(mTmp);
1058
1059 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectI2CAT17(QAction *)));
1060 deviceMenu << *mTmp;
966 mTmp->title = "I2C Bus AT17 eeprom";
967 mTmp->pre_type << AT17XXX;
968
969 addMenuVector(mTmp);
1061970 }
1062971
1063972
1069978 {
1070979 menuToGroup *mTmp = new menuToGroup();
1071980
1072 mTmp->mnu = new QMenu("MicroWire16 eeprom");
1073 mTmp->grp = new QActionGroup(this);
1074 mTmp->type << E93X6;
1075
1076 initMenuVector(mTmp);
1077
1078 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectMW16(QAction *)));
1079 deviceMenu << *mTmp;
981 mTmp->title = "MicroWire16 eeprom";
982 mTmp->pre_type << E93X6;
983
984 addMenuVector(mTmp);
1080985 }
1081986
1082987
1088993 {
1089994 menuToGroup *mTmp = new menuToGroup();
1090995
1091 mTmp->mnu = new QMenu("MicroWire8 eeprom");
1092 mTmp->grp = new QActionGroup(this);
1093 mTmp->type << E93XX_8;
1094
1095 initMenuVector(mTmp);
1096
1097 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectMW8(QAction *)));
1098 deviceMenu << *mTmp;
996 mTmp->title = "MicroWire8 eeprom";
997 mTmp->pre_type << E93XX_8;
998
999 addMenuVector(mTmp);
10991000 }
11001001
11011002
11071008 {
11081009 menuToGroup *mTmp = new menuToGroup();
11091010
1110 mTmp->mnu = new QMenu("SPI eeprom");
1111 mTmp->grp = new QActionGroup(this);
1112 mTmp->type << E250XX << E25XXX;
1113
1114 initMenuVector(mTmp);
1115
1116 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectSPI(QAction *)));
1117 deviceMenu << *mTmp;
1011 mTmp->title = "SPI eeprom";
1012 mTmp->pre_type << E250XX << E25XXX;
1013
1014 addMenuVector(mTmp);
11181015 }
11191016
11201017 /**
11251022 {
11261023 menuToGroup *mTmp = new menuToGroup();
11271024
1128 mTmp->mnu = new QMenu("AVR micro");
1129 mTmp->grp = new QActionGroup(this);
1130 mTmp->type << AT90SXX;
1131
1132 initMenuVector(mTmp);
1133
1134 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectAVR(QAction *)));
1135 deviceMenu << *mTmp;
1025 mTmp->title = "AT90 micro";
1026 mTmp->pre_type << AT90SXX;
1027
1028 addMenuVector(mTmp, "AT90");
1029
1030 mTmp = new menuToGroup();
1031
1032 mTmp->title = "ATmega micro";
1033 mTmp->pre_type << AT90SXX;
1034
1035 addMenuVector(mTmp, "ATmega");
1036
1037 mTmp = new menuToGroup();
1038
1039 mTmp->title = "ATtiny micro";
1040 mTmp->pre_type << AT90SXX;
1041
1042 addMenuVector(mTmp, "ATtiny");
11361043 }
11371044
11381045
11441051 {
11451052 menuToGroup *mTmp = new menuToGroup();
11461053
1147 mTmp->mnu = new QMenu("AT89S micro");
1148 mTmp->grp = new QActionGroup(this);
1149 mTmp->type << AT89SXX;
1150
1151 initMenuVector(mTmp);
1152
1153 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectAT89S(QAction *)));
1154 deviceMenu << *mTmp;
1054 mTmp->title = "AT89S micro";
1055 mTmp->pre_type << AT89SXX;
1056
1057 addMenuVector(mTmp);
11551058 }
11561059
11571060
11631066 {
11641067 menuToGroup *mTmp = new menuToGroup();
11651068
1166 mTmp->mnu = new QMenu("PIC 16 micro");
1167 mTmp->grp = new QActionGroup(this);
1168 mTmp->type << PIC168XX << PIC16XX;
1169
1170 initMenuVector(mTmp);
1171
1172 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectPIC16(QAction *)));
1173 deviceMenu << *mTmp;
1069 mTmp->title = "PIC 16 micro";
1070 mTmp->pre_type << PIC168XX << PIC16XX;
1071
1072 addMenuVector(mTmp);
11741073 }
11751074
11761075
11821081 {
11831082 menuToGroup *mTmp = new menuToGroup();
11841083
1185 mTmp->mnu = new QMenu("PIC 12 micro");
1186 mTmp->grp = new QActionGroup(this);
1187 mTmp->type << PIC125XX;
1188
1189 initMenuVector(mTmp);
1190
1191 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectPIC12(QAction *)));
1192 deviceMenu << *mTmp;
1084 mTmp->title = "PIC 12 micro";
1085 mTmp->pre_type << PIC125XX;
1086
1087 addMenuVector(mTmp);
11931088 }
11941089
11951090 /**
12001095 {
12011096 menuToGroup *mTmp = new menuToGroup();
12021097
1203 mTmp->mnu = new QMenu("ImBus eeprom");
1204 mTmp->grp = new QActionGroup(this);
1205 mTmp->type << ENVMXXX;
1206
1207 initMenuVector(mTmp);
1208
1209 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectImBus(QAction *)));
1210 deviceMenu << *mTmp;
1098 mTmp->title = "ImBus eeprom";
1099 mTmp->pre_type << ENVMXXX;
1100
1101 addMenuVector(mTmp);
12111102 }
12121103
12131104 /**
12181109 {
12191110 menuToGroup *mTmp = new menuToGroup();
12201111
1221 mTmp->mnu = new QMenu("SDE2506 eeprom");
1222 mTmp->grp = new QActionGroup(this);
1223 mTmp->type << E2506XX;
1224
1225 initMenuVector(mTmp);
1226
1227 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectSDE2506(QAction *)));
1228 deviceMenu << *mTmp;
1112 mTmp->title = "SDE2506 eeprom";
1113 mTmp->pre_type << E2506XX;
1114
1115 addMenuVector(mTmp);
12291116 }
12301117
12311118 /**
12361123 {
12371124 menuToGroup *mTmp = new menuToGroup();
12381125
1239 mTmp->mnu = new QMenu("X2444 eeprom");
1240 mTmp->grp = new QActionGroup(this);
1241 mTmp->type << X24C44XX;
1242
1243 initMenuVector(mTmp);
1244
1245 connect(mTmp->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectX244(QAction *)));
1246 deviceMenu << *mTmp;
1247 }
1248
1249
1250 void e2CmdWindow::initMenuVector(menuToGroup *vecMnu)
1251 {
1126 mTmp->title = "X2444 eeprom";
1127 mTmp->pre_type << X24C44XX;
1128
1129 addMenuVector(mTmp);
1130 }
1131
1132
1133 void e2CmdWindow::addMenuVector(menuToGroup *vecMnu, const QString &filter)
1134 {
1135 vecMnu->mnu = new QMenu(vecMnu->title);
1136 vecMnu->grp = new QActionGroup(this);
1137 vecMnu->filter = filter;
1138
12521139 QAction *actionRecent = menuDevice->addMenu(vecMnu->mnu);
12531140
1254 for (int i = 0; i < vecMnu->type.count(); i++)
1255 {
1256 vecMnu->info << GetEEPSubTypeVector(vecMnu->type.at(i));
1257 }
1258
1259 for (int i = 0; i < vecMnu->info.count(); i++)
1260 {
1261 QString entry = vecMnu->info[i].name;
1262 QAction *tmpAction = new QAction(entry, actionRecent);
1263 tmpAction->setCheckable(true);
1264
1265 vecMnu->mnu->addAction(tmpAction);
1266 vecMnu->grp->addAction(tmpAction);
1267 }
1141 if (filter.length() == 0) // old method
1142 {
1143 for (int i = 0; i < vecMnu->pre_type.count(); i++)
1144 {
1145 vecMnu->info << GetEEPSubTypeVector(vecMnu->pre_type.at(i));
1146 }
1147
1148 for (int i = 0; i < vecMnu->info.count(); i++)
1149 {
1150 QString entry = vecMnu->info[i].name;
1151 QAction *tmpAction = new QAction(entry, actionRecent);
1152 tmpAction->setCheckable(true);
1153
1154 vecMnu->mnu->addAction(tmpAction);
1155 vecMnu->grp->addAction(tmpAction);
1156 }
1157 }
1158 else // filter for splitting of ATtiny, ATmega, AT90
1159 {
1160 QVector<chipInfo> tmpInfo;
1161 for (int i = 0; i < vecMnu->pre_type.count(); i++)
1162 {
1163 tmpInfo << GetEEPSubTypeVector(vecMnu->pre_type.at(i));
1164 }
1165
1166 for (int i = 0; i < tmpInfo.count(); i++)
1167 {
1168 if (tmpInfo.at(i).name.indexOf(filter) == 0)
1169 {
1170 vecMnu->info << tmpInfo.at(i);
1171 }
1172 }
1173
1174 for (int i = 0; i < vecMnu->info.count(); i++)
1175 {
1176 if (vecMnu->info[i].name.indexOf(filter) == 0)
1177 {
1178 QString entry = vecMnu->info[i].name;
1179 QAction *tmpAction = new QAction(entry, actionRecent);
1180 tmpAction->setCheckable(true);
1181
1182 vecMnu->mnu->addAction(tmpAction);
1183 vecMnu->grp->addAction(tmpAction);
1184 }
1185 }
1186 }
1187
1188 connect(vecMnu->grp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectChip(QAction *)));
1189
1190 deviceMenu << *vecMnu;
12681191 }
12691192
12701193 /**
13131236
13141237 // X2444: eep2444_map
13151238 addX24CStruct();
1316
1317 setMenuIndexes();
1318 }
1319
1320 // EK 2017
1321 // we need to initialize indexes for minimizing of search
1322 void e2CmdWindow::setMenuIndexes()
1323 {
1324 idxI2Cbus8 = findItemInMenuVector("I2C Bus 8bit eeprom");
1325 idxI2Cbus16 = findItemInMenuVector("I2C Bus 16bit eeprom");
1326 idxI2CbusAT17 = findItemInMenuVector("I2C Bus AT17 eeprom");
1327 idxMicroWire16 = findItemInMenuVector("MicroWire16 eeprom");
1328 idxMicroWire8 = findItemInMenuVector("MicroWire8 eeprom");
1329 idxSPI = findItemInMenuVector("SPI eeprom");
1330 idxAVR = findItemInMenuVector("AVR micro");
1331 idxAT89S = findItemInMenuVector("AT89S micro");
1332 idxPIC16 = findItemInMenuVector("PIC 16 micro");
1333 idxPIC12 = findItemInMenuVector("PIC 12 micro");
1334 idxImBus = findItemInMenuVector("ImBus eeprom");
1335 idxSDE2506 = findItemInMenuVector("SDE2506 eeprom");
1336 idxX244 = findItemInMenuVector("X2444 eeprom");
1337 }
1239 }
1240
13381241
13391242 /**
13401243 * @brief creating of QProgressDialog and start
13761279 // qDebug() << "progress dialog finished";
13771280 //}
13781281
1379
1282 #if 0
13801283 int e2CmdWindow::findItemInMenuVector(const QString &n)
13811284 {
13821285 for (int idx = 0; idx < deviceMenu.count(); idx++)
13891292
13901293 return -1;
13911294 }
1295 #endif
13921296
13931297 /**
1394 * @brief slot for signal from I2c8 action group
1298 * @brief slot for signal from action group
13951299 *
13961300 */
1397 void e2CmdWindow::onSelectI2C8(QAction *a)
1398 {
1399 if (IsAppReady())
1400 {
1401 QString t = deviceMenu.at(idxI2Cbus8).mnu->title(); // current type
1402 QString st = a->text(); // current subtype
1403
1404 selectTypeSubtype(t, st);
1405 }
1406 }
1407
1408
1409 /**
1410 * @brief slot for signal from I2c16 action group
1411 *
1412 */
1413 void e2CmdWindow::onSelectI2C16(QAction *a)
1414 {
1415 if (IsAppReady())
1416 {
1417 QString t = deviceMenu.at(idxI2Cbus16).mnu->title(); // current type
1418 QString st = a->text(); // current subtype
1419
1420 selectTypeSubtype(t, st);
1421 }
1422 }
1423
1424
1425 /**
1426 * @brief slot for signal from I2AT17 action group
1427 *
1428 */
1429 void e2CmdWindow::onSelectI2CAT17(QAction *a)
1430 {
1431 if (IsAppReady())
1432 {
1433 QString t = deviceMenu.at(idxI2CbusAT17).mnu->title(); // current type
1434 QString st = a->text(); // current subtype
1435
1436 selectTypeSubtype(t, st);
1437 }
1438 }
1439
1440 /**
1441 * @brief slot for signal from MW16 action group
1442 *
1443 */
1444 void e2CmdWindow::onSelectMW16(QAction *a)
1445 {
1446 if (IsAppReady())
1447 {
1448 QString t = deviceMenu.at(idxMicroWire16).mnu->title(); // current type
1449 QString st = a->text(); // current subtype
1450
1451 selectTypeSubtype(t, st);
1452 }
1453 }
1454
1455
1456 /**
1457 * @brief slot for signal from MW8 action group
1458 *
1459 */
1460 void e2CmdWindow::onSelectMW8(QAction *a)
1461 {
1462 if (IsAppReady())
1463 {
1464 QString t = deviceMenu.at(idxMicroWire8).mnu->title(); // current type
1465 QString st = a->text(); // current subtype
1466
1467 selectTypeSubtype(t, st);
1468 }
1469 }
1470
1471
1472 /**
1473 * @brief slot for signal from SPI action group
1474 *
1475 */
1476 void e2CmdWindow::onSelectSPI(QAction *a)
1477 {
1478 if (IsAppReady())
1479 {
1480 QString t = deviceMenu.at(idxSPI).mnu->title(); // current type
1481 QString st = a->text(); // current subtype
1482
1483 selectTypeSubtype(t, st);
1484 }
1485 }
1486
1487
1488 /**
1489 * @brief slot for signal from AVR action group
1490 *
1491 */
1492 void e2CmdWindow::onSelectAVR(QAction *a)
1493 {
1494 if (IsAppReady())
1495 {
1496 QString t = deviceMenu.at(idxAVR).mnu->title(); // current type
1497 QString st = a->text(); // current subtype
1498
1499 selectTypeSubtype(t, st);
1500 }
1501 }
1502
1503
1504 /**
1505 * @brief slot for signal from AT89S action group
1506 *
1507 */
1508 void e2CmdWindow::onSelectAT89S(QAction *a)
1509 {
1510 if (IsAppReady())
1511 {
1512 QString t = deviceMenu.at(idxAT89S).mnu->title(); // current typeint
1513 QString st = a->text(); // current subtype
1514
1515 selectTypeSubtype(t, st);
1516 }
1517 }
1518
1519 /**
1520 * @brief slot for signal from PIC16 action group
1521 *
1522 */
1523 void e2CmdWindow::onSelectPIC16(QAction *a)
1524 {
1525 if (IsAppReady())
1526 {
1527 QString t = deviceMenu.at(idxPIC16).mnu->title(); // current type
1528 QString st = a->text(); // current subtype
1529
1530 selectTypeSubtype(t, st);
1531 }
1532 }
1533
1534
1535 /**
1536 * @brief slot for signal from PIC12 action group
1537 *
1538 */
1539 void e2CmdWindow::onSelectPIC12(QAction *a)
1540 {
1541 if (IsAppReady())
1542 {
1543 QString t = deviceMenu.at(idxPIC12).mnu->title(); // current type
1544 QString st = a->text(); // current subtype
1545
1546 selectTypeSubtype(t, st);
1547 }
1548 }
1549
1550
1551 /**
1552 * @brief slot for signal from ImBus action group
1553 *
1554 */
1555 void e2CmdWindow::onSelectImBus(QAction *a)
1556 {
1557 if (IsAppReady())
1558 {
1559 QString t = deviceMenu.at(idxImBus).mnu->title(); // current type
1560 QString st = a->text(); // current subtype
1561
1562 selectTypeSubtype(t, st);
1563 }
1564 }
1565
1566
1567 /**
1568 * @brief slot for signal from SDE action group
1569 *
1570 */
1571 void e2CmdWindow::onSelectSDE2506(QAction *a)
1572 {
1573 if (IsAppReady())
1574 {
1575 QString t = deviceMenu.at(idxSDE2506).mnu->title(); // current type
1576 QString st = a->text(); // current subtype
1577
1578 selectTypeSubtype(t, st);
1579 }
1580 }
1581
1582
1583 /**
1584 * @brief slot for signal from X244 action group
1585 *
1586 */
1587 void e2CmdWindow::onSelectX244(QAction *a)
1588 {
1589 if (IsAppReady())
1590 {
1591 QString t = deviceMenu.at(idxX244).mnu->title(); // current type
1592 QString st = a->text(); // current subtype
1593
1594 selectTypeSubtype(t, st);
1595 }
1596 }
1597
1598
1599 void e2CmdWindow::selectTypeSubtype(const QString &t, const QString &st)
1600 {
1601 QString t_tmp = t;
1602 t_tmp = t_tmp.remove("&");
1603
1604 QString st_tmp = st;
1605 st_tmp = st_tmp.remove("&");
1606
1607 qDebug() << "selectTypeSubtype" << t_tmp << st_tmp;
1608
1609 int nt = cbxEEPType->findText(t_tmp);
1610
1611 if (nt == -1) // not found, it's criminal
1612 {
1613 nt = 0;
1614 }
1615
1616 disconnect(cbxEEPType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevType(int)));
1617 cbxEEPType->setCurrentIndex(nt);
1618 connect(cbxEEPType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevType(int)));
1301 void e2CmdWindow::onSelectChip(QAction *a)
1302 {
1303 if (!IsAppReady())
1304 {
1305 return;
1306 }
1307
1308 QString t = ((QAction *)a->parent())->text(); // current type
1309 QString st = a->text(); // current subtype
1310
1311 selectTypeSubtype(t, st);
1312
1313 if (currentAct != NULL)
1314 {
1315 currentAct->setChecked(false);
1316 }
1317
1318 currentAct = a;
1319 currentAct->setChecked(true);
1320 }
1321
1322
1323 void e2CmdWindow::selectTypeSubtype(const QString &tp, const QString &subtp)
1324 {
1325 QString t_tmp = tp;
1326 t_tmp.remove(QChar('&'));
1327
1328 QString st_tmp = subtp;
1329 st_tmp.remove(QChar('&'));
1330
1331 //qDebug() << Q_FUNC_INFO << " " << t_tmp << st_tmp << currentMenu->title;
1332 //bool rebuildSubmenu = true;
1333
1334 if (currentMenu == NULL || currentMenu->title != t_tmp || cbxEEPSubType->count() == 0) // update the type combobox
1335 {
1336 int nt = cbxEEPType->findText(t_tmp);
1337
1338 if (nt == -1) // not found, it's criminal
1339 {
1340 nt = 0;
1341 }
1342
1343 disconnect(cbxEEPType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevType(int)));
1344 cbxEEPType->setCurrentIndex(nt);
1345 connect(cbxEEPType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevType(int)));
1346
1347 for (int i = 0; i < deviceMenu.count(); i++)
1348 {
1349 if (deviceMenu.at(i).title == t_tmp)
1350 {
1351 // qDebug() << "gefunden" << deviceMenu.at(i).title;
1352 currentMenu = (menuToGroup *)&deviceMenu.at(i);
1353
1354 break;
1355 }
1356 }
1357
1358 // rebuildSubmenu = true;
1359 // }
1360
1361 // rebuild the subtype list
1362 // if (cbxEEPSubType->count() == 0 || cbxEEPSubType-> != st_tmp)
1363 // {
1364 // rebuildSubmenu = true;
1365 // }
1366 //
1367 // if (rebuildSubmenu == true)
1368 // {
1369 disconnect(cbxEEPSubType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevSubType(int)));
1370
1371 cbxEEPSubType->clear();
1372
1373 QStringList l;
1374
1375 // qDebug() << "filter" << currentMenu->title;
1376 if (currentMenu->filter.length() > 0)
1377 {
1378 // qDebug() << "filter" << currentMenu << currentMenu->filter;
1379 foreach (chipInfo cInf, currentMenu->info)
1380 {
1381 if (cInf.name.indexOf(currentMenu->filter) == 0)
1382 {
1383 l << cInf.name;
1384 }
1385 }
1386 }
1387 else
1388 {
1389 foreach (chipInfo cInf, currentMenu->info)
1390 {
1391 l << cInf.name;
1392 }
1393 }
1394
1395 if (l.count()) // refresh combobox list for subtype
1396 {
1397 cbxEEPSubType->addItems(l);
1398 }
1399 else
1400 {
1401 qDebug() << "selectTypeSubtype, something is wrong with search" << currentMenu->title;
1402 return;
1403 }
1404
1405 connect(cbxEEPSubType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevSubType(int)));
1406 }
16191407
16201408 int nst = cbxEEPSubType->findText(st_tmp);
16211409
16311419 // search id
16321420 long new_id = EID_INVALID;
16331421
1634 for (int i = 0; i < deviceMenu[nt].info.count(); i++)
1635 {
1636 if (deviceMenu[nt].info.at(i).name == st_tmp)
1637 {
1638 new_id = deviceMenu[nt].info.at(i).id;
1422 if (currentMenu == NULL)
1423 {
1424 qDebug() << "selectTypeSubtype, something is wrong with data pointer";
1425 return;
1426 }
1427
1428 for (int i = 0; i < currentMenu->info.count(); i++)
1429 {
1430 if (currentMenu->info.at(i).name == st_tmp)
1431 {
1432 new_id = currentMenu->info.at(i).id;
16391433 }
16401434 }
16411435
16451439 }
16461440
16471441
1648
1442 /**
1443 * @brief slot from selecto font size menu
1444 *
1445 */
16491446 void e2CmdWindow::selectFontSize(QAction *mnu)
16501447 {
16511448 QString lngStr;
16521449
16531450 lngStr = mnu->text();
1451 lngStr.remove(QChar('&'));
1452
16541453 fontSize = lngStr.toInt();
16551454
16561455 mnu->setChecked(true);
16811480
16821481 void e2CmdWindow::setFontForWidgets()
16831482 {
1483 //TODO: use font selection dialog to select the font
16841484 #ifdef Q_OS_WIN32
16851485 e2HexEdit->setFont(QFont("Courier", E2Profile::GetFontSize()));
1486 e2HexEditSplit->setFont(QFont("Courier", E2Profile::GetFontSize()));
16861487 #else
16871488 e2HexEdit->setFont(QFont("Monospace", E2Profile::GetFontSize()));
1489 e2HexEditSplit->setFont(QFont("Monospace", E2Profile::GetFontSize()));
16881490 #endif
16891491
16901492 // buttonsWidget->setStyleSheet(programStyleSheet);
16941496 // }
16951497 }
16961498
1499 /**
1500 * @brief create menu with action group for font size selection
1501 *
1502 */
16971503 void e2CmdWindow::createFontSizeMenu()
16981504 {
16991505 QMenu *m = new QMenu("Font size");
17261532 {
17271533 if (awip)
17281534 {
1729 awip->BufChanged(e2HexEdit->isModified());
1535 awip->BufChanged(e2HexEdit->isModified() || e2HexEditSplit->isModified());
17301536 UpdateStatusBar();
17311537 }
17321538 }
17431549 // hex editor connections
17441550 // connect(e2HexEdit, SIGNAL(overwriteModeChanged(bool)), this, SLOT(onOverwriteMode(bool)));
17451551 connect(e2HexEdit, SIGNAL(dataChanged()), this, SLOT(onDtaChanged()));
1552 connect(e2HexEditSplit, SIGNAL(dataChanged()), this, SLOT(onDtaChanged()));
17461553
17471554 // EK 2017
17481555 // TODO
19121719 connect(actiontEEPType, SIGNAL(triggered()), this, SLOT(onSelectEEPType(int val)));
19131720 connect(actiontEEPSubtype, SIGNAL(triggered()), this, SLOT(onEEPSubType(int val)));
19141721 #endif
1915 //connect(actionCalibration, SIGNAL(triggered()), this, SLOT(onReadCalibration(int idx)));
1722 connect(actionReadOscByte, SIGNAL(triggered()), this, SLOT(onReadCalibration()));
19161723 // interface setup
19171724 connect(actionInterfaceSetup, SIGNAL(triggered()), this, SLOT(onInterfSetup()));
19181725 connect(actionSetup, SIGNAL(triggered()), this, SLOT(onInterfSetup()));
1919 // connect(actiontWriteCalibration, SIGNAL(triggered()), this, SLOT( onWriteCalibration(int idx)));
19201726 // connect(actiontReadSecurity, SIGNAL(triggered()), this, SLOT( onReadSecurity(bool display_dialog)));
19211727
19221728 // connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
19741780 void e2CmdWindow::onExit()
19751781 {
19761782 Exit();
1783 qApp->quit();
1784 }
1785
1786 #include <QCloseEvent>
1787 void e2CmdWindow::closeEvent(QCloseEvent *event)
1788 {
1789 Exit();
1790 //event->ignore();
1791 event->accept();
19771792 }
19781793
19791794 #if 0
21601975 {
21611976 if (IsAppReady())
21621977 {
2163 QString fname = a->text();
1978 QString fname = a->iconText();
21641979 fname.replace("~", QDir().homePath());
21651980
21661981 if (QFile().exists(fname))
22062021
22072022 if (rv == OK)
22082023 {
2209 E2Profile::SetLastScript(script_name);
2210 UpdateScriptMenu();
2211
2212 CmdRunScript();
2024 rv = CmdRunScript();
2025 if (rv != BADPARAM && rv != FILENOTFOUND) //rv != CMD_SCRIPTERROR
2026 {
2027 E2Profile::SetLastScript(script_name);
2028 UpdateScriptMenu();
2029 }
22132030 }
22142031
22152032 SetAppReady();
22482065 }
22492066
22502067
2251 void e2CmdWindow::onReadCalibration(int idx)
2068 void e2CmdWindow::onReadCalibration()
22522069 {
22532070 if (IsAppReady())
22542071 {
22552072 CmdReadCalibration(0);
2256 }
2257 }
2258
2259
2260 void e2CmdWindow::onWriteCalibration(int idx)
2261 {
2262 if (IsAppReady())
2263 {
2264 OscCalibOption();
22652073 }
22662074 }
22672075
23242132 bool b = actionEditBuferEnabled->isChecked();
23252133
23262134 e2HexEdit->setReadOnly(!b);
2135 e2HexEditSplit->setReadOnly(!b);
23272136 E2Profile::SetEditBufferEnabled(b);
23282137
23292138 // EK 2017
23992208 msgBox.setButtonText(QMessageBox::Yes, translate(STR_YES));
24002209 msgBox.setButtonText(QMessageBox::No, translate(STR_NO));
24012210 int ret = msgBox.exec();
2402 // int ret = QMessageBox::warning(this, "PonyProg",
2403 // str,
2404 // QMessageBox::Yes | QMessageBox::No);
24052211
24062212 if (ret == QMessageBox::Yes)
24072213 {
24892295 }
24902296
24912297
2492 HIDDEN int FileExist(const QString &name);
2493 HIDDEN bool CmpExtension(const QString &name, const QString &ext);
2494
2495 //====================>>> e2CmdWindow::CmdSave <<<====================
2298 static bool CmpExtension(const QString &name, const QString &ext);
2299
24962300 int e2CmdWindow::CmdSave(int type, const QString &fname, long relocation)
24972301 {
24982302 int result = OK;
25342338 return result;
25352339 }
25362340
2537 //====================>>> e2CmdWindow::CmdSaveAs <<<====================
25382341 int e2CmdWindow::CmdSaveAs(int type, long relocation)
25392342 {
25402343 int result = OK;
25712374 return result;
25722375 }
25732376
2574 //====================>>> e2CmdWindow::CmdLastFile <<<====================
25752377 int e2CmdWindow::CmdLastFile(int index)
25762378 {
25772379 int result = OK;
25872389 msgBox.setButtonText(QMessageBox::No, translate(STR_NO));
25882390 int ret = msgBox.exec();
25892391
2590 // int ret = QMessageBox::warning(this, QString(APP_NAME),
2591 // "Buffer changed. Save it before to close?", //TODO: translate message
2592 // QMessageBox::Yes | QMessageBox::No);
2593
25942392 if (ret == QMessageBox::Yes)
25952393 {
25962394 awip->SetSaveType(ALL_TYPE); //??
26142412 }
26152413
26162414
2617 //====================>>> e2CmdWindow::CmdReload <<<====================
26182415 int e2CmdWindow::CmdReload()
26192416 {
26202417 int result = OK;
26522449
26532450 QString sp1 = E2Profile::GetLastFile(dt1, 0);
26542451
2655 if (sp1.length() && FileExist(sp1))
2452 if (sp1.length() && QFile::exists(sp1))
26562453 {
26572454 QString sp2 = E2Profile::GetLastFile(dt2, 1);
26582455
26612458 // because we don't want PrevFile change the selected device. In
26622459 // case of LastFile is ALL_TYPE there's no need to reload even
26632460 // PrevFile
2664 if (sp2.length() && FileExist(sp2) && dt1 != ALL_TYPE &&
2461 if (sp2.length() && QFile::exists(sp2) && dt1 != ALL_TYPE &&
26652462 CmpExtension(sp2.toLower(), ".e2p") != 0)
26662463 {
26672464 awip->SetLoadType(dt2);
26992496 return result;
27002497 }
27012498
2702 //====================>>> e2CmdWindow::CmdPrint <<<====================
27032499 int e2CmdWindow::CmdPrint()
27042500 {
27052501 if (awip->IsBufferValid())
27272523 return OK;
27282524 }
27292525
2730 //====================>>> e2CmdWindow::CmdHelp <<<====================
27312526 int e2CmdWindow::CmdHelp()
27322527 {
27332528 QString str;
27552550 return OK;
27562551 }
27572552
2758 //====================>>> e2CmdWindow::CmdCalibration <<<====================
27592553 int e2CmdWindow::CmdCalibration()
27602554 {
27612555 QMessageBox msgBox(QMessageBox::Warning, QString(APP_NAME), translate(STR_BUSCALIBRA1) + QString(APP_NAME) + translate(STR_BUSCALIBRA2),
27712565
27722566 if (err == OK)
27732567 {
2774 QMessageBox note(QMessageBox::Information, "Calibration", translate(STR_BUSCALIBRAOK), QMessageBox::Close);
2568 QMessageBox note(QMessageBox::Information, "Calibration", translate(STR_BUSCALIBRAOK), QMessageBox::Ok);
27752569 note.setStyleSheet(programStyleSheet);
2776 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
2570 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
27772571 note.exec();
27782572 UpdateStatusBar();
27792573 }
27822576 QString str;
27832577 str = QString("%1 (%2)").arg(translate(STR_BUSCALIBRAFAIL)).arg(err);
27842578
2785 QMessageBox note(QMessageBox::Critical, "Calibration", str, QMessageBox::Close);
2579 QMessageBox note(QMessageBox::Critical, "Calibration", str, QMessageBox::Ok);
27862580 note.setStyleSheet(programStyleSheet);
2787 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
2581 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
27882582 note.exec();
27892583 }
27902584 }
27922586 return OK;
27932587 }
27942588
2795 //====================>>> e2CmdWindow::CmdWrite <<<====================
27962589 // int e2CmdWindow::CmdWrite(int type)
27972590 // {
27982591 // int res;
28032596 // }
28042597
28052598
2806 //====================>>> e2CmdWindow::CmdRead <<<====================
28072599 int e2CmdWindow::CmdRead(int type)
28082600 {
28092601 if (IsBufChanged() && awip->IsBufferValid() && verbose == verboseAll)
28422634 rval = awip->Read(type);
28432635 e2Prg->reset();
28442636
2637 first_line = 0;
2638 //curIndex = 0;
2639 Draw();
2640
28452641 if (rval > 0)
28462642 {
2847 first_line = 0;
2848 //curIndex = 0;
2849 Draw();
2850
28512643 QString sp;
28522644 //sp = GetEEPTypeString(awip->GetEEPPriType(), awip->GetEEPSubType());
28532645 sp = GetEEPTypeString(awip->GetEEPId());
28612653
28622654 if (verbose == verboseAll)
28632655 {
2864 QMessageBox note(QMessageBox::Information, "Read", str, QMessageBox::Close);
2656 QMessageBox note(QMessageBox::Information, "Read", str, QMessageBox::Ok);
28652657 note.setStyleSheet(programStyleSheet);
2866 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
2658 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
28672659 note.exec();
28682660 }
28692661 }
28702662 else
28712663 {
2872 first_line = 0;
2873 //curIndex = 0;
2874 Draw();
2875
28762664 qDebug() << "CmdWindow->Read -- Error";
28772665
28782666 result = rval;
29072695 }
29082696
29092697
2910 //====================>>> e2CmdWindow::CmdWrite <<<====================
29112698 int e2CmdWindow::CmdWrite(int type, bool verify)
29122699 {
29132700 int result = OK;
29222709 {
29232710 if (verbose != verboseNo)
29242711 {
2925 QMessageBox note(QMessageBox::Warning, "Write", translate(STR_NOTHINGWRITE), QMessageBox::Close);
2712 QMessageBox note(QMessageBox::Warning, "Write", translate(STR_NOTHINGWRITE), QMessageBox::Ok);
29262713
29272714 note.setStyleSheet(programStyleSheet);
2928 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
2715 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
29292716 note.exec();
29302717 }
29312718
29852772
29862773 if (rval > 0) //23/10/1999
29872774 {
2988 //Aggiunto il 01/10/98
29892775 first_line = 0;
2990 // curIndex = 0;
2991 // EK 2017
2992 // TODO
29932776 Draw();
29942777
29952778 if (GetDevSize() == 0)
29962779 {
29972780 QString sp;
2998 // sp = GetEEPTypeString(awip->GetEEPPriType(), awip->GetEEPSubType());
2781 //sp = GetEEPTypeString(awip->GetEEPPriType(), awip->GetEEPSubType());
29992782 sp = GetEEPTypeString(awip->GetEEPId());
3000 // qDebug() << "CmdWrite" << awip->GetEEPPriType() << awip->GetEEPSubType() << sp;
2783 //qDebug() << "CmdWrite" << awip->GetEEPPriType() << awip->GetEEPSubType() << sp;
30012784 UpdateStrFromStr(sp);
30022785 }
30032786
30042787 awip->RecalcCRC();
3005 //---
3006
30072788 UpdateStatusBar();
30082789
30092790 if (verbose == verboseAll)
30102791 {
3011 QMessageBox note(QMessageBox::Information, "Write", translate(STR_MSGWRITEOK), QMessageBox::Close);
2792 QMessageBox note(QMessageBox::Information, "Write", translate(STR_MSGWRITEOK), QMessageBox::Ok);
30122793 note.setStyleSheet(programStyleSheet);
3013 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
3014 //
2794 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
30152795 note.exec();
30162796 }
30172797 }
30192799 {
30202800 if (verbose != verboseNo)
30212801 {
3022 QMessageBox note(QMessageBox::Warning, "Write", translate(STR_MSGWRITEFAIL), QMessageBox::Close);
2802 QMessageBox note(QMessageBox::Warning, "Write", translate(STR_MSGWRITEFAIL), QMessageBox::Ok);
30232803 note.setStyleSheet(programStyleSheet);
3024 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
3025 //
2804 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
30262805 note.exec();
30272806 }
30282807
30752854 return result;
30762855 }
30772856
3078 //====================>>> e2CmdWindow::CmdReadCalibration <<<====================
30792857 int e2CmdWindow::CmdReadCalibration(int idx)
30802858 {
30812859 ClearIgnoreFlag();
30932871 long loc;
30942872 int size;
30952873 bool mtype;
2874 bool enabled;
30962875
30972876 loc = 0;
30982877 size = 1;
30992878 mtype = false;
3100 E2Profile::GetCalibrationAddress(loc, size, mtype);
2879 enabled = false;
2880
2881 E2Profile::GetCalibrationAddress(enabled, loc, size, mtype);
31012882
31022883 if (mtype)
31032884 {
31082889
31092890 if (rval >= 0)
31102891 {
3111 if ((size > 0 && size <= 4) &&
2892 if (enabled && (size > 0 && size <= 4) &&
31122893 (loc + size <= awip->GetBufSize())
31132894 )
31142895 {
31282909 QString str;
31292910 str = translate(STR_MSGREADCALIBOK) + QString().sprintf(": 0x%02X (%d)", rval, rval);
31302911
3131 QMessageBox note(QMessageBox::Information, "Calibration", str, QMessageBox::Close);
2912 QMessageBox note(QMessageBox::Information, "Calibration", str, QMessageBox::Ok);
31322913 note.setStyleSheet(programStyleSheet);
3133 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
2914 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
31342915 note.exec();
31352916 }
31362917 }
31932974 return result;
31942975 }
31952976
3196 //====================>>> e2CmdWindow::CmdErase <<<====================
31972977 int e2CmdWindow::CmdErase(int type)
31982978 {
31992979 ClearIgnoreFlag();
32192999
32203000 if (verbose == verboseAll)
32213001 {
3222 QMessageBox note(QMessageBox::Information, "Warning", translate(STR_MSGERASEOK), QMessageBox::Close);
3002 QMessageBox note(QMessageBox::Information, "Warning", translate(STR_MSGERASEOK), QMessageBox::Ok);
32233003
32243004 note.setStyleSheet(programStyleSheet);
3225 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
3005 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
32263006 note.exec();
32273007 }
32283008 }
32653045 return result;
32663046 }
32673047
3268 //====================>>> e2CmdWindow::CmdVerify <<<====================
32693048 int e2CmdWindow::CmdVerify(int type)
32703049 {
32713050 int result = OK;
32743053 {
32753054 if (verbose != verboseNo)
32763055 {
3277 QMessageBox note(QMessageBox::Information, "Warning", translate(STR_NOTHINGVERIFY), QMessageBox::Close);
3056 QMessageBox note(QMessageBox::Information, "Warning", translate(STR_NOTHINGVERIFY), QMessageBox::Ok);
32783057 note.setStyleSheet(programStyleSheet);
3279 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
3058 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
32803059 note.exec();
32813060 }
32823061
33163095
33173096 if (verbose == verboseAll)
33183097 {
3319 QMessageBox note(QMessageBox::Information, "Verify", translate(STR_MSGVERIFYOK), QMessageBox::Close);
3098 QMessageBox note(QMessageBox::Information, "Verify", translate(STR_MSGVERIFYOK), QMessageBox::Ok);
33203099 note.setStyleSheet(programStyleSheet);
3321 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
3100 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
33223101 note.exec();
33233102 }
33243103 }
33273106 return result;
33283107 }
33293108
3330 //====================>>> e2CmdWindow::CmdProgram <<<====================
33313109 int e2CmdWindow::CmdProgram()
33323110 {
33333111 int result = OK;
33943172
33953173 if (result == OK)
33963174 {
3397
3398
33993175 if (verbose == verboseAll)
34003176 {
3401 QMessageBox note(QMessageBox::Information, "Program", translate(STR_MSGPROGRAMOK), QMessageBox::Close);
3177 QMessageBox note(QMessageBox::Information, "Program", translate(STR_MSGPROGRAMOK), QMessageBox::Ok);
34023178 note.setStyleSheet(programStyleSheet);
3403 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
3179 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
34043180 note.exec();
34053181 }
34063182 }
34073183 else
34083184 {
3409
3410
34113185 if (verbose != verboseNo)
34123186 {
34133187 QString str;
35893363 return CMD_SCRIPTERROR;
35903364 }
35913365
3592 //====================>>> e2CmdWindow::CmdRunScript <<<====================
35933366 int e2CmdWindow::CmdRunScript(bool test_mode)
35943367 {
35953368 int result = OK;
36833456 }
36843457 }
36853458
3686 if (ok && !FileExist(lst.at(1)))
3459 if (ok && !QFile::exists(lst.at(1)))
36873460 {
36883461 ok = false;
36893462 result = ScriptError(linecounter, 1, lst.at(1), translate(STR_MSGFILENOTFOUND));
37193492 }
37203493 }
37213494
3722 if (ok && !FileExist(lst.at(1)))
3495 if (ok && !QFile::exists(lst.at(1)))
37233496 {
37243497 ok = false;
37253498 result = ScriptError(linecounter, 1, lst.at(1), translate(STR_MSGFILENOTFOUND));
37553528 }
37563529 }
37573530
3758 if (ok && !FileExist(lst.at(1)))
3531 if (ok && !QFile::exists(lst.at(1)))
37593532 {
37603533 ok = false;
37613534 result = ScriptError(linecounter, 1, lst.at(1), translate(STR_MSGFILENOTFOUND));
42444017 long start = 0;
42454018 int size = 1;
42464019 bool mtype = false;
4247 E2Profile::GetCalibrationAddress(start, size, mtype);
4020 bool enabled = false;
4021 E2Profile::GetCalibrationAddress(enabled, start, size, mtype);
42484022
42494023 int osc_index = 0;
42504024 bool ok = true;
42674041
42684042 if (ok && !test_mode)
42694043 {
4270 E2Profile::SetCalibrationAddress(start, size, mtype);
4044 E2Profile::SetCalibrationAddress(enabled, start, size, mtype);
42714045 }
42724046
42734047 if (ok && n >= 4)
44914265 {
44924266 if (verbose == verboseAll)
44934267 {
4494 QMessageBox note(QMessageBox::Information, "Script information", translate(STR_MSGPROGRAMOK), QMessageBox::Close);
4268 QMessageBox note(QMessageBox::Information, "Script information", translate(STR_MSGPROGRAMOK), QMessageBox::Ok);
44954269 note.setStyleSheet(programStyleSheet);
4496 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
4270 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
44974271 note.exec();
44984272 }
44994273 }
45014275 {
45024276 if (verbose == verboseAll)
45034277 {
4504 QMessageBox note(QMessageBox::Warning, "Script information", translate(STR_OPABORTED), QMessageBox::Close);
4278 QMessageBox note(QMessageBox::Warning, "Script information", translate(STR_OPABORTED), QMessageBox::Ok);
45054279 note.setStyleSheet(programStyleSheet);
4506 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
4280 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
45074281 note.exec();
45084282 }
45094283 }
45364310 return result;
45374311 }
45384312
4539 //====================>>> e2CmdWindow::CmdGetInfo <<<====================
45404313 int e2CmdWindow::CmdGetInfo()
45414314 {
45424315 long fsize, esize, tsize;
46044377
46054378 if (verbose == verboseAll)
46064379 {
4607 QMessageBox note;
4608 note.setIcon(QMessageBox::Warning);
4380 QMessageBox note(QMessageBox::Warning, "Reset", translate(STR_MSGDEVRESET), QMessageBox::Ok);
46094381 note.setStyleSheet(programStyleSheet);
4610 note.setWindowTitle("Reset");
4611 note.setText(translate(STR_MSGDEVRESET));
4612 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
4382 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
46134383 note.exec();
46144384 }
46154385
46164386 return OK;
46174387 }
46184388
4619 //====================>>> e2CmdWindow::CmdDoubleSize <<<====================
46204389 int e2CmdWindow::CmdDoubleSize()
46214390 {
46224391 if (!awip->IsBufferValid())
46234392 {
4624 QMessageBox note(QMessageBox::Warning, "Double size", translate(STR_BUFEMPTY), QMessageBox::Close);
4393 QMessageBox note(QMessageBox::Warning, "Double size", translate(STR_BUFEMPTY), QMessageBox::Ok);
46254394 note.setStyleSheet(programStyleSheet);
4626 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
4395 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
46274396 note.exec();
46284397 }
46294398 else
46494418 return OK;
46504419 }
46514420
4652 //====================>>> e2CmdWindow::CmdSetDeviceType <<<====================
46534421 int e2CmdWindow::CmdSetDeviceType(int val)
46544422 {
46554423 long new_type = CbxIdToType(val, 0);
46604428 return CmdSelectDevice(new_type);
46614429 }
46624430
4663 //====================>>> e2CmdWindow::CmdSetDeviceSubType <<<====================
46644431 int e2CmdWindow::CmdSetDeviceSubType(int val)
46654432 {
46664433 int v1 = cbxEEPType->currentIndex();
46714438 return CmdSelectDevice(new_type);
46724439 }
46734440
4674 //====================>>> e2CmdWindow::CmdOpen <<<====================
46754441 int e2CmdWindow::CmdOpen(int type, const QString &fname, long relocation, int clear_buffer)
46764442 {
46774443 int result = OK;
47124478 return result;
47134479 }
47144480
4715 //====================>>> e2CmdWindow::CmdClearBuf <<<====================
47164481 int e2CmdWindow::CmdClearBuf(int type)
47174482 {
47184483 //awip->FillBuffer();
47264491
47274492 // EK 2017
47284493 // TODO to check this
4729 //====================>>> e2CmdWindow::CmdFillBuf <<<====================
47304494 int e2CmdWindow::CmdFillBuf()
47314495 {
47324496 static long fromAddr = 0, toAddr = 0xFFFF;
47334497 static int val = 0xFF;
47344498
4735 FillDialog e2Fill(this, fromAddr, toAddr, val, awip->GetBufSize(), translate(STR_MSGINSPARAM));
4499 FillDialog e2Fill(this, fromAddr, toAddr, val, awip->GetBufSize()/*, translate(STR_MSGINSPARAM)*/);
47364500
47374501 if (e2Fill.exec() == QDialog::Accepted)
47384502 {
47604524 return OK;
47614525 }
47624526
4763 //====================>>> e2CmdWindow::SpecialBits <<<====================
47644527 int e2CmdWindow::SpecialBits(bool readonly)
47654528 {
47664529 //int rval;
48324595
48334596 // EK 2017
48344597 // TODO ???
4835 //====================>>> e2CmdWindow::ProgramOptions <<<====================
48364598 int e2CmdWindow::ProgramOptions()
48374599 {
48384600 // int rval;
48684630 return OK;
48694631 }
48704632
4871 //==================>>> e2CmdWindow::SerialNumberOptions <<<=======================
48724633 int e2CmdWindow::SerialNumberOptions()
48734634 {
48744635 SerNumDialog dlg(this) ; //, loc, memtype, autoinc, fmt, size, val);
48774638 return OK;
48784639 }
48794640
4880 //==================>>> e2CmdWindow::OscCalibOption <<<=======================
48814641 int e2CmdWindow::OscCalibOption()
48824642 {
48834643 OscCalibDialog dlg(this, awip);
48874647 }
48884648
48894649
4890 //====================>>> e2CmdWindow::CmdReadSecurity <<<====================
48914650 int e2CmdWindow::CmdReadSecurity(bool display_dialog)
48924651 {
48934652 int result;
49074666 return result;
49084667 }
49094668
4910 //====================>>> e2CmdWindow::CmdWriteSecurity <<<====================
49114669 int e2CmdWindow::CmdWriteSecurity()
49124670 {
49134671 int result;
49364694 return result;
49374695 }
49384696
4939 //====================>>> e2CmdWindow::CmdWriteLock <<<====================
49404697 int e2CmdWindow::CmdWriteLock()
49414698 {
49424699 int result = OK;
50494806 return result;
50504807 }
50514808
5052 //====================>>> e2CmdWindow::CmdReadLock <<<====================
50534809 int e2CmdWindow::CmdReadLock()
50544810 {
50554811 int result = OK;
51184874 return result;
51194875 }
51204876
5121 //====================>>> e2CmdWindow::CmdReadSpecial <<<====================
51224877 int e2CmdWindow::CmdReadSpecial()
51234878 {
51244879 int result = OK;
51894944 }
51904945
51914946 // TODO E2464
5192 //====================>>> e2CmdWindow::CmdWriteSpecial <<<====================
51934947 int e2CmdWindow::CmdWriteSpecial()
51944948 {
51954949 int result = OK;
52965050 return result;
52975051 }
52985052
5299 //====================>>> e2CmdWindow::CmdByteSwap <<<====================
53005053 int e2CmdWindow::CmdByteSwap()
53015054 {
53025055 int result = OK;
53075060
53085061 if (verbose != verboseNo)
53095062 {
5310 QMessageBox note(QMessageBox::Information, "Byte swap", translate(STR_BUFEMPTY), QMessageBox::Close);
5063 QMessageBox note(QMessageBox::Information, "Byte swap", translate(STR_BUFEMPTY), QMessageBox::Ok);
53115064 note.setStyleSheet(programStyleSheet);
5312 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
5065 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
53135066 note.exec();
53145067 }
53155068 }
53275080
53285081 // EK 2017
53295082 // TODO check this
5330 //====================>>> e2CmdWindow::CmdEditNote <<<====================
53315083 int e2CmdWindow::CmdEditNote()
53325084 {
53335085 QString str1 = awip->GetStringID();
53455097 return OK;
53465098 }
53475099
5348 //====================>>> e2CmdWindow::CmdSelectDevice <<<====================
53495100 // EK 2017
53505101 // new_type is the chip id
53515102 int e2CmdWindow::CmdSelectDevice(long new_type, bool init)
53685119 if (new_type != old_type)
53695120 {
53705121 awip->SetEEProm(new_type);
5371 UpdateMenuType(new_type, old_type);
5122 UpdateMenuType(new_type/*, old_type*/);
53725123
53735124 first_line = 0;
53745125 //curIndex = 0;
53845135 }
53855136
53865137 /**
5387 //==================>>> e2CmdWindow::CmdRemoteMode <<<=======================
53885138 void e2CmdWindow::CmdRemoteMode()
53895139 {
53905140 VerboseType old_verbose = verbose;
54035153 }
54045154 **/
54055155
5406 //==================>>> e2CmdWindow::CmdSetSerialNumber <<<=======================
54075156 int e2CmdWindow::CmdSetSerialNumber()
54085157 {
54095158 long loc = 0;
54835232 return OK;
54845233 }
54855234
5486 //===================>>> e2CmdWindow::GetDevSize <<<=========================
54875235 long e2CmdWindow::GetDevSize() const
54885236 {
54895237 return awip->GetSize() == AUTOSIZE_ID ? 0 : awip->GetSize();
54905238 }
54915239
5492 //===================>>> e2CmdWindow::IsBufChanged <<<=========================
54935240 int e2CmdWindow::IsBufChanged() const
54945241 {
54955242 return awip->IsBufChanged();
54965243 }
54975244
5498 //==================>>> e2CmdWindow::UpdateStatusBar <<<=======================
54995245 void e2CmdWindow::UpdateStatusBar()
55005246 {
55015247 //int is_splitted = awip->GetSplittedInfo() > 0 && awip->GetSplittedInfo() != awip->GetSize();
55045250 {
55055251 return;
55065252 }
5507
55085253
55095254 lblStringID->setText(" ");
55105255
55205265
55215266
55225267 /**
5523 //==================>>> e2CmdWindow::SetChipSubType <<<=======================
55245268 void e2CmdWindow::SetChipSubType(int pritype, int subtype)
55255269 {
55265270 long type = BuildE2PType(pritype, subtype);
55625306 **/
55635307
55645308 /**
5565 //==================>>> e2CmdWindow::UpdateChipType <<<=======================
55665309 void e2CmdWindow::UpdateChipType(int pritype, int subtype)
55675310 {
55685311 if (pritype < 0)
56515394 if (deviceMenu[t].info.count())
56525395 {
56535396 new_id = deviceMenu[t].info.at(0).id;
5397 if (currentAct != NULL)
5398 {
5399 currentAct->setChecked(false);
5400 }
56545401 }
56555402
56565403 CmdSelectDevice(new_id);
56805427 CmdSelectDevice(new_id);
56815428 }
56825429
5683
5684 menuToGroup *e2CmdWindow::searchMenuInDeviceVector(int type)
5430 // not in using
5431 #if 0
5432 menuToGroup *e2CmdWindow::searchMenuInDeviceVector(int pre_type)
56855433 {
56865434 menuToGroup *pM = NULL;
56875435
56895437 {
56905438 menuToGroup *mTmp = (menuToGroup *)&deviceMenu.at(i);
56915439
5692 for (int t = 0; t < (*mTmp).type.count(); t++)
5693 {
5694 if ((*mTmp).type.at(t) == type)
5440 for (int t = 0; t < (*mTmp).pre_type.count(); t++)
5441 {
5442 if ((*mTmp).pre_type.at(t) == pre_type)
56955443 {
56965444 pM = mTmp;
56975445
57025450
57035451 return NULL;
57045452 }
5705
5706
5707 //==================>>> e2CmdWindow::UpdateMenuType <<<=======================
5708 void e2CmdWindow::UpdateMenuType(long new_type, long old_type)
5709 {
5710 Q_CHECK_PTR(cbxEEPType);
5711 Q_CHECK_PTR(cbxEEPSubType);
5712
5453 #endif
5454
5455 void e2CmdWindow::UpdateMenues(menuToGroup &mnu, QAction &act)
5456 {
5457 if (currentMenu != &mnu || currentAct != &act) // main menu was changed
5458 {
5459 Q_CHECK_PTR(cbxEEPType);
5460 Q_CHECK_PTR(cbxEEPSubType);
5461
5462 if (currentAct != NULL)
5463 {
5464 currentAct->setChecked(false);
5465 }
5466
5467 // qDebug() << mnu.title << act.text();
5468 selectTypeSubtype(mnu.title, act.text());
5469
5470 act.setChecked(true);
5471
5472 currentAct = &act;
5473 }
5474 }
5475
5476
5477 void e2CmdWindow::UpdateMenuType(long new_type)
5478 {
57135479 if (new_type == 0)
57145480 {
57155481 new_type = awip->GetEEPId();
57165482 }
57175483
5718 // reset checkboxes
5719 static menuToGroup *m = 0;
5720
5721 int pre_pritype = GetE2PPriType(old_type);
5722 int pre_subtype = GetE2PSubType(old_type);
5723
57245484 int new_pritype = GetE2PPriType(new_type);
5725 int new_subtype = GetE2PSubType(new_type);
5726
5727 qDebug() << "UpdateMenuType New: " << new_pritype << new_subtype << " Old: " << pre_pritype << pre_subtype;
5728
5729 disconnect(cbxEEPSubType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevSubType(int)));
5730
5731 // new main type selected, rebuild the subtype list
5732 if ((pre_pritype == -1) || (pre_pritype != new_pritype))
5733 {
5734 cbxEEPSubType->clear();
5735 QStringList l;
5736
5737 if (new_type >= 0)
5738 {
5739 m = searchMenuInDeviceVector(new_pritype);
5740
5741 if (m != NULL)
5742 {
5743 disconnect(cbxEEPType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevType(int)));
5744 QString nmMenu = m->mnu->title();
5745 QString n = nmMenu.remove("&");
5746 int nt = cbxEEPType->findText(n);
5747 cbxEEPType->setCurrentIndex(nt);
5748 connect(cbxEEPType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevType(int)));
5749
5750 for (int i = 0; i < (*m).info.count(); i++)
5751 {
5752 l << (*m).info.at(i).name;
5753 }
5754 }
5755 }
5756
5757 if (l.count())
5758 {
5759 cbxEEPSubType->addItems(l);
5760 }
5761 else
5762 {
5763 qDebug() << "something is wrong with search" << new_type;
5764 return;
5765 }
5766 }
5767
5768 connect(cbxEEPSubType, SIGNAL(currentIndexChanged(int)), this, SLOT(onDevSubType(int)));
5769
5770 if (m == 0)
5771 {
5772 qDebug() << "pointer m not found" << new_type;
5773 return;
5774 }
5775
5776 if (new_subtype >= 0)
5777 {
5778 for (int i = 0; i < (*m).info.count(); i++)
5779 {
5780 chipInfo c = (*m).info.at(i);
5781
5782 if (c.id == new_type)
5783 {
5784 cbxEEPSubType->setCurrentIndex(i);
5485
5486 qDebug() << Q_FUNC_INFO << " (hex) type:" << (hex) << new_type << " pri:" << new_pritype << (dec);
5487
5488 menuToGroup *newMenu = NULL;
5489 QAction *newAct = NULL;
5490
5491 foreach (menuToGroup m, deviceMenu)
5492 {
5493 for (int n = 0; n < m.pre_type.count(); n++)
5494 {
5495 if (m.pre_type.at(n) != new_pritype)
5496 {
5497 continue;
5498 }
5499
5500 for (int j = 0; j < m.info.count(); j++)
5501 {
5502 if (m.info.at(j).id == new_type)
5503 {
5504 newMenu = &m;
5505
5506 newAct = m.grp->actions().at(j);
5507
5508 break;
5509 }
5510
5511 if (newAct != NULL)
5512 {
5513 break;
5514 }
5515 }
5516
5517 if (newAct != NULL)
5518 {
57855519 break;
57865520 }
57875521 }
5788 }
5789
5790
5791
5792 // uncheck the old item
5793 if (pre_pritype >= 0)
5794 {
5795 menuToGroup *mOld = searchMenuInDeviceVector(pre_pritype);
5796
5797 if (mOld != NULL)
5798 {
5799 QList<QAction *> aLst = (*mOld).grp->actions();
5800
5801 if (pre_subtype >= 0)
5802 {
5803 for (int im = 0; im < (*mOld).info.count(); im++)
5804 {
5805 if ((*mOld).info.at(im).id == old_type)
5806 {
5807 aLst.at(im)->setChecked(false);
5808 break;
5809 }
5810 }
5811 }
5812 }
5813 }
5814
5815 // now update radiobutton
5816 if (new_pritype >= 0)
5817 {
5818 QList<QAction *> aLst = (*m).grp->actions();
5819
5820 if (new_subtype >= 0)
5821 {
5822 for (int im = 0; im < (*m).info.count(); im++)
5823 {
5824 if ((*m).info.at(im).id == new_type)
5825 {
5826 aLst.at(im)->setChecked(true);
5827 break;
5828 }
5829 }
5830 }
5831 }
5522
5523 if (newAct != NULL)
5524 {
5525 break;
5526 }
5527 }
5528
5529 UpdateMenues(*newMenu, *newAct);
58325530
58335531 // EK 2017
58345532 // it's not possible to hide the actions, or?
59325630 QStringList lst;
59335631
59345632 //generic
5935 for (int i = 0; i < deviceMenu.count(); i++)
5936 {
5937 lst << deviceMenu.at(i).mnu->title();
5938 }
5633 foreach (menuToGroup m, deviceMenu)
5634 {
5635 lst << m.title;
5636 }
5637 // for (int i = 0; i < deviceMenu.count(); i++)
5638 // {
5639 // lst << deviceMenu.at(i).mnu->title();
5640 // }
59395641
59405642 if (lst.count())
59415643 {
59425644 cbxEEPType->addItems(lst);
59435645 cbxEEPType->setCurrentIndex(0);
5646
5647 currentMenu = (menuToGroup *)&deviceMenu.at(0);
59445648 }
59455649
59465650 //UpdateMenuType();
59505654 // EditMenu[2].checked = 0;
59515655 }
59525656
5953 //==================>>> e2CmdWindow::UpdateStrFromBuf <<<=======================
59545657 void e2CmdWindow::UpdateStrFromBuf()
59555658 {
59565659 QString s;
59705673 }
59715674 }
59725675
5973 //==================>>> e2CmdWindow::UpdateStrFromStr <<<=======================
59745676 void e2CmdWindow::UpdateStrFromStr(const QString &s1, const QString &s2)
59755677 {
59765678 if (s1.length())
59875689 }
59885690
59895691
5990 HIDDEN QStringList script_filter = QStringList({ "Script Files (*.e2s)", "All Files (*)" });
5991 // HIDDEN int script_filterIndex = 0;
5692 static QStringList script_filter = QStringList({ "Script Files (*.e2s)", "All Files (*)" });
5693 //static int script_filterIndex = 0;
59925694
59935695 int e2CmdWindow::OpenScript(const QString &file)
59945696 {
60045706 else
60055707 {
60065708 QString fltr = convertFilterListToString(script_filter);
6007 QString open_path = QDir::homePath(); //TODO: load from settings E2Profile::GetLastScriptPath();
5709 QString open_path("");
5710 QStringList l = E2Profile::GetLastScripts();
5711 if (l.count() > 0)
5712 {
5713 open_path = QFileInfo(l.at(0)).canonicalPath();
5714 }
5715 if (open_path.length() == 0)
5716 {
5717 open_path = QDir::homePath();
5718 }
60085719
60095720 fileName = QFileDialog::getOpenFileName(this, translate(STR_MSGOPENSCRIPT), open_path, fltr);
60105721 }
60125723
60135724 if (fileName.length() > 0)
60145725 {
6015 if (FileExist(fileName))
5726 if (QFile::exists(fileName))
60165727 {
60175728 QString oldname = script_name;
60185729
60315742 {
60325743 QMessageBox note(QMessageBox::Warning, "Open script", translate(STR_MSGFILENOTFOUND), QMessageBox::Yes);
60335744 note.setStyleSheet(programStyleSheet);
6034 // note.setWindowTitle("Open script");
6035 // note.setText(translate(STR_MSGFILENOTFOUND));
60365745 note.setButtonText(QMessageBox::Yes, translate(STR_YES));
60375746 note.exec();
60385747 }
60495758 }
60505759
60515760
6052 HIDDEN QStringList filter = QStringList({ "*.e2p", "*.hex", "*.mot", "*.bin", "*.csm", "*.rom", "*.eep", "*" });
5761 static QStringList filter = QStringList({ "*.e2p", "*.hex", "*.mot", "*.bin", "*.csm", "*" });
60535762 // ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^
60545763 // form E2P form Intel form S-rec, form Binary (Raw), CSM, gli altri non aggiungono ulteriori formati
6055 HIDDEN QStringList filterInfo = QStringList({ "E2P (*.e2p)", "Intel (*.hex)", "S-rec (*.mot)", "Raw (*.bin)", "CSM (*.csm)", "(*.rom)", "(*.eep)", "*" });
6056
6057 HIDDEN int filterIndex = 0;
6058
6059 HIDDEN void AddExtension(QString &name)
5764 static QStringList filterInfo = QStringList({ "E2P files (*.e2p)", "Intel hex files (*.hex)", "S-rec mot files (*.mot)", "Binary files (*.bin)", "CSM (*.csm)", "No filter (*)" });
5765
5766 static int filterIndex = 0;
5767
5768 static void AddExtension(QString &name)
60605769 {
60615770 int p = name.lastIndexOf('.'); //look for extension
60625771
60675776 }
60685777 }
60695778
6070 HIDDEN bool CmpExtension(const QString &name, const QString &ext)
5779 static bool CmpExtension(const QString &name, const QString &ext)
60715780 {
60725781 if ((name.length() > 0) && (ext.length() > 0))
60735782 {
60855794 return false;
60865795 }
60875796
6088 //====================>>> e2CmdWindow::OpenFile <<<====================
60895797 int e2CmdWindow::OpenFile(const QString &file)
60905798 {
60915799 QString fileName;
61275835
61285836 if (fileName.length() > 0)
61295837 {
6130 if (FileExist(fileName))
5838 if (QFile::exists(fileName))
61315839 {
61325840 QString oldfname = awip->GetFileName();
61335841 awip->SetFileName(fileName);
6134 long old_type = awip->GetEEPId(); //EEP type can be changed by E2P file load
5842 //long old_type = awip->GetEEPId(); //EEP type can be changed by E2P file load
61355843
61365844 rval = awip->Load();
61375845
61545862 UpdateStrFromBuf();
61555863
61565864 //UpdateChipType();
6157 UpdateMenuType(awip->GetEEPId(), old_type);
5865 UpdateMenuType(awip->GetEEPId()/*, old_type*/);
61585866
61595867 first_line = 0;
61605868 //curIndex = 0;
62145922 }
62155923
62165924
6217
6218 //====================>>> e2CmdWindow::SaveFile <<<====================
62195925 int e2CmdWindow::SaveFile(int force_select)
62205926 {
62215927 int err = 0;
63336039
63346040 void e2CmdWindow::UpdateScriptMenu()
63356041 {
6336 // QString sp;
6337
63386042 if (!scriptMode)
63396043 {
63406044 disconnect(scrListgrp, SIGNAL(triggered(QAction *)), this, SLOT(onSelectScript(QAction *)));
63586062
63596063 scrptsMenu->addAction(tmpAction);
63606064 scrListgrp->addAction(tmpAction);
6065
6066 tmpAction->setIconText(fname);
63616067 }
63626068 }
63636069
64226128
64236129 filesMenu->addAction(tmpAction);
64246130 fileListgrp->addAction(tmpAction);
6131
6132 tmpAction->setIconText(e); //make sure icontext is equal to text
64256133
64266134 if (stype == "PROG")
64276135 {
65176225 //Update the buffer with edit changes
65186226 void e2CmdWindow::UpdateBuffer()
65196227 {
6228 bool flag1 = false, flag2 = false;
6229
65206230 if (e2HexEdit->isModified())
65216231 {
65226232 const char *ptr = e2HexEdit->data().constData();
6523 memcpy(awip->GetBufPtr(), ptr, awip->GetSize());
6233 memcpy(awip->GetBufPtr(), ptr, e2HexEdit->data().length());
6234 //memcpy(awip->GetBufPtr(), ptr, awip->GetSize());
6235 flag1 = true;
6236 }
6237 if (e2HexEditSplit->isModified())
6238 {
6239 Q_ASSERT(awip->GetSplittedInfo() > 0);
6240
6241 const char *ptr = e2HexEditSplit->data().constData();
6242 long ofst = awip->GetSplittedInfo();
6243 memcpy(awip->GetBufPtr() + ofst, ptr, e2HexEditSplit->data().length());
6244 flag1 = true;
6245 }
6246
6247 if (flag1 || flag2)
6248 {
65246249 awip->BufChanged();
65256250 Draw();
65266251 }
65286253
65296254 void e2CmdWindow::Draw()
65306255 {
6531 if (awip == 0)
6256 if (awip == 0 || !awip->IsBufferValid())
65326257 {
65336258 return; // ** Vlib 1.22 call Draw before the AppWinInfo is created ** 28/08/99
65346259 }
65356260
6536 if (!awip->IsBufferValid()) // ** 01/05/1998 **
6537 {
6538 return;
6539 }
6540
6541 qbuf->setData(reinterpret_cast<char *>(awip->GetBufPtr()), awip->GetSize());
6542 // dev.open();
6543 // dev.read(reinterpret_cast<char*>(awip->GetBufPtr()), awip->GetBufSize());
6544
6545 // QByteArray databuf = QByteArray(reinterpret_cast<char*>(awip->GetBufPtr()), awip->GetBufSize());
6546 // qDebug() << databuf;
6547 e2HexEdit->setData(*qbuf);
6548 // dev.close();
6261 if (awip->GetSplittedInfo() > 0)
6262 {
6263 e2HexEdit->setHexFontColor(Qt::darkGreen);
6264 qbuf->setData(reinterpret_cast<char *>(awip->GetBufPtr()), awip->GetSplittedInfo());
6265 e2HexEdit->setData(*qbuf);
6266
6267 qDebug() << Q_FUNC_INFO << "Datalen: " << e2HexEdit->data().length() << " Splitted: " << awip->GetSplittedInfo() << " Size: " << awip->GetSize();
6268
6269 char *ptr = reinterpret_cast<char *>(awip->GetBufPtr());
6270 long ofst = awip->GetSplittedInfo();
6271 long len = awip->GetSize() - ofst;
6272 ptr += ofst;
6273
6274 qbufSplit->setData(ptr, len);
6275 e2HexEditSplit->setData(*qbufSplit);
6276 e2HexEditSplit->show();
6277
6278 qDebug() << Q_FUNC_INFO << "Datalen: " << e2HexEditSplit->data().length() << " Offset: " << ofst << " Len: " << len;
6279 }
6280 else
6281 {
6282 e2HexEdit->setHexFontColor(Qt::darkBlue);
6283 qbuf->setData(reinterpret_cast<char *>(awip->GetBufPtr()), awip->GetSize());
6284 e2HexEdit->setData(*qbuf);
6285 e2HexEditSplit->hide();
6286 }
65496287 #if 0
65506288 int no_line;
65516289 int new_top, new_shown;
66556393
66566394 if (E2Profile::GetBogoMips() == 0)
66576395 {
6658 QMessageBox note(QMessageBox::Information, "Calibration", translate(STR_MSGNEEDCALIB), QMessageBox::Close);
6396 QMessageBox note(QMessageBox::Information, "Calibration", translate(STR_MSGNEEDCALIB), QMessageBox::Ok);
66596397 note.setStyleSheet(programStyleSheet);
6660 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
6398 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
66616399 note.exec();
66626400 }
66636401
66646402 if (E2Profile::GetPortNumber() < 0)
66656403 {
6666 QMessageBox note(QMessageBox::Information, "Setup", translate(STR_MSGNEEDSETUP), QMessageBox::Close);
6404 QMessageBox note(QMessageBox::Information, "Setup", translate(STR_MSGNEEDSETUP), QMessageBox::Ok);
66676405 note.setStyleSheet(programStyleSheet);
6668 note.setButtonText(QMessageBox::Close, translate(STR_CLOSE));
6406 note.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
66696407 note.exec();
66706408 }
66716409 }
66736411 // EK 2017
66746412 // TODO to check this
66756413 // TODO QPainter convert to QTextDocument ??
6676 //====================>>> e2CmdWindow::Print <<<====================
66776414 void e2CmdWindow::Print()
66786415 {
66796416 int no_line = (awip->GetSize() + awip->GetHexPerLine() - 1) / awip->GetHexPerLine();
67316468 }
67326469 }
67336470
6734
6735 HIDDEN int FileExist(const QString &name)
6736 {
6737 return QFile::exists(name);
6738 }
6739
6740
67416471 bool e2CmdWindow::GetAbortFlag()
67426472 {
67436473 qApp->processEvents();
67686498 }
67696499
67706500 //Update the progress bar
6771 //=====================>>> e2App::SetProgress <<<==============================
67726501 void e2CmdWindow::SetProgress(int progress)
67736502 {
67746503 // EK 2017
67906519
67916520 void e2CmdWindow::SetAppBusy()
67926521 {
6793 qDebug() << "SetAppBusy()";
6522 qDebug() << Q_FUNC_INFO;
67946523 app_status = AppBusy;
67956524 // EK 2017
67966525 // TODO
67996528
68006529 void e2CmdWindow::SetAppReady()
68016530 {
6802 qDebug() << "SetAppReady()";
6531 qDebug() << Q_FUNC_INFO;
68036532 app_status = AppReady;
68046533 // EK 2017
68056534 // TODO
68086537
68096538 void e2CmdWindow::Exit()
68106539 {
6811 // This is called to close all windows.
6812
6813 qDebug() << "e2App::Exit()";
6540 qDebug() << Q_FUNC_INFO;
68146541
68156542 if (!IsAppReady())
68166543 {
6817 //06/09/99
68186544 SetAbortFlag();
68196545 //SendWindowCommandAll(idCloseAllDialog, 0, C_Button);
68206546 //CheckEvents();
68256551 {
68266552 if (!scriptMode)
68276553 {
6828 qDebug() << "e2App::CloseAppWin()";
6829
68306554 if (IsBufChanged())
68316555 {
68326556 QMessageBox msgBox(QMessageBox::Warning, "PonyProg", translate(STR_MSGCLOSEWINSAVE),
68436567 }
68446568 }
68456569
6846 // EK 2017
6847 // TODO now is the winCounter deactivated
6848 //if (winCounter > 1 || exit_ok)
6849 //{
6850 // really_close = true;
6851 //}
6852 //else
6853 //{
6854 // int ret = QMessageBox::warning(this, "PonyProg",
6855 // translate(STR_MSGCLOSEWINEXIT),
6856 // QMessageBox::Yes | QMessageBox::No);
6857 // if ( ret == QMessageBox::Yes )
6858 // {
6859 // really_close = true;
6860 // }
6861 //}
6862 }
6863
6864 qApp->quit();
6865 }
6866 }
6570 E2Profile::saveSplitter(splitter);
6571 E2Profile::writeDialogSettings(this, false);
6572 E2Profile::sync();
6573 }
6574 }
6575 }
6576
6577 void e2CmdWindow::on_actionPreferences_triggered()
6578 {
6579 if (IsAppReady())
6580 {
6581 PrefDialog prefDlg(this, translate(STR_PREFERENCES));
6582
6583 prefDlg.exec();
6584 }
6585 }
4747 #include <QMenu>
4848 #include <QVector>
4949 #include <QFont>
50
50 #include <QSplitter>
5151
5252 #include "device.h"
5353 #include "Translator.h"
6363 struct menuToGroup
6464 {
6565 QMenu *mnu;
66 QString title;
67 QString filter;
6668 QActionGroup *grp;
6769 // vector of main type
68 QVector <int> type;
70 QVector <int> pre_type;
6971 // copy of chipInfo
7072 QVector<chipInfo> info;
7173 };
8890 {
8991 Q_OBJECT
9092
91 public: //---------------------------------------- public
93 public:
9294 e2CmdWindow(QWidget *parent = 0);
9395 virtual ~e2CmdWindow();
9496 // virtual int CloseAppWin();
201203 void onSetSerialNumber();
202204 void onClearBuf();
203205 void onEditNote();
204 void onReadCalibration(int idx);
205 void onWriteCalibration(int idx);
206 void onReadCalibration();
206207 void onReadSecurity(bool display_dialog);
207208 //void onWriteSecurity();
208209 void onFillBuf();
215216 void onDevType(int i);
216217 void onDevSubType(int i);
217218
218 // EK 2017: slots for signals from group actions
219 void onSelectI2C8(QAction *a);
220 void onSelectI2C16(QAction *a);
221 void onSelectI2CAT17(QAction *a);
222 void onSelectMW16(QAction *a);
223 void onSelectMW8(QAction *a);
224 void onSelectSPI(QAction *a);
225 void onSelectAVR(QAction *a);
226 void onSelectAT89S(QAction *a);
227 void onSelectPIC16(QAction *a);
228 void onSelectPIC12(QAction *a);
229 void onSelectImBus(QAction *a);
230 void onSelectSDE2506(QAction *a);
231 void onSelectX244(QAction *a);
219 // EK 2017: slot for signals from group actions
220 void onSelectChip(QAction *a);
232221
233222 //void onEndProgress();
234223
242231 void onSelectFile(QAction *a);
243232 void onDtaChanged();
244233
234 void on_actionPreferences_triggered();
235
245236 public:
246237 int CmdHelp();
247238
248239 protected:
249240 //void CmdRemoteMode();
241 void closeEvent(QCloseEvent *event) override;
250242
251243 private:
252244 //All commands
295287 void reateToolBarNotice();
296288 void createStatusWidgets();
297289
298 int findItemInMenuVector(const QString &n);
299
300 void initMenuVector(menuToGroup *vecMnu);
290 //int findItemInMenuVector(const QString &n);
291
292 void addMenuVector(menuToGroup *vecMnu, const QString &filter = "");
301293
302294 bool readLangDir();
303295 bool getLangTable();
307299 void createScriptList();
308300 void createFileList();
309301
310
311 private: //--------------------------------------- private
302 private:
312303 void createSignalSlotConnections();
313304 QString convertFilterListToString(const QStringList &lst);
314305 int filterNameToIndex(const QString &s, const QStringList &lst);
318309 void Draw(/*int rows = 0, int cols = 0*/);
319310 void UpdateBuffer();
320311
321 menuToGroup *searchMenuInDeviceVector(int new_type);
312 // menuToGroup *searchMenuInDeviceVector(int new_type);
322313
323314 void createDeviceMenues();
324315 void addI2C8Struct();
344335
345336 // void UpdateChipType(int pritype = -1, int subtype = -1);
346337 // void SetChipSubType(int pritype, int subtype = 0);
347 void UpdateMenuType(long new_type = 0, long old_type = 0);
338 void UpdateMenues(menuToGroup &grp, QAction &act);
339 void UpdateMenuType(long new_type = 0/*, long old_type = 0*/);
348340 void UpdateFileMenu();
349341 void UpdateScriptMenu();
350342
366358
367359 // int CoordToIndex(int row, int col);
368360 // void IndexToCoord(int index, int &row, int &col);
369 void setMenuIndexes();
361 // void setMenuIndexes();
370362 void selectTypeSubtype(const QString &t, const QString &st);
371363 int ScriptError(int line_number, int arg_index, const QString &s, const QString msg = "");
372364
373365
374366 private:
375 int idxI2Cbus8;
376 int idxI2Cbus16;
377 int idxI2CbusAT17;
378 int idxMicroWire16;
379 int idxMicroWire8;
380 int idxSPI;
381 int idxAVR;
382 int idxAT89S;
383 int idxPIC16;
384 int idxPIC12;
385 int idxImBus;
386 int idxSDE2506;
387 int idxX244;
388
389367 QString selectedLang;
390368
391369 QFont sysFont;
401379 QComboBox *cbxEEPSubType;
402380 QLabel *lblEEPInfo;
403381 QLabel *lblStringID;
382
383 menuToGroup *currentMenu;
384 QAction *currentAct;
404385
405386 QLineEdit *txtEEPInfo;
406387 QLineEdit *txtStringID;
424405
425406 // Standard elements
426407 QHexEdit *e2HexEdit; // For the canvas
408 QHexEdit *e2HexEditSplit;
427409 QBuffer *qbuf;
410 QBuffer *qbufSplit;
411 QSplitter *splitter;
428412
429413 QProgressDialog *e2Prg;
430414
2828 #include <QCheckBox>
2929 #include <QStringList>
3030 #include <QDebug>
31 #include <QComboBox>
3132
3233 #include "e2dlg.h"
3334 #include "e2cmdw.h"
3435 #include "eeptypes.h"
3536 #include "types.h"
3637 #include "i2cbus.h"
38 #include "interfconv.h"
3739
3840 class e2CmdWindow;
3941
40 //=========================>>> e2Dialog::e2Dialog <<<====================
4142 e2Dialog::e2Dialog(QWidget *bw, const QString title)
4243 : QDialog(bw),
44 port_no(-1),
4345 lpt_no(2),
44 com_no(3)
46 com_no(3),
47 usb_no(0),
48 gpio_no(0),
49 usb_vp(0),
50 interf_type(SIPROG_API)
4551 {
4652 setupUi(this);
47
4853 setWindowTitle(title);
4954
5055 e2CmdWindow *cmdw = static_cast<e2CmdWindow *>(bw);
5459 setStyleSheet(cmdw->getStyleSheet());
5560 }
5661
57 qDebug() << "e2Dialog::e2Dialog()";
58
59 setWidgetsText();
60
61 connect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
62 connect(rdbLptPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
63
64 connect(cbxInterfCOM, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectCOM(int)));
65 connect(cbxInterfLPT, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectLPT(int)));
66
67 connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
62 setWidgetsText(); //NB Must be called before getSettings()
63
64 //connect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
65 //connect(rdbLptPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
66
67 //connect(cbxInterfCOM, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectCOM(int)));
68 //connect(cbxInterfLPT, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectLPT(int)));
69
70 //connect(cbxInterfCOMNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectCOMNum(int)));
6871
6972 connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
7073 connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
7174 connect(pushTest, SIGNAL(clicked(bool)), this, SLOT(onTest()));
7275
76 connect(&watcher, SIGNAL(notify(bool, quint16, quint16)),
77 this, SLOT(onUSB(bool, quint16, quint16)));
7378
7479 getSettings();
7580 }
7681
77
78 //======================>>> e2Dialog::~e2Dialog <<<======================
79 e2Dialog::~e2Dialog()
80 {
81 qDebug() << "e2Dialog::~e2Dialog()";
82 }
83
84 extern HInterfaceType VindexToInterfType(int vector, int index);
85
86 void e2Dialog::onSelectLPT(int i)
87 {
88 interf_type = VindexToInterfType(1, i);
89 qDebug() << "IntefType: " << (int)interf_type << ", index = " << i << ", LPT";
90 // interf_type = (HInterfaceType)(i + 3);
91 }
92
93
94 void e2Dialog::onSelectCOM(int i)
95 {
96 interf_type = VindexToInterfType(0, i);
97 qDebug() << "IntefType: " << (int)interf_type << ", index = " << i << ", COM";
98 // interf_type = (HInterfaceType)i;
99 }
100
101
102 void e2Dialog::onSelectNum(int i)
103 {
104 if (rdbLptPort->isChecked() == true)
105 {
106 lpt_no = i;
107 port_no = lpt_no;
108 qDebug() << "LPT port " << port_no;
109 }
110 else
111 {
112 com_no = i;
113 port_no = com_no;
114 qDebug() << "COM port " << port_no;
115 }
116 }
117
118 void e2Dialog::onChangePort(bool b)
119 {
120 if (b)
121 {
122 QRadioButton *s = static_cast<QRadioButton *>(sender());
123 //bool state = s->isChecked();
124
125 //disconnect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
126 //disconnect(rdbLptPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
127
128 if (s == rdbComPort)
129 {
130 qDebug() << "COM Port selected";
131
132 cbxInterfCOM->setEnabled(true);
133 cbxInterfLPT->setEnabled(false);
134
135 disconnect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
136 cbxInterfNum->clear();
137 cbxInterfNum->addItems(comList);
138 connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
139
140 port_no = com_no;
141 cbxInterfNum->setCurrentIndex(com_no);
142
143 interf_type = VindexToInterfType(0, cbxInterfCOM->currentIndex());
144 }
145 else
146 {
147 qDebug() << "LPT Port selected";
148
149 cbxInterfCOM->setEnabled(false);
150 cbxInterfLPT->setEnabled(true);
151
152 disconnect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
153 cbxInterfNum->clear();
154 cbxInterfNum->addItems(lptList);
155 connect(cbxInterfNum, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectNum(int)));
156
157 port_no = lpt_no;
158 cbxInterfNum->setCurrentIndex(lpt_no);
159
160 interf_type = VindexToInterfType(1, cbxInterfLPT->currentIndex());
161 }
162
163 //connect(rdbComPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
164 //connect(rdbLptPort, SIGNAL(toggled(bool)), this, SLOT(onChangePort(bool)));
165 }
166 }
167
168 extern int TypeToInterfVector(HInterfaceType type);
169 extern int TypeToInterfIndex(HInterfaceType type);
170
17182 void e2Dialog::getSettings()
17283 {
84 E2Profile::readDialogSettings(this);
85
17386 interf_type = cmdWin->GetInterfaceType();
17487
17588 if (interf_type < SIPROG_API || interf_type >= LAST_HT)
17992
18093 port_no = cmdWin->GetPort();
18194
182 // init of radiobuttons
183 if (TypeToInterfVector(interf_type) == 0) //COM
184 {
185 cbxInterfCOM->setCurrentIndex(TypeToInterfIndex(interf_type));
186 cbxInterfLPT->setCurrentIndex(0);
187
95 if (TypeToInterfVector(interf_type) == INTERF_COM) //COM
96 {
18897 com_no = port_no;
189 rdbComPort->setChecked(true);
190
191 if (com_no >= cbxInterfNum->count())
98 if (com_no >= comList.count())
19299 {
193100 com_no = 0;
194101 port_no = 0;
195102 }
196
197 cbxInterfNum->setCurrentIndex(com_no);
198 }
199 else
200 {
201 cbxInterfLPT->setCurrentIndex(TypeToInterfIndex(interf_type));
202 cbxInterfCOM->setCurrentIndex(0);
203
103 cbxInterfCOMNum->setCurrentIndex(com_no);
104 cbxInterfCOM->setCurrentIndex(TypeToInterfIndex(interf_type));
105
106 if (tabWidget->currentIndex() != INTERF_COM)
107 {
108 tabWidget->setCurrentIndex(INTERF_COM);
109 }
110 else
111 {
112 on_tabWidget_currentChanged(INTERF_COM);
113 }
114 ckControlOutCOM->setChecked((cmdWin->GetPolarity() & RESETINV) ? true : false);
115 ckClockOutCOM->setChecked((cmdWin->GetPolarity() & CLOCKINV) ? true : false);
116 ckDataInCOM->setChecked((cmdWin->GetPolarity() & DININV) ? true : false);
117 ckDataOutCOM->setChecked((cmdWin->GetPolarity() & DOUTINV) ? true : false);
118 }
119 else if (TypeToInterfVector(interf_type) == INTERF_LPT)
120 {
204121 lpt_no = port_no;
205 rdbLptPort->setChecked(true);
206
207 if (lpt_no >= cbxInterfNum->count())
122 if (lpt_no >= lptList.count())
208123 {
209124 lpt_no = 0;
210125 port_no = 0;
211126 }
212
213 cbxInterfNum->setCurrentIndex(lpt_no);
214 }
215
216 chkPol1->setChecked((cmdWin->GetPolarity() & RESETINV) ? 1 : 0);
217 chkPol2->setChecked((cmdWin->GetPolarity() & CLOCKINV) ? 1 : 0);
218 chkPol3->setChecked((cmdWin->GetPolarity() & DININV) ? 1 : 0);
219 chkPol4->setChecked((cmdWin->GetPolarity() & DOUTINV) ? 1 : 0);
127 cbxInterfLPTNum->setCurrentIndex(lpt_no);
128 cbxInterfLPT->setCurrentIndex(TypeToInterfIndex(interf_type));
129
130 if (tabWidget->currentIndex() != INTERF_LPT)
131 {
132 tabWidget->setCurrentIndex(INTERF_LPT);
133 }
134 else
135 {
136 on_tabWidget_currentChanged(INTERF_LPT);
137 }
138 ckControlOutLPT->setChecked((cmdWin->GetPolarity() & RESETINV) ? true : false);
139 ckClockOutLPT->setChecked((cmdWin->GetPolarity() & CLOCKINV) ? true : false);
140 ckDataInLPT->setChecked((cmdWin->GetPolarity() & DININV) ? true : false);
141 ckDataOutLPT->setChecked((cmdWin->GetPolarity() & DOUTINV) ? true : false);
142 //ckPowerOnLPT->setChecked((cmdWin->GetPolarity() & POWERINV) ? true : false);
143 //ckEnaODLPT->setChecked((cmdWin->GetPolarity() & ENBUSINV) ? true : false);
144 ckClockInLPT->setChecked((cmdWin->GetPolarity() & CLOCKININV) ? true : false);
145 //ckControlInLPT->setChecked((cmdWin->GetPolarity() & CTRLININV) ? true : false);
146 }
147 else if (TypeToInterfVector(interf_type) == INTERF_USB)
148 {
149 usb_no = port_no;
150 //usb_vp = TypeToInterfVidPid(interf_type);
151 //watcher.hotplug_register(usb_vp.vid, usb_vp.pid);
152 //usbList = MpsseInterface::find_all(usb_vp.vid, usb_vp.pid);
153
154 cbxInterfUSB->setCurrentIndex(TypeToInterfIndex(interf_type));
155 cbxInterfUSBNum->setCurrentIndex(usb_no);
156
157 if (tabWidget->currentIndex() != INTERF_USB)
158 {
159 tabWidget->setCurrentIndex(INTERF_USB);
160 }
161 else
162 {
163 on_tabWidget_currentChanged(INTERF_USB);
164 }
165 ckControlOutUSB->setChecked((cmdWin->GetPolarity() & RESETINV) ? true : false);
166 ckClockOutUSB->setChecked((cmdWin->GetPolarity() & CLOCKINV) ? true : false);
167 ckDataInUSB->setChecked((cmdWin->GetPolarity() & DININV) ? true : false);
168 ckDataOutUSB->setChecked((cmdWin->GetPolarity() & DOUTINV) ? true : false);
169 ckPowerOnUSB->setChecked((cmdWin->GetPolarity() & POWERINV) ? true : false);
170 ckEnaODUSB->setChecked((cmdWin->GetPolarity() & ENBUSINV) ? true : false);
171 ckClockInUSB->setChecked((cmdWin->GetPolarity() & CLOCKININV) ? true : false);
172 ckControlInUSB->setChecked((cmdWin->GetPolarity() & CTRLININV) ? true : false);
173 }
174 else if (TypeToInterfVector(interf_type) == INTERF_GPIO)
175 {
176 gpio_no = port_no;
177 if (gpio_no >= gpioList.count())
178 {
179 gpio_no = 0;
180 port_no = 0;
181 }
182 cbxInterfGPIONum->setCurrentIndex(gpio_no);
183 cbxInterfGPIO->setCurrentIndex(TypeToInterfIndex(interf_type));
184
185 if (tabWidget->currentIndex() != INTERF_GPIO)
186 {
187 tabWidget->setCurrentIndex(INTERF_GPIO);
188 }
189 else
190 {
191 on_tabWidget_currentChanged(INTERF_GPIO);
192 }
193 ckControlOutGPIO->setChecked((cmdWin->GetPolarity() & RESETINV) ? true : false);
194 ckClockOutGPIO->setChecked((cmdWin->GetPolarity() & CLOCKINV) ? true : false);
195 ckDataInGPIO->setChecked((cmdWin->GetPolarity() & DININV) ? true : false);
196 ckDataOutGPIO->setChecked((cmdWin->GetPolarity() & DOUTINV) ? true : false);
197 ckPowerOnGPIO->setChecked((cmdWin->GetPolarity() & POWERINV) ? true : false);
198 ckEnaODGPIO->setChecked((cmdWin->GetPolarity() & ENBUSINV) ? true : false);
199 ckClockInGPIO->setChecked((cmdWin->GetPolarity() & CLOCKININV) ? true : false);
200 ckControlInGPIO->setChecked((cmdWin->GetPolarity() & CTRLININV) ? true : false);
201 }
202
203 //TODO: A way to detect if run on RaspberryPi
204 //if (QSysInfo::currentCpuArchitecture().startsWith("arm"))
205 cbxInterfGPIONum->setEnabled(false);
220206 }
221207
222208 void e2Dialog::setSettings()
223209 {
224 // *** Add code to process dialog values here
225 if (chkPol1->isChecked())
226 {
227 cmdWin->SetPolarity(cmdWin->GetPolarity() | (uint8_t)RESETINV);
228 }
229 else
230 {
231 cmdWin->SetPolarity(cmdWin->GetPolarity() & (uint8_t)~RESETINV);
232 }
233
234 if (chkPol2->isChecked())
235 {
236 cmdWin->SetPolarity(cmdWin->GetPolarity() | (uint8_t)CLOCKINV);
237 }
238 else
239 {
240 cmdWin->SetPolarity(cmdWin->GetPolarity() & (uint8_t)~CLOCKINV);
241 }
242
243 if (chkPol3->isChecked())
244 {
245 cmdWin->SetPolarity(cmdWin->GetPolarity() | (uint8_t)DININV);
246 }
247 else
248 {
249 cmdWin->SetPolarity(cmdWin->GetPolarity() & (uint8_t)~DININV);
250 }
251
252 if (chkPol4->isChecked())
253 {
254 cmdWin->SetPolarity(cmdWin->GetPolarity() | (uint8_t)DOUTINV);
255 }
256 else
257 {
258 cmdWin->SetPolarity(cmdWin->GetPolarity() & (uint8_t)~DOUTINV);
259 }
210 E2Profile::writeDialogSettings(this);
211 InterfPins pins = {-1, -1, -1, -1, -1, -1, -1, -1};
212
213 unsigned int pol = 0;
214 switch (TypeToInterfVector(interf_type))
215 {
216 case INTERF_COM:
217 if (ckControlOutCOM->isChecked())
218 {
219 pol |= RESETINV;
220 }
221 if (ckClockOutCOM->isChecked())
222 {
223 pol |= CLOCKINV;
224 }
225 if (ckDataInCOM->isChecked())
226 {
227 pol |= DININV;
228 }
229 if (ckDataOutCOM->isChecked())
230 {
231 pol |= DOUTINV;
232 }
233 break;
234 case INTERF_LPT:
235 if (ckControlOutLPT->isChecked())
236 {
237 pol |= RESETINV;
238 }
239 if (ckClockOutLPT->isChecked())
240 {
241 pol |= CLOCKINV;
242 }
243 if (ckDataInLPT->isChecked())
244 {
245 pol |= DININV;
246 }
247 if (ckDataOutLPT->isChecked())
248 {
249 pol |= DOUTINV;
250 }
251 if (ckClockInLPT->isChecked())
252 {
253 pol |= CLOCKININV;
254 }
255 break;
256 case INTERF_USB:
257 if (ckControlOutUSB->isChecked())
258 {
259 pol |= RESETINV;
260 }
261 if (ckClockOutUSB->isChecked())
262 {
263 pol |= CLOCKINV;
264 }
265 if (ckDataInUSB->isChecked())
266 {
267 pol |= DININV;
268 }
269 if (ckDataOutUSB->isChecked())
270 {
271 pol |= DOUTINV;
272 }
273 if (ckPowerOnUSB->isChecked())
274 {
275 pol |= POWERINV;
276 }
277 if (ckEnaODUSB->isChecked())
278 {
279 pol |= ENBUSINV;
280 }
281 if (ckClockInUSB->isChecked())
282 {
283 pol |= CLOCKININV;
284 }
285 if (ckControlInUSB->isChecked())
286 {
287 pol |= CTRLININV;
288 }
289
290 //Set pins configuration
291 pins.clock = cbxClockOutUSB->currentIndex();
292 pins.ctrl = cbxControlOutUSB->currentIndex();
293 pins.datain = cbxDataInUSB->currentIndex();
294 pins.dataout = cbxDataOutUSB->currentIndex();
295
296 pins.clockin = cbxClockInUSB->currentIndex();
297 pins.ctrlin = cbxControlInUSB->currentIndex();
298 pins.enbus = cbxEnaODUSB->currentIndex();
299 pins.poweron = cbxPowerOnUSB->currentIndex();
300
301 E2Profile::SetInterfacePins(interf_type, pins);
302 break;
303 case INTERF_GPIO:
304 if (ckControlOutGPIO->isChecked())
305 {
306 pol |= RESETINV;
307 }
308 if (ckClockOutGPIO->isChecked())
309 {
310 pol |= CLOCKINV;
311 }
312 if (ckDataInGPIO->isChecked())
313 {
314 pol |= DININV;
315 }
316 if (ckDataOutGPIO->isChecked())
317 {
318 pol |= DOUTINV;
319 }
320 if (ckPowerOnGPIO->isChecked())
321 {
322 pol |= POWERINV;
323 }
324 if (ckEnaODGPIO->isChecked())
325 {
326 pol |= ENBUSINV;
327 }
328 if (ckClockInGPIO->isChecked())
329 {
330 pol |= CLOCKININV;
331 }
332 if (ckControlInGPIO->isChecked())
333 {
334 pol |= CTRLININV;
335 }
336
337 pins.clock = cbxClockOutGPIO->currentIndex();
338 pins.ctrl = cbxControlOutGPIO->currentIndex();
339 pins.datain = cbxDataInGPIO->currentIndex();
340 pins.dataout = cbxDataOutGPIO->currentIndex();
341
342 pins.clockin = cbxClockInGPIO->currentIndex();
343 pins.ctrlin = cbxControlInGPIO->currentIndex();
344 pins.enbus = cbxEnaODGPIO->currentIndex();
345 pins.poweron = cbxPowerOnGPIO->currentIndex();
346
347 E2Profile::SetInterfacePins(interf_type, pins);
348 break;
349 }
350 cmdWin->SetPolarity(pol);
260351
261352 if (interf_type != cmdWin->GetInterfaceType())
262353 {
263354 cmdWin->ClosePort();
264355 cmdWin->SetInterfaceType(interf_type);
265356 }
357 else
358 {
359 cmdWin->GetInterfPtr()->ConfigPins(pins);
360 }
361
266362 cmdWin->SetPort(port_no);
267363
268364 //Store values in the INI file
269365 E2Profile::SetParInterfType(interf_type);
270366 E2Profile::SetPortNumber(port_no);
271 E2Profile::SetPolarityControl(cmdWin->GetPolarity());
367 E2Profile::SetPolarityLines(cmdWin->GetPolarity());
272368
273369 qDebug() << "PortNo: " << port_no;
274370 }
275371
276 extern QStringList GetInterfList(int vector);
372 static QStringList generatePinList(int min, int max)
373 {
374 QStringList pinList;
375
376 Q_ASSERT(min <= max);
377
378 for (int k = min; k <= max; k++)
379 {
380 pinList << QString::number(k);
381 }
382
383 return pinList;
384 }
385
386 #define GPIO_PIN_MAX 31 //may be 27 for RaspberryPi
387 #define USB_PIN_MAX 15 //0-7 for ADBUS, 8-15 for ACBUS
277388
278389 void e2Dialog::setWidgetsText()
279390 {
280 //Serial interfaces list
281 QStringList interfListC = GetInterfList(0);
282 cbxInterfCOM->addItems(interfListC);
283
284 //Parallel interfaces list
285 QStringList interfListL = GetInterfList(1);
286 cbxInterfLPT->addItems(interfListL);
287
288 rdbComPort->setText(translate(STR_LBLSERIAL));
289 rdbLptPort->setText(translate(STR_LBLPARALLEL));
391 #ifndef Q_OS_LINUX
392 //remove the tab on system different from Linux
393 tabWidget->removeTab(INTERF_GPIO);
394 #endif
395 //recurseCbxHide(groupBoxUSBPol);
396 recurseCbxHide(groupBoxCOMPol); //No pin select on legacy COM
397 recurseCbxHide(groupBoxLPTPol); //No pin select on legacy LPT
398 //recurseCbxHide(groupBoxGPIOPol);
399
400 QStringList pinlist = generatePinList(0, GPIO_PIN_MAX);
401 cbxClockOutGPIO->addItems(pinlist);
402 cbxDataOutGPIO->addItems(pinlist);
403 cbxDataInGPIO->addItems(pinlist);
404 cbxControlOutGPIO->addItems(pinlist);
405
406 cbxClockInGPIO->addItems(pinlist);
407 cbxControlInGPIO->addItems(pinlist);
408 cbxEnaODGPIO->addItems(pinlist);
409 cbxPowerOnGPIO->addItems(pinlist);
410
411 pinlist = generatePinList(0, USB_PIN_MAX);
412 cbxClockOutUSB->addItems(pinlist);
413 cbxDataOutUSB->addItems(pinlist);
414 cbxDataInUSB->addItems(pinlist);
415 cbxControlOutUSB->addItems(pinlist);
416
417 cbxClockInUSB->addItems(pinlist);
418 cbxControlInUSB->addItems(pinlist);
419 cbxEnaODUSB->addItems(pinlist);
420 cbxPowerOnUSB->addItems(pinlist);
421
422 cbxInterfCOM->addItems(GetInterfList(INTERF_COM));
423 cbxInterfLPT->addItems(GetInterfList(INTERF_LPT));
424 cbxInterfUSB->addItems(GetInterfList(INTERF_USB));
425 cbxInterfGPIO->addItems(GetInterfList(INTERF_GPIO));
426
427 //rdbComPort->setText(translate(STR_LBLSERIAL));
428 //rdbLptPort->setText(translate(STR_LBLPARALLEL));
290429
291430 lptList = E2Profile::GetLPTDevList();
292431 comList = E2Profile::GetCOMDevList();
293
294 lblPol1->setText(translate(STR_LBLSELPOLARITY));
295
296 chkPol1->setText(translate(STR_LBLINVRESET));
297 chkPol2->setText(translate(STR_LBLINVSCK));
298 chkPol3->setText(translate(STR_LBLINVDATAIN));
299 chkPol4->setText(translate(STR_LBLINVDATAOUT));
432 usbList.clear();
433 gpioList = QString("0 1 2 3 4 5 6 7").split(' ');
434
435 cbxInterfCOMNum->clear();
436 cbxInterfCOMNum->addItems(comList);
437 //Check valid com ports
438 interf_type = SIPROG_API;
439 port_no = -1;
440 for (const auto &i : comList)
441 {
442 qDebug() << "comList " << i;
443
444 QString devname = E2Profile::GetCOMDevName();
445 QString s = i;
446 if (s.startsWith(devname))
447 {
448 int n = s.midRef(devname.length()).toString().toInt();
449 #ifdef Q_OS_WIN32
450 n--;
451 #endif
452 if (n >= 0 && Test(n, true) != OK)
453 {
454 //comList.removeOne(s);
455 cbxInterfCOMNum->setItemData(n, QColor(Qt::lightGray), Qt::BackgroundRole);
456 }
457 }
458 }
459
460 cbxInterfLPTNum->clear();
461 cbxInterfLPTNum->addItems(lptList);
462 //Check valid com ports
463 #ifdef Q_OS_WIN32
464 interf_type = AVRISP_IO;
465 #else
466 interf_type = AVRISP;
467 #endif
468 port_no = -1;
469 for (const auto &i : lptList)
470 {
471 qDebug() << "lptList " << i;
472
473 QString devname = E2Profile::GetLPTDevName();
474 QString s = i;
475 if (s.startsWith(devname))
476 {
477 int n = s.midRef(devname.length()).toString().toInt();
478 #ifdef Q_OS_WIN32
479 n--;
480 #endif
481 if (n >= 0 && Test(n, true) != OK)
482 {
483 cbxInterfLPTNum->setItemData(n, QColor(Qt::lightGray), Qt::BackgroundRole);
484 }
485 }
486 }
487
488
489 cbxInterfUSBNum->clear();
490 cbxInterfUSBNum->addItems(usbList);
491 cbxInterfGPIONum->clear();
492 cbxInterfGPIONum->addItems(gpioList);
493
494 groupBoxCOMPol->setTitle(translate(STR_LBLSELPOLARITY));
495 groupBoxLPTPol->setTitle(translate(STR_LBLSELPOLARITY));
496 groupBoxUSBPol->setTitle(translate(STR_LBLSELPOLARITY));
497 groupBoxGPIOPol->setTitle(translate(STR_LBLSELPOLARITY));
498
499 ckControlOutCOM->setToolTip(translate(STR_LBLINVRESET));
500 ckControlOutLPT->setToolTip(translate(STR_LBLINVRESET));
501 ckControlOutUSB->setToolTip(translate(STR_LBLINVRESET));
502 ckControlOutGPIO->setToolTip(translate(STR_LBLINVRESET));
503
504 ckClockOutCOM->setToolTip(translate(STR_LBLINVSCK));
505 ckClockOutLPT->setToolTip(translate(STR_LBLINVSCK));
506 ckClockOutUSB->setToolTip(translate(STR_LBLINVSCK));
507 ckClockOutGPIO->setToolTip(translate(STR_LBLINVSCK));
508
509 ckDataInCOM->setToolTip(translate(STR_LBLINVDATAIN));
510 ckDataInLPT->setToolTip(translate(STR_LBLINVDATAIN));
511 ckDataInUSB->setToolTip(translate(STR_LBLINVDATAIN));
512 ckDataInGPIO->setToolTip(translate(STR_LBLINVDATAIN));
513
514 ckDataOutCOM->setToolTip(translate(STR_LBLINVDATAOUT));
515 ckDataOutLPT->setToolTip(translate(STR_LBLINVDATAOUT));
516 ckDataOutUSB->setToolTip(translate(STR_LBLINVDATAOUT));
517 ckDataOutGPIO->setToolTip(translate(STR_LBLINVDATAOUT));
518
519 cbxControlOutGPIO->setToolTip("Select Control-Out Pin");
520 cbxClockOutGPIO->setToolTip("Select Clock-Out Pin");
521 cbxDataOutGPIO->setToolTip("Select Data-Out Pin");
522 cbxDataInGPIO->setToolTip("Select Data-In Pin");
523
524 cbxControlOutUSB->setToolTip("Select Control-Out Pin");
525 cbxClockOutUSB->setToolTip("Select Clock-Out Pin");
526 cbxDataOutUSB->setToolTip("Select Data-Out Pin");
527 cbxDataInUSB->setToolTip("Select Data-In Pin");
528
529 //lblPol1->setText(translate(STR_LBLSELPOLARITY));
530
531 //chkPol1->setText(translate(STR_LBLINVRESET));
532 //chkPol2->setText(translate(STR_LBLINVSCK));
533 //chkPol3->setText(translate(STR_LBLINVDATAIN));
534 //chkPol4->setText(translate(STR_LBLINVDATAOUT));
300535
301536 pushOk->setText(translate(STR_BTNOK));
302537 pushTest->setText(translate(STR_BTNPROBE));
317552
318553 if (test)
319554 {
320 QMessageBox msgBox(QMessageBox::Critical, "Failed", translate(STR_TEST) + " " + translate(STR_MSGFAILED), QMessageBox::Ok);
555 QString extraMsg = "";
556 if (test == E2ERR_IOTEST)
557 {
558 if (cmdWin->GetInterfaceType() == PONYPROG_FT)
559 extraMsg = "\nBe sure the VTarget is on (check J3)";
560 }
561 QMessageBox msgBox(QMessageBox::Critical, "Failed", translate(STR_TEST) + " " + translate(STR_MSGFAILED) + extraMsg, QMessageBox::Ok);
321562 msgBox.setStyleSheet(cmdWin->getStyleSheet());
322563 msgBox.setButtonText(QMessageBox::Ok, translate(STR_CLOSE));
323564 msgBox.exec();
363604 return test;
364605 }
365606
607 void e2Dialog::on_tabWidget_currentChanged(int index)
608 {
609 if (index == INTERF_COM)
610 {
611 qDebug() << "COM Port selected: " << com_no;
612
613 port_no = com_no;
614 cbxInterfCOMNum->setCurrentIndex(com_no);
615
616 interf_type = VindexToInterfType(INTERF_COM, cbxInterfCOM->currentIndex());
617 }
618 else if (index == INTERF_LPT)
619 {
620 qDebug() << "LPT Port selected: " << lpt_no;
621
622 port_no = lpt_no;
623 cbxInterfLPTNum->setCurrentIndex(lpt_no);
624
625 interf_type = VindexToInterfType(INTERF_LPT, cbxInterfLPT->currentIndex());
626 }
627 else if (index == INTERF_USB)
628 {
629 qDebug() << "USB Port selected: " << usb_no;
630
631 //usb_vp = TypeToInterfVidPid(interf_type);
632 //watcher.hotplug_register(usb_vp.vid, usb_vp.pid);
633 //usbList = MpsseInterface::find_all(usb_vp.vid, usb_vp.pid);
634
635 int idx = cbxInterfUSB->currentIndex();
636 on_cbxInterfUSB_currentIndexChanged(idx);
637 port_no = usb_no;
638 cbxInterfUSBNum->setCurrentIndex(port_no);
639
640 //Get pins configuration
641 InterfPins pins = E2Profile::GetInterfacePins(interf_type);
642
643 cbxClockOutUSB->setCurrentIndex(pins.clock);
644 cbxControlOutUSB->setCurrentIndex(pins.ctrl);
645 cbxDataInUSB->setCurrentIndex(pins.datain);
646 cbxDataOutUSB->setCurrentIndex(pins.dataout);
647
648 cbxClockInUSB->setCurrentIndex(pins.clockin);
649 cbxControlInUSB->setCurrentIndex(pins.ctrlin);
650 cbxEnaODUSB->setCurrentIndex(pins.enbus);
651 cbxPowerOnUSB->setCurrentIndex(pins.poweron);
652 }
653 else if (index == INTERF_GPIO)
654 {
655 qDebug() << "GPIO Port selected: " << gpio_no;
656
657 port_no = gpio_no;
658 cbxInterfGPIONum->setCurrentIndex(gpio_no);
659
660 interf_type = VindexToInterfType(INTERF_GPIO, cbxInterfGPIO->currentIndex());
661
662 //Get pins configuration
663 InterfPins pins = E2Profile::GetInterfacePins(interf_type);
664
665 cbxClockOutGPIO->setCurrentIndex(pins.clock);
666 cbxControlOutGPIO->setCurrentIndex(pins.ctrl);
667 cbxDataInGPIO->setCurrentIndex(pins.datain);
668 cbxDataOutGPIO->setCurrentIndex(pins.dataout);
669
670 cbxClockInGPIO->setCurrentIndex(pins.clockin);
671 cbxControlInGPIO->setCurrentIndex(pins.ctrlin);
672 cbxEnaODGPIO->setCurrentIndex(pins.enbus);
673 cbxPowerOnGPIO->setCurrentIndex(pins.poweron);
674 }
675 }
676
677 void e2Dialog::on_cbxInterfCOM_currentIndexChanged(int index)
678 {
679 interf_type = VindexToInterfType(INTERF_COM, index);
680 qDebug() << "Selected IntefType: " << (int)interf_type << ", index = " << index << ", COM";
681 }
682
683 void e2Dialog::on_cbxInterfLPT_currentIndexChanged(int index)
684 {
685 interf_type = VindexToInterfType(INTERF_LPT, index);
686 qDebug() << "Selected IntefType: " << (int)interf_type << ", index = " << index << ", LPT";
687 }
688
689 void e2Dialog::on_cbxInterfUSB_currentIndexChanged(int index)
690 {
691 interf_type = VindexToInterfType(INTERF_USB, index);
692 qDebug() << "Selected IntefType: " << (int)interf_type << ", index = " << index << ", USB";
693 usb_vp = TypeToInterfVidPid(interf_type);
694 watcher.hotplug_register(usb_vp.vid, usb_vp.pid);
695 usbList = MpsseInterface::find_all(usb_vp.vid, usb_vp.pid);
696 cbxInterfUSBNum->clear();
697 cbxInterfUSBNum->addItems(usbList);
698 }
699
700 void e2Dialog::on_cbxInterfGPIO_currentIndexChanged(int index)
701 {
702 interf_type = VindexToInterfType(INTERF_GPIO, index);
703 qDebug() << "Selected IntefType: " << (int)interf_type << ", index = " << index << ", GPIO";
704 }
705
706 void e2Dialog::on_cbxInterfCOMNum_currentIndexChanged(int index)
707 {
708 if (index >= 0)
709 {
710 port_no = com_no = index;
711 qDebug() << "Selected COM port " << port_no;
712 }
713 }
714
715 void e2Dialog::on_cbxInterfLPTNum_currentIndexChanged(int index)
716 {
717 if (index >= 0)
718 {
719 port_no = lpt_no = index;
720 qDebug() << "Selected LPT port " << port_no;
721 }
722 }
723
724 void e2Dialog::on_cbxInterfUSBNum_currentIndexChanged(int index)
725 {
726 if (index >= 0)
727 {
728 port_no = usb_no = index;
729 qDebug() << Q_FUNC_INFO << "Selected USB port " << port_no;
730 }
731 }
732
733 void e2Dialog::on_cbxInterfGPIONum_currentIndexChanged(int index)
734 {
735 if (index >= 0)
736 {
737 port_no = gpio_no = index;
738 qDebug() << Q_FUNC_INFO << "Selected GPIO port " << port_no;
739 }
740 }
741
742 void e2Dialog::onUSB(bool connected, quint16 vid, quint16 pid)
743 {
744 qDebug() << Q_FUNC_INFO << " " << connected << " " << vid << " " << pid;
745
746 usbList.clear();
747 usbList = MpsseInterface::find_all(usb_vp.vid, usb_vp.pid);
748 cbxInterfUSBNum->clear();
749 cbxInterfUSBNum->addItems(usbList);
750 }
751
752 void e2Dialog::on_pushDefaultsUSB_clicked()
753 {
754 ckControlOutUSB->setChecked(false);
755 ckClockOutUSB->setChecked(false);
756 ckDataInUSB->setChecked(false);
757 ckDataOutUSB->setChecked(false);
758 ckPowerOnUSB->setChecked(false);
759 ckEnaODUSB->setChecked(false);
760 ckClockInUSB->setChecked(false);
761 ckControlInUSB->setChecked(false);
762
763 InterfPins dpins; //default pins
764 if (!TypeToInterfPins(interf_type, dpins))
765 {
766 qWarning() << Q_FUNC_INFO << " TypeToInterfPins(" << interf_type << ") Failed";
767 }
768 cbxClockOutUSB->setCurrentIndex(dpins.clock);
769 cbxControlOutUSB->setCurrentIndex(dpins.ctrl);
770 cbxDataInUSB->setCurrentIndex(dpins.datain);
771 cbxDataOutUSB->setCurrentIndex(dpins.dataout);
772 cbxClockInUSB->setCurrentIndex(dpins.clockin);
773 cbxControlInUSB->setCurrentIndex(dpins.ctrlin);
774 cbxPowerOnUSB->setCurrentIndex(dpins.poweron);
775 cbxEnaODUSB->setCurrentIndex(dpins.enbus);
776 }
777
778 void e2Dialog::on_pushDefaultsCOM_clicked()
779 {
780 ckControlOutCOM->setChecked(false);
781 ckClockOutCOM->setChecked(false);
782 ckDataInCOM->setChecked(false);
783 ckDataOutCOM->setChecked(false);
784 }
785
786 void e2Dialog::on_pushDefaultsLPT_clicked()
787 {
788 ckControlOutLPT->setChecked(false);
789 ckClockOutLPT->setChecked(false);
790 ckDataInLPT->setChecked(false);
791 ckDataOutLPT->setChecked(false);
792 //ckPowerOnLPT->setChecked(false);
793 //ckEnaODLPT->setChecked(false);
794 ckClockInLPT->setChecked(false);
795 //ckControlInLPT->setChecked(false);
796 }
797
798 void e2Dialog::on_pushDefaultsGPIO_clicked()
799 {
800 ckControlOutGPIO->setChecked(false);
801 ckClockOutGPIO->setChecked(false);
802 ckDataInGPIO->setChecked(false);
803 ckDataOutGPIO->setChecked(false);
804 ckPowerOnGPIO->setChecked(false);
805 ckEnaODGPIO->setChecked(false);
806 ckClockInGPIO->setChecked(false);
807 ckControlInGPIO->setChecked(false);
808
809 InterfPins dpins; //default pins
810 if (!TypeToInterfPins(interf_type, dpins))
811 {
812 qWarning() << Q_FUNC_INFO << " TypeToInterfPins(" << interf_type << ") Failed";
813 }
814 cbxClockOutGPIO->setCurrentIndex(dpins.clock);
815 cbxControlOutGPIO->setCurrentIndex(dpins.ctrl);
816 cbxDataInGPIO->setCurrentIndex(dpins.datain);
817 cbxDataOutGPIO->setCurrentIndex(dpins.dataout);
818
819 //cbxClockOutGPIO->setCurrentIndex(DEF_GPIO_CLOCK);
820 //cbxControlOutGPIO->setCurrentIndex(DEF_GPIO_CTRL);
821 //cbxDataInGPIO->setCurrentIndex(DEF_GPIO_DATAIN);
822 //cbxDataOutGPIO->setCurrentIndex(DEF_GPIO_DATAOUT);
823 }
824
825 void e2Dialog::recurseCbxHide(QObject *object)
826 {
827 QComboBox *combobox = dynamic_cast<QComboBox *>(object);
828 if (0 != combobox)
829 {
830 combobox->hide();
831 }
832
833 foreach (QObject *child, object->children())
834 {
835 recurseCbxHide(child);
836 }
837 }
11 // //
22 // PonyProg - Serial Device Programmer //
33 // //
4 // Copyright (C) 1997-2007 Claudio Lanconelli //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
55 // //
66 // http://ponyprog.sourceforge.net //
77 // //
3030 #include <QWidget>
3131 #include <QObject>
3232
33
34 //#include "e2cmdw.h"
3533 #include "Translator.h"
3634 #include "globals.h"
3735
3836 #include "ui_e2dlg.h"
39
40
41 //class e2CmdWindow;
37 #include "usbwatcher.h"
4238
4339 class e2Dialog : public QDialog, public cTranslator, public Ui::E2Dialog
4440 {
4541 Q_OBJECT
4642
47 public: //---------------------------------------- public
43 public:
4844 e2Dialog(QWidget *bw, const QString title = translate(STR_MSGINTSETUP));
49 virtual ~e2Dialog(); // Destructor
45 //virtual ~e2Dialog(); // Destructor
5046
51 protected: //--------------------------------------- protected
47 protected:
48
49 public slots:
50 void onUSB(bool connected, quint16 vid, quint16 pid);
5251
5352 private slots:
5453 void onOk();
5554 void onTest();
56 void onChangePort(bool);
57 void onSelectNum(int i);
58 void onSelectCOM(int i);
59 void onSelectLPT(int i);
55 void on_tabWidget_currentChanged(int index);
56 void on_cbxInterfCOM_currentIndexChanged(int index);
57 void on_cbxInterfCOMNum_currentIndexChanged(int index);
58 void on_cbxInterfLPT_currentIndexChanged(int index);
59 void on_cbxInterfLPTNum_currentIndexChanged(int index);
60 void on_cbxInterfUSB_currentIndexChanged(int index);
61 void on_cbxInterfUSBNum_currentIndexChanged(int index);
62 void on_cbxInterfGPIO_currentIndexChanged(int index);
63 void on_cbxInterfGPIONum_currentIndexChanged(int index);
64 void on_pushDefaultsUSB_clicked();
65 void on_pushDefaultsCOM_clicked();
66 void on_pushDefaultsLPT_clicked();
67 void on_pushDefaultsGPIO_clicked();
6068
61 private: //--------------------------------------- private
69 private:
6270 int Test(int p = -1, bool open_only = false) const;
6371 void setWidgetsText();
6472 void getSettings();
6573 void setSettings();
6674
75 void recurseCbxHide(QObject *object);
76
77 USBWatcher watcher;
6778 QStringList lptList;
6879 QStringList comList;
6980 QStringList usbList;
81 QStringList gpioList;
7082
71 //e2CmdWindow* cmdWin;
72 int port_no; //Idex of selected port in portList
73 int lpt_no, com_no;
83 int port_no; //Index of selected port in portList
84 int lpt_no, com_no, usb_no, gpio_no;
85 VidPid usb_vp;
7486 HInterfaceType interf_type;
7587 };
7688
3737
3838 static char const *id_string = "E2P!Lanc";
3939
40 //======================>>> e2pFileBuf::e2pFileBuf <<<=======================
4140 e2pFileBuf::e2pFileBuf(e2AppWinInfo *wininfo)
4241 : FileBuf(wininfo)
4342 {
4544 Q_ASSERT_X(sizeof(struct e2pHeader) == 152, "e2pFileBuf", "Bad size for e2pHeader");
4645 }
4746
48 //======================>>> e2pFileBuf::~e2pFileBuf <<<=======================
4947 e2pFileBuf::~e2pFileBuf()
5048 {
5149 }
7876 }
7977 ***/
8078
81 //======================>>> e2pFileBuf::Load <<<=======================
8279 int e2pFileBuf::Load(int loadtype, long relocation_offset)
8380 {
8481 extern int GetE2PSubType(unsigned long x);
202199 return rval;
203200 }
204201
205 //======================>>> e2pFileBuf::Save <<<=======================
206202 int e2pFileBuf::Save(int savetype, long relocation_offset)
207203 {
208204 e2pHeader hdr;
3333
3434 class e2pFileBuf : public FileBuf
3535 {
36 public: //---------------------------------------- public
36 public:
3737
3838 e2pFileBuf(e2AppWinInfo *wininfo = 0);
3939 virtual ~e2pFileBuf();
4141 virtual int Load(int loadtype = ALL_TYPE, long relocation_offfset = 0);
4242 virtual int Save(int savetype = ALL_TYPE, long relocation_offfset = 0);
4343
44 protected: //--------------------------------------- protected
44 protected:
4545
46 private: //--------------------------------------- private
46 private:
4747 // void check_offsets();
4848 };
4949 #endif
3737 #include "globals.h"
3838 #include "portint.h"
3939
40 //QSettings *E2Profile::s = new QSettings("ponyprog.ini", QSettings::IniFormat);
40 #ifdef Q_OS_WIN32
41 QSettings *E2Profile::s = new QSettings(QSettings::IniFormat, QSettings::UserScope, "LancOS", APP_NAME);
42 #else
4143 QSettings *E2Profile::s = new QSettings(APP_NAME);
42
43 //=====>>> Costruttore <<<======
44 #if 0
45 E2Profile::E2Profile(const QString &nm) :
46 s(0)
47 {
48 if (nm.length())
49 {
50 filename = nm;
44 #endif
45
46 int E2Profile::GetBogoMips()
47 {
48 return s->value("BogoMipsX1000", 0).toInt();
49 }
50
51 void E2Profile::SetBogoMips(int value)
52 {
53 s->setValue("BogoMipsX1000", value);
54 }
55
56
57 #include "eeptypes.h"
58
59
60 long E2Profile::GetLastDevType()
61 {
62 QString vrs = s->value("PonyProgVers", "pre").toString();
63
64 QString sp = s->value("DeviceType", "24XX Auto").toString();
65
66 if (vrs == "pre") // init for old configurations
67 {
68 sp = "24XX Auto";
69 }
70
71 if (sp.length())
72 {
73 return GetEEPTypeFromString(sp);
5174 }
5275 else
5376 {
54 filename = "e2p.ini";
55 }
56
57 s = new QSettings(filename, QSettings::IniFormat);
58 }
59
60
61 E2Profile::~E2Profile()
62 {
63 s->sync();
64 }
65 #endif
66
67 int E2Profile::GetBogoMips()
68 {
69 QString sp = s->value("BogoMipsX1000", "0").toString();
70 int rval = 0; //Defaultvalue
77 return E2400; //Default device type
78 }
79 }
80
81 void E2Profile::SetLastDevType(long devtype)
82 {
83 QString sp = GetEEPTypeString(devtype);
84
85 s->setValue("PonyProgVers", APP_VERSION);
7186
7287 if (sp.length())
7388 {
74 rval = sp.toInt();
75 }
76
77 return rval;
78 }
79
80
81 void E2Profile::SetBogoMips(int value)
82 {
83 // QString str;
84 s->setValue("BogoMipsX1000", QString::number(value));
85 // if ( decnum2str(value, str, MAXNUMDIGIT) == OK )
86 // {
87 // return s->setValue("BogoMipsX1000", str);
88 // }
89 // else
90 // {
91 // return BADPARAM;
92 // }
93 }
94
95
96 #include "eeptypes.h"
97
98
99 long E2Profile::GetLastDevType()
100 {
101 QString sp = s->value("DeviceType", "24XX Auto").toString();
102
103 if (sp.length())
104 {
105 return GetEEPTypeFromString(sp);
106 }
107 else
108 {
109 return E2400; //Default device type
110 }
111 }
112
113
114 //void E2Profile::SetConfigFile(const QString &nm)
115 //{
116 // if (nm.length())
117 // {
118 // delete s;
119 // s = new QSettings(nm, QSettings::IniFormat);
120 // }
121 //}
122
123
124 void E2Profile::SetLastDevType(long devtype)
125 {
126 QString sp = GetEEPTypeString(devtype);
127
128 if (sp.length())
129 {
13089 s->setValue("DeviceType", sp.remove(QChar(' ')));
13190 }
13291 }
13493
13594 HInterfaceType E2Profile::GetParInterfType()
13695 {
137 extern HInterfaceType NameToInterfType(const QString & name);
138
139 QString v = s->value("InterfaceType", "SI-ProgAPI").toString();
140
141 return NameToInterfType(v);
142 }
143
96 QString sp = s->value("InterfaceType", TypeToInterfName(SIPROG_API)).toString();
97
98 return NameToInterfType(sp);
99 }
144100
145101 void E2Profile::SetParInterfType(HInterfaceType type)
146102 {
147 QString TypeToInterfName(HInterfaceType type);
148
149103 s->setValue("InterfaceType", TypeToInterfName(type));
150104 }
151105
152106
153107 int E2Profile::GetPortNumber()
154108 {
155 return s->value("PortNumber", "-1").toInt();
156 }
157
109 return s->value("PortNumber", -1).toInt();
110 }
158111
159112 void E2Profile::SetPortNumber(int port)
160113 {
161114 if (port >= 0 /* && port < 4 */)
162115 {
163 s->setValue("PortNumber", QString::number(port));
164 }
165 }
166
167
168 // QString E2Profile::GetLastScript()
169 // {
170 // return s->value("LastScript", "").toString();
171 // }
172
173
116 s->setValue("PortNumber", port);
117 }
118 }
119
120
121 //Check if the entry is already in the list, in this case remove
122 //then insert the entry in the head of the list
174123 void E2Profile::SetLastScript(const QString &name)
175124 {
176 QStringList l = GetLastScripts();
177 l.insert(0, name);
178 SetLastScripts(l);
179 // s->setValue("LastScript", name);
125 //Save complete file path
126 QString fname = QFileInfo(name).canonicalFilePath();
127
128 if (fname.length() > 0)
129 {
130 QStringList l = GetLastScripts();
131
132 //Check if already in the list
133 int idx = l.indexOf(fname);
134 if (idx != 0)
135 {
136 l.insert(0, fname);
137 l.removeDuplicates();
138 SetLastScripts(l);
139 }
140 }
180141 }
181142
182143 //Check if the entry is already in the list, in this case remove
183144 //then insert the entry in the head of the list
184145 void E2Profile::SetLastFile(const QString &name, int data_type)
185146 {
186 if (name.length() > 0)
147 //Save complete file path
148 QString fname = QFileInfo(name).canonicalFilePath();
149
150 if (fname.length() > 0)
187151 {
188152 QStringList l = GetLastFiles();
189 QString item_name = name;
153 QString item_name = fname;
190154 if (data_type == PROG_TYPE)
191155 {
192156 item_name += "?PROG";
205169 SetLastFiles(l);
206170 }
207171 }
208
209172
210173 QString E2Profile::GetLastFile(int &data, int index)
211174 {
241204 return sp;
242205 }
243206
244 //QString E2Profile::GetPrevFile(int &data)
245 //{
246 // return GetLastFile(data, 1);
247 //}
248
249
250207 QStringList E2Profile::GetLastFiles()
251208 {
252209 QStringList res;
307264 }
308265 }
309266
310 uint8_t E2Profile::GetPolarityControl()
311 {
312 uint8_t res;
313 QString rval;
314
315 res = 0;
316 rval = s->value("ClockPolarity", "").toString();
317
318 if (rval.length())
319 if (rval == "INV")
320 {
321 res |= CLOCKINV;
322 }
323
324 rval = s->value("ResetPolarity", "").toString();
325
326 if (rval.length())
327 if (rval == "INV")
328 {
329 res |= RESETINV;
330 }
331
332 rval = s->value("DOutPolarity", "").toString();
333
334 if (rval.length())
335 if (rval == "INV")
336 {
337 res |= DOUTINV;
338 }
339
340 rval = s->value("DInPolarity", "").toString();
341
342 if (rval.length())
343 if (rval == "INV")
344 {
345 res |= DININV;
346 }
347
348 return res;
349 }
350
351
352 void E2Profile::SetPolarityControl(uint8_t polarity_control)
353 {
354 s->setValue("ResetPolarity",
355 (polarity_control & RESETINV) ? "INV" : "TRUE");
356
357 s->setValue("ClockPolarity",
358 (polarity_control & CLOCKINV) ? "INV" : "TRUE");
359
360 s->setValue("DOutPolarity",
361 (polarity_control & DOUTINV) ? "INV" : "TRUE");
362
363 s->setValue("DInPolarity",
364 (polarity_control & DININV) ? "INV" : "TRUE");
267
268 unsigned int E2Profile::GetPolarityLines()
269 {
270 return s->value("PolarityLines", 0).toUInt();
271 }
272
273 void E2Profile::SetPolarityLines(unsigned int polarity)
274 {
275 s->setValue("PolarityLines", polarity);
365276 }
366277
367278
368279 int E2Profile::GetI2CPageWrite()
369280 {
370 QString sp = s->value("I2CBusPageWrite", "16").toString();
371 int rval = 16; //Default: 16 bytes page write (only for 16-bit I2C Bus eeprom)
372
373 if (sp.length())
374 {
375 rval = sp.toInt();
376 }
377
378 return rval;
379 }
380
281 return s->value("I2CBusPageWrite", 16).toInt();
282 }
381283
382284 void E2Profile::SetI2CPageWrite(int page_write)
383285 {
384286 if (page_write > 0)
385287 {
386 s->setValue("I2CBusPageWrite", QString::number(page_write));
288 s->setValue("I2CBusPageWrite", page_write);
387289 }
388290 }
389291
390292
391293 int E2Profile::GetSPIPageWrite()
392294 {
393 QString sp = s->value("BigSPIPageWrite", "16").toString();
394 int rval = 16; //Default: 16 bytes page write
395
396 if (sp.length())
397 {
398 rval = sp.toInt();
399 }
400
401 return rval;
402 }
403
295 return s->value("BigSPIPageWrite", 16).toInt();
296 }
404297
405298 void E2Profile::SetSPIPageWrite(int page_write)
406299 {
407300 if (page_write > 0)
408301 {
409 s->setValue("BigSPIPageWrite", QString::number(page_write));
302 s->setValue("BigSPIPageWrite", page_write);
410303 }
411304 }
412305
422315
423316 rval = sp.toLong(&ok, 0);
424317
425 if (ok == false)
318 if (!ok)
426319 {
427320 rval = 0xA0;
428321 }
431324 return rval;
432325 }
433326
434
435327 void E2Profile::SetI2CBaseAddr(int base_addr)
436328 {
437329 if (base_addr >= 0x00 && base_addr < 0x100)
441333 }
442334
443335
336 int E2Profile::GetSPIResetPulse()
337 {
338 //Default: 100 msec
339 return s->value("SPIResetPulse", 100).toInt();
340 }
341
342 void E2Profile::SetSPIResetPulse(int delay)
343 {
344 if (delay > 0)
345 {
346 s->setValue("SPIResetPulse", delay);
347 }
348 }
349
350
351 int E2Profile::GetSPIDelayAfterReset()
352 {
353 //Default: 50 msec
354 return s->value("SPIDelayAfterReset", 50).toInt();
355 }
356
357 void E2Profile::SetSPIDelayAfterReset(int delay)
358 {
359 if (delay > 0)
360 {
361 s->setValue("SPIDelayAfterReset", delay);
362 }
363 }
364
365
366 int E2Profile::GetAT89DelayAfterReset()
367 {
368 //Default: 50 msec
369 return s->value("AT89DelayAfterReset", 50).toInt();
370 }
371
372 void E2Profile::SetAT89DelayAfterReset(int delay)
373 {
374 if (delay > 0)
375 {
376 s->setValue("AT89DelayAfterReset", delay);
377 }
378 }
379
380
381 int E2Profile::GetAVRDelayAfterReset()
382 {
383 //Default: 50 msec
384 return s->value("AVRDelayAfterReset", 50).toInt();
385 }
386
387
388 void E2Profile::SetAVRDelayAfterReset(int delay)
389 {
390 if (delay > 0)
391 {
392 s->setValue("AVRDelayAfterReset", delay);
393 }
394 }
395
396
397 QString E2Profile::getSpeedName(int speed)
398 {
399 if (speed == TURBO)
400 {
401 return QString("TURBO");
402 }
403 else if (speed == FAST)
404 {
405 return QString("FAST");
406 }
407 else if (speed == SLOW)
408 {
409 return QString("SLOW");
410 }
411 else if (speed == VERYSLOW)
412 {
413 return QString("VERYSLOW");
414 }
415 else if (speed == ULTRASLOW)
416 {
417 return QString("ULTRASLOW");
418 }
419 else //if (speed == NORMAL)
420 {
421 return QString("NORMAL");
422 }
423 }
424
425 int E2Profile::getSpeedIndex(const QString &sp)
426 {
427 int rval = NORMAL; //Default speed
428
429 if (sp.length())
430 {
431 if (sp == "TURBO")
432 {
433 rval = TURBO;
434 }
435 else if (sp == "FAST")
436 {
437 rval = FAST;
438 }
439 else if (sp == "SLOW")
440 {
441 rval = SLOW;
442 }
443 else if (sp == "VERYSLOW")
444 {
445 rval = VERYSLOW;
446 }
447 else if (sp == "ULTRASLOW")
448 {
449 rval = ULTRASLOW;
450 }
451 }
452
453 return rval;
454 }
455
456
444457 int E2Profile::GetI2CSpeed()
445458 {
446 QString sp = s->value("I2CBusSpeed", "NORMAL").toString();
447 int rval = NORMAL; //Default speed
448
449 if (sp.length())
450 {
451 if (sp == "TURBO")
452 {
453 rval = TURBO;
454 }
455 else if (sp == "FAST")
456 {
457 rval = FAST;
458 }
459 else if (sp == "SLOW")
460 {
461 rval = SLOW;
462 }
463 else if (sp == "VERYSLOW")
464 {
465 rval = VERYSLOW;
466 }
467 else if (sp == "ULTRASLOW")
468 {
469 rval = ULTRASLOW;
470 }
471 }
472
473 return rval;
474 }
475
459 QString sp = s->value("BusSpeed/I2CBusSpeed", getSpeedName(NORMAL)).toString();
460 return getSpeedIndex(sp);
461 }
476462
477463 void E2Profile::SetI2CSpeed(int speed)
478464 {
479 if (speed == TURBO)
480 {
481 s->setValue("I2CBusSpeed", "TURBO");
482 }
483 else if (speed == FAST)
484 {
485 s->setValue("I2CBusSpeed", "FAST");
486 }
487 else if (speed == NORMAL)
488 {
489 s->setValue("I2CBusSpeed", "NORMAL");
490 }
491 else if (speed == SLOW)
492 {
493 s->setValue("I2CBusSpeed", "SLOW");
494 }
495 else if (speed == VERYSLOW)
496 {
497 s->setValue("I2CBusSpeed", "VERYSLOW");
498 }
499 else if (speed == ULTRASLOW)
500 {
501 s->setValue("I2CBusSpeed", "ULTRASLOW");
502 }
503 }
504
505
506 int E2Profile::GetSPIResetPulse()
507 {
508 QString sp = s->value("SPIResetPulse", "100").toString();
509 int rval = 100; //Default: 100 msec
510
511 if (sp.length())
512 {
513 rval = sp.toInt();
514 }
515
516 return rval;
517 }
518
519
520 void E2Profile::SetSPIResetPulse(int delay)
521 {
522 if (delay > 0)
523 {
524 s->setValue("SPIResetPulse", QString::number(delay));
525 }
526 }
527
528
529 int E2Profile::GetSPIDelayAfterReset()
530 {
531 QString sp = s->value("SPIDelayAfterReset", "50").toString();
532 int rval = 50; //Default: 50 msec
533
534 if (sp.length())
535 {
536 rval = sp.toInt();
537 }
538
539 return rval;
540 }
541
542
543 void E2Profile::SetSPIDelayAfterReset(int delay)
544 {
545 if (delay > 0)
546 {
547 s->setValue("SPIDelayAfterReset", QString::number(delay));
548 }
549 }
550
551
552 int E2Profile::GetAT89DelayAfterReset()
553 {
554 QString sp = s->value("AT89DelayAfterReset", "50").toString();
555 int rval = 50; //Default: 50 msec
556
557 if (sp.length())
558 {
559 rval = sp.length();
560 }
561
562 return rval;
563 }
564
565
566 void E2Profile::SetAT89DelayAfterReset(int delay)
567 {
568 if (delay > 0)
569 {
570 s->setValue("AT89DelayAfterReset", QString::number(delay));
571 }
572 }
573
574
575 int E2Profile::GetAVRDelayAfterReset()
576 {
577 QString sp = s->value("AVRDelayAfterReset", "50").toString();
578 int rval = 50; //Default: 50 msec
579
580 if (sp.length())
581 {
582 rval = sp.toInt();
583 }
584
585 return rval;
586 }
587
588
589 void E2Profile::SetAVRDelayAfterReset(int delay)
590 {
591 if (delay > 0)
592 {
593 s->setValue("AVRDelayAfterReset", QString::number(delay));
594 }
465 s->setValue("BusSpeed/I2CBusSpeed", getSpeedName(speed));
595466 }
596467
597468
598469 int E2Profile::GetSPISpeed()
599470 {
600 QString sp = s->value("SPIBusSpeed", "NORMAL").toString();
601 int rval = NORMAL; //Default speed
602
603 if (sp.length())
604 {
605 if (sp == "TURBO")
606 {
607 rval = TURBO;
608 }
609 else if (sp == "FAST")
610 {
611 rval = FAST;
612 }
613 else if (sp == "SLOW")
614 {
615 rval = SLOW;
616 }
617 else if (sp == "VERYSLOW")
618 {
619 rval = VERYSLOW;
620 }
621 else if (sp == "ULTRASLOW")
622 {
623 rval = ULTRASLOW;
624 }
625 }
626
627 return rval;
628 }
629
471 QString sp = s->value("BusSpeed/SPIBusSpeed", getSpeedName(NORMAL)).toString();
472 return getSpeedIndex(sp);
473 }
630474
631475 void E2Profile::SetSPISpeed(int speed)
632476 {
633 if (speed == TURBO)
634 {
635 s->setValue("SPIBusSpeed", "TURBO");
636 }
637 else if (speed == FAST)
638 {
639 s->setValue("SPIBusSpeed", "FAST");
640 }
641 else if (speed == NORMAL)
642 {
643 s->setValue("SPIBusSpeed", "NORMAL");
644 }
645 else if (speed == SLOW)
646 {
647 s->setValue("SPIBusSpeed", "SLOW");
648 }
649 else if (speed == VERYSLOW)
650 {
651 s->setValue("SPIBusSpeed", "VERYSLOW");
652 }
653 else if (speed == ULTRASLOW)
654 {
655 s->setValue("SPIBusSpeed", "ULTRASLOW");
656 }
657 }
658
659
660 int E2Profile::GetMegaPageDelay()
661 {
662 QString sp = s->value("ATMegaPageWriteDelay", "50").toString();
663 int rval = 50; //Default: 50 msec
664
665 if (sp.length())
666 {
667 rval = sp.toInt();
668 }
669
670 return rval;
671 }
672
673
674 void E2Profile::SetMegaPageDelay(int delay)
675 {
676 if (delay > 0)
677 {
678 s->setValue("ATMegaPageWriteDelay", QString::number(delay));
679 }
477 s->setValue("BusSpeed/SPIBusSpeed", getSpeedName(speed));
680478 }
681479
682480
683481 int E2Profile::GetMicroWireSpeed()
684482 {
685 QString sp = s->value("MicroWireBusSpeed", "NORMAL").toString();
686 int rval = NORMAL; //Default speed
687
688 if (sp.length())
689 {
690 if (sp == "TURBO")
691 {
692 rval = TURBO;
693 }
694 else if (sp == "FAST")
695 {
696 rval = FAST;
697 }
698 else if (sp == "SLOW")
699 {
700 rval = SLOW;
701 }
702 else if (sp == "VERYSLOW")
703 {
704 rval = VERYSLOW;
705 }
706 else if (sp == "ULTRASLOW")
707 {
708 rval = ULTRASLOW;
709 }
710 }
711
712 return rval;
713 }
714
483 QString sp = s->value("BusSpeed/MicroWireBusSpeed", getSpeedName(NORMAL)).toString();
484 return getSpeedIndex(sp);
485 }
715486
716487 void E2Profile::SetMicroWireSpeed(int speed)
717488 {
718 if (speed == TURBO)
719 {
720 s->setValue("MicroWireBusSpeed", "TURBO");
721 }
722 else if (speed == FAST)
723 {
724 s->setValue("MicroWireBusSpeed", "FAST");
725 }
726 else if (speed == NORMAL)
727 {
728 s->setValue("MicroWireBusSpeed", "NORMAL");
729 }
730 else if (speed == SLOW)
731 {
732 s->setValue("MicroWireBusSpeed", "SLOW");
733 }
734 else if (speed == VERYSLOW)
735 {
736 s->setValue("MicroWireBusSpeed", "VERYSLOW");
737 }
738 else if (speed == ULTRASLOW)
739 {
740 s->setValue("MicroWireBusSpeed", "ULTRASLOW");
741 }
489 s->setValue("BusSpeed/MicroWireBusSpeed", getSpeedName(speed));
742490 }
743491
744492
745493 int E2Profile::GetPICSpeed()
746494 {
747 QString sp = s->value("PICBusSpeed", "NORMAL").toString();
748 int rval = NORMAL; //Default speed
749
750 if (sp.length())
751 {
752 if (sp == "TURBO")
753 {
754 rval = TURBO;
755 }
756 else if (sp == "FAST")
757 {
758 rval = FAST;
759 }
760 else if (sp == "SLOW")
761 {
762 rval = SLOW;
763 }
764 else if (sp == "VERYSLOW")
765 {
766 rval = VERYSLOW;
767 }
768 else if (sp == "ULTRASLOW")
769 {
770 rval = ULTRASLOW;
771 }
772 }
773
774 return rval;
775 }
776
495 QString sp = s->value("BusSpeed/PICBusSpeed", getSpeedName(NORMAL)).toString();
496 return getSpeedIndex(sp);
497 }
777498
778499 void E2Profile::SetPICSpeed(int speed)
779500 {
780 if (speed == TURBO)
781 {
782 s->setValue("PICBusSpeed", "TURBO");
783 }
784 else if (speed == FAST)
785 {
786 s->setValue("PICBusSpeed", "FAST");
787 }
788 else if (speed == NORMAL)
789 {
790 s->setValue("PICBusSpeed", "NORMAL");
791 }
792 else if (speed == SLOW)
793 {
794 s->setValue("PICBusSpeed", "SLOW");
795 }
796 else if (speed == VERYSLOW)
797 {
798 s->setValue("PICBusSpeed", "VERYSLOW");
799 }
800 else if (speed == ULTRASLOW)
801 {
802 s->setValue("PICBusSpeed", "ULTRASLOW");
803 }
501 s->setValue("BusSpeed/PICBusSpeed", getSpeedName(speed));
804502 }
805503
806504
807505 int E2Profile::GetSDESpeed()
808506 {
809 QString sp = s->value("SDEBusSpeed", "NORMAL").toString();
810 int rval = NORMAL; //Default speed
811
812 if (sp.length())
813 {
814 if (sp == "TURBO")
815 {
816 rval = TURBO;
817 }
818 else if (sp == "FAST")
819 {
820 rval = FAST;
821 }
822 else if (sp == "SLOW")
823 {
824 rval = SLOW;
825 }
826 else if (sp == "VERYSLOW")
827 {
828 rval = VERYSLOW;
829 }
830 else if (sp == "ULTRASLOW")
831 {
832 rval = ULTRASLOW;
833 }
834 }
835
836 return rval;
837 }
838
507 QString sp = s->value("BusSpeed/SDEBusSpeed", getSpeedName(NORMAL)).toString();
508 return getSpeedIndex(sp);
509 }
839510
840511 void E2Profile::SetSDESpeed(int speed)
841512 {
842 if (speed == TURBO)
843 {
844 s->setValue("SDEBusSpeed", "TURBO");
845 }
846 else if (speed == FAST)
847 {
848 s->setValue("SDEBusSpeed", "FAST");
849 }
850 else if (speed == NORMAL)
851 {
852 s->setValue("SDEBusSpeed", "NORMAL");
853 }
854 else if (speed == SLOW)
855 {
856 s->setValue("SDEBusSpeed", "SLOW");
857 }
858 else if (speed == VERYSLOW)
859 {
860 s->setValue("SDEBusSpeed", "VERYSLOW");
861 }
862 else if (speed == ULTRASLOW)
863 {
864 s->setValue("SDEBusSpeed", "ULTRASLOW");
865 }
513 s->setValue("BusSpeed/SDEBusSpeed", getSpeedName(speed));
514 }
515
516
517 int E2Profile::GetIMBusSpeed()
518 {
519 QString sp = s->value("BusSpeed/IMBusSpeed", getSpeedName(NORMAL)).toString();
520 return getSpeedIndex(sp);
521 }
522
523 void E2Profile::SetIMBusSpeed(int speed)
524 {
525 s->setValue("BusSpeed/IMBusSpeed", getSpeedName(speed));
866526 }
867527
868528
902562 s->endGroup();
903563 }
904564
905
906565 void E2Profile::SetPrinterSettings(QPrinter &p)
907566 {
908567 s->beginGroup("Printer");
940599 }
941600
942601
943 int E2Profile::GetIMBusSpeed()
944 {
945 QString sp = s->value("IMBusSpeed", "NORMAL").toString();
946 int rval = NORMAL; //Default speed
602 int E2Profile::GetMegaPageDelay()
603 {
604 //Default: 50 msec
605 return s->value("ATMegaPageWriteDelay", 50).toInt();
606 }
607
608 void E2Profile::SetMegaPageDelay(int delay)
609 {
610 if (delay > 0)
611 {
612 s->setValue("ATMegaPageWriteDelay", delay);
613 }
614 }
615
616
617 int E2Profile::GetPowerUpDelay()
618 {
619 //Default: 200 msec
620 return s->value("PowerUpDelay", 200).toInt();
621 }
622
623 void E2Profile::SetPowerUpDelay(int delay)
624 {
625 if (delay > 0)
626 {
627 s->setValue("PowerUpDelay", delay);
628 }
629 }
630
631
632 int E2Profile::GetAVRProgDelay()
633 {
634 //Default: 20 msec
635 return s->value("AVRByteWriteDelay", 20).toInt();
636 }
637
638 void E2Profile::SetAVRProgDelay(int delay)
639 {
640 if (delay > 0)
641 {
642 s->setValue("AVRByteWriteDelay", delay);
643 }
644 }
645
646
647 int E2Profile::GetFontSize()
648 {
649 return s->value("FontSize", 9).toInt();
650 }
651
652 void E2Profile::SetFontSize(int sz)
653 {
654 if (sz > 0)
655 {
656 s->setValue("FontSize", sz);
657 }
658 }
659
660
661 int E2Profile::GetAVREraseDelay()
662 {
663 //Default: 50 msec
664 return s->value("AVREraseDelay", 50).toInt();
665 }
666
667 void E2Profile::SetAVREraseDelay(int delay)
668 {
669 if (delay > 0)
670 {
671 s->setValue("AVREraseDelay", delay);
672 }
673 }
674
675
676 int E2Profile::GetMDAProgDelay()
677 {
678 //Default: 30 msec
679 return s->value("MDAWriteDelay", 30).toInt();
680 }
681
682 void E2Profile::SetMDAProgDelay(int delay)
683 {
684 if (delay >= 0)
685 {
686 s->setValue("MDAWriteDelay", delay);
687 }
688 }
689
690
691 int E2Profile::GetNVMProgDelay()
692 {
693 //Default: 30 msec
694 return s->value("NVMWriteDelay", 30).toInt();
695 }
696
697 void E2Profile::SetNVMProgDelay(int delay)
698 {
699 if (delay >= 0)
700 {
701 s->setValue("NVMWriteDelay", delay);
702 }
703 }
704
705
706 unsigned long E2Profile::GetSerialNumVal()
707 {
708 QString sp = s->value("SerialNumber/Value", "0").toString();
709 unsigned long rval = 0; //Default 0
947710
948711 if (sp.length())
949712 {
950 if (sp == "TURBO")
951 {
952 rval = TURBO;
953 }
954 else if (sp == "FAST")
955 {
956 rval = FAST;
957 }
958 else if (sp == "SLOW")
959 {
960 rval = SLOW;
961 }
962 else if (sp == "VERYSLOW")
963 {
964 rval = VERYSLOW;
965 }
966 else if (sp == "ULTRASLOW")
967 {
968 rval = ULTRASLOW;
713 bool ok;
714 rval = sp.toULong(&ok);
715 if (!ok)
716 {
717 rval = 0;
969718 }
970719 }
971720
972721 return rval;
973722 }
974723
975
976 void E2Profile::SetIMBusSpeed(int speed)
977 {
978 if (speed == TURBO)
979 {
980 s->setValue("IMBusSpeed", "TURBO");
981 }
982 else if (speed == FAST)
983 {
984 s->setValue("IMBusSpeed", "FAST");
985 }
986 else if (speed == NORMAL)
987 {
988 s->setValue("IMBusSpeed", "NORMAL");
989 }
990 else if (speed == SLOW)
991 {
992 s->setValue("IMBusSpeed", "SLOW");
993 }
994 else if (speed == VERYSLOW)
995 {
996 s->setValue("IMBusSpeed", "VERYSLOW");
997 }
998 else if (speed == ULTRASLOW)
999 {
1000 s->setValue("IMBusSpeed", "ULTRASLOW");
1001 }
1002 }
1003
1004
1005 int E2Profile::GetPowerUpDelay()
1006 {
1007 QString sp = s->value("PowerUpDelay", "200").toString();
1008 int rval = 200; //Default: 200 msec
1009
1010 if (sp.length())
1011 {
1012 rval = sp.toInt();
1013 }
1014
1015 return rval;
1016 }
1017
1018
1019 void E2Profile::SetPowerUpDelay(int delay)
1020 {
1021 if (delay > 0)
1022 {
1023 s->setValue("PowerUpDelay", QString::number(delay));
1024 }
1025 }
1026
1027
1028 int E2Profile::GetAVRProgDelay()
1029 {
1030 QString sp = s->value("AVRByteWriteDelay", "20").toString();
1031 int rval = 20; //Default: 20 msec
1032
1033 if (sp.length())
1034 {
1035 rval = sp.toInt();
1036 }
1037
1038 return rval;
1039 }
1040
1041
1042 void E2Profile::SetAVRProgDelay(int delay)
1043 {
1044 if (delay > 0)
1045 {
1046 s->setValue("AVRByteWriteDelay", QString::number(delay));
1047 }
1048 }
1049
1050
1051 int E2Profile::GetFontSize()
1052 {
1053 QString sp = s->value("FontSize", "9").toString();
1054 int rval = 9; //Default: 20 msec
1055
1056 if (sp.length())
1057 {
1058 rval = sp.toInt();
1059 }
1060
1061 return rval;
1062 }
1063
1064
1065 void E2Profile::SetFontSize(int sz)
1066 {
1067 if (sz > 0)
1068 {
1069 s->setValue("FontSize", QString::number(sz));
1070 }
1071 }
1072
1073
1074 int E2Profile::GetAVREraseDelay()
1075 {
1076 QString sp = s->value("AVREraseDelay", "50").toString();
1077 int rval = 50; //Default: 50 msec
1078
1079 if (sp.length())
1080 {
1081 rval = sp.toInt();
1082 }
1083
1084 return rval;
1085 }
1086
1087
1088 void E2Profile::SetAVREraseDelay(int delay)
1089 {
1090 if (delay > 0)
1091 {
1092 s->setValue("AVREraseDelay", QString::number(delay));
1093 }
1094 }
1095
1096
1097 int E2Profile::GetMDAProgDelay()
1098 {
1099 QString sp = s->value("MDAWriteDelay", "30").toString();
1100 int rval = 30; //Default: 30 msec
1101
1102 if (sp.length())
1103 {
1104 rval = sp.toInt();
1105 }
1106
1107 return rval;
1108 }
1109
1110
1111 void E2Profile::SetMDAProgDelay(int delay)
1112 {
1113 return s->setValue("MDAWriteDelay", QString::number(delay));
1114 }
1115
1116
1117 int E2Profile::GetNVMProgDelay()
1118 {
1119 QString sp = s->value("NVMWriteDelay", "30").toString();
1120 int rval = 30; //Default: 30 msec
1121
1122 if (sp.length())
1123 {
1124 rval = sp.toInt();
1125 }
1126
1127 return rval;
1128 }
1129
1130
1131 void E2Profile::SetNVMProgDelay(int delay)
1132 {
1133 return s->setValue("NVMWriteDelay", QString::number(delay));
1134 }
1135
1136
1137 unsigned long E2Profile::GetSerialNumVal()
1138 {
1139 QString sp = s->value("SerialNumberVal", "0").toString();
1140 unsigned long rval = 0; //Default 0
1141
1142 if (sp.length())
1143 {
1144 rval = sp.toULong();
1145 }
1146
1147 return rval;
1148 }
1149
1150
1151724 void E2Profile::SetSerialNumVal(unsigned long val)
1152725 {
1153 if (val > 0)
1154 {
1155 s->setValue("SerialNumberVal", QString::number(val));
1156 }
726 s->setValue("SerialNumber/Value", QString::number(val));
1157727 }
1158728
1159729
1163733 bool ok;
1164734
1165735 start = 0;
1166 size = 1;
736
737 s->beginGroup("SerialNumber");
738 sp = s->value("Address", "0").toString();
739 if (sp.length())
740 {
741 start = sp.toLong(&ok, 0);
742
743 if (!ok)
744 {
745 start = 0;
746 }
747 }
748
749 size = s->value("Size", 1).toInt(&ok);
750 if (!ok)
751 {
752 size = 1;
753 }
754
1167755 mtype = false;
1168
1169 if ((sp = s->value("SerialNumberAddr", "0").toString()).length())
1170 {
1171 start = sp.toLong(&ok, 0);
1172
1173 if (!ok)
1174 {
1175 start = 0;
1176 }
1177 }
1178
1179 if ((sp = s->value("SerialNumberSize", "1").toString()).length())
1180 {
1181 size = sp.toInt();
1182 }
1183
1184 if ((sp = s->value("SerialNumberType", "PROG").toString()).length())
1185 {
1186 if (sp == "DATA")
1187 {
1188 mtype = true;
1189 }
1190 }
756 sp = s->value("Type", "PROG").toString();
757 if (sp.length() && sp == "DATA")
758 {
759 mtype = true;
760 }
761 s->endGroup();
1191762
1192763 return OK;
1193764 }
1194765
1195
1196766 void E2Profile::SetSerialNumAddress(unsigned long start, int size, bool mtype)
1197767 {
1198 // if (start >= 0)
1199 {
1200 s->setValue("SerialNumberAddr", QString::number(start));
1201 }
768 s->beginGroup("SerialNumber");
769 s->setValue("Address", QString().sprintf("0x%04lX", start));
1202770
1203771 if (size >= 1)
1204772 {
1205 s->setValue("SerialNumberSize", QString::number(size));
1206 }
1207
1208 s->setValue("SerialNumberType", mtype ? "DATA" : "PROG");
773 s->setValue("Size", size);
774 }
775
776 s->setValue("Type", mtype ? "DATA" : "PROG");
777 s->endGroup();
1209778 }
1210779
1211780
1212781 FmtEndian E2Profile::GetSerialNumFormat()
1213782 {
1214 QString sp = s->value("SerialNumberFormat", "BIGENDIAN").toString();
783 QString sp = s->value("SerialNumber/Format", "BIGENDIAN").toString();
1215784
1216785 if (sp.length() && ("LITTLEENDIAN" == sp))
1217786 {
1223792 }
1224793 }
1225794
1226
1227795 void E2Profile::SetSerialNumFormat(FmtEndian fmt)
1228796 {
1229 if (fmt == FMT_BIG_ENDIAN)
1230 {
1231 s->setValue("SerialNumberFormat", "BIGENDIAN");
1232 }
1233 else
1234 {
1235 s->setValue("SerialNumberFormat", "LITTLEENDIAN");
1236 }
797 s->setValue("SerialNumber/Format", (fmt == FMT_BIG_ENDIAN) ? "BIGENDIAN" : "LITTLEENDIAN");
1237798 }
1238799
1239800
1240801 bool E2Profile::GetSerialNumAutoInc()
1241802 {
1242 QString sp = s->value("SerialNumAutoIncrement", "YES").toString();
1243
1244 if (sp.length() && (sp == "NO"))
1245 {
1246 return false;
1247 }
1248 else
1249 {
1250 return true;
1251 }
1252 }
1253
803 return s->value("SerialNumber/AutoIncrement", true).toBool();
804 }
1254805
1255806 void E2Profile::SetSerialNumAutoInc(bool val)
1256807 {
1257 if (val)
1258 {
1259 s->setValue("SerialNumAutoIncrement", "YES");
1260 }
1261 else
1262 {
1263 s->setValue("SerialNumAutoIncrement", "NO");
1264 }
808 s->setValue("SerialNumber/AutoIncrement", val);
1265809 }
1266810
1267811
1268812 long E2Profile::GetProgramOptions()
1269813 {
1270 long res;
814 long res = 0;
1271815 QString rval;
1272816
1273 res = 0;
817 s->beginGroup("ProgramOptions");
818
1274819 rval = s->value("ReloadOption", "").toString();
1275
1276 if (rval.length())
1277 if (rval != "NO")
1278 {
1279 res |= RELOAD_YES;
1280 }
820 if (rval.length() && rval != "NO")
821 {
822 res |= RELOAD_YES;
823 }
1281824
1282825 rval = s->value("ReadFlashOption", "").toString();
1283
1284 if (rval.length())
1285 if (rval != "NO")
1286 {
1287 res |= READFLASH_YES;
1288 }
826 if (rval.length() && rval != "NO")
827 {
828 res |= READFLASH_YES;
829 }
1289830
1290831 rval = s->value("ReadEEpromOption", "").toString();
1291
1292 if (rval.length())
1293 if (rval != "NO")
1294 {
1295 res |= READEEP_YES;
1296 }
832 if (rval.length() && rval != "NO")
833 {
834 res |= READEEP_YES;
835 }
1297836
1298837 rval = s->value("ByteSwapOption", "").toString();
1299
1300 if (rval.length())
1301 if (rval != "NO")
1302 {
1303 res |= BYTESWAP_YES;
1304 }
838 if (rval.length() && rval != "NO")
839 {
840 res |= BYTESWAP_YES;
841 }
1305842
1306843 rval = s->value("SetIDkeyOption", "").toString();
1307
1308 if (rval.length())
1309 if (rval != "NO")
1310 {
1311 res |= SETID_YES;
1312 }
844 if (rval.length() && rval != "NO")
845 {
846 res |= SETID_YES;
847 }
1313848
1314849 rval = s->value("ReadOscCalibration", "").toString();
1315
1316 if (rval.length())
1317 if (rval != "NO")
1318 {
1319 res |= READOSCAL_YES;
1320 }
850 if (rval.length() && rval != "NO")
851 {
852 res |= READOSCAL_YES;
853 }
1321854
1322855 rval = s->value("EraseOption", "").toString();
1323
1324 if (rval.length())
1325 if (rval != "NO")
1326 {
1327 res |= ERASE_YES;
1328 }
856 if (rval.length() && rval != "NO")
857 {
858 res |= ERASE_YES;
859 }
1329860
1330861 rval = s->value("WriteFlashOption", "").toString();
1331
1332 if (rval.length())
1333 if (rval != "NO")
1334 {
1335 res |= FLASH_YES;
1336 }
862 if (rval.length() && rval != "NO")
863 {
864 res |= FLASH_YES;
865 }
1337866
1338867 rval = s->value("WriteEEpromOption", "").toString();
1339
1340 if (rval.length())
1341 if (rval != "NO")
1342 {
1343 res |= EEPROM_YES;
1344 }
868 if (rval.length() && rval != "NO")
869 {
870 res |= EEPROM_YES;
871 }
1345872
1346873 rval = s->value("WriteSecurityOption", "").toString();
1347
1348 if (rval.length())
1349 if (rval != "NO")
1350 {
1351 res |= LOCK_YES;
1352 }
874 if (rval.length() && rval != "NO")
875 {
876 res |= LOCK_YES;
877 }
878
879 s->endGroup();
1353880
1354881 return res;
1355882 }
1356883
1357
1358884 void E2Profile::SetProgramOptions(long prog_option)
1359885 {
886 s->beginGroup("ProgramOptions");
1360887 s->setValue("ReloadOption",
1361888 (prog_option & RELOAD_YES) ? "YES" : "NO");
1362889 s->setValue("ReadFlashOption",
1377904 (prog_option & EEPROM_YES) ? "YES" : "NO");
1378905 s->setValue("WriteSecurityOption",
1379906 (prog_option & LOCK_YES) ? "YES" : "NO");
907 s->endGroup();
1380908 }
1381909
1382910
1385913 return s->value("LangDir", "").toString();
1386914 }
1387915
1388
1389916 void E2Profile::SetLangDir(const QString &name)
1390917 {
1391918 if (name.length())
1397924
1398925 QString E2Profile::GetCurrentLang()
1399926 {
1400 QString sp = s->value("CurrentLang", "english").toString();
927 return s->value("CurrentLang", "english").toString();
928 }
929
930 void E2Profile::SetCurrentLang(const QString &name)
931 {
932 if (name.length())
933 {
934 s->setValue("CurrentLang", name);
935 }
936 }
937
938
939 QString E2Profile::GetLogFileName()
940 {
941 QString sp = s->value("LogFileName", "PonyProg.log").toString();
1401942
1402943 return sp;
1403944 }
1404
1405
1406 void E2Profile::SetCurrentLang(const QString &name)
1407 {
1408 if (name.length())
1409 {
1410 s->setValue("CurrentLang", name);
1411 }
1412 }
1413
1414
1415 QString E2Profile::GetLogFileName()
1416 {
1417 QString sp = s->value("LogFileName", "PonyProg.log").toString();
1418
1419 return sp;
1420 }
1421
1422945
1423946 void E2Profile::SetLogFileName(const QString &name)
1424947 {
14911014 }
14921015 else
14931016 {
1494 qDebug() << "Can't open file /proc/tty/drivers";
1017 qWarning() << "Can't open file /proc/tty/drivers";
14951018 }
14961019
14971020 return sp;
15361059 }
15371060 else
15381061 {
1539 qDebug() << "Can't open file /proc/tty/drivers";
1062 qWarning() << "Can't open file /proc/tty/driver/serial";
15401063 }
15411064
15421065 return lst;
15461069
15471070 QString E2Profile::GetCOMDevName()
15481071 {
1549 QString sp = s->value("COMDevName", "").toString();
1072 QString sp = s->value("LegacyPorts/COMDevName", "").toString();
15501073
15511074 if (sp.length() == 0)
15521075 {
15641087 {
15651088 if (name.length())
15661089 {
1567 s->setValue("COMDevName", name);
1090 s->setValue("LegacyPorts/COMDevName", name);
15681091 }
15691092 }
15701093
15711094
15721095 QStringList E2Profile::GetCOMDevList()
15731096 {
1574 QStringList lst = s->value("COMDevList", QStringList()).toStringList();
1097 QStringList lst = s->value("LegacyPorts/COMDevList", QStringList()).toStringList();
15751098
15761099 if (lst.count() == 0)
15771100 {
16051128
16061129 void E2Profile::SetCOMDevList(const QStringList &lst)
16071130 {
1608 s->setValue("COMDevList", lst);
1131 s->setValue("LegacyPorts/COMDevList", lst);
16091132 }
16101133
16111134
16121135 QString E2Profile::GetLPTDevName()
16131136 {
1614 QString sp = s->value("LPTDevName", "").toString();
1137 QString sp = s->value("LegacyPorts/LPTDevName", "").toString();
16151138
16161139 if (sp.length() == 0)
16171140 {
16291152 {
16301153 if (name.length())
16311154 {
1632 s->setValue("LPTDevName", name);
1155 s->setValue("LegacyPorts/LPTDevName", name);
16331156 }
16341157 }
16351158
16361159
16371160 QStringList E2Profile::GetLPTDevList()
16381161 {
1639 QStringList lst = s->value("LPTDevList", QStringList()).toStringList();
1162 QStringList lst = s->value("LegacyPorts/LPTDevList", QStringList()).toStringList();
16401163
16411164 if (lst.count() == 0)
16421165 {
16561179
16571180 void E2Profile::SetLPTDevList(const QStringList &lst)
16581181 {
1659 s->setValue("LPTDevList", lst);
1182 s->setValue("LegacyPorts/LPTDevList", lst);
16601183 }
16611184
16621185
16971220
16981221 bool E2Profile::GetLogEnabled()
16991222 {
1700 QString sp = s->value("LogEnabled", "").toString();
1223 return s->value("LogEnabled", false).toBool();
1224 }
1225
1226 void E2Profile::SetLogEnabled(bool enabled)
1227 {
1228 s->setValue("LogEnabled", enabled);
1229 }
1230
1231
1232 bool E2Profile::GetSkipStartupDialog()
1233 {
1234 QString sp = s->value("Preferences/SkipStartupDialog", "NO").toString();
17011235
17021236 if (sp.length() && (sp == "YES"))
17031237 {
17091243 }
17101244 }
17111245
1712
1713 void E2Profile::SetLogEnabled(bool enabled)
1714 {
1715 if (enabled)
1716 {
1717 s->setValue("LogEnabled", "YES");
1246 void E2Profile::SetSkipStartupDialog(bool skip)
1247 {
1248 s->setValue("Preferences/SkipStartupDialog", skip ? "YES" : "NO");
1249 }
1250
1251
1252 bool E2Profile::GetClearBufBeforeLoad()
1253 {
1254 QString sp = s->value("ClearBufferBeforeLoad", "NO").toString();
1255
1256 if (sp.length() && (sp == "YES"))
1257 {
1258 return true;
17181259 }
17191260 else
17201261 {
1721 s->setValue("LogEnabled", "NO");
1722 }
1723 }
1724
1725
1726 bool E2Profile::GetSkipStartupDialog()
1727 {
1728 QString sp = s->value("SkipStartupDialog", "").toString();
1262 return false;
1263 }
1264 }
1265
1266 void E2Profile::SetClearBufBeforeLoad(bool enabled)
1267 {
1268 s->setValue("ClearBufferBeforeLoad", enabled ? "YES" : "NO");
1269 }
1270
1271
1272 bool E2Profile::GetClearBufBeforeRead()
1273 {
1274 QString sp = s->value("ClearBufferBeforeRead", "NO").toString();
17291275
17301276 if (sp.length() && (sp == "YES"))
17311277 {
17381284 }
17391285
17401286
1741 void E2Profile::SetSkipStartupDialog(bool skip)
1742 {
1743 if (skip)
1744 {
1745 s->setValue("SkipStartupDialog", "YES");
1287 void E2Profile::SetClearBufBeforeRead(bool enabled)
1288 {
1289 s->setValue("ClearBufferBeforeRead", enabled ? "YES" : "NO");
1290 }
1291
1292
1293 bool E2Profile::GetAt89PageOp()
1294 {
1295 QString sp = s->value("AT89SPageOpEnabled", "YES").toString();
1296
1297 if (sp.length() && (sp == "NO"))
1298 {
1299 return false;
17461300 }
17471301 else
17481302 {
1749 s->setValue("SkipStartupDialog", "NO");
1750 }
1751 }
1752
1753
1754 bool E2Profile::GetClearBufBeforeLoad()
1755 {
1756 QString sp = s->value("ClearBufferBeforeLoad").toString();
1303 return true;
1304 }
1305 }
1306
1307 void E2Profile::SetAt89PageOp(bool enabled)
1308 {
1309 s->setValue("AT89SPageOpEnabled", enabled ? "YES" : "NO");
1310 }
1311
1312
1313 bool E2Profile::Get8253FallEdge()
1314 {
1315 QString sp = s->value("AT89S8253FallEdgeSampling", "YES").toString();
1316
1317 if (sp.length() && (sp == "NO"))
1318 {
1319 return false;
1320 }
1321 else
1322 {
1323 return true;
1324 }
1325 }
1326
1327 void E2Profile::Set8253FallEdge(bool enabled)
1328 {
1329 s->setValue("AT89S8253FallEdgeSampling", enabled ? "YES" : "NO");
1330 }
1331
1332
1333 bool E2Profile::GetSoundEnabled()
1334 {
1335 QString sp = s->value("Preferences/SoundEnabled", "NO").toString();
17571336
17581337 if (sp.length() && (sp == "YES"))
17591338 {
17651344 }
17661345 }
17671346
1768
1769 void E2Profile::SetClearBufBeforeLoad(bool enabled)
1770 {
1771 if (enabled)
1772 {
1773 s->setValue("ClearBufferBeforeLoad", "YES");
1774 }
1775 else
1776 {
1777 s->setValue("ClearBufferBeforeLoad", "NO");
1778 }
1779 }
1780
1781
1782 bool E2Profile::GetClearBufBeforeRead()
1783 {
1784 QString sp = s->value("ClearBufferBeforeRead", "").toString();
1785
1786 if (sp.length() && (sp == "YES"))
1787 {
1788 return true;
1789 }
1790 else
1791 {
1792 return false;
1793 }
1794 }
1795
1796
1797 void E2Profile::SetClearBufBeforeRead(bool enabled)
1798 {
1799 if (enabled)
1800 {
1801 s->setValue("ClearBufferBeforeRead", "YES");
1802 }
1803 else
1804 {
1805 s->setValue("ClearBufferBeforeRead", "NO");
1806 }
1807 }
1808
1809
1810 bool E2Profile::GetAt89PageOp()
1811 {
1812 QString sp = s->value("AT89SPageOpEnabled", "").toString();
1813
1814 if (sp.length() && (sp == "NO"))
1815 {
1816 return false;
1817 }
1818 else
1819 {
1820 return true;
1821 }
1822 }
1823
1824
1825 void E2Profile::SetAt89PageOp(bool enabled)
1826 {
1827 if (enabled)
1828 {
1829 s->setValue("AT89SPageOpEnabled", "YES");
1830 }
1831 else
1832 {
1833 s->setValue("AT89SPageOpEnabled", "NO");
1834 }
1835 }
1836
1837
1838 bool E2Profile::Get8253FallEdge()
1839 {
1840 QString sp = s->value("AT89S8253FallEdgeSampling", "").toString();
1841
1842 if (sp.length() && (sp == "NO"))
1843 {
1844 return false;
1845 }
1846 else
1847 {
1848 return true;
1849 }
1850 }
1851
1852
1853 void E2Profile::Set8253FallEdge(bool enabled)
1854 {
1855 if (enabled)
1856 {
1857 s->setValue("AT89S8253FallEdgeSampling", "YES");
1858 }
1859 else
1860 {
1861 s->setValue("AT89S8253FallEdgeSampling", "NO");
1862 }
1863 }
1864
1865
1866 bool E2Profile::GetSoundEnabled()
1867 {
1868 QString sp = s->value("SoundEnabled", "").toString();
1869
1870 if (sp.length() && (sp == "YES"))
1871 {
1872 return true;
1873 }
1874 else
1875 {
1876 return false;
1877 }
1878 }
1879
1880
18811347 void E2Profile::SetSoundEnabled(bool enabled)
18821348 {
1883 if (enabled)
1884 {
1885 s->setValue("SoundEnabled", "YES");
1886 }
1887 else
1888 {
1889 s->setValue("SoundEnabled", "NO");
1890 }
1891 }
1892
1893
1894 int E2Profile::GetCalibrationAddress(long &start, int &size, bool &mtype)
1349 s->setValue("Preferences/SoundEnabled", enabled ? "YES" : "NO");
1350 }
1351
1352
1353 int E2Profile::GetCalibrationAddress(bool &enabled, long &start, int &size, bool &mtype)
18951354 {
18961355 QString sp;
18971356 bool ok;
18981357
1358 s->beginGroup("OscillatorCalibration");
1359 enabled = s->value("Enabled", true).toBool();
1360
18991361 start = 0;
1900 size = 1;
1362 sp = s->value("StartAddress", "0").toString();
1363 if (sp.length())
1364 {
1365 start = sp.toLong(&ok, 0);
1366
1367 if (!ok)
1368 {
1369 start = 0;
1370 }
1371 }
1372
1373 size = s->value("Size", 1).toInt(&ok);
1374 if (!ok)
1375 {
1376 size = 1;
1377 }
1378
19011379 mtype = false;
1902
1903 if ((sp = s->value("OscCalibrationAddr", "0").toString()).length())
1904 {
1905 start = sp.toLong(&ok, 0);
1906
1907 if (!ok)
1908 {
1909 start = 0;
1910 }
1911 }
1912
1913 if ((sp = s->value("OscCalibrationSize", "1").toString()).length())
1914 {
1915 size = sp.toInt();
1916 }
1917
1918 if ((sp = s->value("OscCalibrationMemType", "PROG").toString()).length())
1919 {
1920 if (sp == "DATA")
1921 {
1922 mtype = true;
1923 }
1924 }
1380 sp = s->value("MemoryType", "PROG").toString();
1381 if (sp.length() && sp == "DATA")
1382 {
1383 mtype = true;
1384 }
1385 s->endGroup();
19251386
19261387 return OK;
19271388 }
19281389
1929
1930 void E2Profile::SetCalibrationAddress(unsigned long start, int size, bool mtype)
1931 {
1932 // if (start >= 0)
1933 {
1934 s->setValue("OscCalibrationAddr", QString::number(start));
1935 }
1936
1390 void E2Profile::SetCalibrationAddress(bool enabled, unsigned long start, int size, bool mtype)
1391 {
1392 s->beginGroup("OscillatorCalibration");
1393 s->setValue("Enabled", enabled);
1394 s->setValue("StartAddress", QString().sprintf("0x%04lX", start));
19371395 if (size >= 1)
19381396 {
1939 s->setValue("OscCalibrationSize", QString::number(size));
1940 }
1941
1942 s->setValue("OscCalibrationType", mtype ? "DATA" : "PROG");
1943 }
1944
1945
1946 int E2Profile::GetJDMCmd2CmdDelay()
1947 {
1948 QString sp = s->value("JDM-CmdToCmdDelay", "4000").toString();
1949 int rval = 4000; //Default: 4000 usec
1950
1951 if (sp.length())
1952 {
1953 rval = sp.toInt();
1954 }
1955
1956 return rval;
1957 }
1958
1959
1960 void E2Profile::SetJDMCmd2CmdDelay(int delay)
1961 {
1962 if (delay >= 0)
1963 {
1964 s->setValue("JDM-CmdToCmdDelay", QString::number(delay));
1965 }
1397 s->setValue("Size", size);
1398 }
1399 s->setValue("MemoryType", mtype ? "DATA" : "PROG");
1400 s->endGroup();
1401 }
1402
1403
1404 unsigned int E2Profile::GetJDMCmd2CmdDelay()
1405 {
1406 //Default: 4000 usec
1407 return s->value("JDM-CmdToCmdDelay", 4000).toUInt();
1408 }
1409
1410 void E2Profile::SetJDMCmd2CmdDelay(unsigned int delay)
1411 {
1412 s->setValue("JDM-CmdToCmdDelay", delay);
19661413 }
19671414
19681415
19691416 bool E2Profile::GetVerifyAfterWrite()
19701417 {
1971 QString sp = s->value("VerifyAfterWrite", "YES").toString();
1972
1973 if (sp.length() && (sp == "NO"))
1974 {
1975 return false;
1976 }
1977 else
1978 {
1979 return true;
1980 }
1981 }
1982
1418 return s->value("VerifyAfterWrite", true).toBool();
1419 }
19831420
19841421 void E2Profile::SetVerifyAfterWrite(bool enabled)
19851422 {
1986 if (enabled)
1987 {
1988 s->setValue("VerifyAfterWrite", "YES");
1989 }
1990 else
1991 {
1992 s->setValue("VerifyAfterWrite", "NO");
1993 }
1423 s->setValue("VerifyAfterWrite", enabled);
19941424 }
19951425
19961426
19971427 bool E2Profile::GetAutoDetectPorts()
19981428 {
1999 QString sp = s->value("AutoDetectPorts", "YES").toString();
2000
2001 if (sp.length() && (sp == "NO"))
2002 {
2003 return false;
2004 }
2005 else
2006 {
2007 return true;
2008 }
2009 }
2010
1429 return s->value("LegacyPorts/AutoDetectPorts", true).toBool();
1430 }
20111431
20121432 void E2Profile::SetAutoDetectPorts(bool enabled)
20131433 {
2014 if (enabled)
2015 {
2016 s->setValue("AutoDetectPorts", "YES");
2017 }
2018 else
2019 {
2020 s->setValue("AutoDetectPorts", "NO");
2021 }
2022 }
2023
2024
2025 int E2Profile::GetCOMAddress(int &com1, int &com2, int &com3, int &com4)
2026 {
2027 QString sp = s->value("COMPorts").toString();
1434 s->setValue("LegacyPorts/AutoDetectPorts", enabled);
1435 }
1436
1437
1438 int E2Profile::GetCOMAddress(unsigned int &com1, unsigned int &com2, unsigned int &com3, unsigned int &com4)
1439 {
1440 QString sp = s->value("LegacyPorts/COMPorts").toString();
20281441
20291442 com1 = 0x3F8;
20301443 com2 = 0x2F8;
20391452 return OK;
20401453 }
20411454
2042
2043 void E2Profile::SetCOMAddress(int com1, int com2, int com3, int com4)
1455 void E2Profile::SetCOMAddress(unsigned int com1, unsigned int com2, unsigned int com3, unsigned int com4)
20441456 {
20451457 QString str;
20461458
20691481 str.sprintf("%X", com1);
20701482 }
20711483
2072 s->setValue("COMPorts", str);
2073 }
2074 }
2075
2076
2077 int E2Profile::GetLPTAddress(int &lpt1, int &lpt2, int &lpt3)
2078 {
2079 QString sp = s->value("LPTPorts").toString();
1484 s->setValue("LegacyPorts/COMPorts", str);
1485 }
1486 }
1487
1488
1489 int E2Profile::GetLPTAddress(unsigned int &lpt1, unsigned int &lpt2, unsigned int &lpt3)
1490 {
1491 QString sp = s->value("LegacyPorts/LPTPorts").toString();
20801492
20811493 lpt1 = 0x378;
20821494 lpt2 = 0x278;
20901502 return OK;
20911503 }
20921504
2093
2094 void E2Profile::SetLPTAddress(int lpt1, int lpt2, int lpt3)
1505 void E2Profile::SetLPTAddress(unsigned int lpt1, unsigned int lpt2, unsigned int lpt3)
20951506 {
20961507 QString str;
20971508
21131524 str.sprintf("%X", lpt1);
21141525 }
21151526
2116 s->setValue("LPTPorts", str);
1527 s->setValue("LegacyPorts/LPTPorts", str);
21171528 }
21181529 }
21191530
21501561 return ft;
21511562 }
21521563
2153
21541564 void E2Profile::SetDefaultFileType(FileType ft)
21551565 {
21561566 QString str;
21831593 }
21841594
21851595
2186 //RaspberryPi default pins
2187 #define DEF_GPIO_CTRL 23 //Rst pin 16
2188 #define DEF_GPIO_DATAIN 27 //Miso pin 13
2189 #define DEF_GPIO_DATAOUT 17 //Mosi pin 11
2190 #define DEF_GPIO_CLOCK 24 //Clock pin 18
2191
2192 int E2Profile::GetGpioPinCtrl()
2193 {
2194 QString sp;
2195 int rval = DEF_GPIO_CTRL; //Default pin number
2196
2197 sp = s->value("GpioPinCtrl", "").toString();
2198
2199 if (sp.length())
2200 {
2201 rval = sp.toInt();
2202 }
2203
2204 return rval;
2205 }
2206
2207
2208 void E2Profile::SetGpioPinCtrl(int pin)
2209 {
2210 s->setValue("GpioPinCtrl", QString::number(pin));
2211 }
2212
2213
2214 int E2Profile::GetGpioPinClock()
2215 {
2216 QString sp;
2217 int rval = DEF_GPIO_CLOCK; //Default pin number
2218
2219 sp = s->value("GpioPinClock").toString();
2220
2221 if (sp.length())
2222 {
2223 rval = sp.toInt();
2224 }
2225
2226 return rval;
2227 }
2228
2229
2230 void E2Profile::SetGpioPinClock(int pin)
2231 {
2232 s->setValue("GpioPinClock", QString::number(pin));
2233 }
2234
2235
2236 int E2Profile::GetGpioPinDataIn()
2237 {
2238 QString sp;
2239 int rval = DEF_GPIO_DATAIN; //Default pin number
2240
2241 sp = s->value("GpioPinDataIn").toString();
2242
2243 if (sp.length())
2244 {
2245 rval = sp.toInt();
2246 }
2247
2248 return rval;
2249 }
2250
2251
2252 void E2Profile::SetGpioPinDataIn(int pin)
2253 {
2254 s->setValue("GpioPinDataIn", QString::number(pin));
2255 }
2256
2257
2258 int E2Profile::GetGpioPinDataOut()
2259 {
2260 QString sp;
2261 int rval = DEF_GPIO_DATAOUT; //Default pin number
2262
2263 sp = s->value("GpioPinDataOut").toString();
2264
2265 if (sp.length())
2266 {
2267 rval = sp.toInt();
2268 }
2269
2270 return rval;
2271 }
2272
2273
2274 void E2Profile::SetGpioPinDataOut(int pin)
2275 {
2276 s->setValue("GpioPinDataOut", QString::number(pin));
2277 }
2278
22791596 bool E2Profile::GetEditBufferEnabled()
22801597 {
22811598 return !(s->value("Editor/ReadOnlyMode", false).toBool());
22851602 {
22861603 s->setValue("Editor/ReadOnlyMode", !enable);
22871604 }
1605
1606
1607 void E2Profile::GetInterfacePins(HInterfaceType type, InterfPins &pins)
1608 {
1609 InterfPins dpins; //default pins
1610 if (!TypeToInterfPins(type, dpins))
1611 {
1612 qWarning() << "TypeToInterfPins(" << type << ") Failed";
1613 }
1614
1615 s->beginGroup("InterfacePins-" + TypeToInterfName(type));
1616 pins.clock = s->value("clockout", dpins.clock).toInt();
1617 pins.clockin = s->value("clockin", dpins.clockin).toInt();
1618 pins.ctrl = s->value("controlout", dpins.ctrl).toInt();
1619 pins.ctrlin = s->value("controlin", dpins.ctrlin).toInt();
1620 pins.datain = s->value("datain", dpins.datain).toInt();
1621 pins.dataout = s->value("dataout", dpins.dataout).toInt();
1622 pins.enbus = s->value("enbus", dpins.enbus).toInt();
1623 pins.poweron = s->value("poweron", dpins.poweron).toInt();
1624 s->endGroup();
1625 }
1626
1627 void E2Profile::SetInterfacePins(HInterfaceType type, const InterfPins &pins)
1628 {
1629 s->beginGroup("InterfacePins-" + TypeToInterfName(type));
1630 if (pins.clock > -1)
1631 {
1632 s->setValue("clockout", pins.clock);
1633 }
1634 if (pins.clockin > -1)
1635 {
1636 s->setValue("clockin", pins.clockin);
1637 }
1638 if (pins.ctrl > -1)
1639 {
1640 s->setValue("controlout", pins.ctrl);
1641 }
1642 if (pins.ctrlin > -1)
1643 {
1644 s->setValue("controlin", pins.ctrlin);
1645 }
1646 if (pins.datain > -1)
1647 {
1648 s->setValue("datain", pins.datain);
1649 }
1650 if (pins.dataout > -1)
1651 {
1652 s->setValue("dataout", pins.dataout);
1653 }
1654 if (pins.enbus > -1)
1655 {
1656 s->setValue("enbus", pins.enbus);
1657 }
1658 if (pins.poweron > -1)
1659 {
1660 s->setValue("poweron", pins.poweron);
1661 }
1662 s->endGroup();
1663 }
1664
1665
1666 int E2Profile::GetInterfacePort()
1667 {
1668 QString sp = s->value("InterfacePort", "A").toString();
1669 int rv = FTDI_PORTA;
1670
1671 if (sp.length() != 0)
1672 {
1673 if (sp.compare("B", Qt::CaseInsensitive) == 0 || sp.compare("1") == 0)
1674 {
1675 rv = FTDI_PORTB;
1676 }
1677 else if (sp.compare("C", Qt::CaseInsensitive) == 0 || sp.compare("2") == 0)
1678 {
1679 rv = FTDI_PORTC;
1680 }
1681 else if (sp.compare("D", Qt::CaseInsensitive) == 0 || sp.compare("3") == 0)
1682 {
1683 rv = FTDI_PORTD;
1684 }
1685 }
1686
1687 return rv;
1688 }
1689
1690 void E2Profile::SetInterfacePort(int port_index)
1691 {
1692 QString intname = QString::number(port_index);
1693
1694 if (intname.length())
1695 {
1696 s->setValue("InterfacePort", intname);
1697 }
1698 }
1699
1700
1701 void E2Profile::readDialogSettings(QWidget *window, bool recurse)
1702 {
1703 s->beginGroup(window->objectName());
1704 //window->restoreGeometry(s->value("geometry").toByteArray());
1705 if (s->value("maximized", false).toBool())
1706 {
1707 window->showMaximized();
1708 }
1709 else
1710 {
1711 QVariant value = s->value("pos");
1712 if (!value.isNull())
1713 {
1714 window->move(s->value("pos").toPoint());
1715 window->resize(s->value("size").toSize());
1716 }
1717 }
1718 if (recurse)
1719 {
1720 recurseRead(window);
1721 }
1722 s->endGroup();
1723 }
1724
1725 void E2Profile::writeDialogSettings(QWidget *window, bool recurse)
1726 {
1727 s->beginGroup(window->objectName());
1728 //s->setValue("geometry", window->saveGeometry());
1729 if (window->isMaximized())
1730 {
1731 s->setValue("maximized", true);
1732 }
1733 else
1734 {
1735 s->setValue("maximized", false);
1736 s->setValue("pos", window->pos());
1737 s->setValue("size", window->size());
1738 }
1739 if (recurse)
1740 {
1741 recurseWrite(window);
1742 }
1743 s->endGroup();
1744 }
1745
1746 #include <QCheckBox>
1747 #include <QComboBox>
1748
1749 void E2Profile::recurseRead(QObject *object)
1750 {
1751 Q_CHECK_PTR(object);
1752 QCheckBox *checkbox = dynamic_cast<QCheckBox *>(object);
1753 if (0 != checkbox)
1754 {
1755 checkbox->setChecked(s->value(checkbox->objectName()).toBool());
1756 }
1757 QComboBox *combobox = dynamic_cast<QComboBox *>(object);
1758 if (0 != combobox)
1759 {
1760 combobox->setCurrentIndex(s->value(combobox->objectName()).toInt());
1761 }
1762 QSplitter *spl = dynamic_cast<QSplitter *>(object);
1763 if (0 != spl)
1764 {
1765 spl->restoreState(s->value(spl->objectName()).toByteArray());
1766 }
1767
1768 foreach (QObject *child, object->children())
1769 {
1770 recurseRead(child);
1771 }
1772 }
1773
1774 void E2Profile::recurseWrite(QObject *object)
1775 {
1776 Q_CHECK_PTR(object);
1777 QCheckBox *checkbox = dynamic_cast<QCheckBox *>(object);
1778 if (0 != checkbox)
1779 {
1780 s->setValue(checkbox->objectName(), checkbox->isChecked());
1781 }
1782 QComboBox *combobox = dynamic_cast<QComboBox *>(object);
1783 if (0 != combobox)
1784 {
1785 s->setValue(combobox->objectName(), combobox->currentIndex());
1786 }
1787 QSplitter *spl = dynamic_cast<QSplitter *>(object);
1788 if (0 != spl)
1789 {
1790 s->setValue(spl->objectName(), spl->saveState());
1791 }
1792
1793 foreach (QObject *child, object->children())
1794 {
1795 recurseWrite(child);
1796 }
1797 }
1798
1799 void E2Profile::restoreSplitter(QSplitter *spl)
1800 {
1801 Q_CHECK_PTR(spl);
1802 spl->restoreState(s->value("MainWindow/splitterSizes").toByteArray());
1803 }
1804
1805 void E2Profile::saveSplitter(QSplitter *spl)
1806 {
1807 Q_CHECK_PTR(spl);
1808 s->setValue("MainWindow/splitterSizes", spl->saveState());
1809 }
3030 #include <QSettings>
3131 #include "types.h"
3232 #include "globals.h"
33 #include "interfconv.h"
3334
3435 #include <QString>
35
36 #define CLOCKINV (1<<0)
37 #define RESETINV (1<<1)
38 #define DININV (1<<2)
39 #define DOUTINV (1<<3)
40
41 #define RELOAD_idx 0
42 #define READFLASH_idx 1
43 #define READEEP_idx 2
44 #define BYTESWAP_idx 3
45 #define SETID_idx 4
46 #define READOSCCAL_idx 5
47 #define ERASE_idx 6
48 #define FLASH_idx 7
49 #define EEPROM_idx 8
50 #define LOCK_idx 9
51
52 #define RELOAD_YES (1<<RELOAD_idx)
53 #define READFLASH_YES (1<<READFLASH_idx)
54 #define READEEP_YES (1<<READEEP_idx)
55 #define BYTESWAP_YES (1<<BYTESWAP_idx)
56 #define SETID_YES (1<<SETID_idx)
57 #define ERASE_YES (1<<ERASE_idx)
58 #define FLASH_YES (1<<FLASH_idx)
59 #define EEPROM_YES (1<<EEPROM_idx)
60 #define LOCK_YES (1<<LOCK_idx)
61 #define READOSCAL_YES (1<<READOSCCAL_idx)
62
36 #include <QWidget>
37 #include <QSplitter>
38
39 #define CLOCKINV (1<<0)
40 #define RESETINV (1<<1)
41 #define DININV (1<<2)
42 #define DOUTINV (1<<3)
43 #define POWERINV (1<<4)
44 #define ENBUSINV (1<<5)
45 #define CLOCKININV (1<<6)
46 #define CTRLININV (1<<7)
47
48 #define RELOAD_idx 0
49 #define READFLASH_idx 1
50 #define READEEP_idx 2
51 #define BYTESWAP_idx 3
52 #define SETID_idx 4
53 #define READOSCCAL_idx 5
54 #define ERASE_idx 6
55 #define FLASH_idx 7
56 #define EEPROM_idx 8
57 #define LOCK_idx 9
58
59 #define RELOAD_YES (1<<RELOAD_idx)
60 #define READFLASH_YES (1<<READFLASH_idx)
61 #define READEEP_YES (1<<READEEP_idx)
62 #define BYTESWAP_YES (1<<BYTESWAP_idx)
63 #define SETID_YES (1<<SETID_idx)
64 #define ERASE_YES (1<<ERASE_idx)
65 #define FLASH_YES (1<<FLASH_idx)
66 #define EEPROM_YES (1<<EEPROM_idx)
67 #define LOCK_YES (1<<LOCK_idx)
68 #define READOSCAL_YES (1<<READOSCCAL_idx)
6369
6470 typedef enum
6571 {
6975
7076 enum
7177 {
78 ULTRASLOW = 0,
7279 VERYSLOW,
7380 SLOW,
7481 NORMAL,
7582 FAST,
76 TURBO,
77 ULTRASLOW
83 TURBO
7884 };
79
80 #define STRBUFSIZE 256
81
8285
8386 class E2Profile
8487 {
8588
86 public: //---------------------------------------- public
89 public:
8790 //E2Profile(const QString &nm);
8891 //virtual ~E2Profile();
8992
93 static void sync()
94 {
95 s->sync();
96 }
9097 static HInterfaceType GetParInterfType();
9198 static void SetParInterfType(HInterfaceType type);
9299 static int GetPortNumber();
99106 static void SetLastDevType(long devtype);
100107
101108 static QString GetLastFile(int &data, int index = 0);
102 // static QString GetPrevFile(int &data);
103109 static void SetLastFile(const QString &name, int data = ALL_TYPE);
104
105 // static QString GetLastScript();
106110 static void SetLastScript(const QString &name);
107111
108 static uint8_t GetPolarityControl();
109 static void SetPolarityControl(uint8_t polarity_control);
112 static QStringList GetLastScripts();
113
114 static unsigned int GetPolarityLines();
115 static void SetPolarityLines(unsigned int polarity_control);
110116
111117 static int GetSPIPageWrite();
112118 static void SetSPIPageWrite(int page_write = 1);
163169 static void SetFontSize(int sz = 9);
164170
165171 static QStringList GetLastFiles();
166
167 static QStringList GetLastScripts();
168 static void SetLastScripts(const QStringList &l);
169172
170173 static int GetAVREraseDelay();
171174 static void SetAVREraseDelay(int delay = 30);
187190 static long GetProgramOptions();
188191 static void SetProgramOptions(long prog_option);
189192
190 static int GetCalibrationAddress(long &start, int &size, bool &mtype);
191 static void SetCalibrationAddress(unsigned long start, int size, bool mtype);
193 static int GetCalibrationAddress(bool &enabled, long &start, int &size, bool &mtype);
194 static void SetCalibrationAddress(bool enabled, unsigned long start, int size, bool mtype);
192195
193196 static QString GetLogFileName();
194197 static void SetLogFileName(const QString &name);
225228 static bool GetVerifyAfterWrite();
226229 static void SetVerifyAfterWrite(bool enabled = true);
227230
228 static int GetJDMCmd2CmdDelay();
229 static void SetJDMCmd2CmdDelay(int delay = 4000);
231 static unsigned int GetJDMCmd2CmdDelay();
232 static void SetJDMCmd2CmdDelay(unsigned int delay = 4000);
230233
231234 static bool GetAutoDetectPorts();
232235 static void SetAutoDetectPorts(bool enabled = true);
233236
234 static int GetCOMAddress(int &com1, int &com2, int &com3, int &com4);
235 static void SetCOMAddress(int com1, int com2, int com3, int com4);
236 static int GetLPTAddress(int &lpt1, int &lpt2, int &lpt3);
237 static void SetLPTAddress(int lpt1, int lpt2, int lpt3);
238
239 // static void SetConfigFile(const QString &n);
237 static int GetCOMAddress(unsigned int &com1, unsigned int &com2, unsigned int &com3, unsigned int &com4);
238 static void SetCOMAddress(unsigned int com1, unsigned int com2, unsigned int com3, unsigned int com4);
239 static int GetLPTAddress(unsigned int &lpt1, unsigned int &lpt2, unsigned int &lpt3);
240 static void SetLPTAddress(unsigned int lpt1, unsigned int lpt2, unsigned int lpt3);
241
240242 static QString GetConfigFile()
241243 {
242244 return s->fileName();
243245 }
244246
245 //static QString GetLockDir();
246 //static void SetLockDir(const QString &name);
247 //static QString GetDevDir();
248 //static void SetDevDir(const QString &name);
249247 static QString GetCOMDevName();
250248 static void SetCOMDevName(const QString &name);
251249 static QStringList GetCOMDevList();
258256 static FileType GetDefaultFileType();
259257 static void SetDefaultFileType(FileType ft);
260258
261 static QString GetHtmlBrowseApp();
262 static void SetHtmlBrowseApp(const QString &name);
263
264 static int GetGpioPinCtrl();
265 static int GetGpioPinClock();
266 static int GetGpioPinDataIn();
267 static int GetGpioPinDataOut();
268
269 static void SetGpioPinCtrl(int pin);
270 static void SetGpioPinClock(int pin);
271 static void SetGpioPinDataIn(int pin);
272 static void SetGpioPinDataOut(int pin);
259 //static QString GetHtmlBrowseApp();
260 //static void SetHtmlBrowseApp(const QString &name);
261
262 static int GetInterfacePort();
263 static void SetInterfacePort(int port_index);
264
265 static void GetInterfacePins(HInterfaceType type, InterfPins &pins);
266 static InterfPins GetInterfacePins(HInterfaceType type)
267 {
268 InterfPins pins;
269 GetInterfacePins(type, pins);
270 return pins;
271 }
272
273 static void SetInterfacePins(HInterfaceType type, const InterfPins &pins);
273274
274275 static bool GetEditBufferEnabled();
275276 static void SetEditBufferEnabled(bool enable);
276277
277 protected: //--------------------------------------- protected
278 static void readDialogSettings(QWidget *window, bool recurse = true);
279 static void writeDialogSettings(QWidget *window, bool recurse = true);
280
281 static void restoreSplitter(QSplitter *spl);
282 static void saveSplitter(QSplitter *spl);
283
284 protected:
285 static void recurseRead(QObject *object);
286 static void recurseWrite(QObject *object);
278287 static void SetLastFiles(const QStringList &l);
288 static void SetLastScripts(const QStringList &l);
279289 static QSettings *s;
280290
281 private: //--------------------------------------- private
282 // static QString filename; //name of .INI file
291 private:
292
293 static int getSpeedIndex(const QString &sp);
294 static QString getSpeedName(int speed);
283295 };
284296
285297 #endif
147147
148148 if (IsInstalled())
149149 {
150 int control = cmdWin->GetPolarity();
150 unsigned int control = cmdWin->GetPolarity();
151151 uint8_t cpreg = GetLastData();
152152
153153 if (control & CLOCKINV)
254254 qDebug() << "EasyI2CInterface::TestPort(" << port << ") IN";
255255
256256 int ret_val = TestSave(port);
257 Wait w;
258257
259258 if (ret_val == OK)
260259 {
3030
3131 class EasyI2CInterface : public LptExtInterface
3232 {
33 public: //------------------------------- public
33 public:
3434 EasyI2CInterface(bool use_io = false);
3535
3636 virtual int Open(int com_no);
4545 virtual int IsClockDataDOWN() ;
4646 virtual int TestPort(int port);
4747
48 protected: //------------------------------- protected
48 protected:
4949
50 private: //------------------------------- private
50 private:
5151
5252 };
5353
3939
4040 static QVector<chipInfo> const eep24xx_map =
4141 {
42 { "24XX Auto", E2400, AUTOSIZE_ID / 256, -1, -1, -1 },
42 {"24XX Auto", E2400, AUTOSIZE_ID / 256, -1, -1, -1 },
4343 {"2402", E2402, 1, -1, -1, -1},
4444 {"2404", E2404, 2, -1, -1, -1},
4545 {"2408", E2408, 4, -1, -1, -1},
8181 {"24645", E24645, 32, -1, -1, -1}
8282 };
8383
84
85 static QVector<chipInfo> const eepAt90s_map =
86 {
84 static QVector<chipInfo> const eepAT90_map =
85 {
86 {"ATmega8515", ATmega8515, (KB(8) + 512), KB(8), 64, -1 },
87 {"ATmega8535", ATmega8535, (KB(8) + 512), KB(8), 64, -1 },
88 {"ATmega48", ATmega48, (KB(4) + 256), KB(4), 64, -1},
89 {"ATmega8", ATmega8, (KB(8) + 512), KB(8), 64, -1},
90 {"ATmega88", ATmega88, (KB(8) + 512), KB(8), 64, -1},
91 {"ATmega16", ATmega16, (KB(16) + 512), KB(16), 128, -1},
92 {"ATmega161", ATmega161, (KB(16) + 512), KB(16), 128, -1},
93 {"ATmega162", ATmega162, (KB(16) + 512), KB(16), 128, -1},
94 {"ATmega163", ATmega163, (KB(16) + 512), KB(16), 128, -1},
95 {"ATmega164", ATmega164, (KB(16) + 512), KB(16), 128, -1},
96 {"ATmega168", ATmega168, (KB(16) + 512), KB(16), 128, -1},
97 {"ATmega169", ATmega169, (KB(16) + 512), KB(16), 128, -1},
98 {"ATmega32", ATmega32, (KB(32) + KB(1)), KB(32), 128, -1},
99
100 {"ATmega323", ATmega323, (KB(32) + KB(1)), KB(32), 128, -1},
101 {"ATmega324", ATmega324, (KB(32) + KB(1)), KB(32), 128, -1},
102 {"ATmega328", ATmega328, (KB(32) + KB(1)), KB(32), 128, -1}, // new (RG 22.06.2012)
103 {"ATmega603", ATmega603, (KB(64) + KB(2)), KB(64), 256, -1},
104 {"ATmega103", ATmega103, (KB(128) + KB(4)), KB(128), 256, -1},
105 {"ATmega64", ATmega64, (KB(64) + KB(2)), KB(64), 256, -1},
106 {"ATmega640", ATmega640, (KB(64) + KB(4)), KB(64), 256, -1},
107 {"ATmega644", ATmega644, (KB(64) + KB(2)), KB(64), 256, -1},
108 {"ATmega128", ATmega128, (KB(128) + KB(4)), KB(128), 256, -1},
109 {"ATmega1280", ATmega1280, (KB(128) + KB(4)), KB(128), 256, -1},
110 {"ATmega1281", ATmega1281, (KB(128) + KB(4)), KB(128), 256, -1},
111 {"ATmega1284", ATmega1284, (KB(128) + KB(4)), KB(128), 256, -1}, // new (RG 10.06.2017)
112 {"ATmega2560", ATmega2560, (KB(256) + KB(4)), KB(256), 256, -1},
113 {"ATmega2561", ATmega2561, (KB(256) + KB(4)), KB(256), 256, -1},
114
115 {"ATtiny12", ATtiny12, (KB(1) + 64), KB(1), 0, -1},
116 {"ATtiny13", ATtiny13, (KB(1) + 64), KB(1), 32, -1},
117 {"ATtiny15", ATtiny15, (KB(1) + 64), KB(1), 0, -1},
118 {"ATtiny22", ATtiny22, (KB(2) + 128), KB(2), 0, -1},
119 {"ATtiny24", ATtiny24, (KB(2) + 128), KB(2), 32, -1}, // new 08.01.2015 @RG
120 {"ATtiny25", ATtiny25, (KB(2) + 128), KB(2), 32, -1},
121 {"ATtiny26", ATtiny26, (KB(2) + 128), KB(2), 32, -1},
122 {"ATtiny261", ATtiny261, (KB(2) + 128), KB(2), 32, -1},
123 // {"ATtiny28", ATtiny28, },
124 {"ATtiny2313", ATtiny2313, (KB(2) + 128), KB(2), 32, -1},
125 {"ATtiny4313", ATtiny4313, (KB(4) + 256), KB(4), 64, -1}, // new 16.09.2015 @RG
126 {"ATtiny44", ATtiny44, (KB(4) + 256), KB(4), 64, -1}, // new 08.01.2015 @RG
127 {"ATtiny45", ATtiny45, (KB(4) + 256), KB(4), 64, -1},
128 {"ATtiny461", ATtiny461, (KB(4) + 256), KB(4), 64, -1},
129 {"ATtiny84", ATtiny84, (KB(8) + 512), KB(8), 64, -1}, // new 08.01.2015 @RG
130 {"ATtiny85", ATtiny85, (KB(8) + 512), KB(8), 64, -1},
131 {"ATtiny861", ATtiny861, (KB(8) + 512), KB(8), 64, -1},
132
87133 // "AVR Auto", AT90S0000
88134 {"AT90S1200", AT90S1200, (KB(1) + 64), KB(1), 0, -1},
89135 {"AT90S2313", AT90S2313, (KB(2) + 128), KB(2), 0, -1},
98144 {"AT90S8535", AT90S8535, (KB(8) + 512), KB(8), 0, -1},
99145 {"AT90CAN32", AT90CAN32, (KB(32) + KB(1)), KB(32), 128, -1},
100146 {"AT90CAN64", AT90CAN64, (KB(64) + KB(2)), KB(64), 256, -1},
101 {"AT90CAN128", AT90CAN128, (KB(128) + KB(4)), KB(128), 256, -1},
102
103 {"ATmega8515", ATmega8515, (KB(8) + 512), KB(8), 64, -1 },
104 {"ATmega8535", ATmega8535, (KB(8) + 512), KB(8), 64, -1 },
105 {"ATmega48", ATmega48, (KB(4) + 256), KB(4), 64, -1},
106 {"ATmega8", ATmega8, (KB(8) + 512), KB(8), 64, -1},
107 {"ATmega88", ATmega88, (KB(8) + 512), KB(8), 64, -1},
108 {"ATmega16", ATmega16, (KB(16) + 512), KB(16), 128, -1},
109 {"ATmega161", ATmega161, (KB(16) + 512), KB(16), 128, -1},
110 {"ATmega162", ATmega162, (KB(16) + 512), KB(16), 128, -1},
111 {"ATmega163", ATmega163, (KB(16) + 512), KB(16), 128, -1},
112 {"ATmega164", ATmega164, (KB(16) + 512), KB(16), 128, -1},
113 {"ATmega168", ATmega168, (KB(16) + 512), KB(16), 128, -1},
114 {"ATmega169", ATmega169, (KB(16) + 512), KB(16), 128, -1},
115 {"ATmega32", ATmega32, (KB(32) + KB(1)), KB(32), 128, -1},
116
117 {"ATmega323", ATmega323, (KB(32) + KB(1)), KB(32), 128, -1},
118 {"ATmega324", ATmega324, (KB(32) + KB(1)), KB(32), 128, -1},
119 {"ATmega328", ATmega328, (KB(32) + KB(1)), KB(32), 128, -1}, // new (RG 22.06.2012)
120 {"ATmega603", ATmega603, (KB(64) + KB(2)), KB(64), 256, -1},
121 {"ATmega103", ATmega103, (KB(128) + KB(4)), KB(128), 256, -1},
122 {"ATmega64", ATmega64, (KB(64) + KB(2)), KB(64), 256, -1},
123 {"ATmega640", ATmega640, (KB(64) + KB(4)), KB(64), 256, -1},
124 {"ATmega644", ATmega644, (KB(64) + KB(2)), KB(64), 256, -1},
125 {"ATmega128", ATmega128, (KB(128) + KB(4)), KB(128), 256, -1},
126 {"ATmega1280", ATmega1280, (KB(128) + KB(4)), KB(128), 256, -1},
127 {"ATmega1281", ATmega1281, (KB(128) + KB(4)), KB(128), 256, -1},
128 {"ATmega2560", ATmega2560, (KB(256) + KB(4)), KB(256), 256, -1},
129 {"ATmega2561", ATmega2561, (KB(256) + KB(4)), KB(256), 256, -1},
130
131 {"ATtiny12", ATtiny12, (KB(1) + 64), KB(1), 0, -1},
132 {"ATtiny13", ATtiny13, (KB(1) + 64), KB(1), 32, -1},
133 {"ATtiny15", ATtiny15, (KB(1) + 64), KB(1), 0, -1},
134 {"ATtiny22", ATtiny22, (KB(2) + 128), KB(2), 0, -1},
135 {"ATtiny25", ATtiny25, (KB(2) + 128), KB(2), 32, -1},
136 {"ATtiny26", ATtiny26, (KB(2) + 128), KB(2), 32, -1},
137 {"ATtiny261", ATtiny261, (KB(2) + 128), KB(2), 32, -1},
138 // {"ATtiny28", ATtiny28, },
139 {"ATtiny2313", ATtiny2313, (KB(2) + 128), KB(2), 32, -1},
140 {"ATtiny45", ATtiny45, (KB(4) + 256), KB(4), 64, -1},
141 {"ATtiny461", ATtiny461, (KB(4) + 256), KB(4), 64, -1},
142 {"ATtiny85", ATtiny85, (KB(8) + 512), KB(8), 64, -1},
143 {"ATtiny861", ATtiny861, (KB(8) + 512), KB(8), 64, -1}
147 {"AT90CAN128", AT90CAN128, (KB(128) + KB(4)), KB(128), 256, -1}
144148 };
145149
146150
364368 break;
365369
366370 case AT90SXX:
367 return eepAt90s_map;
371 return eepAT90_map;
368372 break;
369373
370374 case AT89SXX:
103103 #define ATmega2560 0x030037
104104 #define ATmega2561 0x030038
105105 #define ATmega328 0x030039 // new (RG 22.06.2012)
106 #define ATmega1284 0x03003A // new (RG 10.06.2017)
106107
107108 #define ATtiny11 0x030080
108109 #define ATtiny10 0x030081
115116 #define ATtiny261 0x030088
116117 #define ATtiny461 0x030089
117118 #define ATtiny861 0x03008A
119 #define ATtiny24 0x03008B
120 #define ATtiny44 0x03008C
121 #define ATtiny84 0x03008D
122 #define ATtiny4313 0x03008E // new 16.09.2015 @RG
118123
119124 #define AT90CAN32 0x030100
120125 #define AT90CAN64 0x030101
6464 #define OUTOFMEMORY -31
6565 #define BUFFERUNDERFLOW -32
6666
67 #define E2ERR_IOTEST -33
68
6769 //Codici di errore restituiti dall'interprete di comandi a menu
6870 #define CMD_BUFFEREMPTY -39
6971 #define CMD_NOTHINGTOWRITE -40
3333 #include "e2awinfo.h"
3434 #include "errcode.h"
3535
36 //======================>>> FileBuf::FileBuf <<<=======================
3736 FileBuf::FileBuf(e2AppWinInfo *wininfo)
3837 {
3938 SetAWInfo(wininfo);
4039 }
4140
42 //======================>>> FileBuf::~FileBuf <<<=======================
4341 FileBuf::~FileBuf()
4442 {
4543 }
8280 return awi->GetBlockSize();
8381 }
8482
85 //======================>>> FileBuf::SetNewFile <<<=======================
8683 void FileBuf::SetFileName(const QString &name)
8784 {
8885 awi->SetFileName(name);
8986 }
9087
91 //======================>>> FileBuf::GetFileName <<<=======================
9288 QString FileBuf::GetFileName()
9389 {
9490 return awi->GetFileName();
159155 awi->SetCRC(c);
160156 }
161157
162 //======================>>> FileBuf::GetEEpromType <<<=======================
163158 long FileBuf::GetEEpromType() const
164159 {
165160 return awi->GetEEPId();
166161 }
167162
168 //======================>>> FileBuf::GetEEpromPriType <<<=======================
169163 int FileBuf::GetEEpromPriType() const
170164 {
171165 return GetE2PPriType(awi->GetEEPId());
172166 }
173167
174 //======================>>> FileBuf::GetEEpromSubType <<<=======================
175168 int FileBuf::GetEEpromSubType() const
176169 {
177170 return GetE2PSubType(awi->GetEEPId());
178171 }
179172
180 //======================>>> FileBuf::SetEEpromType <<<=======================
181173 void FileBuf::SetEEpromType(int pritype, int subtype)
182174 {
183175 extern long BuildE2PType(int pritype, int subtype);
191183 }
192184
193185
194 //======================>>> FileBuf::GetFileSize <<<=======================
195186 long FileBuf::GetFileSize(QFile &fh)
196187 {
197188 if (fh.exists())
3838
3939 class FileBuf
4040 {
41 public: //---------------------------------------- public
41 public:
4242
4343 FileBuf(e2AppWinInfo *wininfo = 0);
4444 virtual ~FileBuf();
8585 // { return awi->GetCRC(); }
8686 void SetCRC(uint16_t c);
8787
88 protected: //--------------------------------------- protected
88 protected:
8989
9090 uint8_t *GetBufPtr() const;
9191 long GetBufSize() const;
9696
9797 // Informazioni addizionali sull'eeprom che vengono salvate nel file
9898
99 private: //--------------------------------------- private
99 private:
100100
101101 e2AppWinInfo *awi; //puntatore alla AppWinInfo che contiene questo FileBuffer
102102 };
3333
3434 class e2CmdWindow;
3535
36 //=========================>>> FillDialog::FillDialog <<<====================
3736 FillDialog::FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title) :
3837 QDialog(bw)
3938 {
8281 }
8382
8483
85 //======================>>> FillDialog::~FillDialog <<<======================
8684 FillDialog::~FillDialog()
8785 {
8886 qDebug() << "FillDialog::~FillDialog()";
3939 class FillDialog : public QDialog, public cTranslator, public Ui::EditDialog
4040 {
4141 Q_OBJECT
42 public: //---------------------------------------- public
42 public:
4343 FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title = translate(STR_LBLFILLBUF));
4444 virtual ~FillDialog(); // Destructor
4545
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 private slots:
5050 void onOk();
5151
5252
53 private: //--------------------------------------- private
53 private:
5454
5555 long *pFrom, *pTo;
5656 int *pVal;
88 <rect>
99 <x>0</x>
1010 <y>0</y>
11 <width>330</width>
12 <height>336</height>
11 <width>411</width>
12 <height>550</height>
1313 </rect>
1414 </property>
1515 <property name="windowTitle">
1616 <string>Dialog</string>
1717 </property>
1818 <layout class="QGridLayout" name="gridLayout_5">
19 <item row="4" column="0" colspan="2">
20 <widget class="QFrame" name="frmPolsel">
21 <property name="frameShape">
22 <enum>QFrame::StyledPanel</enum>
23 </property>
24 <property name="frameShadow">
25 <enum>QFrame::Raised</enum>
26 </property>
27 <layout class="QGridLayout" name="gridLayout">
28 <item row="0" column="0" colspan="2">
29 <widget class="QLabel" name="lblPol1">
30 <property name="text">
31 <string>TextLabel</string>
32 </property>
33 </widget>
34 </item>
35 <item row="1" column="0">
36 <widget class="QCheckBox" name="chkPol1">
37 <property name="text">
38 <string>CheckBox</string>
39 </property>
40 </widget>
41 </item>
42 <item row="1" column="1">
43 <widget class="QCheckBox" name="chkPol3">
44 <property name="text">
45 <string>CheckBox</string>
46 </property>
47 </widget>
48 </item>
49 <item row="2" column="0">
50 <widget class="QCheckBox" name="chkPol2">
51 <property name="text">
52 <string>CheckBox</string>
53 </property>
54 </widget>
55 </item>
56 <item row="2" column="1">
57 <widget class="QCheckBox" name="chkPol4">
58 <property name="text">
59 <string>CheckBox</string>
60 </property>
61 </widget>
62 </item>
63 </layout>
64 </widget>
65 </item>
66 <item row="5" column="0" colspan="2">
19 <item row="2" column="0" colspan="2">
6720 <layout class="QHBoxLayout" name="horizontalLayout">
6821 <item>
6922 <spacer name="horizontalSpacer">
10154 </item>
10255 </layout>
10356 </item>
104 <item row="0" column="0" colspan="2">
105 <widget class="QLabel" name="lblMainMsg">
106 <property name="text">
107 <string>I/O port settings</string>
57 <item row="0" column="0">
58 <widget class="QTabWidget" name="tabWidget">
59 <property name="currentIndex">
60 <number>3</number>
10861 </property>
109 </widget>
110 </item>
111 <item row="3" column="0" colspan="2">
112 <widget class="QGroupBox" name="frmComsel">
113 <layout class="QGridLayout" name="gridLayout_3">
114 <item row="0" column="1">
115 <widget class="QComboBox" name="cbxInterfNum">
116 <property name="toolTip">
117 <string notr="true"/>
118 </property>
119 </widget>
120 </item>
121 <item row="0" column="0">
122 <widget class="QLabel" name="label">
123 <property name="text">
124 <string>Select number</string>
125 </property>
126 </widget>
127 </item>
128 </layout>
129 </widget>
130 </item>
131 <item row="1" column="0" colspan="2">
132 <widget class="QFrame" name="frmPortsel">
133 <property name="frameShape">
134 <enum>QFrame::StyledPanel</enum>
135 </property>
136 <property name="frameShadow">
137 <enum>QFrame::Raised</enum>
138 </property>
139 <layout class="QGridLayout" name="gridLayout_4">
140 <item row="0" column="0">
141 <widget class="QRadioButton" name="rdbComPort">
142 <property name="text">
143 <string>RadioButton</string>
144 </property>
145 </widget>
146 </item>
147 <item row="2" column="0">
148 <widget class="QRadioButton" name="rdbLptPort">
149 <property name="text">
150 <string>RadioButton</string>
151 </property>
152 </widget>
153 </item>
154 <item row="2" column="1">
155 <widget class="QComboBox" name="cbxInterfLPT">
156 <property name="toolTip">
157 <string notr="true"/>
158 </property>
159 <property name="currentIndex">
160 <number>-1</number>
161 </property>
162 <property name="insertPolicy">
163 <enum>QComboBox::InsertAtTop</enum>
164 </property>
165 <property name="modelColumn">
166 <number>0</number>
167 </property>
168 </widget>
169 </item>
170 <item row="0" column="1">
171 <widget class="QComboBox" name="cbxInterfCOM">
172 <property name="toolTip">
173 <string notr="true"/>
174 </property>
175 <property name="currentIndex">
176 <number>-1</number>
177 </property>
178 <property name="insertPolicy">
179 <enum>QComboBox::InsertAtTop</enum>
180 </property>
181 </widget>
182 </item>
183 <item row="1" column="0" colspan="2">
184 <widget class="Line" name="line">
185 <property name="orientation">
186 <enum>Qt::Horizontal</enum>
187 </property>
188 </widget>
189 </item>
190 </layout>
62 <widget class="QWidget" name="tabUSB">
63 <attribute name="title">
64 <string>USB</string>
65 </attribute>
66 <layout class="QFormLayout" name="formLayout">
67 <item row="0" column="0" colspan="2">
68 <widget class="QFrame" name="frmPortsel_3">
69 <property name="frameShape">
70 <enum>QFrame::StyledPanel</enum>
71 </property>
72 <property name="frameShadow">
73 <enum>QFrame::Raised</enum>
74 </property>
75 <layout class="QGridLayout" name="gridLayout_8">
76 <item row="0" column="1">
77 <widget class="QComboBox" name="cbxInterfUSB">
78 <property name="sizePolicy">
79 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
80 <horstretch>0</horstretch>
81 <verstretch>0</verstretch>
82 </sizepolicy>
83 </property>
84 <property name="toolTip">
85 <string notr="true"/>
86 </property>
87 <property name="currentIndex">
88 <number>-1</number>
89 </property>
90 <property name="insertPolicy">
91 <enum>QComboBox::InsertAtTop</enum>
92 </property>
93 </widget>
94 </item>
95 <item row="0" column="0">
96 <widget class="QLabel" name="label_type_2">
97 <property name="text">
98 <string>Adapter Type</string>
99 </property>
100 </widget>
101 </item>
102 <item row="1" column="1">
103 <widget class="QComboBox" name="cbxInterfUSBNum">
104 <property name="sizePolicy">
105 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
106 <horstretch>0</horstretch>
107 <verstretch>0</verstretch>
108 </sizepolicy>
109 </property>
110 <property name="toolTip">
111 <string notr="true"/>
112 </property>
113 </widget>
114 </item>
115 <item row="1" column="0">
116 <widget class="QLabel" name="label_port_3">
117 <property name="sizePolicy">
118 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
119 <horstretch>0</horstretch>
120 <verstretch>0</verstretch>
121 </sizepolicy>
122 </property>
123 <property name="text">
124 <string>Detected S/N</string>
125 </property>
126 </widget>
127 </item>
128 </layout>
129 </widget>
130 </item>
131 <item row="1" column="0">
132 <widget class="QGroupBox" name="groupBoxUSBPol">
133 <property name="title">
134 <string>Custom Settings</string>
135 </property>
136 <layout class="QVBoxLayout" name="verticalLayout">
137 <item>
138 <layout class="QHBoxLayout" name="horizontalLayout_2">
139 <item>
140 <widget class="QLabel" name="label">
141 <property name="text">
142 <string>Clock Out</string>
143 </property>
144 </widget>
145 </item>
146 <item>
147 <widget class="QComboBox" name="cbxClockOutUSB"/>
148 </item>
149 <item>
150 <widget class="QCheckBox" name="ckClockOutUSB">
151 <property name="text">
152 <string>Inverted</string>
153 </property>
154 </widget>
155 </item>
156 </layout>
157 </item>
158 <item>
159 <layout class="QHBoxLayout" name="horizontalLayout_3">
160 <item>
161 <widget class="QLabel" name="label_3">
162 <property name="text">
163 <string>Clock In</string>
164 </property>
165 </widget>
166 </item>
167 <item>
168 <widget class="QComboBox" name="cbxClockInUSB"/>
169 </item>
170 <item>
171 <widget class="QCheckBox" name="ckClockInUSB">
172 <property name="text">
173 <string>Inverted</string>
174 </property>
175 </widget>
176 </item>
177 </layout>
178 </item>
179 <item>
180 <layout class="QHBoxLayout" name="horizontalLayout_4">
181 <item>
182 <widget class="QLabel" name="label_4">
183 <property name="text">
184 <string>Data Out</string>
185 </property>
186 </widget>
187 </item>
188 <item>
189 <widget class="QComboBox" name="cbxDataOutUSB"/>
190 </item>
191 <item>
192 <widget class="QCheckBox" name="ckDataOutUSB">
193 <property name="text">
194 <string>Inverted</string>
195 </property>
196 </widget>
197 </item>
198 </layout>
199 </item>
200 <item>
201 <layout class="QHBoxLayout" name="horizontalLayout_5">
202 <item>
203 <widget class="QLabel" name="label_5">
204 <property name="text">
205 <string>Data In</string>
206 </property>
207 </widget>
208 </item>
209 <item>
210 <widget class="QComboBox" name="cbxDataInUSB"/>
211 </item>
212 <item>
213 <widget class="QCheckBox" name="ckDataInUSB">
214 <property name="text">
215 <string>Inverted</string>
216 </property>
217 </widget>
218 </item>
219 </layout>
220 </item>
221 <item>
222 <layout class="QHBoxLayout" name="horizontalLayout_6">
223 <item>
224 <widget class="QLabel" name="label_6">
225 <property name="text">
226 <string>Control Out</string>
227 </property>
228 </widget>
229 </item>
230 <item>
231 <widget class="QComboBox" name="cbxControlOutUSB"/>
232 </item>
233 <item>
234 <widget class="QCheckBox" name="ckControlOutUSB">
235 <property name="text">
236 <string>Inverted</string>
237 </property>
238 </widget>
239 </item>
240 </layout>
241 </item>
242 <item>
243 <layout class="QHBoxLayout" name="horizontalLayout_8">
244 <item>
245 <widget class="QLabel" name="label_8">
246 <property name="text">
247 <string>Control In</string>
248 </property>
249 </widget>
250 </item>
251 <item>
252 <widget class="QComboBox" name="cbxControlInUSB"/>
253 </item>
254 <item>
255 <widget class="QCheckBox" name="ckControlInUSB">
256 <property name="text">
257 <string>Inverted</string>
258 </property>
259 </widget>
260 </item>
261 </layout>
262 </item>
263 <item>
264 <layout class="QHBoxLayout" name="horizontalLayout_9">
265 <item>
266 <widget class="QLabel" name="label_9">
267 <property name="text">
268 <string>Power On</string>
269 </property>
270 </widget>
271 </item>
272 <item>
273 <widget class="QComboBox" name="cbxPowerOnUSB"/>
274 </item>
275 <item>
276 <widget class="QCheckBox" name="ckPowerOnUSB">
277 <property name="text">
278 <string>Inverted</string>
279 </property>
280 </widget>
281 </item>
282 </layout>
283 </item>
284 <item>
285 <layout class="QHBoxLayout" name="horizontalLayout_7">
286 <item>
287 <widget class="QLabel" name="label_7">
288 <property name="text">
289 <string>Enable OD</string>
290 </property>
291 </widget>
292 </item>
293 <item>
294 <widget class="QComboBox" name="cbxEnaODUSB"/>
295 </item>
296 <item>
297 <widget class="QCheckBox" name="ckEnaODUSB">
298 <property name="text">
299 <string>Inverted</string>
300 </property>
301 </widget>
302 </item>
303 </layout>
304 </item>
305 </layout>
306 </widget>
307 </item>
308 <item row="1" column="1">
309 <layout class="QVBoxLayout" name="verticalLayout_2">
310 <item>
311 <widget class="QPushButton" name="pushDefaultsUSB">
312 <property name="text">
313 <string>Defaults</string>
314 </property>
315 </widget>
316 </item>
317 <item>
318 <spacer name="verticalSpacer">
319 <property name="orientation">
320 <enum>Qt::Vertical</enum>
321 </property>
322 <property name="sizeHint" stdset="0">
323 <size>
324 <width>20</width>
325 <height>40</height>
326 </size>
327 </property>
328 </spacer>
329 </item>
330 </layout>
331 </item>
332 </layout>
333 </widget>
334 <widget class="QWidget" name="tabCOM">
335 <attribute name="title">
336 <string>COM</string>
337 </attribute>
338 <layout class="QFormLayout" name="formLayout_3">
339 <item row="0" column="0" colspan="2">
340 <widget class="QGroupBox" name="groupBoxCOMSel">
341 <property name="title">
342 <string>Serial port settings</string>
343 </property>
344 <layout class="QGridLayout" name="gridLayout">
345 <item row="0" column="0">
346 <widget class="QLabel" name="label_type">
347 <property name="text">
348 <string>Adapter Type</string>
349 </property>
350 </widget>
351 </item>
352 <item row="0" column="1">
353 <widget class="QComboBox" name="cbxInterfCOM">
354 <property name="sizePolicy">
355 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
356 <horstretch>0</horstretch>
357 <verstretch>0</verstretch>
358 </sizepolicy>
359 </property>
360 <property name="toolTip">
361 <string notr="true"/>
362 </property>
363 <property name="currentIndex">
364 <number>-1</number>
365 </property>
366 <property name="insertPolicy">
367 <enum>QComboBox::InsertAtTop</enum>
368 </property>
369 </widget>
370 </item>
371 <item row="1" column="0">
372 <widget class="QLabel" name="label_port">
373 <property name="text">
374 <string>Port Number</string>
375 </property>
376 </widget>
377 </item>
378 <item row="1" column="1">
379 <widget class="QComboBox" name="cbxInterfCOMNum">
380 <property name="sizePolicy">
381 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
382 <horstretch>0</horstretch>
383 <verstretch>0</verstretch>
384 </sizepolicy>
385 </property>
386 <property name="toolTip">
387 <string notr="true"/>
388 </property>
389 </widget>
390 </item>
391 </layout>
392 </widget>
393 </item>
394 <item row="1" column="0">
395 <widget class="QGroupBox" name="groupBoxCOMPol">
396 <property name="title">
397 <string>Custom Settings</string>
398 </property>
399 <layout class="QVBoxLayout" name="verticalLayout_3">
400 <item>
401 <layout class="QHBoxLayout" name="horizontalLayout_10">
402 <item>
403 <widget class="QLabel" name="label_2">
404 <property name="text">
405 <string>Clock Out</string>
406 </property>
407 </widget>
408 </item>
409 <item>
410 <widget class="QComboBox" name="cbxClockOutCOM">
411 <property name="enabled">
412 <bool>false</bool>
413 </property>
414 </widget>
415 </item>
416 <item>
417 <widget class="QCheckBox" name="ckClockOutCOM">
418 <property name="text">
419 <string>Inverted</string>
420 </property>
421 </widget>
422 </item>
423 </layout>
424 </item>
425 <item>
426 <layout class="QHBoxLayout" name="horizontalLayout_12">
427 <item>
428 <widget class="QLabel" name="label_11">
429 <property name="text">
430 <string>Data Out</string>
431 </property>
432 </widget>
433 </item>
434 <item>
435 <widget class="QComboBox" name="cbxDataOutCOM">
436 <property name="enabled">
437 <bool>false</bool>
438 </property>
439 </widget>
440 </item>
441 <item>
442 <widget class="QCheckBox" name="ckDataOutCOM">
443 <property name="text">
444 <string>Inverted</string>
445 </property>
446 </widget>
447 </item>
448 </layout>
449 </item>
450 <item>
451 <layout class="QHBoxLayout" name="horizontalLayout_13">
452 <item>
453 <widget class="QLabel" name="label_12">
454 <property name="text">
455 <string>Data In</string>
456 </property>
457 </widget>
458 </item>
459 <item>
460 <widget class="QComboBox" name="cbxDataInCOM">
461 <property name="enabled">
462 <bool>false</bool>
463 </property>
464 </widget>
465 </item>
466 <item>
467 <widget class="QCheckBox" name="ckDataInCOM">
468 <property name="text">
469 <string>Inverted</string>
470 </property>
471 </widget>
472 </item>
473 </layout>
474 </item>
475 <item>
476 <layout class="QHBoxLayout" name="horizontalLayout_14">
477 <item>
478 <widget class="QLabel" name="label_13">
479 <property name="text">
480 <string>Control Out</string>
481 </property>
482 </widget>
483 </item>
484 <item>
485 <widget class="QComboBox" name="cbxControlOutCOM">
486 <property name="enabled">
487 <bool>false</bool>
488 </property>
489 </widget>
490 </item>
491 <item>
492 <widget class="QCheckBox" name="ckControlOutCOM">
493 <property name="text">
494 <string>Inverted</string>
495 </property>
496 </widget>
497 </item>
498 </layout>
499 </item>
500 </layout>
501 </widget>
502 </item>
503 <item row="1" column="1">
504 <layout class="QVBoxLayout" name="verticalLayout_9">
505 <item>
506 <widget class="QPushButton" name="pushDefaultsCOM">
507 <property name="text">
508 <string>Defaults</string>
509 </property>
510 </widget>
511 </item>
512 <item>
513 <spacer name="verticalSpacer_3">
514 <property name="orientation">
515 <enum>Qt::Vertical</enum>
516 </property>
517 <property name="sizeHint" stdset="0">
518 <size>
519 <width>20</width>
520 <height>40</height>
521 </size>
522 </property>
523 </spacer>
524 </item>
525 </layout>
526 </item>
527 </layout>
528 </widget>
529 <widget class="QWidget" name="tabLPT">
530 <attribute name="title">
531 <string>LPT</string>
532 </attribute>
533 <layout class="QFormLayout" name="formLayout_4">
534 <item row="1" column="0">
535 <widget class="QGroupBox" name="groupBoxLPTPol">
536 <property name="title">
537 <string>Custom Settings</string>
538 </property>
539 <layout class="QVBoxLayout" name="verticalLayout_5">
540 <item>
541 <layout class="QHBoxLayout" name="horizontalLayout_15">
542 <item>
543 <widget class="QLabel" name="label_14">
544 <property name="text">
545 <string>Clock Out</string>
546 </property>
547 </widget>
548 </item>
549 <item>
550 <widget class="QComboBox" name="cbxClockOutLPT">
551 <property name="enabled">
552 <bool>false</bool>
553 </property>
554 </widget>
555 </item>
556 <item>
557 <widget class="QCheckBox" name="ckClockOutLPT">
558 <property name="text">
559 <string>Inverted</string>
560 </property>
561 </widget>
562 </item>
563 </layout>
564 </item>
565 <item>
566 <layout class="QHBoxLayout" name="horizontalLayout_31">
567 <item>
568 <widget class="QLabel" name="label_30">
569 <property name="text">
570 <string>Clock In</string>
571 </property>
572 </widget>
573 </item>
574 <item>
575 <widget class="QComboBox" name="cbxClockInLPT">
576 <property name="enabled">
577 <bool>false</bool>
578 </property>
579 </widget>
580 </item>
581 <item>
582 <widget class="QCheckBox" name="ckClockInLPT">
583 <property name="enabled">
584 <bool>false</bool>
585 </property>
586 <property name="text">
587 <string>Inverted</string>
588 </property>
589 </widget>
590 </item>
591 </layout>
592 </item>
593 <item>
594 <layout class="QHBoxLayout" name="horizontalLayout_28">
595 <item>
596 <widget class="QLabel" name="label_27">
597 <property name="text">
598 <string>Data Out</string>
599 </property>
600 </widget>
601 </item>
602 <item>
603 <widget class="QComboBox" name="cbxDataOutLPT">
604 <property name="enabled">
605 <bool>false</bool>
606 </property>
607 </widget>
608 </item>
609 <item>
610 <widget class="QCheckBox" name="ckDataOutLPT">
611 <property name="text">
612 <string>Inverted</string>
613 </property>
614 </widget>
615 </item>
616 </layout>
617 </item>
618 <item>
619 <layout class="QHBoxLayout" name="horizontalLayout_29">
620 <item>
621 <widget class="QLabel" name="label_28">
622 <property name="text">
623 <string>Data In</string>
624 </property>
625 </widget>
626 </item>
627 <item>
628 <widget class="QComboBox" name="cbxDataInLPT">
629 <property name="enabled">
630 <bool>false</bool>
631 </property>
632 </widget>
633 </item>
634 <item>
635 <widget class="QCheckBox" name="ckDataInLPT">
636 <property name="text">
637 <string>Inverted</string>
638 </property>
639 </widget>
640 </item>
641 </layout>
642 </item>
643 <item>
644 <layout class="QHBoxLayout" name="horizontalLayout_30">
645 <item>
646 <widget class="QLabel" name="label_29">
647 <property name="text">
648 <string>Control Out</string>
649 </property>
650 </widget>
651 </item>
652 <item>
653 <widget class="QComboBox" name="cbxControlOutLPT">
654 <property name="enabled">
655 <bool>false</bool>
656 </property>
657 </widget>
658 </item>
659 <item>
660 <widget class="QCheckBox" name="ckControlOutLPT">
661 <property name="text">
662 <string>Inverted</string>
663 </property>
664 </widget>
665 </item>
666 </layout>
667 </item>
668 </layout>
669 </widget>
670 </item>
671 <item row="1" column="1">
672 <layout class="QVBoxLayout" name="verticalLayout_10">
673 <item>
674 <widget class="QPushButton" name="pushDefaultsLPT">
675 <property name="text">
676 <string>Defaults</string>
677 </property>
678 </widget>
679 </item>
680 <item>
681 <spacer name="verticalSpacer_4">
682 <property name="orientation">
683 <enum>Qt::Vertical</enum>
684 </property>
685 <property name="sizeHint" stdset="0">
686 <size>
687 <width>20</width>
688 <height>40</height>
689 </size>
690 </property>
691 </spacer>
692 </item>
693 </layout>
694 </item>
695 <item row="0" column="0" colspan="2">
696 <widget class="QGroupBox" name="groupBoxLPTSel">
697 <property name="title">
698 <string>Parallel port settings</string>
699 </property>
700 <layout class="QGridLayout" name="gridLayout_2">
701 <item row="0" column="0">
702 <widget class="QLabel" name="label_type_3">
703 <property name="text">
704 <string>Adapter Type</string>
705 </property>
706 </widget>
707 </item>
708 <item row="0" column="1">
709 <widget class="QComboBox" name="cbxInterfLPT">
710 <property name="sizePolicy">
711 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
712 <horstretch>0</horstretch>
713 <verstretch>0</verstretch>
714 </sizepolicy>
715 </property>
716 <property name="toolTip">
717 <string notr="true"/>
718 </property>
719 <property name="currentIndex">
720 <number>-1</number>
721 </property>
722 <property name="insertPolicy">
723 <enum>QComboBox::InsertAtTop</enum>
724 </property>
725 </widget>
726 </item>
727 <item row="1" column="0">
728 <widget class="QLabel" name="label_port_2">
729 <property name="text">
730 <string>Port Number</string>
731 </property>
732 </widget>
733 </item>
734 <item row="1" column="1">
735 <widget class="QComboBox" name="cbxInterfLPTNum">
736 <property name="sizePolicy">
737 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
738 <horstretch>0</horstretch>
739 <verstretch>0</verstretch>
740 </sizepolicy>
741 </property>
742 <property name="toolTip">
743 <string notr="true"/>
744 </property>
745 </widget>
746 </item>
747 </layout>
748 </widget>
749 </item>
750 </layout>
751 </widget>
752 <widget class="QWidget" name="tabGPIO">
753 <attribute name="title">
754 <string>GPIO</string>
755 </attribute>
756 <layout class="QFormLayout" name="formLayout_5">
757 <item row="0" column="0" colspan="2">
758 <widget class="QFrame" name="frmPortsel_6">
759 <property name="frameShape">
760 <enum>QFrame::StyledPanel</enum>
761 </property>
762 <property name="frameShadow">
763 <enum>QFrame::Raised</enum>
764 </property>
765 <layout class="QFormLayout" name="formLayout_2">
766 <item row="0" column="0">
767 <widget class="QLabel" name="label_type_8">
768 <property name="text">
769 <string>Adapter Type</string>
770 </property>
771 </widget>
772 </item>
773 <item row="0" column="1">
774 <widget class="QComboBox" name="cbxInterfGPIO">
775 <property name="sizePolicy">
776 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
777 <horstretch>0</horstretch>
778 <verstretch>0</verstretch>
779 </sizepolicy>
780 </property>
781 <property name="toolTip">
782 <string notr="true"/>
783 </property>
784 <property name="currentIndex">
785 <number>-1</number>
786 </property>
787 <property name="insertPolicy">
788 <enum>QComboBox::InsertAtTop</enum>
789 </property>
790 </widget>
791 </item>
792 <item row="1" column="0">
793 <widget class="QLabel" name="label_port_4">
794 <property name="text">
795 <string>Port Number</string>
796 </property>
797 </widget>
798 </item>
799 <item row="1" column="1">
800 <widget class="QComboBox" name="cbxInterfGPIONum">
801 <property name="sizePolicy">
802 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
803 <horstretch>0</horstretch>
804 <verstretch>0</verstretch>
805 </sizepolicy>
806 </property>
807 <property name="toolTip">
808 <string notr="true"/>
809 </property>
810 </widget>
811 </item>
812 </layout>
813 </widget>
814 </item>
815 <item row="1" column="0">
816 <widget class="QGroupBox" name="groupBoxGPIOPol">
817 <property name="title">
818 <string>Custom Settings</string>
819 </property>
820 <layout class="QVBoxLayout" name="verticalLayout_13">
821 <item>
822 <layout class="QHBoxLayout" name="horizontalLayout_40">
823 <item>
824 <widget class="QLabel" name="label_39">
825 <property name="text">
826 <string>Clock Out</string>
827 </property>
828 </widget>
829 </item>
830 <item>
831 <widget class="QComboBox" name="cbxClockOutGPIO">
832 <property name="toolTip">
833 <string/>
834 </property>
835 <property name="editable">
836 <bool>false</bool>
837 </property>
838 </widget>
839 </item>
840 <item>
841 <widget class="QCheckBox" name="ckClockOutGPIO">
842 <property name="text">
843 <string>Inverted</string>
844 </property>
845 </widget>
846 </item>
847 </layout>
848 </item>
849 <item>
850 <layout class="QHBoxLayout" name="horizontalLayout_41">
851 <item>
852 <widget class="QLabel" name="label_40">
853 <property name="text">
854 <string>Clock In</string>
855 </property>
856 </widget>
857 </item>
858 <item>
859 <widget class="QComboBox" name="cbxClockInGPIO">
860 <property name="enabled">
861 <bool>false</bool>
862 </property>
863 </widget>
864 </item>
865 <item>
866 <widget class="QCheckBox" name="ckClockInGPIO">
867 <property name="enabled">
868 <bool>false</bool>
869 </property>
870 <property name="text">
871 <string>Inverted</string>
872 </property>
873 </widget>
874 </item>
875 </layout>
876 </item>
877 <item>
878 <layout class="QHBoxLayout" name="horizontalLayout_42">
879 <item>
880 <widget class="QLabel" name="label_41">
881 <property name="text">
882 <string>Data Out</string>
883 </property>
884 </widget>
885 </item>
886 <item>
887 <widget class="QComboBox" name="cbxDataOutGPIO">
888 <property name="editable">
889 <bool>false</bool>
890 </property>
891 </widget>
892 </item>
893 <item>
894 <widget class="QCheckBox" name="ckDataOutGPIO">
895 <property name="text">
896 <string>Inverted</string>
897 </property>
898 </widget>
899 </item>
900 </layout>
901 </item>
902 <item>
903 <layout class="QHBoxLayout" name="horizontalLayout_43">
904 <item>
905 <widget class="QLabel" name="label_42">
906 <property name="text">
907 <string>Data In</string>
908 </property>
909 </widget>
910 </item>
911 <item>
912 <widget class="QComboBox" name="cbxDataInGPIO">
913 <property name="editable">
914 <bool>false</bool>
915 </property>
916 </widget>
917 </item>
918 <item>
919 <widget class="QCheckBox" name="ckDataInGPIO">
920 <property name="text">
921 <string>Inverted</string>
922 </property>
923 </widget>
924 </item>
925 </layout>
926 </item>
927 <item>
928 <layout class="QHBoxLayout" name="horizontalLayout_44">
929 <item>
930 <widget class="QLabel" name="label_43">
931 <property name="text">
932 <string>Control Out</string>
933 </property>
934 </widget>
935 </item>
936 <item>
937 <widget class="QComboBox" name="cbxControlOutGPIO">
938 <property name="editable">
939 <bool>false</bool>
940 </property>
941 </widget>
942 </item>
943 <item>
944 <widget class="QCheckBox" name="ckControlOutGPIO">
945 <property name="text">
946 <string>Inverted</string>
947 </property>
948 </widget>
949 </item>
950 </layout>
951 </item>
952 <item>
953 <layout class="QHBoxLayout" name="horizontalLayout_45">
954 <item>
955 <widget class="QLabel" name="label_44">
956 <property name="text">
957 <string>Control In</string>
958 </property>
959 </widget>
960 </item>
961 <item>
962 <widget class="QComboBox" name="cbxControlInGPIO">
963 <property name="enabled">
964 <bool>false</bool>
965 </property>
966 </widget>
967 </item>
968 <item>
969 <widget class="QCheckBox" name="ckControlInGPIO">
970 <property name="enabled">
971 <bool>false</bool>
972 </property>
973 <property name="text">
974 <string>Inverted</string>
975 </property>
976 </widget>
977 </item>
978 </layout>
979 </item>
980 <item>
981 <layout class="QHBoxLayout" name="horizontalLayout_46">
982 <item>
983 <widget class="QLabel" name="label_45">
984 <property name="text">
985 <string>Power On</string>
986 </property>
987 </widget>
988 </item>
989 <item>
990 <widget class="QComboBox" name="cbxPowerOnGPIO">
991 <property name="enabled">
992 <bool>false</bool>
993 </property>
994 </widget>
995 </item>
996 <item>
997 <widget class="QCheckBox" name="ckPowerOnGPIO">
998 <property name="enabled">
999 <bool>false</bool>
1000 </property>
1001 <property name="text">
1002 <string>Inverted</string>
1003 </property>
1004 </widget>
1005 </item>
1006 </layout>
1007 </item>
1008 <item>
1009 <layout class="QHBoxLayout" name="horizontalLayout_47">
1010 <item>
1011 <widget class="QLabel" name="label_46">
1012 <property name="text">
1013 <string>Enable OD</string>
1014 </property>
1015 </widget>
1016 </item>
1017 <item>
1018 <widget class="QComboBox" name="cbxEnaODGPIO">
1019 <property name="enabled">
1020 <bool>false</bool>
1021 </property>
1022 </widget>
1023 </item>
1024 <item>
1025 <widget class="QCheckBox" name="ckEnaODGPIO">
1026 <property name="enabled">
1027 <bool>false</bool>
1028 </property>
1029 <property name="text">
1030 <string>Inverted</string>
1031 </property>
1032 </widget>
1033 </item>
1034 </layout>
1035 </item>
1036 </layout>
1037 </widget>
1038 </item>
1039 <item row="1" column="1">
1040 <layout class="QVBoxLayout" name="verticalLayout_14">
1041 <item>
1042 <widget class="QPushButton" name="pushDefaultsGPIO">
1043 <property name="text">
1044 <string>Defaults</string>
1045 </property>
1046 </widget>
1047 </item>
1048 <item>
1049 <spacer name="verticalSpacer_6">
1050 <property name="orientation">
1051 <enum>Qt::Vertical</enum>
1052 </property>
1053 <property name="sizeHint" stdset="0">
1054 <size>
1055 <width>20</width>
1056 <height>40</height>
1057 </size>
1058 </property>
1059 </spacer>
1060 </item>
1061 </layout>
1062 </item>
1063 </layout>
1064 </widget>
1911065 </widget>
1921066 </item>
1931067 </layout>
1919 <x>0</x>
2020 <y>0</y>
2121 <width>800</width>
22 <height>32</height>
22 <height>30</height>
2323 </rect>
2424 </property>
2525 <widget class="QMenu" name="menuFile">
9696 </property>
9797 <addaction name="actionInterfaceSetup"/>
9898 <addaction name="actionCalibration"/>
99 <addaction name="actionPreferences"/>
99100 </widget>
100101 <widget class="QMenu" name="menuHelp">
101102 <property name="title">
531532 <string>&amp;ByteSwap</string>
532533 </property>
533534 </action>
535 <action name="actionPreferences">
536 <property name="text">
537 <string>Preferences</string>
538 </property>
539 </action>
534540 </widget>
535541 <resources>
536542 <include location="../ponyprog.qrc"/>
1616 <string>Dialog</string>
1717 </property>
1818 <layout class="QGridLayout" name="gridLayout_2">
19 <item row="2" column="2">
19 <item row="3" column="2">
2020 <widget class="QPushButton" name="pushCancel">
2121 <property name="text">
2222 <string>cancel</string>
2323 </property>
2424 </widget>
2525 </item>
26 <item row="2" column="0">
26 <item row="3" column="0">
2727 <spacer name="horizontalSpacer">
2828 <property name="orientation">
2929 <enum>Qt::Horizontal</enum>
3535 </size>
3636 </property>
3737 </spacer>
38 </item>
39 <item row="2" column="3">
40 <widget class="QPushButton" name="pushOk">
41 <property name="text">
42 <string>ok</string>
43 </property>
44 </widget>
45 </item>
46 <item row="1" column="0" colspan="4">
47 <widget class="QCheckBox" name="chkMemOffset">
48 <property name="text">
49 <string>CheckBox</string>
50 </property>
51 </widget>
52 </item>
53 <item row="2" column="1">
54 <widget class="QPushButton" name="pushRead">
55 <property name="text">
56 <string>read</string>
57 </property>
58 </widget>
5938 </item>
6039 <item row="0" column="0" colspan="4">
6140 <widget class="QFrame" name="frmSN">
8968 </layout>
9069 </widget>
9170 </item>
71 <item row="3" column="3">
72 <widget class="QPushButton" name="pushOk">
73 <property name="text">
74 <string>ok</string>
75 </property>
76 </widget>
77 </item>
78 <item row="1" column="0" colspan="4">
79 <widget class="QCheckBox" name="chkMemOffset">
80 <property name="text">
81 <string>CheckBox</string>
82 </property>
83 </widget>
84 </item>
85 <item row="3" column="1">
86 <widget class="QPushButton" name="pushRead">
87 <property name="text">
88 <string>read</string>
89 </property>
90 </widget>
91 </item>
92 <item row="2" column="0" colspan="4">
93 <widget class="QCheckBox" name="chkEnabled">
94 <property name="text">
95 <string>CheckBox</string>
96 </property>
97 </widget>
98 </item>
9299 </layout>
93100 </widget>
94101 <resources/>
0 <?xml version="1.0" encoding="UTF-8"?>
1 <ui version="4.0">
2 <class>PrefDialog</class>
3 <widget class="QDialog" name="PrefDialog">
4 <property name="geometry">
5 <rect>
6 <x>0</x>
7 <y>0</y>
8 <width>330</width>
9 <height>348</height>
10 </rect>
11 </property>
12 <property name="windowTitle">
13 <string>Preferences</string>
14 </property>
15 <layout class="QVBoxLayout" name="verticalLayout">
16 <item>
17 <widget class="QTabWidget" name="tabWidget">
18 <property name="currentIndex">
19 <number>1</number>
20 </property>
21 <widget class="QWidget" name="tabBusSpeed">
22 <attribute name="title">
23 <string>Bus Speed</string>
24 </attribute>
25 <layout class="QFormLayout" name="formLayout">
26 <item row="0" column="0">
27 <widget class="QLabel" name="lblBusSpeedSPI">
28 <property name="text">
29 <string>TextLabel</string>
30 </property>
31 </widget>
32 </item>
33 <item row="0" column="1">
34 <widget class="QComboBox" name="cbxBusSpeedSPI">
35 <property name="sizePolicy">
36 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
37 <horstretch>0</horstretch>
38 <verstretch>0</verstretch>
39 </sizepolicy>
40 </property>
41 </widget>
42 </item>
43 <item row="1" column="0">
44 <widget class="QLabel" name="lblBusSpeedMicroWire">
45 <property name="text">
46 <string>TextLabel</string>
47 </property>
48 </widget>
49 </item>
50 <item row="1" column="1">
51 <widget class="QComboBox" name="cbxBusSpeedMicroWire"/>
52 </item>
53 <item row="2" column="0">
54 <widget class="QLabel" name="lblBusSpeedI2C">
55 <property name="text">
56 <string>TextLabel</string>
57 </property>
58 </widget>
59 </item>
60 <item row="2" column="1">
61 <widget class="QComboBox" name="cbxBusSpeedI2C"/>
62 </item>
63 <item row="3" column="0">
64 <widget class="QLabel" name="lblBusSpeedPIC">
65 <property name="text">
66 <string>TextLabel</string>
67 </property>
68 </widget>
69 </item>
70 <item row="3" column="1">
71 <widget class="QComboBox" name="cbxBusSpeedPIC"/>
72 </item>
73 <item row="4" column="0">
74 <widget class="QLabel" name="lblBusSpeedSDE">
75 <property name="text">
76 <string>TextLabel</string>
77 </property>
78 </widget>
79 </item>
80 <item row="4" column="1">
81 <widget class="QComboBox" name="cbxBusSpeedSDE"/>
82 </item>
83 <item row="5" column="0">
84 <widget class="QLabel" name="lblBusSpeedIM">
85 <property name="text">
86 <string>TextLabel</string>
87 </property>
88 </widget>
89 </item>
90 <item row="5" column="1">
91 <widget class="QComboBox" name="cbxBusSpeedIM"/>
92 </item>
93 </layout>
94 </widget>
95 <widget class="QWidget" name="tabTimings">
96 <attribute name="title">
97 <string>Timings</string>
98 </attribute>
99 <layout class="QFormLayout" name="formLayout_2">
100 <item row="0" column="0">
101 <widget class="QGroupBox" name="groupBox">
102 <layout class="QFormLayout" name="formLayout_3">
103 <item row="0" column="0">
104 <widget class="QLabel" name="label_1">
105 <property name="text">
106 <string>TextLabel</string>
107 </property>
108 </widget>
109 </item>
110 <item row="0" column="1">
111 <widget class="QLineEdit" name="lineEdit_1"/>
112 </item>
113 <item row="1" column="0">
114 <widget class="QLabel" name="label_2">
115 <property name="text">
116 <string>TextLabel</string>
117 </property>
118 </widget>
119 </item>
120 <item row="1" column="1">
121 <widget class="QLineEdit" name="lineEdit_2"/>
122 </item>
123 <item row="2" column="0">
124 <widget class="QLabel" name="label_3">
125 <property name="text">
126 <string>TextLabel</string>
127 </property>
128 </widget>
129 </item>
130 <item row="2" column="1">
131 <widget class="QLineEdit" name="lineEdit_3"/>
132 </item>
133 <item row="3" column="0">
134 <widget class="QLabel" name="label_4">
135 <property name="text">
136 <string>TextLabel</string>
137 </property>
138 </widget>
139 </item>
140 <item row="3" column="1">
141 <widget class="QLineEdit" name="lineEdit_4"/>
142 </item>
143 <item row="4" column="0">
144 <widget class="QLabel" name="label_5">
145 <property name="text">
146 <string>TextLabel</string>
147 </property>
148 </widget>
149 </item>
150 <item row="4" column="1">
151 <widget class="QLineEdit" name="lineEdit_5"/>
152 </item>
153 <item row="5" column="0">
154 <widget class="QLabel" name="label_6">
155 <property name="text">
156 <string>TextLabel</string>
157 </property>
158 </widget>
159 </item>
160 <item row="5" column="1">
161 <widget class="QLineEdit" name="lineEdit_6"/>
162 </item>
163 </layout>
164 </widget>
165 </item>
166 </layout>
167 </widget>
168 </widget>
169 </item>
170 <item>
171 <widget class="QDialogButtonBox" name="buttonBox">
172 <property name="orientation">
173 <enum>Qt::Horizontal</enum>
174 </property>
175 <property name="standardButtons">
176 <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
177 </property>
178 </widget>
179 </item>
180 </layout>
181 </widget>
182 <resources/>
183 <connections>
184 <connection>
185 <sender>buttonBox</sender>
186 <signal>accepted()</signal>
187 <receiver>PrefDialog</receiver>
188 <slot>accept()</slot>
189 <hints>
190 <hint type="sourcelabel">
191 <x>248</x>
192 <y>254</y>
193 </hint>
194 <hint type="destinationlabel">
195 <x>157</x>
196 <y>274</y>
197 </hint>
198 </hints>
199 </connection>
200 <connection>
201 <sender>buttonBox</sender>
202 <signal>rejected()</signal>
203 <receiver>PrefDialog</receiver>
204 <slot>reject()</slot>
205 <hints>
206 <hint type="sourcelabel">
207 <x>316</x>
208 <y>260</y>
209 </hint>
210 <hint type="destinationlabel">
211 <x>286</x>
212 <y>274</y>
213 </hint>
214 </hints>
215 </connection>
216 </connections>
217 </ui>
88 <rect>
99 <x>0</x>
1010 <y>0</y>
11 <width>221</width>
12 <height>314</height>
11 <width>290</width>
12 <height>330</height>
1313 </rect>
1414 </property>
1515 <property name="windowTitle">
3131 #include <QTreeWidget>
3232
3333
34
35 //======================>>> fuseModalDialog::fuseModalDialog <<<==================
34 //=========================================================================//
35 //
36 // E. Kalinowski
37 // description for fuse/lock bits is under:
38 // http://eleccelerator.com/fusecalc/
39 // http://www.engbedded.com/cgi-bin/fcx.cgi?
40 //
41 //=========================================================================//
42
3643 fuseModalDialog::fuseModalDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
3744 QDialog(bw)
3845 {
6774 }
6875
6976
70 //===================>>> fuseModalDialog::~fuseModalDialog <<<====================
7177 fuseModalDialog::~fuseModalDialog()
7278 {
7379 qDebug() << "fuseModalDialog::~fuseModalDialog()";
163169 fuseEnabled = true;
164170 lockEnabled = true;
165171
172 QString nm = GetEEPTypeString(type);
173
166174 chkHlp1->setText(translate(STR_FUSEDLGNOTECLR) + " (bit = 1)");
167175 chkHlp1->setEnabled(false);
168176 chkHlp0->setText(translate(STR_FUSEDLGNOTESET) + " (bit = 0)");
192200 unsigned int f = awip->GetFuseBits();
193201 if (currentBitField.fuse.count() > 0)
194202 {
195 fuseWidget = new BitFieldWidget(this, currentBitField.fuse, currentBitField.fuseDescr, f);
203 fuseWidget = new BitFieldWidget(this, currentBitField.fuse, currentBitField.fuseDescr, f, nm);
196204 tabWidget->addTab(fuseWidget, "Fuse");
197205 connect(fuseWidget, SIGNAL(displayBitFields(int)), this, SLOT(getFuse(int)));
198206
206214 unsigned int l = awip->GetLockBits();
207215 if (currentBitField.lock.count() > 0)
208216 {
209 lockWidget = new BitFieldWidget(this, currentBitField.lock, currentBitField.lockDescr, l);
217 lockWidget = new BitFieldWidget(this, currentBitField.lock, currentBitField.lockDescr, l, nm);
210218 tabWidget->addTab(lockWidget, "Lock");
211219 connect(lockWidget, SIGNAL(displayBitFields(int)), this, SLOT(getLock(int)));
212220
248256 },
249257 {
250258 // lock
251 { 5, "LB5", "" },
252 { 6, "LB6", "" },
253 { 7, "LB7", "" }
254 },
255 {
256 // lock mask description
257 { "LB=000", "Mode 1: No memory lock features enabled" },
258 { "LB=001", "Mode 2: MOVC disabled" },
259 { "LB=011", "Mode 3: Verify disabled" },
260 { "LB=111", "Mode 4: External execution disabled" }
259 { 5, "LB5", "", "" },
260 { 6, "LB6", "", "" },
261 { 7, "LB7", "", "" }
262 },
263 {
264 // lock mask description
265 { "LB=000", "Mode 1: No memory lock features enabled", "" },
266 { "LB=001", "Mode 2: MOVC disabled", "" },
267 { "LB=011", "Mode 3: Verify disabled", "" },
268 { "LB=111", "Mode 4: External execution disabled", "" }
261269 }
262270 },
263271 {
264272 { AT89S8253 }, // ???
265273 {
266274 // fuse
267 { 0, "ClkSel", "" },
268 { 1, "UserRow", "" },
269 { 2, "x2Mode", ""},
270 { 3, "SerProg", "" }
271 },
272 {
273 // fuse mask description
274 },
275 {
276 // lock
277 { 0, "LB0", "" },
278 { 1, "LB1", "" },
279 { 2, "LB2", "" }
280 },
281 {
282 // lock mask description
283 { "LB=000", "Mode 1: No memory lock features enabled" },
284 { "LB=001", "Mode 2: MOVC disabled" },
285 { "LB=011", "Mode 3: Verify disabled" },
286 { "LB=111", "Mode 4: External execution disabled" }
275 { 0, "ClkSel", "", "" },
276 { 1, "UserRow", "", "" },
277 { 2, "x2Mode", "", "" },
278 { 3, "SerProg", "", "" }
279 },
280 {
281 // fuse mask description
282 },
283 {
284 // lock
285 { 0, "LB0", "", "" },
286 { 1, "LB1", "", "" },
287 { 2, "LB2", "", "" }
288 },
289 {
290 // lock mask description
291 { "LB=000", "Mode 1: No memory lock features enabled", "" },
292 { "LB=001", "Mode 2: MOVC disabled", "" },
293 { "LB=011", "Mode 3: Verify disabled", "" },
294 { "LB=111", "Mode 4: External execution disabled", "" }
287295 }
288296 },
289297
297305 },
298306 {
299307 // lock
300 { 2, "LB2", "" },
301 { 3, "LB3", "" },
302 { 4, "LB4", "" }
303 },
304 {
305 // lock mask description
306 { "LB=000", "Mode 1: No memory lock features enabled" },
307 { "LB=001", "Mode 2: MOVC disabled" },
308 { "LB=011", "Mode 3: Verify disabled" },
309 { "LB=111", "Mode 4: External execution disabled" }
310 }
311 },
312 #if 0
313 {
314 { AT89S52 }, // ???
315 {
316 // fuse
317 },
318 {
319 // fuse mask description
320 },
321 {
322 // lock
323 { 2, "LB2", "" },
324 { 3, "LB3", "" },
325 { 4, "LB4", "" }
326 },
327 {
328 // lock mask description
329 { "LB=000", "Mode 1: No memory lock features enabled" },
330 { "LB=001", "Mode 2: MOVC disabled" },
331 { "LB=011", "Mode 3: Verify disabled" },
332 { "LB=111", "Mode 4: External execution disabled" }
333 }
334 },
335
336 {
337 { AT89S53 }, // ???
338 {
339 // fuse
340 },
341 {
342 // fuse mask description
343 },
344 {
345 // lock
346 { 5, "LB5", "" },
347 { 6, "LB6", "" },
348 { 7, "LB7", "" }
349 },
350 {
351 // lock mask description
352 { "LB=000", "Mode 1: No memory lock features enabled" },
353 { "LB=001", "Mode 2: MOVC disabled" },
354 { "LB=011", "Mode 3: Verify disabled" },
355 { "LB=111", "Mode 4: External execution disabled" }
356 }
357 },
358 #endif
359 {
360 { AT90CAN32 },
308 { 2, "LB2", "", "" },
309 { 3, "LB3", "", "" },
310 { 4, "LB4", "", "" }
311 },
312 {
313 // lock mask description
314 { "LB=000", "Mode 1: No memory lock features enabled", "" },
315 { "LB=001", "Mode 2: MOVC disabled", "" },
316 { "LB=011", "Mode 3: Verify disabled", "" },
317 { "LB=111", "Mode 4: External execution disabled", "" }
318 }
319 },
320
321 {
322 { AT90CAN32, AT90CAN64, AT90CAN128 },
361323 {
362324 // fuse
363325 // byte low
364 { 0, "CKSEL0", "" },
365 { 1, "CKSEL1", "" },
366 { 2, "CKSEL2", "" },
367 { 3, "CKSEL3", "" },
368 { 4, "SUT0", "" },
369 { 5, "SUT1", "" },
370 { 6, "CKOUT", "Clock output on PORTC7" },
371 { 7, "CKDIV8", "Divide clock by 8 internally" },
326 { 0, "CKSEL0", "", "" },
327 { 1, "CKSEL1", "", "" },
328 { 2, "CKSEL2", "", "" },
329 { 3, "CKSEL3", "", "" },
330 { 4, "SUT0", "", "" },
331 { 5, "SUT1", "", "" },
332 { 6, "CKOUT", "Clock output on PORTC7", "" },
333 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
372334 // byte high
373 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
374 { 9, "BOOTSZ0", "" },
375 { 10, "BOOTSZ1", "" },
376 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
377 { 12, "WDTON", "Watchdog timer always on" },
378 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
379 { 14, "JTAGEN", "JTAG Interface Enabled" },
380 { 15, "OCDEN", "On-Chip Debug Enabled" },
335 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
336 { 9, "BOOTSZ0", "", "" },
337 { 10, "BOOTSZ1", "", "" },
338 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
339 { 12, "WDTON", "Watchdog timer always on", "" },
340 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
341 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
342 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
381343 // byte ext
382 { 16, "TA0SEL", "Reserved for factory tests" },
383 { 17, "BODLEVEL0", "" },
384 { 18, "BODLEVEL1", "" },
385 { 19, "BODLEVEL2", "" }
386 },
387 {
388 // fuse mask description
389 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
390 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
391 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
392 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
393 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
394 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
395 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
396 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
397 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
398 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
399 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
400 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
401 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
402 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
403 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
404 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
405 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
406 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
407 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 0 ms" },
408 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 4.1 ms" },
409 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 65 ms" },
410 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 4.1 ms" },
411 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 65 ms" },
412 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
413 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; Int. Cap." },
414 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
415 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; Int. Cap." },
416 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
417 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; Int. Cap." },
418 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
419 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; Int. Cap." },
420 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
421 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; Int. Cap." },
422 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
423 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; Int. Cap." },
424 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
425 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
426 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
427
428 { "BOOTSZ=10", "Boot Flash section size=1024 words Boot start address=$3C00" },
429 { "BOOTSZ=01", "Boot Flash section size=2048 words Boot start address=$3800" },
430 { "BOOTSZ=00", "Boot Flash section size=4096 words Boot start address=$3000" },
431 { "BOOTSZ=11", "Boot Flash section size=512 words Boot start address=$3E00" },
432
433 { "BODLEVEL=111", "Brown-out detection disabled" },
434 { "BODLEVEL=000", "Brown-out detection level at VCC=2.5 V" },
435 { "BODLEVEL=001", "Brown-out detection level at VCC=2.6 V" },
436 { "BODLEVEL=010", "Brown-out detection level at VCC=2.7 V" },
437 { "BODLEVEL=011", "Brown-out detection level at VCC=3.8 V" },
438 { "BODLEVEL=100", "Brown-out detection level at VCC=3.9 V" },
439 { "BODLEVEL=101", "Brown-out detection level at VCC=4.0 V" },
440 { "BODLEVEL=110", "Brown-out detection level at VCC=4.1 V" }
441 },
442 {
443 // lock
444 { 0, "Lock1", "" },
445 { 1, "Lock2", "" },
446 { 2, "BootLock1", "" },
447 { 3, "BootLock2", "" },
448 { 4, "BootLoad1", "" },
449 { 5, "BootLoad2", "" }
450 },
451 {
452 // lock mask description
453 { "Lock=11", "Mode 1: No memory lock features enabled" },
454 { "Lock=10", "Mode 2: Further programming disabled" },
455 { "Lock=00", "Mode 3: Further programming and verification disabled" },
456
457 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
458 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
459 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
460 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
461
462 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
463 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
464 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
465 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
466 }
467 },
468
469 {
470 { AT90CAN64 },
471 {
472 // fuse
473 { 0, "CKSEL0", "" },
474 { 1, "CKSEL1", "" },
475 { 2, "CKSEL2", "" },
476 { 3, "CKSEL3", "" },
477 { 4, "SUT0", "" },
478 { 5, "SUT1", "" },
479 { 6, "CKOUT", "Clock output on PORTC7" },
480 { 7, "CKDIV8", "Divide clock by 8 internally" },
481 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
482 { 9, "BOOTSZ0", "" },
483 { 10, "BOOTSZ1", "" },
484 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
485 { 12, "WDTON", "Watchdog timer always on" },
486 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
487 { 14, "JTAGEN", "JTAG Interface Enabled" },
488 { 15, "OCDEN", "On-Chip Debug Enabled" },
489 { 16, "TA0SEL", "Reserved for factory tests" },
490 { 17, "BODLEVEL0", "" },
491 { 18, "BODLEVEL1", "" },
492 { 19, "BODLEVEL2", "" }
493 },
494 {
495 // fuse mask description
496 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
497 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
498 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
499 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
500 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
501 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
502 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
503 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
504 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
505 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
506 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
507 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
508 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
509 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
510 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
511 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
512 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
513 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
514 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 0 ms" },
515 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 4.1 ms" },
516 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 65 ms" },
517 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 4.1 ms" },
518 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 65 ms" },
519 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
520 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; Int. Cap." },
521 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
522 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; Int. Cap." },
523 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
524 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; Int. Cap." },
525 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
526 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; Int. Cap." },
527 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
528 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; Int. Cap." },
529 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
530 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; Int. Cap." },
531 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
532 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
533 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
534
535 { "BOOTSZ=10", "Boot Flash section size=1024 words Boot start address=$7C00" },
536 { "BOOTSZ=01", "Boot Flash section size=2048 words Boot start address=$7800" },
537 { "BOOTSZ=00", "Boot Flash section size=4096 words Boot start address=$7000" },
538 { "BOOTSZ=11", "Boot Flash section size=512 words Boot start address=$7E00" },
539
540 { "BODLEVEL=111", "Brown-out detection disabled" },
541 { "BODLEVEL=000", "Brown-out detection level at VCC=2.5 V" },
542 { "BODLEVEL=001", "Brown-out detection level at VCC=2.6 V" },
543 { "BODLEVEL=010", "Brown-out detection level at VCC=2.7 V" },
544 { "BODLEVEL=011", "Brown-out detection level at VCC=3.8 V" },
545 { "BODLEVEL=100", "Brown-out detection level at VCC=3.9 V" },
546 { "BODLEVEL=101", "Brown-out detection level at VCC=4.0 V" },
547 { "BODLEVEL=110", "Brown-out detection level at VCC=4.1 V" }
548 },
549 {
550 // lock
551 { 0, "Lock1", "" },
552 { 1, "Lock2", "" },
553 { 2, "BootLock1", "" },
554 { 3, "BootLock2", "" },
555 { 4, "BootLoad1", "" },
556 { 5, "BootLoad2", "" }
557 },
558 {
559 // lock mask description
560 { "Lock=11", "Mode 1: No memory lock features enabled" },
561 { "Lock=10", "Mode 2: Further programming disabled" },
562 { "Lock=00", "Mode 3: Further programming and verification disabled" },
563
564 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
565 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
566 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
567 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
568
569 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
570 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
571 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
572 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
573 }
574 },
575
576 {
577 { AT90CAN128 },
578 {
579 // fuse
580 { 0, "CKSEL0", "" },
581 { 1, "CKSEL1", "" },
582 { 2, "CKSEL2", "" },
583 { 3, "CKSEL3", "" },
584 { 4, "SUT0", "" },
585 { 5, "SUT1", "" },
586 { 6, "CKOUT", "Clock output on PORTE7" },
587 { 7, "CKDIV8", "Divide clock by 8 internally" },
588 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
589 { 9, "BOOTSZ0", "" },
590 { 10, "BOOTSZ1", "" },
591 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
592 { 12, "WDTON", "Watchdog timer always on" },
593 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
594 { 14, "JTAGEN", "JTAG Interface Enabled" },
595 { 15, "OCDEN", "On-Chip Debug Enabled" },
596 { 16, "TA0SEL", "Reserved for factory tests" },
597 { 17, "BODLEVEL0", "" },
598 { 18, "BODLEVEL1", "" },
599 { 19, "BODLEVEL2", "" }
600 },
601 {
602 // fuse mask description
603 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
604 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
605 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
606 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
607 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
608 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
609 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
610 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
611 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
612 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
613 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
614 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
615 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
616 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
617 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
618 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
619 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
620 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
621 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 0 ms" },
622 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 4.1 ms" },
623 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 65 ms" },
624 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 4.1 ms" },
625 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 65 ms" },
626 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
627 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; Int. Cap." },
628 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
629 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; Int. Cap." },
630 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
631 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; Int. Cap." },
632 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
633 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; Int. Cap." },
634 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
635 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; Int. Cap." },
636 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
637 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; Int. Cap." },
638 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
639 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
640 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
641
642 { "BOOTSZ=10", "Boot Flash section size=1024 words Boot start address=$FC00" },
643 { "BOOTSZ=01", "Boot Flash section size=2048 words Boot start address=$F800" },
644 { "BOOTSZ=00", "Boot Flash section size=4096 words Boot start address=$F000" },
645 { "BOOTSZ=11", "Boot Flash section size=512 words Boot start address=$FE00" },
646
647 { "BODLEVEL=111", "Brown-out detection disabled" },
648 { "BODLEVEL=000", "Brown-out detection level at VCC=2.5 V" },
649 { "BODLEVEL=001", "Brown-out detection level at VCC=2.6 V" },
650 { "BODLEVEL=010", "Brown-out detection level at VCC=2.7 V" },
651 { "BODLEVEL=011", "Brown-out detection level at VCC=3.8 V" },
652 { "BODLEVEL=100", "Brown-out detection level at VCC=3.9 V" },
653 { "BODLEVEL=101", "Brown-out detection level at VCC=4.0 V" },
654 { "BODLEVEL=110", "Brown-out detection level at VCC=4.1 V" }
655 },
656 {
657 // lock
658 { 0, "Lock1", "" },
659 { 1, "Lock2", "" },
660 { 2, "BootLock1", "" },
661 { 3, "BootLock2", "" },
662 { 4, "BootLoad1", "" },
663 { 5, "BootLoad2", "" }
664 },
665 {
666 // lock mask description
667 { "Lock=11", "Mode 1: No memory lock features enabled" },
668 { "Lock=10", "Mode 2: Further programming disabled" },
669 { "Lock=00", "Mode 3: Further programming and verification disabled" },
670
671 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
672 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
673 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
674 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
675
676 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
677 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
678 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
679 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
344 { 16, "TA0SEL", "Reserved for factory tests", "" },
345 { 17, "BODLEVEL0", "", "" },
346 { 18, "BODLEVEL1", "", "" },
347 { 19, "BODLEVEL2", "", "" }
348 },
349 {
350 // fuse mask description
351 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
352 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms", "" },
353 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms", "" },
354 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms", "" },
355 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms", "" },
356 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms", "" },
357 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms", "" },
358 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms", "" },
359 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms", "" },
360 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
361 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms", "" },
362 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
363 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms", "" },
364 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms", "" },
365 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
366 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms", "" },
367 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
368 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms", "" },
369 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 0 ms", "" },
370 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
371 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 1K CK + 65 ms", "" },
372 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
373 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0-16.0 MHz; Start-up time: 258 CK + 65 ms", "" },
374 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms", "" },
375 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; Int. Cap.", "" },
376 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms", "" },
377 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; Int. Cap.", "" },
378 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms", "" },
379 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; Int. Cap.", "" },
380 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms", "" },
381 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; Int. Cap.", "" },
382 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms", "" },
383 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; Int. Cap.", "" },
384 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms", "" },
385 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; Int. Cap.", "" },
386 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms", "" },
387 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms", "" },
388 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms", "" },
389
390 { "BOOTSZ=10", "Boot Flash section size=1024 words Boot start address=$nC00", "AT90CAN32: $3C00, AT90CAN64: $7C00, AT90CAN128: $FC00" },
391 { "BOOTSZ=01", "Boot Flash section size=2048 words Boot start address=$n800", "AT90CAN32: $3800, AT90CAN64: $7800, AT90CAN128: $F800" },
392 { "BOOTSZ=00", "Boot Flash section size=4096 words Boot start address=$n000", "AT90CAN32: $3000, AT90CAN64: $7000, AT90CAN128: $F000" },
393 { "BOOTSZ=11", "Boot Flash section size=512 words Boot start address=$nE00", "AT90CAN32: $3E00, AT90CAN64: $7E00, AT90CAN128: $FE00" },
394
395 { "BODLEVEL=111", "Brown-out detection disabled", "" },
396 { "BODLEVEL=000", "Brown-out detection level at VCC=2.5 V", "" },
397 { "BODLEVEL=001", "Brown-out detection level at VCC=2.6 V", "" },
398 { "BODLEVEL=010", "Brown-out detection level at VCC=2.7 V", "" },
399 { "BODLEVEL=011", "Brown-out detection level at VCC=3.8 V", "" },
400 { "BODLEVEL=100", "Brown-out detection level at VCC=3.9 V", "" },
401 { "BODLEVEL=101", "Brown-out detection level at VCC=4.0 V", "" },
402 { "BODLEVEL=110", "Brown-out detection level at VCC=4.1 V", "" }
403 },
404 {
405 // lock
406 { 0, "Lock1", "", "" },
407 { 1, "Lock2", "", "" },
408 { 2, "BootLock1", "", "" },
409 { 3, "BootLock2", "", "" },
410 { 4, "BootLoad1", "", "" },
411 { 5, "BootLoad2", "", "" }
412 },
413 {
414 // lock mask description
415 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
416 { "Lock=10", "Mode 2: Further programming disabled", "" },
417 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
418
419 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
420 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
421 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
422 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
423
424 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
425 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
426 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
427 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
680428 }
681429 },
682430
684432 { AT90S1200 },
685433 {
686434 // fuse
687 { 0, "/FB0", "NOT External clock enabled" },
688 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
689 },
690 {
691 // fuse mask description
692 },
693 {
694 // lock
695 { 1, "LB1", "" },
696 { 2, "LB2", "" }
697 },
698 {
699 // lock mask description
700 { "LB=11", "Mode 1: No memory lock features enabled" },
701 { "LB=10", "Mode 2: Further programming disabled" },
702 { "LB=00", "Mode 3: Further programming and verification disabled" }
435 { 0, "/FB0", "NOT External clock enabled", "" },
436 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
437 },
438 {
439 // fuse mask description
440 },
441 {
442 // lock
443 { 1, "LB1", "", "" },
444 { 2, "LB2", "", "" }
445 },
446 {
447 // lock mask description
448 { "LB=11", "Mode 1: No memory lock features enabled", "" },
449 { "LB=10", "Mode 2: Further programming disabled", "" },
450 { "LB=00", "Mode 3: Further programming and verification disabled", "" }
703451 }
704452 },
705453 {
706454 { AT90S2313, AT90S4414, AT90S8515, AT90S4434, AT90S8535 },
707455 {
708456 // fuse
709 { 0, "FSTRT", "Short start-up time enabled" },
710 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
711 },
712 {
713 // fuse mask description
714 },
715 {
716 // lock
717 { 1, "Lock1", "" },
718 { 2, "Lock2", "" }
719 },
720 {
721 // lock mask description
722 { "Lock=11", "Mode 1: No memory lock features enabled" },
723 { "Lock=10", "Mode 2: Further programming disabled" },
724 { "Lock=00", "Mode 3: Further programming and verification disabled" }
725 }
726 },
727 #if 0
728 {
729 { AT90S4414 },
730 {
731 // fuse
732 { 0, "FSTRT", "Short start-up time enabled" },
733 // { 1, "SPIEN", "" },
734 // { 2, "FSTRT", "" },
735 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
736 },
737 {
738 // fuse mask description
739 },
740 {
741 // lock
742 { 1, "Lock1", "" },
743 { 2, "Lock2", "" }
744 },
745 {
746 // lock mask description
747 { "Lock=11", "Mode 1: No memory lock features enabled" },
748 { "Lock=10", "Mode 2: Further programming disabled" },
749 { "Lock=00", "Mode 3: Further programming and verification disabled" }
750 }
751 },
752
753 {
754 { AT90S8515 },
755 {
756 // fuse
757 { 0, "FSTRT", "Short start-up time enabled" },
758 // { 1, "SPIEN", "" },
759 // { 2, "FSTRT", "" },
760 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
761 },
762 {
763 // fuse mask description
764 },
765 {
766 // lock
767 { 1, "Lock1", "" },
768 { 2, "Lock2", "" }
769 },
770 {
771 // lock mask description
772 { "Lock=11", "Mode 1: No memory lock features enabled" },
773 { "Lock=10", "Mode 2: Further programming disabled" },
774 { "Lock=00", "Mode 3: Further programming and verification disabled" }
775 }
776 },
777 {
778 { AT90S4434 },
779 {
780 // fuse
781 { 0, "FSTRT", "Short start-up time enabled" },
782 // { 1, "SPIEN", "" },
783 // { 2, "FSTRT", "" },
784 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
785 },
786 {
787 // fuse mask description
788 },
789 {
790 // lock
791 { 1, "Lock1", "" },
792 { 2, "Lock2", "" }
793 },
794 {
795 // lock mask description
796 { "Lock=11", "Mode 1: No memory lock features enabled" },
797 { "Lock=10", "Mode 2: Further programming disabled" },
798 { "Lock=00", "Mode 3: Further programming and verification disabled" }
799 }
800 },
801
802 {
803 { AT90S8535 },
804 {
805 // fuse
806 { 0, "FSTRT", "Short start-up time enabled" },
807 // { 1, "SPIEN", "" },
808 // { 2, "FSTRT", "" },
809 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
810 },
811 {
812 // fuse mask description
813 },
814 {
815 // lock
816 { 1, "Lock1", "" },
817 { 2, "Lock2", "" }
818 },
819 {
820 // lock mask description
821 { "Lock=11", "Mode 1: No memory lock features enabled" },
822 { "Lock=10", "Mode 2: Further programming disabled" },
823 { "Lock=00", "Mode 3: Further programming and verification disabled" }
824 }
825 },
826 #endif
827 {
828 { AT90S2333 }, // ???
829 {
830 // fuse
831 { 0, "CKSEL0", "" },
832 { 1, "CKSEL1", "" },
833 { 2, "CKSEL2", "" },
834 { 3, "BODEN", "Brown-out detection enabled" },
835 { 4, "BODLEVEL", "Brown-out detection level at VCC=2.7V" },
836 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
837 },
838 {
839 // fuse mask description
840 },
841 {
842 // lock
843 { 1, "Lock1", "" },
844 { 2, "Lock2", "" }
845 },
846 {
847 // lock mask description
848 { "Lock=11", "Mode 1: No memory lock features enabled" },
849 { "Lock=10", "Mode 2: Further programming disabled" },
850 { "Lock=00", "Mode 3: Further programming and verification disabled" }
851 }
852 },
853
854 {
855 { AT90S4433 },
856 {
857 // fuse
858 { 0, "CKSEL0", "" },
859 { 1, "CKSEL1", "" },
860 { 2, "CKSEL2", "" },
861 { 3, "BODEN", "Brown-out detection enabled" },
862 { 4, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7V" },
863 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
864 },
865 {
866 // fuse mask description
867 { "CKSEL=101", "Ceramic Resonator" },
868 { "CKSEL=111", "Ceramic Resonator; BOD Enabled or power-on reset" },
869 { "CKSEL=110", "Ceramic Resonator; fast rising power" },
870 { "CKSEL=100", "Crystal Oscillator; BOD Enabled or power-on reset" },
871 { "CKSEL=010", "Crystal Oscillator; default value" },
872 { "CKSEL=011", "Crystal Oscillator; fast rising power" },
873 { "CKSEL=001", "External Clock; BOD Enabled or power-on reset" },
874 { "CKSEL=000", "External Clock; slowly rising power" }
875 },
876 {
877 // lock
878 { 1, "Lock1", "" },
879 { 2, "Lock2", "" }
880 },
881 {
882 // lock mask description
883 { "Lock=11", "Mode 1: No memory lock features enabled" },
884 { "Lock=10", "Mode 2: Further programming disabled" },
885 { "Lock=00", "Mode 3: Further programming and verification disabled" }
457 { 0, "FSTRT", "Short start-up time enabled", "" },
458 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
459 },
460 {
461 // fuse mask description
462 },
463 {
464 // lock
465 { 1, "Lock1", "", "" },
466 { 2, "Lock2", "", "" }
467 },
468 {
469 // lock mask description
470 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
471 { "Lock=10", "Mode 2: Further programming disabled", "" },
472 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
473 }
474 },
475
476 {
477 { AT90S2333, AT90S4433 },
478 {
479 // fuse
480 { 0, "CKSEL0", "", "" },
481 { 1, "CKSEL1", "", "" },
482 { 2, "CKSEL2", "", "" },
483 { 3, "BODEN", "Brown-out detection enabled", "" },
484 { 4, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7V", "" },
485 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
486 },
487 {
488 // fuse mask description
489 { "CKSEL=101", "Ceramic Resonator", "" },
490 { "CKSEL=111", "Ceramic Resonator; BOD Enabled or power-on reset", "" },
491 { "CKSEL=110", "Ceramic Resonator; fast rising power", "" },
492 { "CKSEL=100", "Crystal Oscillator; BOD Enabled or power-on reset", "" },
493 { "CKSEL=010", "Crystal Oscillator; default value", "" },
494 { "CKSEL=011", "Crystal Oscillator; fast rising power", "" },
495 { "CKSEL=001", "External Clock; BOD Enabled or power-on reset", "" },
496 { "CKSEL=000", "External Clock; slowly rising power", "" }
497 },
498 {
499 // lock
500 { 1, "Lock1", "", "" },
501 { 2, "Lock2", "", "" }
502 },
503 {
504 // lock mask description
505 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
506 { "Lock=10", "Mode 2: Further programming disabled", "" },
507 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
886508 }
887509 },
888510
890512 { AT90S2323, AT90S8534 },
891513 {
892514 // fuse
893 { 0, "FSTRT", "Short start-up time enabled" },
894 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
895 },
896 {
897 // fuse mask description
898 },
899 {
900 // lock
901 { 1, "Lock1", "" },
902 { 2, "Lock2", "" }
903 },
904 {
905 // lock mask description
906 { "Lock=11", "Mode 1: No memory lock features enabled" },
907 { "Lock=10", "Mode 2: Further programming disabled" },
908 { "Lock=00", "Mode 3: Further programming and verification disabled" }
515 { 0, "FSTRT", "Short start-up time enabled", "" },
516 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
517 },
518 {
519 // fuse mask description
520 },
521 {
522 // lock
523 { 1, "Lock1", "", "" },
524 { 2, "Lock2", "", "" }
525 },
526 {
527 // lock mask description
528 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
529 { "Lock=10", "Mode 2: Further programming disabled", "" },
530 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
909531 }
910532 },
911533
913535 { AT90S2343 },
914536 {
915537 // fuse
916 { 0, "/FB0", "NOT External clock enabled" }, // enabled but invert
917 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
918 },
919 {
920 // fuse mask description
921 },
922 {
923 // lock
924 { 1, "Lock1", "" },
925 { 2, "Lock2", "" }
926 },
927 {
928 // lock mask description
929 { "Lock=11", "Mode 1: No memory lock features enabled" },
930 { "Lock=10", "Mode 2: Further programming disabled" },
931 { "Lock=00", "Mode 3: Further programming and verification disabled" }
932 }
933 },
934 #if 0
935 {
936 { AT90S8534 },
937 {
938 // fuse
939 { 0, "FSTRT", "Short start-up time enabled" },
940 // { 1, "SPIEN", "" },
941 // { 2, "FSTRT", "" },
942 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
943 },
944 {
945 // fuse mask description
946 },
947 {
948 // lock
949 { 1, "Lock1", "" },
950 { 2, "Lock2", "" }
951 },
952 {
953 // lock mask description
954 { "Lock=11", "Mode 1: No memory lock features enabled" },
955 { "Lock=10", "Mode 2: Further programming disabled" },
956 { "Lock=00", "Mode 3: Further programming and verification disabled" }
957 }
958 },
959 #endif
538 { 0, "/FB0", "NOT External clock enabled", "" }, // enabled but invert
539 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
540 },
541 {
542 // fuse mask description
543 },
544 {
545 // lock
546 { 1, "Lock1", "", "" },
547 { 2, "Lock2", "", "" }
548 },
549 {
550 // lock mask description
551 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
552 { "Lock=10", "Mode 2: Further programming disabled", "" },
553 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
554 }
555 },
556
960557 {
961558 { ATtiny12 },
962559 {
963560 // fuse
964 { 0, "CKSEL0", "" },
965 { 1, "CKSEL1", "" },
966 { 2, "CKSEL2", "" },
967 { 3, "CKSEL3", "" },
968 { 4, "RSTDISBL", "External reset function of PB5 disabled" },
969 { 5, "SPIEN", "Serial program downloading (SPI) enabled" },
970 { 6, "BODEN", "Brown-out detection enabled" },
971 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=1.8 V" }
561 { 0, "CKSEL0", "", "" },
562 { 1, "CKSEL1", "", "" },
563 { 2, "CKSEL2", "", "" },
564 { 3, "CKSEL3", "", "" },
565 { 4, "RSTDISBL", "External reset function of PB5 disabled", "" },
566 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" },
567 { 6, "BODEN", "Brown-out detection enabled", "" },
568 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=1.8 V", "" }
972569 },
973570 {
974571 // fuse mask description ???
975 { "CKSEL=0000", "External Clock" },
976 { "CKSEL=0001", "External Clock" },
977 { "CKSEL=0010", "Internal RC Ocsillator" },
978 { "CKSEL=0011", "Internal RC Ocsillator" },
979 { "CKSEL=0100", "Internal RC Ocsillator" },
980 { "CKSEL=0101", "External RC Ocsillator" },
981 { "CKSEL=0110", "External RC Ocsillator" },
982 { "CKSEL=0111", "External RC Ocsillator" },
983 { "CKSEL=1000", "External Low-Frequency Crystal" },
984 { "CKSEL=1001", "External Low-Frequency Crystal" },
985 { "CKSEL=1010", "External Crystal / Ceramic Resonator" },
986 { "CKSEL=1011", "External Crystal / Ceramic Resonator" },
987 { "CKSEL=1100", "External Crystal / Ceramic Resonator" },
988 { "CKSEL=1101", "External Crystal / Ceramic Resonator" },
989 { "CKSEL=1110", "External Crystal / Ceramic Resonator" },
990 { "CKSEL=1111", "External Crystal / Ceramic Resonator" }
991 },
992 {
993 // lock
994 { 1, "Lock1", "" },
995 { 2, "Lock2", "" }
996 },
997 {
998 // lock mask description
999 { "Lock=11", "Mode 1: No memory lock features enabled" },
1000 { "Lock=10", "Mode 2: Further programming disabled" },
1001 { "Lock=00", "Mode 3: Further programming and verification disabled" }
572 { "CKSEL=0000", "External Clock", "" },
573 { "CKSEL=0001", "External Clock", "" },
574 { "CKSEL=0010", "Internal RC Ocsillator", "" },
575 { "CKSEL=0011", "Internal RC Ocsillator", "" },
576 { "CKSEL=0100", "Internal RC Ocsillator", "" },
577 { "CKSEL=0101", "External RC Ocsillator", "" },
578 { "CKSEL=0110", "External RC Ocsillator", "" },
579 { "CKSEL=0111", "External RC Ocsillator", "" },
580 { "CKSEL=1000", "External Low-Frequency Crystal", "" },
581 { "CKSEL=1001", "External Low-Frequency Crystal", "" },
582 { "CKSEL=1010", "External Crystal / Ceramic Resonator", "" },
583 { "CKSEL=1011", "External Crystal / Ceramic Resonator", "" },
584 { "CKSEL=1100", "External Crystal / Ceramic Resonator", "" },
585 { "CKSEL=1101", "External Crystal / Ceramic Resonator", "" },
586 { "CKSEL=1110", "External Crystal / Ceramic Resonator", "" },
587 { "CKSEL=1111", "External Crystal / Ceramic Resonator", "" }
588 },
589 {
590 // lock
591 { 1, "Lock1", "", "" },
592 { 2, "Lock2", "", "" }
593 },
594 {
595 // lock mask description
596 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
597 { "Lock=10", "Mode 2: Further programming disabled", "" },
598 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
1002599 }
1003600 },
1004601
1006603 { ATtiny13 },
1007604 {
1008605 // fuse
1009 { 0, "CKSEL0", "" },
1010 { 1, "CKSEL1", "" },
1011 { 2, "SUT0", "" },
1012 { 3, "SUT1", "" },
1013 { 4, "CKDIV8", "Divide clock by 8 internally" },
1014 { 5, "WDTON", "Watch-dog Timer always on" },
1015 { 6, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1016 { 7, "SPIEN", "Serial program downloading (SPI) enabled" },
1017 { 8, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)" },
1018 { 9, "BODLEVEL0", "" },
1019 { 10, "BODLEVEL1", "" },
1020 { 11, "DWEN", "Debug Wire enable" },
1021 { 12, "SELFPRGEN", "Self Programming enable" }
1022 },
1023 {
1024 // fuse mask description
1025 { "CKSEL=00 SUT=00", "Ext. Clock; Start-up time: 14 CK + 0 ms" },
1026 { "CKSEL=00 SUT=01", "Ext. Clock; Start-up time: 14 CK + 4 ms" },
1027 { "CKSEL=00 SUT=10", "Ext. Clock; Start-up time: 14 CK + 64 ms" },
1028 { "CKSEL=11 SUT=00", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 0 ms" },
1029 { "CKSEL=11 SUT=01", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 4 ms" },
1030 { "CKSEL=11 SUT=10", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 64 ms" },
1031 { "CKSEL=01 SUT=00", "Int. RC Osc. 4.8 MHz; Start-up time: 14 CK + 0 ms" },
1032 { "CKSEL=01 SUT=01", "Int. RC Osc. 4.8 MHz; Start-up time: 14 CK + 4 ms" },
1033 { "CKSEL=01 SUT=10", "Int. RC Osc. 4.8 MHz; Start-up time: 14 CK + 64 ms" },
1034 { "CKSEL=10 SUT=00", "Int. RC Osc. 9.6 MHz; Start-up time: 14 CK + 0 ms" },
1035 { "CKSEL=10 SUT=01", "Int. RC Osc. 9.6 MHz; Start-up time: 14 CK + 4 ms" },
1036 { "CKSEL=10 SUT=10", "Int. RC Osc. 9.6 MHz; Start-up time: 14 CK + 64 ms" },
1037
1038 { "BODLEVEL=11", "Brown-out detection disabled" },
1039 { "BODLEVEL=10", "Brown-out detection level at VCC=1.8 V" },
1040 { "BODLEVEL=01", "Brown-out detection level at VCC=2.7 V" },
1041 { "BODLEVEL=00", "Brown-out detection level at VCC=4.3 V" }
1042 },
1043 {
1044 // lock
1045 { 0, "Lock1", "" },
1046 { 1, "Lock2", "" }
1047 },
1048 {
1049 // lock mask description
1050 { "Lock=11", "Mode 1: No memory lock features enabled" },
1051 { "Lock=10", "Mode 2: Further programming disabled" },
1052 { "Lock=00", "Mode 3: Further programming and verification disabled" }
606 { 0, "CKSEL0", "", "" },
607 { 1, "CKSEL1", "", "" },
608 { 2, "SUT0", "", "" },
609 { 3, "SUT1", "", "" },
610 { 4, "CKDIV8", "Divide clock by 8 internally", "" },
611 { 5, "WDTON", "Watch-dog Timer always on", "" },
612 { 6, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
613 { 7, "SPIEN", "Serial program downloading (SPI) enabled", "" },
614 { 8, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)", "" },
615 { 9, "BODLEVEL0", "", "" },
616 { 10, "BODLEVEL1", "", "" },
617 { 11, "DWEN", "Debug Wire enable", "" },
618 { 12, "SELFPRGEN", "Self Programming enable", "" }
619 },
620 {
621 // fuse mask description
622 { "CKSEL=00 SUT=00", "Ext. Clock; Start-up time: 14 CK + 0 ms", "" },
623 { "CKSEL=00 SUT=01", "Ext. Clock; Start-up time: 14 CK + 4 ms", "" },
624 { "CKSEL=00 SUT=10", "Ext. Clock; Start-up time: 14 CK + 64 ms", "" },
625 { "CKSEL=11 SUT=00", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 0 ms", "" },
626 { "CKSEL=11 SUT=01", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 4 ms", "" },
627 { "CKSEL=11 SUT=10", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 64 ms", "" },
628 { "CKSEL=01 SUT=00", "Int. RC Osc. 4.8 MHz; Start-up time: 14 CK + 0 ms", "" },
629 { "CKSEL=01 SUT=01", "Int. RC Osc. 4.8 MHz; Start-up time: 14 CK + 4 ms", "" },
630 { "CKSEL=01 SUT=10", "Int. RC Osc. 4.8 MHz; Start-up time: 14 CK + 64 ms", "" },
631 { "CKSEL=10 SUT=00", "Int. RC Osc. 9.6 MHz; Start-up time: 14 CK + 0 ms", "" },
632 { "CKSEL=10 SUT=01", "Int. RC Osc. 9.6 MHz; Start-up time: 14 CK + 4 ms", "" },
633 { "CKSEL=10 SUT=10", "Int. RC Osc. 9.6 MHz; Start-up time: 14 CK + 64 ms", "" },
634
635 { "BODLEVEL=11", "Brown-out detection disabled", "" },
636 { "BODLEVEL=10", "Brown-out detection level at VCC=1.8 V", "" },
637 { "BODLEVEL=01", "Brown-out detection level at VCC=2.7 V", "" },
638 { "BODLEVEL=00", "Brown-out detection level at VCC=4.3 V", "" }
639 },
640 {
641 // lock
642 { 0, "Lock1", "", "" },
643 { 1, "Lock2", "", "" }
644 },
645 {
646 // lock mask description
647 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
648 { "Lock=10", "Mode 2: Further programming disabled", "" },
649 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
1053650 }
1054651 },
1055652 {
1056653 { ATtiny15 },
1057654 {
1058655 // fuse
1059 { 0, "CKSEL0", "" },
1060 { 1, "CKSEL1", "" },
1061 { 4, "RSTDISBL", "External reset function of PB5 disabled" },
1062 { 5, "SPIEN", "Serial program downloading (SPI) enabled" },
1063 { 6, "BODEN", "Brown-out detection enabled" },
1064 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" }
1065 },
1066 {
1067 // fuse mask description
1068 { "CKSEL=00", "Slowly rising power" },
1069 { "CKSEL=01", "Slowly rising power" },
1070 { "CKSEL=10", "Quickly rising power" },
1071 { "CKSEL=11", "Very quickly rising power" }
1072 },
1073 {
1074 // lock
1075 { 1, "Lock1", "" },
1076 { 2, "Lock2", "" }
1077 },
1078 {
1079 // lock mask description
1080 { "Lock=11", "Mode 1: No memory lock features enabled" },
1081 { "Lock=10", "Mode 2: Further programming disabled" },
1082 { "Lock=00", "Mode 3: Further programming and verification disabled" }
656 { 0, "CKSEL0", "", "" },
657 { 1, "CKSEL1", "", "" },
658 { 4, "RSTDISBL", "External reset function of PB5 disabled", "" },
659 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" },
660 { 6, "BODEN", "Brown-out detection enabled", "" },
661 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" }
662 },
663 {
664 // fuse mask description
665 { "CKSEL=00", "Slowly rising power", "" },
666 { "CKSEL=01", "Slowly rising power", "" },
667 { "CKSEL=10", "Quickly rising power", "" },
668 { "CKSEL=11", "Very quickly rising power", "" }
669 },
670 {
671 // lock
672 { 1, "Lock1", "", "" },
673 { 2, "Lock2", "", "" }
674 },
675 {
676 // lock mask description
677 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
678 { "Lock=10", "Mode 2: Further programming disabled", "" },
679 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
1083680 }
1084681 },
1085682
1087684 { ATtiny22 },
1088685 {
1089686 // fuse
1090 { 0, "/FB0", "NOT External clock disabled" }, // NOT enabled
1091 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
1092 },
1093 {
1094 // fuse mask description
1095 },
1096 {
1097 // lock
1098 { 1, "Lock1", "" },
1099 { 2, "Lock2", "" }
1100 },
1101 {
1102 // lock mask description
1103 { "Lock=11", "Mode 1: No memory lock features enabled" },
1104 { "Lock=10", "Mode 2: Further programming disabled" },
1105 { "Lock=00", "Mode 3: Further programming and verification disabled" }
687 { 0, "/FB0", "NOT External clock disabled", "" }, // NOT enabled
688 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
689 },
690 {
691 // fuse mask description
692 },
693 {
694 // lock
695 { 1, "Lock1", "", "" },
696 { 2, "Lock2", "", "" }
697 },
698 {
699 // lock mask description
700 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
701 { "Lock=10", "Mode 2: Further programming disabled", "" },
702 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
1106703 }
1107704 },
1108705 {
1109706 { ATtiny26 },
1110707 {
1111708 // fuse
1112 { 0, "CKSEL0", "" },
1113 { 1, "CKSEL1", "" },
1114 { 2, "CKSEL2", "" },
1115 { 3, "CKSEL3", "" },
1116 { 4, "SUT0", "" },
1117 { 5, "SUT1", "" },
1118 { 6, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
1119 { 7, "PLLCK0", "" },
1120 { 8, "BODEN", "Brown-out detection enabled" },
1121 { 9, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
1122 { 10, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1123 { 11, "SPIEN", "Serial program downloading (SPI) enabled" },
1124 { 12, "RSTDISBL", "Reset Disabled (Enable PB7 as i/o pin)" }
1125 },
1126 {
1127 // fuse mask description
1128 { "CKSEL=0000 SUT=00 PLLCK=1", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
1129 { "CKSEL=0000 SUT=01 PLLCK=1", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
1130 { "CKSEL=0000 SUT=10 PLLCK=1", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
1131 { "CKSEL=1111 SUT=01 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
1132 { "CKSEL=1111 SUT=10 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
1133 { "CKSEL=1111 SUT=11 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
1134 { "CKSEL=1110 SUT=10 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
1135 { "CKSEL=1110 SUT=11 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
1136 { "CKSEL=1111 SUT=00 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
1137 { "CKSEL=1110 SUT=00 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
1138 { "CKSEL=1110 SUT=01 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
1139 { "CKSEL=1011 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
1140 { "CKSEL=1011 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
1141 { "CKSEL=1011 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
1142 { "CKSEL=1010 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
1143 { "CKSEL=1010 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
1144 { "CKSEL=1011 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
1145 { "CKSEL=1010 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
1146 { "CKSEL=1010 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
1147 { "CKSEL=1101 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
1148 { "CKSEL=1101 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
1149 { "CKSEL=1101 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
1150 { "CKSEL=1100 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
1151 { "CKSEL=1100 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
1152 { "CKSEL=1101 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
1153 { "CKSEL=1100 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
1154 { "CKSEL=1100 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
1155 { "CKSEL=1001 SUT=00 PLLCK=1", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
1156 { "CKSEL=1001 SUT=01 PLLCK=1", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
1157 { "CKSEL=1001 SUT=10 PLLCK=1", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
1158 { "CKSEL=0101 SUT=00 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
1159 { "CKSEL=0101 SUT=01 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
1160 { "CKSEL=0101 SUT=10 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
1161 { "CKSEL=0101 SUT=11 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
1162 { "CKSEL=0110 SUT=00 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
1163 { "CKSEL=0110 SUT=01 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
1164 { "CKSEL=0110 SUT=10 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
1165 { "CKSEL=0110 SUT=11 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
1166 { "CKSEL=0111 SUT=00 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
1167 { "CKSEL=0111 SUT=01 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
1168 { "CKSEL=0111 SUT=10 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
1169 { "CKSEL=0111 SUT=11 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
1170 { "CKSEL=1000 SUT=00 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
1171 { "CKSEL=1000 SUT=01 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
1172 { "CKSEL=1000 SUT=10 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
1173 { "CKSEL=1000 SUT=11 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
1174 { "CKSEL=0001 SUT=00 PLLCK=1", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
1175 { "CKSEL=0001 SUT=01 PLLCK=1", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
1176 { "CKSEL=0001 SUT=10 PLLCK=1", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
1177 { "CKSEL=0010 SUT=00 PLLCK=1", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
1178 { "CKSEL=0010 SUT=01 PLLCK=1", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
1179 { "CKSEL=0010 SUT=10 PLLCK=1", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
1180 { "CKSEL=0011 SUT=00 PLLCK=1", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
1181 { "CKSEL=0011 SUT=01 PLLCK=1", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
1182 { "CKSEL=0011 SUT=10 PLLCK=1", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
1183 { "CKSEL=0100 SUT=00 PLLCK=1", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
1184 { "CKSEL=0100 SUT=01 PLLCK=1", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
1185 { "CKSEL=0100 SUT=10 PLLCK=1", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
1186 { "CKSEL=0001 SUT=11 PLLCK=0", "PLL Clock; Start-up time: 16K CK + 64 ms" },
1187 { "CKSEL=0001 SUT=00 PLLCK=0", "PLL Clock; Start-up time: 1K CK + 0 ms" },
1188 { "CKSEL=0001 SUT=01 PLLCK=0", "PLL Clock; Start-up time: 1K CK + 4 ms" },
1189 { "CKSEL=0001 SUT=10 PLLCK=0", "PLL Clock; Start-up time: 1K CK + 64 ms" }
1190 },
1191 {
1192 // lock
1193 { 0, "Lock1", "" },
1194 { 1, "Lock2", "" }
1195 },
1196 {
1197 // lock mask description
1198 { "Lock=11", "Mode 1: No memory lock features enabled" },
1199 { "Lock=10", "Mode 2: Further programming disabled" },
1200 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1201 }
1202 },
1203
1204 {
1205 { ATtiny2313 },
1206 {
1207 // fuse
1208 { 0, "CKSEL0", "" },
1209 { 1, "CKSEL1", "" },
1210 { 2, "CKSEL2", "" },
1211 { 3, "CKSEL3", "" },
1212 { 4, "SUT0", "" },
1213 { 5, "SUT1", "" },
1214 { 6, "CKOUT", "Clock output on PORTD2" },
1215 { 7, "CKDIV8", "Divide clock by 8 internally" },
1216 { 8, "RSTDISBL", "Reset Disabled (Enable PA2 as i/o pin)" },
1217 { 9, "BODLEVEL0", "" },
1218 { 10, "BODLEVEL1", "" },
1219 { 11, "BODLEVEL2", "" },
1220 { 12, "WDTON", "Watch-dog Timer always on" },
1221 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1222 { 14, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1223 { 15, "DWEN", "Debug Wire enable" },
1224 { 16, "SELFPRGEN", "Self programming enable" }
1225 },
1226 {
1227 // fuse mask description
1228 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 14 CK + 0 ms" },
1229 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 14 CK + 4.1 ms" },
1230 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 14 CK + 65 ms" },
1231 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 0 ms" },
1232 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 0 ms" },
1233 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 4.1 ms" },
1234 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 4.1 ms" },
1235 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 4.1 ms" },
1236 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 65 ms" },
1237 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 65 ms" },
1238 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 65 ms" },
1239 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 0 ms" },
1240 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 0 ms" },
1241 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 4.1 ms" },
1242 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 4.1 ms" },
1243 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 4.1 ms" },
1244 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 65 ms" },
1245 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 65 ms" },
1246 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 65 ms" },
1247 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 0 ms" },
1248 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 0 ms" },
1249 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 4.1 ms" },
1250 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 4.1 ms" },
1251 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 4.1 ms" },
1252 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 65 ms" },
1253 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 65 ms" },
1254 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 65 ms" },
1255 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 0 ms" },
1256 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 0 ms" },
1257 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 4.1 ms" },
1258 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 4.1 ms" },
1259 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 4.1 ms" },
1260 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 65 ms" },
1261 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 65 ms" },
1262 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 65 ms" },
1263 { "CKSEL=0110 SUT=00", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 0 ms" },
1264 { "CKSEL=0110 SUT=01", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 4 ms" },
1265 { "CKSEL=0110 SUT=10", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 64 ms" },
1266 { "CKSEL=0010 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 14 CK + 0 ms" },
1267 { "CKSEL=0010 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 14 CK + 4.1 ms" },
1268 { "CKSEL=0010 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 14 CK + 65 ms" },
1269 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 14 CK + 0 ms" },
1270 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 14 CK + 4.1 ms" },
1271 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 14 CK + 65 ms" },
1272
1273 { "BODLEVEL=11", "Brown-out detection disabled" },
1274 { "BODLEVEL=10", "Brown-out detection level at VCC=1.8 V" },
1275 { "BODLEVEL=01", "Brown-out detection level at VCC=2.7 V" },
1276 { "BODLEVEL=00", "Brown-out detection level at VCC=4.3 V" }
1277 },
1278 {
1279 // lock
1280 { 0, "Lock1", "" },
1281 { 1, "Lock2", "" }
1282 },
1283 {
1284 // lock mask description
1285 { "Lock=11", "Mode 1: No memory lock features enabled" },
1286 { "Lock=10", "Mode 2: Further programming disabled" },
1287 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1288 }
1289 },
1290 {
1291 { ATtiny25 },
1292 {
1293 // fuse
1294 { 0, "CKSEL0", "" },
1295 { 1, "CKSEL1", "" },
1296 { 2, "CKSEL2", "" },
1297 { 3, "CKSEL3", "" },
1298 { 4, "SUT0", "" },
1299 { 5, "SUT1", "" },
1300 { 6, "CKOUT", "Clock output on PORTB4" },
1301 { 7, "CKDIV8", "Divide clock by 8 internally" },
1302 { 8, "BODLEVEL0", "" },
1303 { 9, "BODLEVEL1", "" },
1304 { 10, "BODLEVEL2", "" },
1305 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1306 { 12, "WDTON", "Watch-dog Timer always on" },
1307 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1308 { 14, "DWEN", "Debug Wire enable" },
1309 { 15, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)" },
1310 { 16, "SELFPRGEN", "Self Programming enable" }
1311 },
1312 {
1313 // fuse mask description
1314 { "CKSEL=0011 SUT=11", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 1 CK/14 CK + 0 ms" },
1315 { "CKSEL=0011 SUT=10", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1316 { "CKSEL=0011 SUT=00", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1317 { "CKSEL=0011 SUT=01", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1318 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1319 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1320 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1321 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1322 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1323 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1324 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1325 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1326 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1327 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1328 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1329 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1330 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1331 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1332 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1333 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1334 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1335 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1336 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1337 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1338 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1339 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1340 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1341 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1342 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1343 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1344 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1345 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1346 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1347 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1348 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1349 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1350 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1351 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1352 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1353 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms" },
1354 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms" },
1355 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 64 ms" },
1356 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1357 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1358 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1359 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4 ms" },
1360 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 64 ms" },
1361 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms" },
1362 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 64 ms" },
1363 { "CKSEL=0100 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1364 { "CKSEL=0100 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1365 { "CKSEL=0100 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1366
1367 { "BODLEVEL=111", "Brown-out detection disabled" },
1368 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1369 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1370 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1371 },
1372 {
1373 // lock
1374 { 0, "Lock1", "" },
1375 { 1, "Lock2", "" }
1376 },
1377 {
1378 // lock mask description
1379 { "Lock=11", "Mode 1: No memory lock features enabled" },
1380 { "Lock=10", "Mode 2: Further programming disabled" },
1381 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1382 }
1383 },
1384
1385 {
1386 { ATtiny45 },
1387 {
1388 // fuse
1389 { 0, "CKSEL0", "" },
1390 { 1, "CKSEL1", "" },
1391 { 2, "CKSEL2", "" },
1392 { 3, "CKSEL3", "" },
1393 { 4, "SUT0", "" },
1394 { 5, "SUT1", "" },
1395 { 6, "CKOUT", "Clock output on PORTB4" },
1396 { 7, "CKDIV8", "Divide clock by 8 internally" },
1397 { 8, "BODLEVEL0", "" },
1398 { 9, "BODLEVEL1", "" },
1399 { 10, "BODLEVEL2", "" },
1400 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1401 { 12, "WDTON", "Watch-dog Timer always on" },
1402 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1403 { 14, "DWEN", "Debug Wire enable" },
1404 { 15, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)" },
1405 { 16, "SELFPRGEN", "Self Programming enable" }
1406 },
1407 {
1408 // fuse mask description
1409 { "CKSEL=0011 SUT=11", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 1 CK/14 CK + 0 ms" },
1410 { "CKSEL=0011 SUT=10", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1411 { "CKSEL=0011 SUT=00", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1412 { "CKSEL=0011 SUT=01", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1413 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1414 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1415 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1416 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1417 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1418 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1419 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1420 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1421 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1422 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1423 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1424 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1425 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1426 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1427 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1428 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1429 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1430 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1431 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1432 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1433 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1434 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1435 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1436 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1437 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1438 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1439 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1440 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1441 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1442 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1443 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1444 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1445 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1446 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1447 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1448 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms" },
1449 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms" },
1450 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 64 ms" },
1451 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1452 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1453 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1454 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4 ms" },
1455 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 64 ms" },
1456 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms" },
1457 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 64 ms" },
1458 { "CKSEL=0100 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1459 { "CKSEL=0100 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1460 { "CKSEL=0100 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1461
1462 { "BODLEVEL=111", "Brown-out detection disabled" },
1463 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1464 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1465 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1466 },
1467 {
1468 // lock
1469 { 0, "Lock1", "" },
1470 { 1, "Lock2", "" }
1471 },
1472 {
1473 // lock mask description
1474 { "Lock=11", "Mode 1: No memory lock features enabled" },
1475 { "Lock=10", "Mode 2: Further programming disabled" },
1476 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1477 }
1478 },
1479 {
1480 { ATtiny85 },
1481 {
1482 // fuse
1483 { 0, "CKSEL0", "" },
1484 { 1, "CKSEL1", "" },
1485 { 2, "CKSEL2", "" },
1486 { 3, "CKSEL3", "" },
1487 { 4, "SUT0", "" },
1488 { 5, "SUT1", "" },
1489 { 6, "CKOUT", "Clock output on PORTB4" },
1490 { 7, "CKDIV8", "Divide clock by 8 internally" },
1491 { 8, "BODLEVEL0", "" },
1492 { 9, "BODLEVEL1", "" },
1493 { 10, "BODLEVEL2", "" },
1494 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1495 { 12, "WDTON", "Watch-dog Timer always on" },
1496 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1497 { 14, "DWEN", "Debug Wire enable" },
1498 { 15, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)" },
1499 { 16, "SELFPRGEN", "Self Programming enable" }
1500 },
1501 {
1502 // fuse mask description
1503 { "CKSEL=0011 SUT=11", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 1 CK/14 CK + 0 ms" },
1504 { "CKSEL=0011 SUT=10", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1505 { "CKSEL=0011 SUT=00", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1506 { "CKSEL=0011 SUT=01", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1507 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1508 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1509 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1510 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1511 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1512 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1513 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1514 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1515 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1516 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1517 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1518 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1519 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1520 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1521 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1522 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1523 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1524 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1525 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1526 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1527 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1528 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1529 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1530 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1531 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1532 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1533 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1534 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1535 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1536 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1537 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1538 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1539 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1540 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1541 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1542 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms" },
1543 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms" },
1544 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 64 ms" },
1545 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1546 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1547 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1548 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4 ms" },
1549 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 64 ms" },
1550 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms" },
1551 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 64 ms" },
1552 { "CKSEL=0100 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1553 { "CKSEL=0100 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1554 { "CKSEL=0100 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1555
1556 { "BODLEVEL=111", "Brown-out detection disabled" },
1557 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1558 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1559 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1560 },
1561 {
1562 // lock
1563 { 0, "Lock1", "" },
1564 { 1, "Lock2", "" }
1565 },
1566 {
1567 // lock mask description
1568 { "Lock=11", "Mode 1: No memory lock features enabled" },
1569 { "Lock=10", "Mode 2: Further programming disabled" },
1570 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1571 }
1572 },
1573
1574 {
1575 { ATtiny261 },
1576 {
1577 // fuse
1578 { 0, "CKSEL0", "" },
1579 { 1, "CKSEL1", "" },
1580 { 2, "CKSEL2", "" },
1581 { 3, "CKSEL3", "" },
1582 { 4, "SUT0", "" },
1583 { 5, "SUT1", "" },
1584 { 6, "CKOUT", "Clock output on PORTB5" },
1585 { 7, "CKDIV8", "Divide clock by 8 internally" },
1586 { 8, "BODLEVEL0", "" },
1587 { 9, "BODLEVEL1", "" },
1588 { 10, "BODLEVEL2", "" },
1589 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1590 { 12, "WDTON", "Watch-dog Timer always on" },
1591 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1592 { 14, "DWEN", "Debug Wire enable" },
1593 { 15, "RSTDISBL", "Reset Disabled (Enable PB7 as i/o pin)" },
1594 { 16, "SELFPRGEN", "Self Programming enable" }
1595 },
1596 {
1597 // fuse mask description
1598 { "CKSEL=1000 SUT=10", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1599 { "CKSEL=1000 SUT=11", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1600 { "CKSEL=1001 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1601 { "CKSEL=1000 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1602 { "CKSEL=1000 SUT=01", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1603 { "CKSEL=1010 SUT=10", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1604 { "CKSEL=1010 SUT=11", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1605 { "CKSEL=1011 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1606 { "CKSEL=1010 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1607 { "CKSEL=1010 SUT=01", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1608 { "CKSEL=1100 SUT=10", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1609 { "CKSEL=1100 SUT=11", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1610 { "CKSEL=1101 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1611 { "CKSEL=1100 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1612 { "CKSEL=1100 SUT=01", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1613 { "CKSEL=1110 SUT=10", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1614 { "CKSEL=1110 SUT=11", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1615 { "CKSEL=1111 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1616 { "CKSEL=1110 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1617 { "CKSEL=1110 SUT=01", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1618 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1619 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1620 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1621 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1622 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1623 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1624 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1625 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1626 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1627 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1628 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1629 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1630 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1631 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1632 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1633 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK + 64 ms" },
1634 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK 4 ms" },
1635 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32 CK + 64 ms" },
1636 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1637 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1638 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1639 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 68 ms" },
1640 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 8 ms" },
1641 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 68 ms" },
1642 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 8 ms" },
1643 { "CKSEL=0011 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1644 { "CKSEL=0011 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1645 { "CKSEL=0011 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
709 { 0, "CKSEL0", "", "" },
710 { 1, "CKSEL1", "", "" },
711 { 2, "CKSEL2", "", "" },
712 { 3, "CKSEL3", "", "" },
713 { 4, "SUT0", "", "" },
714 { 5, "SUT1", "", "" },
715 { 6, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)", "" },
716 { 7, "PLLCK0", "", "" },
717 { 8, "BODEN", "Brown-out detection enabled", "" },
718 { 9, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
719 { 10, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
720 { 11, "SPIEN", "Serial program downloading (SPI) enabled", "" },
721 { 12, "RSTDISBL", "Reset Disabled (Enable PB7 as i/o pin)", "" }
722 },
723 {
724 // fuse mask description
725 { "CKSEL=0000 SUT=00 PLLCK=1", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
726 { "CKSEL=0000 SUT=01 PLLCK=1", "Ext. Clock; Start-up time: 6 CK + 4 ms", "" },
727 { "CKSEL=0000 SUT=10 PLLCK=1", "Ext. Clock; Start-up time: 6 CK + 64 ms", "" },
728 { "CKSEL=1111 SUT=01 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms", "" },
729 { "CKSEL=1111 SUT=10 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms", "" },
730 { "CKSEL=1111 SUT=11 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms", "" },
731 { "CKSEL=1110 SUT=10 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms", "" },
732 { "CKSEL=1110 SUT=11 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms", "" },
733 { "CKSEL=1111 SUT=00 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms", "" },
734 { "CKSEL=1110 SUT=00 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms", "" },
735 { "CKSEL=1110 SUT=01 PLLCK=1", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms", "" },
736 { "CKSEL=1011 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms", "" },
737 { "CKSEL=1011 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms", "" },
738 { "CKSEL=1011 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms", "" },
739 { "CKSEL=1010 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms", "" },
740 { "CKSEL=1010 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms", "" },
741 { "CKSEL=1011 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms", "" },
742 { "CKSEL=1010 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms", "" },
743 { "CKSEL=1010 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms", "" },
744 { "CKSEL=1101 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms", "" },
745 { "CKSEL=1101 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms", "" },
746 { "CKSEL=1101 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms", "" },
747 { "CKSEL=1100 SUT=10 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms", "" },
748 { "CKSEL=1100 SUT=11 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms", "" },
749 { "CKSEL=1101 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms", "" },
750 { "CKSEL=1100 SUT=00 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms", "" },
751 { "CKSEL=1100 SUT=01 PLLCK=1", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms", "" },
752 { "CKSEL=1001 SUT=00 PLLCK=1", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms", "" },
753 { "CKSEL=1001 SUT=01 PLLCK=1", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms", "" },
754 { "CKSEL=1001 SUT=10 PLLCK=1", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms", "" },
755 { "CKSEL=0101 SUT=00 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms", "" },
756 { "CKSEL=0101 SUT=01 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms", "" },
757 { "CKSEL=0101 SUT=10 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms", "" },
758 { "CKSEL=0101 SUT=11 PLLCK=1", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms", "" },
759 { "CKSEL=0110 SUT=00 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms", "" },
760 { "CKSEL=0110 SUT=01 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms", "" },
761 { "CKSEL=0110 SUT=10 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms", "" },
762 { "CKSEL=0110 SUT=11 PLLCK=1", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms", "" },
763 { "CKSEL=0111 SUT=00 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms", "" },
764 { "CKSEL=0111 SUT=01 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms", "" },
765 { "CKSEL=0111 SUT=10 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms", "" },
766 { "CKSEL=0111 SUT=11 PLLCK=1", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms", "" },
767 { "CKSEL=1000 SUT=00 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms", "" },
768 { "CKSEL=1000 SUT=01 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms", "" },
769 { "CKSEL=1000 SUT=10 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms", "" },
770 { "CKSEL=1000 SUT=11 PLLCK=1", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms", "" },
771 { "CKSEL=0001 SUT=00 PLLCK=1", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms", "" },
772 { "CKSEL=0001 SUT=01 PLLCK=1", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms", "" },
773 { "CKSEL=0001 SUT=10 PLLCK=1", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms", "" },
774 { "CKSEL=0010 SUT=00 PLLCK=1", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms", "" },
775 { "CKSEL=0010 SUT=01 PLLCK=1", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms", "" },
776 { "CKSEL=0010 SUT=10 PLLCK=1", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms", "" },
777 { "CKSEL=0011 SUT=00 PLLCK=1", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms", "" },
778 { "CKSEL=0011 SUT=01 PLLCK=1", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms", "" },
779 { "CKSEL=0011 SUT=10 PLLCK=1", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms", "" },
780 { "CKSEL=0100 SUT=00 PLLCK=1", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms", "" },
781 { "CKSEL=0100 SUT=01 PLLCK=1", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms", "" },
782 { "CKSEL=0100 SUT=10 PLLCK=1", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms", "" },
783 { "CKSEL=0001 SUT=11 PLLCK=0", "PLL Clock; Start-up time: 16K CK + 64 ms", "" },
784 { "CKSEL=0001 SUT=00 PLLCK=0", "PLL Clock; Start-up time: 1K CK + 0 ms", "" },
785 { "CKSEL=0001 SUT=01 PLLCK=0", "PLL Clock; Start-up time: 1K CK + 4 ms", "" },
786 { "CKSEL=0001 SUT=10 PLLCK=0", "PLL Clock; Start-up time: 1K CK + 64 ms", "" }
787 },
788 {
789 // lock
790 { 0, "Lock1", "", "" },
791 { 1, "Lock2", "", "" }
792 },
793 {
794 // lock mask description
795 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
796 { "Lock=10", "Mode 2: Further programming disabled", "" },
797 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
798 }
799 },
800
801 {
802 { ATtiny2313, ATtiny4313 }, // ATtiny4313 new 16.09.2015 @RG, EK : possible diff descriptions for bit combinations
803 {
804 // fuse
805 { 0, "CKSEL0", "", "" },
806 { 1, "CKSEL1", "", "" },
807 { 2, "CKSEL2", "", "" },
808 { 3, "CKSEL3", "", "" },
809 { 4, "SUT0", "", "" },
810 { 5, "SUT1", "", "" },
811 { 6, "CKOUT", "Clock output on PORTD2", "" },
812 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
813 { 8, "BODLEVEL0", "", "" },
814 { 9, "BODLEVEL1", "", "" },
815 { 10, "BODLEVEL2", "", "" },
816 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
817 { 12, "WDTON", "Watch-dog Timer always on", "" },
818 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
819 { 14, "DWEN", "Debug Wire enable", "" },
820 { 15, "RSTDISBL", "Reset Disabled (Enable PA2 as i/o pin)", "" },
821 { 16, "SELFPRGEN", "Self programming enable", "" }
822 },
823 {
824 // fuse mask description
825 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 14 CK + 0 ms", "" },
826 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 14 CK + 4.1 ms", "" },
827 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 14 CK + 65 ms", "" },
828 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 0 ms", "" },
829 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 0 ms", "" },
830 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 4.1 ms", "" },
831 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 4.1 ms", "" },
832 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 4.1 ms", "" },
833 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 65 ms", "" },
834 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 65 ms", "" },
835 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 14 CK + 65 ms", "" },
836 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 0 ms", "" },
837 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 0 ms", "" },
838 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 4.1 ms", "" },
839 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 4.1 ms", "" },
840 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 4.1 ms", "" },
841 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 65 ms", "" },
842 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 65 ms", "" },
843 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 14 CK + 65 ms", "" },
844 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 0 ms", "" },
845 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 0 ms", "" },
846 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 4.1 ms", "" },
847 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 4.1 ms", "" },
848 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 4.1 ms", "" },
849 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 65 ms", "" },
850 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 65 ms", "" },
851 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 14 CK + 65 ms", "" },
852 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 0 ms", "" },
853 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 0 ms", "" },
854 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 4.1 ms", "" },
855 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 4.1 ms", "" },
856 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 4.1 ms", "" },
857 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 65 ms", "" },
858 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 65 ms", "" },
859 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 14 CK + 65 ms", "" },
860 { "CKSEL=0110 SUT=00", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 0 ms", "" },
861 { "CKSEL=0110 SUT=01", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 4 ms", "" },
862 { "CKSEL=0110 SUT=10", "Int. RC Osc. 128 kHz; Start-up time: 14 CK + 64 ms", "" },
863 { "CKSEL=0010 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 14 CK + 0 ms", "" },
864 { "CKSEL=0010 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 14 CK + 4.1 ms", "" },
865 { "CKSEL=0010 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 14 CK + 65 ms", "" },
866 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 14 CK + 0 ms", "" },
867 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 14 CK + 4.1 ms", "" },
868 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 14 CK + 65 ms", "" },
869
870 { "BODLEVEL=111", "Brown-out detection disabled", "" },
871 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
872 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
873 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
874 },
875 {
876 // lock
877 { 0, "Lock1", "", "" },
878 { 1, "Lock2", "", "" }
879 },
880 {
881 // lock mask description
882 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
883 { "Lock=10", "Mode 2: Further programming disabled", "" },
884 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
885 }
886 },
887 {
888 { ATtiny24, ATtiny44, ATtiny84 }, // new 08.01.2015 @RG, EK : possible diff descriptions for bit combinations
889 {
890 // fuse
891 { 0, "CKSEL0", "", "" },
892 { 1, "CKSEL1", "", "" },
893 { 2, "CKSEL2", "", "" },
894 { 3, "CKSEL3", "", "" },
895 { 4, "SUT0", "", "" },
896 { 5, "SUT1", "", "" },
897 { 6, "CKOUT", "Clock output on PORTB2", "" },
898 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
899 { 8, "BODLEVEL0", "", "" },
900 { 9, "BODLEVEL1", "", "" },
901 { 10, "BODLEVEL2", "", "" },
902 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
903 { 12, "WDTON", "Watch-dog Timer always on", "" },
904 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
905 { 14, "DWEN", "Debug Wire enable", "" },
906 { 15, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)", "" },
907 { 16, "SELFPRGEN", "Self Programming enable", "" }
908 },
909 {
910 // fuse mask description
911 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
912 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
913 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
914 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
915 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
916 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
917 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
918 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
919 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
920 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
921 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
922 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
923 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
924 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
925 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
926 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
927 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
928 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
929 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
930 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
931 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
932 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
933 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
934 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
935 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
936 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
937 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
938 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
939 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
940 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
941 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
942 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
943 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
944 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
945 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
946 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms", "" },
947 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms", "" },
948 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 64 ms", "" },
949 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
950 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
951 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
952 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4 ms", "" },
953 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 64 ms", "" },
954 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms", "" },
955 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 64 ms", "" },
956 { "CKSEL=0100 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
957 { "CKSEL=0100 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
958 { "CKSEL=0100 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
959
960 { "BODLEVEL=111", "Brown-out detection disabled", "" },
961 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
962 { "BODLEVEL=001", "Brown-out detection level at VCC=1.9 V", "" },
963 { "BODLEVEL=000", "Brown-out detection level at VCC=2.0 V", "" },
964 { "BODLEVEL=010", "Brown-out detection level at VCC=2.2 V", "" },
965 { "BODLEVEL=011", "Brown-out detection level at VCC=2.3 V", "" },
966 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
967 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
968 },
969 {
970 // lock
971 { 0, "Lock1", "", "" },
972 { 1, "Lock2", "", "" }
973 },
974 {
975 // lock mask description
976 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
977 { "Lock=10", "Mode 2: Further programming disabled", "" },
978 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
979 }
980 },
981
982 {
983 { ATtiny25, ATtiny45, ATtiny85 },
984 {
985 // fuse
986 { 0, "CKSEL0", "", "" },
987 { 1, "CKSEL1", "", "" },
988 { 2, "CKSEL2", "", "" },
989 { 3, "CKSEL3", "", "" },
990 { 4, "SUT0", "", "" },
991 { 5, "SUT1", "", "" },
992 { 6, "CKOUT", "Clock output on PORTB4", "" },
993 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
994 { 8, "BODLEVEL0", "", "" },
995 { 9, "BODLEVEL1", "", "" },
996 { 10, "BODLEVEL2", "", "" },
997 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
998 { 12, "WDTON", "Watch-dog Timer always on", "" },
999 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1000 { 14, "DWEN", "Debug Wire enable", "" },
1001 { 15, "RSTDISBL", "Reset Disabled (Enable PB5 as i/o pin)", "" },
1002 { 16, "SELFPRGEN", "Self Programming enable", "" }
1003 },
1004 {
1005 // fuse mask description
1006 { "CKSEL=0011 SUT=11", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 1 CK/14 CK + 0 ms", "" },
1007 { "CKSEL=0011 SUT=10", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
1008 { "CKSEL=0011 SUT=00", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
1009 { "CKSEL=0011 SUT=01", "ATtiny15 Comp: Int. RC Osc. 6.4 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
1010 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1011 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1012 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1013 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1014 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1015 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1016 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1017 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1018 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1019 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1020 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1021 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1022 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1023 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1024 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1025 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1026 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1027 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1028 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1029 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1030 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1031 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1032 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1033 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1034 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1035 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1036 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1037 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1038 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1039 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1040 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1041 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1042 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1043 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1044 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1045 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms", "" },
1046 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms", "" },
1047 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 64 ms", "" },
1048 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1049 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
1050 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
1051 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4 ms", "" },
1052 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 64 ms", "" },
1053 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4 ms", "" },
1054 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 64 ms", "" },
1055 { "CKSEL=0100 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1056 { "CKSEL=0100 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
1057 { "CKSEL=0100 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
1058
1059 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1060 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1061 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1062 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1063 },
1064 {
1065 // lock
1066 { 0, "Lock1", "", "" },
1067 { 1, "Lock2", "", "" }
1068 },
1069 {
1070 // lock mask description
1071 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1072 { "Lock=10", "Mode 2: Further programming disabled", "" },
1073 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
1074 }
1075 },
1076
1077 {
1078 { ATtiny261, ATtiny461, ATtiny861 },
1079 {
1080 // fuse
1081 { 0, "CKSEL0", "", "" },
1082 { 1, "CKSEL1", "", "" },
1083 { 2, "CKSEL2", "", "" },
1084 { 3, "CKSEL3", "", "" },
1085 { 4, "SUT0", "", "" },
1086 { 5, "SUT1", "", "" },
1087 { 6, "CKOUT", "Clock output on PORTB5", "" },
1088 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1089 { 8, "BODLEVEL0", "", "" },
1090 { 9, "BODLEVEL1", "", "" },
1091 { 10, "BODLEVEL2", "", "" },
1092 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1093 { 12, "WDTON", "Watch-dog Timer always on", "" },
1094 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1095 { 14, "DWEN", "Debug Wire enable", "" },
1096 { 15, "RSTDISBL", "Reset Disabled (Enable PB7 as i/o pin)", "" },
1097 { 16, "SELFPRGEN", "Self Programming enable", "" }
1098 },
1099 {
1100 // fuse mask description
1101 { "CKSEL=1000 SUT=10", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1102 { "CKSEL=1000 SUT=11", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1103 { "CKSEL=1001 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1104 { "CKSEL=1000 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1105 { "CKSEL=1000 SUT=01", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1106 { "CKSEL=1010 SUT=10", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1107 { "CKSEL=1010 SUT=11", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1108 { "CKSEL=1011 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1109 { "CKSEL=1010 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1110 { "CKSEL=1010 SUT=01", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1111 { "CKSEL=1100 SUT=10", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1112 { "CKSEL=1100 SUT=11", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1113 { "CKSEL=1101 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1114 { "CKSEL=1100 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1115 { "CKSEL=1100 SUT=01", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1116 { "CKSEL=1110 SUT=10", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1117 { "CKSEL=1110 SUT=11", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1118 { "CKSEL=1111 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1119 { "CKSEL=1110 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1120 { "CKSEL=1110 SUT=01", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1121 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1122 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
1123 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
1124 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1125 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1126 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1127 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1128 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1129 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1130 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1131 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1132 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1133 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1134 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1135 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1136 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK + 64 ms", "" },
1137 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK 4 ms", "" },
1138 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32 CK + 64 ms", "" },
1139 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1140 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
1141 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
1142 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 68 ms", "" },
1143 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 8 ms", "" },
1144 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 68 ms", "" },
1145 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 8 ms", "" },
1146 { "CKSEL=0011 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1147 { "CKSEL=0011 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms", "" },
1148 { "CKSEL=0011 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms", "" },
16461149
16471150 // brown out
1648 { "BODLEVEL=111", "Brown-out detection disabled" },
1649 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1650 { "BODLEVEL=001", "Brown-out detection level at VCC=1.9 V" },
1651 { "BODLEVEL=000", "Brown-out detection level at VCC=2.0 V" },
1652 { "BODLEVEL=010", "Brown-out detection level at VCC=2.2 V" },
1653 { "BODLEVEL=011", "Brown-out detection level at VCC=2.3 V" },
1654 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1655 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1656 },
1657 {
1658 // lock
1659 { 0, "Lock1", "" },
1660 { 1, "Lock2", "" }
1661 },
1662 {
1663 // lock mask description
1664 { "Lock=11", "Mode 1: No memory lock features enabled" },
1665 { "Lock=10", "Mode 2: Further programming disabled" },
1666 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1667 }
1668 },
1669
1670 {
1671 { ATtiny461 },
1672 {
1673 // fuse
1674 { 0, "CKSEL0", "" },
1675 { 1, "CKSEL1", "" },
1676 { 2, "CKSEL2", "" },
1677 { 3, "CKSEL3", "" },
1678 { 4, "SUT0", "" },
1679 { 5, "SUT1", "" },
1680 { 6, "CKOUT", "Clock output on PORTB5" },
1681 { 7, "CKDIV8", "Divide clock by 8 internally" },
1682 { 8, "BODLEVEL0", "" },
1683 { 9, "BODLEVEL1", "" },
1684 { 10, "BODLEVEL2", "" },
1685 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1686 { 12, "WDTON", "Watch-dog Timer always on" },
1687 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1688 { 14, "DWEN", "Debug Wire enable" },
1689 { 15, "RSTDISBL", "Reset Disabled (Enable PB7 as i/o pin)" },
1690 { 16, "SELFPRGEN", "Self Programming enable" }
1691 },
1692 {
1693 // fuse mask description
1694 { "CKSEL=1000 SUT=10", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1695 { "CKSEL=1000 SUT=11", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1696 { "CKSEL=1001 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1697 { "CKSEL=1000 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1698 { "CKSEL=1000 SUT=01", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1699 { "CKSEL=1010 SUT=10", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1700 { "CKSEL=1010 SUT=11", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1701 { "CKSEL=1011 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1702 { "CKSEL=1010 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1703 { "CKSEL=1010 SUT=01", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1704 { "CKSEL=1100 SUT=10", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1705 { "CKSEL=1100 SUT=11", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1706 { "CKSEL=1101 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1707 { "CKSEL=1100 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1708 { "CKSEL=1100 SUT=01", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1709 { "CKSEL=1110 SUT=10", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1710 { "CKSEL=1110 SUT=11", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1711 { "CKSEL=1111 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1712 { "CKSEL=1110 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1713 { "CKSEL=1110 SUT=01", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1714 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1715 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1716 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1717 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1718 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1719 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1720 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1721 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1722 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1723 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1724 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1725 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1726 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1727 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1728 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1729 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK + 64 ms" },
1730 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK 4 ms" },
1731 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32 CK + 64 ms" },
1732 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1733 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1734 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1735 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 68 ms" },
1736 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 8 ms" },
1737 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 68 ms" },
1738 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 8 ms" },
1739 { "CKSEL=0011 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1740 { "CKSEL=0011 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1741 { "CKSEL=0011 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1742
1743 // brown out
1744 { "BODLEVEL=111", "Brown-out detection disabled" },
1745 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1746 { "BODLEVEL=001", "Brown-out detection level at VCC=1.9 V" },
1747 { "BODLEVEL=000", "Brown-out detection level at VCC=2.0 V" },
1748 { "BODLEVEL=010", "Brown-out detection level at VCC=2.2 V" },
1749 { "BODLEVEL=011", "Brown-out detection level at VCC=2.3 V" },
1750 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1751 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1752 },
1753 {
1754 // lock
1755 { 0, "Lock1", "" },
1756 { 1, "Lock2", "" }
1757 },
1758 {
1759 // lock mask description
1760 { "Lock=11", "Mode 1: No memory lock features enabled" },
1761 { "Lock=10", "Mode 2: Further programming disabled" },
1762 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1763 }
1764 },
1765
1766 {
1767 { ATtiny861 },
1768 {
1769 // fuse
1770 { 0, "CKSEL0", "" },
1771 { 1, "CKSEL1", "" },
1772 { 2, "CKSEL2", "" },
1773 { 3, "CKSEL3", "" },
1774 { 4, "SUT0", "" },
1775 { 5, "SUT1", "" },
1776 { 6, "CKOUT", "Clock output on PORTB5" },
1777 { 7, "CKDIV8", "Divide clock by 8 internally" },
1778 { 8, "BODLEVEL0", "" },
1779 { 9, "BODLEVEL1", "" },
1780 { 10, "BODLEVEL2", "" },
1781 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1782 { 12, "WDTON", "Watch-dog Timer always on" },
1783 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1784 { 14, "DWEN", "Debug Wire enable" },
1785 { 15, "RSTDISBL", "Reset Disabled (Enable PB7 as i/o pin)" },
1786 { 16, "SELFPRGEN", "Self Programming enable" }
1787 },
1788 {
1789 // fuse mask description
1790 { "CKSEL=1000 SUT=10", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1791 { "CKSEL=1000 SUT=11", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1792 { "CKSEL=1001 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1793 { "CKSEL=1000 SUT=00", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1794 { "CKSEL=1000 SUT=01", "Ext. Ceramic Res.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1795 { "CKSEL=1010 SUT=10", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1796 { "CKSEL=1010 SUT=11", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1797 { "CKSEL=1011 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1798 { "CKSEL=1010 SUT=00", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1799 { "CKSEL=1010 SUT=01", "Ext. Ceramic Res.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1800 { "CKSEL=1100 SUT=10", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1801 { "CKSEL=1100 SUT=11", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1802 { "CKSEL=1101 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1803 { "CKSEL=1100 SUT=00", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1804 { "CKSEL=1100 SUT=01", "Ext. Ceramic Res.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1805 { "CKSEL=1110 SUT=10", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1806 { "CKSEL=1110 SUT=11", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
1807 { "CKSEL=1111 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
1808 { "CKSEL=1110 SUT=00", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
1809 { "CKSEL=1110 SUT=01", "Ext. Ceramic Res.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
1810 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1811 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1812 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1813 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1814 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1815 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1816 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1817 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1818 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1819 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1820 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1821 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1822 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1823 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1824 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1825 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK + 64 ms" },
1826 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1 CK 4 ms" },
1827 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32 CK + 64 ms" },
1828 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1829 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1830 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1831 { "CKSEL=0001 SUT=11", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 68 ms" },
1832 { "CKSEL=0001 SUT=01", "PLL Clock; Start-up time PWRDWN/RESET: 16K CK/14 CK + 8 ms" },
1833 { "CKSEL=0001 SUT=10", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 68 ms" },
1834 { "CKSEL=0001 SUT=00", "PLL Clock; Start-up time PWRDWN/RESET: 1K CK/14 CK + 8 ms" },
1835 { "CKSEL=0011 SUT=00", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1836 { "CKSEL=0011 SUT=01", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4 ms" },
1837 { "CKSEL=0011 SUT=10", "WD. Osc. 128 kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 64 ms" },
1838
1839 // brown out
1840 { "BODLEVEL=111", "Brown-out detection disabled" },
1841 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1842 { "BODLEVEL=001", "Brown-out detection level at VCC=1.9 V" },
1843 { "BODLEVEL=000", "Brown-out detection level at VCC=2.0 V" },
1844 { "BODLEVEL=010", "Brown-out detection level at VCC=2.2 V" },
1845 { "BODLEVEL=011", "Brown-out detection level at VCC=2.3 V" },
1846 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1847 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1848 },
1849 {
1850 // lock
1851 { 0, "Lock1", "" },
1852 { 1, "Lock2", "" }
1853 },
1854 {
1855 // lock mask description
1856 { "Lock=11", "Mode 1: No memory lock features enabled" },
1857 { "Lock=10", "Mode 2: Further programming disabled" },
1858 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1151 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1152 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1153 { "BODLEVEL=001", "Brown-out detection level at VCC=1.9 V", "" },
1154 { "BODLEVEL=000", "Brown-out detection level at VCC=2.0 V", "" },
1155 { "BODLEVEL=010", "Brown-out detection level at VCC=2.2 V", "" },
1156 { "BODLEVEL=011", "Brown-out detection level at VCC=2.3 V", "" },
1157 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1158 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1159 },
1160 {
1161 // lock
1162 { 0, "Lock1", "", "" },
1163 { 1, "Lock2", "", "" }
1164 },
1165 {
1166 // lock mask description
1167 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1168 { "Lock=10", "Mode 2: Further programming disabled", "" },
1169 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
18591170 }
18601171 },
18611172
18631174 { ATmega48 },
18641175 {
18651176 // fuse
1866 { 0, "CKSEL0", "" },
1867 { 1, "CKSEL1", "" },
1868 { 2, "CKSEL2", "" },
1869 { 3, "CKSEL3", "" },
1870 { 4, "SUT0", "" },
1871 { 5, "SUT1", "" },
1872 { 6, "CKOUT", "Clock output on PORTB0" },
1873 { 7, "CKDIV8", "Divide clock by 8 internally" },
1874 { 8, "BODLEVEL0", "" },
1875 { 9, "BODLEVEL1", "" },
1876 { 10, "BODLEVEL2", "" },
1877 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1878 { 12, "WDTON", "Watch-dog Timer always on" },
1879 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1880 { 14, "DWEN", "Debug Wire enable" },
1881 { 15, "RSTDISBL", "Reset Disabled (Enable PB6 as i/o pin)" },
1882 { 16, "SELFPRGEN", "Self Programming enable" }
1883 },
1884 {
1885 // fuse mask description
1886 { "CKSEL=1100 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1887 { "CKSEL=1100 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1888 { "CKSEL=1100 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1889 { "CKSEL=1111 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1890 { "CKSEL=1111 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1891 { "CKSEL=1111 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1892 { "CKSEL=1110 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1893 { "CKSEL=1110 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1894 { "CKSEL=1110 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1895
1896 { "BODLEVEL=111", "Brown-out detection disabled" },
1897 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1898 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1899 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1900 },
1901 {
1902 // lock
1903 { 0, "Lock1", "" },
1904 { 1, "Lock2", "" }
1905 },
1906 {
1907 // lock mask description
1908 { "Lock=11", "Mode 1: No memory lock features enabled" },
1909 { "Lock=10", "Mode 2: Further programming disabled" },
1910 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1911 }
1912 },
1913
1914 {
1915 { ATmega88 },
1916 {
1917 // fuse
1918 { 0, "CKSEL0", "" },
1919 { 1, "CKSEL1", "" },
1920 { 2, "CKSEL2", "" },
1921 { 3, "CKSEL3", "" },
1922 { 4, "SUT0", "" },
1923 { 5, "SUT1", "" },
1924 { 6, "CKOUT", "Clock output on PORTB0" },
1925 { 7, "CKDIV8", "Divide clock by 8 internally" },
1926 { 8, "BODLEVEL0", "" },
1927 { 9, "BODLEVEL1", "" },
1928 { 10, "BODLEVEL2", "" },
1929 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1930 { 12, "WDTON", "Watch-dog Timer always on" },
1931 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1932 { 14, "DWEN", "Debug Wire enable" },
1933 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)" },
1934 { 16, "SELFPRGEN", "Self Programming enable" }
1935 },
1936 {
1937 // fuse mask description
1938 { "CKSEL=1100 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1939 { "CKSEL=1100 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1940 { "CKSEL=1100 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1941 { "CKSEL=1111 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1942 { "CKSEL=1111 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1943 { "CKSEL=1111 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1944 { "CKSEL=1110 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1945 { "CKSEL=1110 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1946 { "CKSEL=1110 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1947
1948 { "BODLEVEL=111", "Brown-out detection disabled" },
1949 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
1950 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
1951 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
1952 },
1953 {
1954 // lock
1955 { 0, "Lock1", "" },
1956 { 1, "Lock2", "" }
1957 },
1958 {
1959 // lock mask description
1960 { "Lock=11", "Mode 1: No memory lock features enabled" },
1961 { "Lock=10", "Mode 2: Further programming disabled" },
1962 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1963 }
1964 },
1965
1966 {
1967 { ATmega168 },
1968 {
1969 // fuse
1970 { 0, "CKSEL0", "" },
1971 { 1, "CKSEL1", "" },
1972 { 2, "CKSEL2", "" },
1973 { 3, "CKSEL3", "" },
1974 { 4, "SUT0", "" },
1975 { 5, "SUT1", "" },
1976 { 6, "CKOUT", "Clock output on PORTB0" },
1977 { 7, "CKDIV8", "Divide clock by 8 internally" },
1978 { 8, "BODLEVEL0", "" },
1979 { 9, "BODLEVEL1", "" },
1980 { 10, "BODLEVEL2", "" },
1981 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
1982 { 12, "WDTON", "Watch-dog Timer always on" },
1983 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
1984 { 14, "DWEN", "Debug Wire enable" },
1985 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)" },
1986 { 16, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
1987 { 17, "BOOTSZ0", "" },
1988 { 18, "BOOTSZ1", "" }
1989 },
1990 {
1991 // fuse mask description
1992 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
1993 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
1994 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
1995 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
1996 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
1997 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
1998 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
1999 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2000 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2001 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2002 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2003 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2004 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2005 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2006 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2007 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2008 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2009 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2010 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2011 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2012 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2013 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2014 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2015 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2016 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2017 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2018 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2019 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2020 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2021 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2022 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2023 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2024 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2025 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2026 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2027 { "CKSEL=0111 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2028 { "CKSEL=0111 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2029 { "CKSEL=0111 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2030 { "CKSEL=0110 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2031 { "CKSEL=0110 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2032 { "CKSEL=0111 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2033 { "CKSEL=0110 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2034 { "CKSEL=0110 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2035 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms" },
2036 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4.1 ms" },
2037 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 65 ms" },
2038 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 0 ms" },
2039 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 4.1 ms" },
2040 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 65 ms" },
2041 { "CKSEL=0011 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
2042 { "CKSEL=0011 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
2043 { "CKSEL=0011 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
2044 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
2045 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
2046 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
2047
2048 { "BODLEVEL=111", "Brown-out detection disabled" },
2049 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2050 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2051 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" },
1177 { 0, "CKSEL0", "", "" },
1178 { 1, "CKSEL1", "", "" },
1179 { 2, "CKSEL2", "", "" },
1180 { 3, "CKSEL3", "", "" },
1181 { 4, "SUT0", "", "" },
1182 { 5, "SUT1", "", "" },
1183 { 6, "CKOUT", "Clock output on PORTB0", "" },
1184 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1185 { 8, "BODLEVEL0", "", "" },
1186 { 9, "BODLEVEL1", "", "" },
1187 { 10, "BODLEVEL2", "", "" },
1188 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1189 { 12, "WDTON", "Watch-dog Timer always on", "" },
1190 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1191 { 14, "DWEN", "Debug Wire enable", "" },
1192 { 15, "RSTDISBL", "Reset Disabled (Enable PB6 as i/o pin)", "" },
1193 { 16, "SELFPRGEN", "Self Programming enable", "" }
1194 },
1195 {
1196 // fuse mask description
1197 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1198 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1199 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1200 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1201 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1202 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1203 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1204 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1205 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1206 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1207 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1208 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1209 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1210 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1211 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1212 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1213 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1214 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1215 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1216 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1217 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1218 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1219 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1220 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1221 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1222 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1223 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1224 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1225 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1226 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1227 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1228 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1229 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1230 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1231 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1232 { "CKSEL=0111 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1233 { "CKSEL=0111 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1234 { "CKSEL=0111 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1235 { "CKSEL=0110 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1236 { "CKSEL=0110 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1237 { "CKSEL=0111 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1238 { "CKSEL=0110 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1239 { "CKSEL=0110 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1240 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms", "" },
1241 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4.1 ms", "" },
1242 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 65 ms", "" },
1243 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 0 ms", "" },
1244 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 4.1 ms", "" },
1245 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 65 ms", "" },
1246 { "CKSEL=0011 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1247 { "CKSEL=0011 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1248 { "CKSEL=0011 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1249 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1250 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1251 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1252
1253 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1254 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1255 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1256 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1257 },
1258 {
1259 // lock
1260 { 0, "Lock1", "", "" },
1261 { 1, "Lock2", "", "" }
1262 },
1263 {
1264 // lock mask description
1265 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1266 { "Lock=10", "Mode 2: Further programming disabled", "" },
1267 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
1268 }
1269 },
1270
1271 {
1272 { ATmega88, ATmega168 },
1273 {
1274 // fuse
1275 { 0, "CKSEL0", "", "" },
1276 { 1, "CKSEL1", "", "" },
1277 { 2, "CKSEL2", "", "" },
1278 { 3, "CKSEL3", "", "" },
1279 { 4, "SUT0", "", "" },
1280 { 5, "SUT1", "", "" },
1281 { 6, "CKOUT", "Clock output on PORTB0", "" },
1282 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1283 { 8, "BODLEVEL0", "", "" },
1284 { 9, "BODLEVEL1", "", "" },
1285 { 10, "BODLEVEL2", "", "" },
1286 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1287 { 12, "WDTON", "Watch-dog Timer always on", "" },
1288 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1289 { 14, "DWEN", "Debug Wire enable", "" },
1290 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)", "" },
1291 { 16, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
1292 { 17, "BOOTSZ0", "", "" },
1293 { 18, "BOOTSZ1", "", "" }
1294 },
1295 {
1296 // fuse mask description
1297 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1298 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1299 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1300 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1301 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1302 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1303 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1304 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1305 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1306 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1307 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1308 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1309 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1310 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1311 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1312 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1313 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1314 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1315 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1316 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1317 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1318 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1319 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1320 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1321 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1322 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1323 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1324 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1325 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1326 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1327 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1328 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1329 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1330 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1331 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1332 { "CKSEL=0111 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1333 { "CKSEL=0111 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1334 { "CKSEL=0111 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1335 { "CKSEL=0110 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1336 { "CKSEL=0110 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1337 { "CKSEL=0111 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1338 { "CKSEL=0110 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1339 { "CKSEL=0110 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1340 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms", "" },
1341 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4.1 ms", "" },
1342 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 65 ms", "" },
1343 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 0 ms", "" },
1344 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 4.1 ms", "" },
1345 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 65 ms", "" },
1346 { "CKSEL=0011 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1347 { "CKSEL=0011 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1348 { "CKSEL=0011 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1349 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1350 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1351 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1352
1353 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1354 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1355 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1356 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" },
20521357
20531358 // extended
2054 { "BOOTSZ=00", "Boot Flash section size=1024 words Boot start address=$1C00" },
2055 { "BOOTSZ=11", "Boot Flash section size=128 words Boot start address=$1F80" },
2056 { "BOOTSZ=10", "Boot Flash section size=256 words Boot start address=$1F00" },
2057 { "BOOTSZ=01", "Boot Flash section size=512 words Boot start address=$1E00" }
2058 },
2059 {
2060 // lock
2061 { 0, "Lock1", "" },
2062 { 1, "Lock2", "" },
2063 { 2, "BootLock1", "" },
2064 { 3, "BootLock2", "" },
2065 { 4, "BootLoad1", "" },
2066 { 5, "BootLoad2", "" }
2067 },
2068 {
2069 // lock mask description
2070 { "Lock=11", "Mode 1: No memory lock features enabled" },
2071 { "Lock=10", "Mode 2: Further programming disabled" },
2072 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2073
2074 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2075 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2076 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2077 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2078
2079 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2080 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2081 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2082 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
1359 { "BOOTSZ=00", "Boot Flash section size=1024 words Boot start address=$xC00", "Atmega88: $0C00, ATmega168: $1C00" },
1360 { "BOOTSZ=11", "Boot Flash section size=128 words Boot start address=$xF80", "Atmega88: $0F80, ATmega168: $1F80" },
1361 { "BOOTSZ=10", "Boot Flash section size=256 words Boot start address=$xF00", "Atmega88: $0F00, ATmega168: $1F00" },
1362 { "BOOTSZ=01", "Boot Flash section size=512 words Boot start address=$xE00", "Atmega88: $0E00, ATmega168: $1E00" }
1363 },
1364 {
1365 // lock
1366 { 0, "Lock1", "", "" },
1367 { 1, "Lock2", "", "" },
1368 { 2, "BootLock1", "", "" },
1369 { 3, "BootLock2", "", "" },
1370 { 4, "BootLoad1", "", "" },
1371 { 5, "BootLoad2", "", "" }
1372 },
1373 {
1374 // lock mask description
1375 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1376 { "Lock=10", "Mode 2: Further programming disabled", "" },
1377 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
1378
1379 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
1380 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
1381 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
1382 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
1383
1384 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
1385 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
1386 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
1387 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
20831388 }
20841389 },
20851390
20871392 { ATmega328 },
20881393 {
20891394 // fuse
2090 { 0, "CKSEL0", "" },
2091 { 1, "CKSEL1", "" },
2092 { 2, "CKSEL2", "" },
2093 { 3, "CKSEL3", "" },
2094 { 4, "SUT0", "" },
2095 { 5, "SUT1", "" },
2096 { 6, "CKOUT", "Clock output on PORTB0" },
2097 { 7, "CKDIV8", "Divide clock by 8 internally" },
2098 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2099 { 9, "BOOTSZ0", "" },
2100 { 10, "BOOTSZ1", "" },
2101 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2102 { 12, "WDTON", "Watch-dog Timer always on" },
2103 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2104 { 14, "DWEN", "Debug Wire enable" },
2105 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)" },
2106 { 16, "BODLEVEL0", "" },
2107 { 17, "BODLEVEL1", "" },
2108 { 18, "BODLEVEL2", "" }
2109 },
2110 {
2111 // fuse mask description
2112 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
2113 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
2114 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
2115 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2116 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2117 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2118 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2119 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2120 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2121 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2122 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2123 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2124 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2125 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2126 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2127 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2128 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2129 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2130 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2131 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2132 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2133 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2134 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2135 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2136 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2137 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2138 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2139 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2140 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2141 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2142 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2143 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2144 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2145 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2146 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2147 { "CKSEL=0111 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms" },
2148 { "CKSEL=0111 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms" },
2149 { "CKSEL=0111 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms" },
2150 { "CKSEL=0110 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms" },
2151 { "CKSEL=0110 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms" },
2152 { "CKSEL=0111 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms" },
2153 { "CKSEL=0110 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms" },
2154 { "CKSEL=0110 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms" },
2155 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms" },
2156 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4.1 ms" },
2157 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 65 ms" },
2158 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 0 ms" },
2159 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 4.1 ms" },
2160 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 65 ms" },
2161 { "CKSEL=0011 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
2162 { "CKSEL=0011 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
2163 { "CKSEL=0011 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
2164 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms" },
2165 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms" },
2166 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms" },
2167
2168 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00" },
2169 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800" },
2170 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00" },
2171 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00" },
2172
2173 { "BODLEVEL=111", "Brown-out detection disabled" },
2174 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2175 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2176 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2177 },
2178 {
2179 // lock
2180 { 0, "Lock1", "" },
2181 { 1, "Lock2", "" },
2182 { 2, "BootLock1", "" },
2183 { 3, "BootLock2", "" },
2184 { 4, "BootLoad1", "" },
2185 { 5, "BootLoad2", "" }
2186 },
2187 {
2188 // lock mask description
2189 { "Lock=11", "Mode 1: No memory lock features enabled" },
2190 { "Lock=10", "Mode 2: Further programming disabled" },
2191 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2192
2193 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2194 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2195 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2196 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2197
2198 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2199 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2200 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2201 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
1395 { 0, "CKSEL0", "", "" },
1396 { 1, "CKSEL1", "", "" },
1397 { 2, "CKSEL2", "", "" },
1398 { 3, "CKSEL3", "", "" },
1399 { 4, "SUT0", "", "" },
1400 { 5, "SUT1", "", "" },
1401 { 6, "CKOUT", "Clock output on PORTB0", "" },
1402 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1403 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
1404 { 9, "BOOTSZ0", "", "" },
1405 { 10, "BOOTSZ1", "", "" },
1406 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1407 { 12, "WDTON", "Watch-dog Timer always on", "" },
1408 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1409 { 14, "DWEN", "Debug Wire enable", "" },
1410 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)", "" },
1411 { 16, "BODLEVEL0", "", "" },
1412 { 17, "BODLEVEL1", "", "" },
1413 { 18, "BODLEVEL2", "", "" }
1414 },
1415 {
1416 // fuse mask description
1417 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1418 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1419 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1420 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1421 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1422 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1423 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1424 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1425 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1426 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1427 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1428 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1429 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1430 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1431 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1432 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1433 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1434 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1435 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1436 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1437 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1438 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1439 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1440 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1441 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1442 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1443 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1444 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1445 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1446 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1447 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1448 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1449 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1450 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1451 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1452 { "CKSEL=0111 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 0 ms", "" },
1453 { "CKSEL=0111 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 4.1 ms", "" },
1454 { "CKSEL=0111 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 16K CK/14 CK + 65 ms", "" },
1455 { "CKSEL=0110 SUT=10", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 0 ms", "" },
1456 { "CKSEL=0110 SUT=11", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 4.1 ms", "" },
1457 { "CKSEL=0111 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 1K CK /14 CK + 65 ms", "" },
1458 { "CKSEL=0110 SUT=00", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 4.1 ms", "" },
1459 { "CKSEL=0110 SUT=01", "Ext. Full-swing Crystal; Start-up time PWRDWN/RESET: 258 CK/14 CK + 65 ms", "" },
1460 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 0 ms", "" },
1461 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 4.1 ms", "" },
1462 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 1K CK/14 CK + 65 ms", "" },
1463 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 0 ms", "" },
1464 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 4.1 ms", "" },
1465 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time PWRDWN/RESET: 32K CK/14 CK + 65 ms", "" },
1466 { "CKSEL=0011 SUT=00", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1467 { "CKSEL=0011 SUT=01", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1468 { "CKSEL=0011 SUT=10", "Int. RC Osc. 128kHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1469 { "CKSEL=0010 SUT=00", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms", "" },
1470 { "CKSEL=0010 SUT=01", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms", "" },
1471 { "CKSEL=0010 SUT=10", "Int. RC Osc. 8 MHz; Start-up time PWRDWN/RESET: 6 CK/14 CK + 65 ms", "" },
1472
1473 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00", "" },
1474 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800", "" },
1475 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00", "" },
1476 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00", "" },
1477
1478 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1479 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1480 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1481 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1482 },
1483 {
1484 // lock
1485 { 0, "Lock1", "", "" },
1486 { 1, "Lock2", "", "" },
1487 { 2, "BootLock1", "", "" },
1488 { 3, "BootLock2", "", "" },
1489 { 4, "BootLoad1", "", "" },
1490 { 5, "BootLoad2", "", "" }
1491 },
1492 {
1493 // lock mask description
1494 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1495 { "Lock=10", "Mode 2: Further programming disabled", "" },
1496 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
1497
1498 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
1499 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
1500 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
1501 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
1502
1503 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
1504 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
1505 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
1506 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
22021507 }
22031508 },
22041509
22061511 { ATmega164 },
22071512 {
22081513 // fuse
2209 { 0, "CKSEL0", "" },
2210 { 1, "CKSEL1", "" },
2211 { 2, "CKSEL2", "" },
2212 { 3, "CKSEL3", "" },
2213 { 4, "SUT0", "" },
2214 { 5, "SUT1", "" },
2215 { 6, "CKOUT", "Clock output on PORTB1" },
2216 { 7, "CKDIV8", "Divide clock by 8 internally" },
2217 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2218 { 9, "BOOTSZ0", "" },
2219 { 10, "BOOTSZ1", "" },
2220 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2221 { 12, "WDTON", "Watch-dog Timer always on" },
2222 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2223 { 14, "JTAGEN", "JTAG Interface Enabled" },
2224 { 15, "OCDEN", "On-Chip Debug Enabled" },
2225 { 16, "BODLEVEL0", "" },
2226 { 17, "BODLEVEL1", "" },
2227 { 18, "BODLEVEL2", "" }
2228 },
2229 {
2230 // fuse mask description
2231 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2232 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2233 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2234 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2235 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2236 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2237 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2238 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2239 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2240 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2241 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2242 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2243 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2244 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2245 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2246 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2247 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2248 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2249 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2250 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2251 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2252 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2253 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2254 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2255 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2256 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2257 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2258 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2259 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2260 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2261 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2262 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2263 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2264 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2265 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2266 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2267 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2268 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2269 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2270 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2271 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2272 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2273 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2274 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2275 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2276 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2277 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2278 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2279 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2280 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2281 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2282 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2283 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2284 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2285 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
2286
2287 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00" },
2288 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800" },
2289 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00" },
2290 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00" },
2291
2292 { "BODLEVEL=111", "Brown-out detection disabled" },
2293 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2294 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2295 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2296 },
2297 {
2298 // lock
2299 { 0, "Lock1", "" },
2300 { 1, "Lock2", "" },
2301 { 2, "BootLock1", "" },
2302 { 3, "BootLock2", "" },
2303 { 4, "BootLoad1", "" },
2304 { 5, "BootLoad2", "" }
2305 },
2306 {
2307 // lock mask description
2308 { "Lock=11", "Mode 1: No memory lock features enabled" },
2309 { "Lock=10", "Mode 2: Further programming disabled" },
2310 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2311
2312 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2313 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2314 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2315 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2316
2317 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2318 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2319 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2320 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
1514 { 0, "CKSEL0", "", "" },
1515 { 1, "CKSEL1", "", "" },
1516 { 2, "CKSEL2", "", "" },
1517 { 3, "CKSEL3", "", "" },
1518 { 4, "SUT0", "", "" },
1519 { 5, "SUT1", "", "" },
1520 { 6, "CKOUT", "Clock output on PORTB1", "" },
1521 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1522 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
1523 { 9, "BOOTSZ0", "", "" },
1524 { 10, "BOOTSZ1", "", "" },
1525 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1526 { 12, "WDTON", "Watch-dog Timer always on", "" },
1527 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1528 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
1529 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
1530 { 16, "BODLEVEL0", "", "" },
1531 { 17, "BODLEVEL1", "", "" },
1532 { 18, "BODLEVEL2", "", "" }
1533 },
1534 {
1535 // fuse mask description
1536 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
1537 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms", "" },
1538 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms", "" },
1539 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms", "" },
1540 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1541 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms", "" },
1542 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms", "" },
1543 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1544 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms", "" },
1545 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1546 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms", "" },
1547 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms", "" },
1548 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1549 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms", "" },
1550 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms", "" },
1551 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1552 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms", "" },
1553 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1554 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms", "" },
1555 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms", "" },
1556 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1557 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms", "" },
1558 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms", "" },
1559 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1560 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms", "" },
1561 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1562 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms", "" },
1563 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms", "" },
1564 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms", "" },
1565 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms", "" },
1566 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms", "" },
1567 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms", "" },
1568 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms", "" },
1569 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms", "" },
1570 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms", "" },
1571 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms", "" },
1572 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms", "" },
1573 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms", "" },
1574 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms", "" },
1575 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms", "" },
1576 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms", "" },
1577 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled", "" },
1578 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power", "" },
1579 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power", "" },
1580 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable", "" },
1581 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power", "" },
1582 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power", "" },
1583 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power", "" },
1584 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power", "" },
1585 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms", "" },
1586 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms", "" },
1587 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms", "" },
1588 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms", "" },
1589 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms", "" },
1590 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms", "" },
1591
1592 { "BOOTSZ=01", "Boot Flash section size=512 words Boot start address=$1C00", "" },
1593 { "BOOTSZ=00", "Boot Flash section size=1024 words Boot start address=$1800", "" },
1594 { "BOOTSZ=11", "Boot Flash section size=128 words Boot start address=$1F00", "" },
1595 { "BOOTSZ=10", "Boot Flash section size=256 words Boot start address=$1E00", "" },
1596
1597 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1598 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1599 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1600 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1601 },
1602 {
1603 // lock
1604 { 0, "Lock1", "", "" },
1605 { 1, "Lock2", "", "" },
1606 { 2, "BootLock1", "", "" },
1607 { 3, "BootLock2", "", "" },
1608 { 4, "BootLoad1", "", "" },
1609 { 5, "BootLoad2", "", "" }
1610 },
1611 {
1612 // lock mask description
1613 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1614 { "Lock=10", "Mode 2: Further programming disabled", "" },
1615 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
1616
1617 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
1618 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
1619 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
1620 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
1621
1622 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
1623 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
1624 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
1625 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
23211626 }
23221627 },
23231628
23251630 { ATmega324 },
23261631 {
23271632 // fuse
2328 { 0, "CKSEL0", "" },
2329 { 1, "CKSEL1", "" },
2330 { 2, "CKSEL2", "" },
2331 { 3, "CKSEL3", "" },
2332 { 4, "SUT0", "" },
2333 { 5, "SUT1", "" },
2334 { 6, "CKOUT", "Clock output on PORTB1" },
2335 { 7, "CKDIV8", "Divide clock by 8 internally" },
2336 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2337 { 9, "BOOTSZ0", "" },
2338 { 10, "BOOTSZ1", "" },
2339 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2340 { 12, "WDTON", "Watch-dog Timer always on" },
2341 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2342 { 14, "JTAGEN", "JTAG Interface Enabled" },
2343 { 15, "OCDEN", "On-Chip Debug Enabled" },
2344 { 16, "BODLEVEL0", "" },
2345 { 17, "BODLEVEL1", "" },
2346 { 18, "BODLEVEL2", "" }
2347 },
2348 {
2349 // fuse mask description
2350 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2351 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2352 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2353 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2354 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2355 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2356 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2357 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2358 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2359 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2360 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2361 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2362 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2363 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2364 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2365 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2366 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2367 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2368 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2369 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2370 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2371 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2372 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2373 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2374 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2375 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2376 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2377 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2378 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2379 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2380 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2381 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2382 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2383 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2384 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2385 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2386 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2387 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2388 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2389 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2390 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2391 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2392 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2393 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2394 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2395 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2396 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2397 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2398 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2399 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2400 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2401 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2402 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2403 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2404 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
2405
2406 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00" },
2407 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800" },
2408 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00" },
2409 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00" },
2410
2411 { "BODLEVEL=111", "Brown-out detection disabled" },
2412 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2413 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2414 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2415 },
2416 {
2417 // lock
2418 { 0, "Lock1", "" },
2419 { 1, "Lock2", "" },
2420 { 2, "BootLock1", "" },
2421 { 3, "BootLock2", "" },
2422 { 4, "BootLoad1", "" },
2423 { 5, "BootLoad2", "" }
2424 },
2425 {
2426 // lock mask description
2427 { "Lock=11", "Mode 1: No memory lock features enabled" },
2428 { "Lock=10", "Mode 2: Further programming disabled" },
2429 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2430
2431 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2432 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2433 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2434 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2435
2436 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2437 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2438 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2439 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2440 }
2441 },
2442
2443 {
2444 { ATmega644 },
2445 {
2446 // fuse
2447 { 0, "CKSEL0", "" },
2448 { 1, "CKSEL1", "" },
2449 { 2, "CKSEL2", "" },
2450 { 3, "CKSEL3", "" },
2451 { 4, "SUT0", "" },
2452 { 5, "SUT1", "" },
2453 { 6, "CKOUT", "Clock output on PORTB1" },
2454 { 7, "CKDIV8", "Divide clock by 8 internally" },
2455 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2456 { 9, "BOOTSZ0", "" },
2457 { 10, "BOOTSZ1", "" },
2458 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2459 { 12, "WDTON", "Watch-dog Timer always on" },
2460 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2461 { 14, "JTAGEN", "JTAG Interface Enabled" },
2462 { 15, "OCDEN", "On-Chip Debug Enabled" },
2463 { 16, "BODLEVEL0", "" },
2464 { 17, "BODLEVEL1", "" },
2465 { 18, "BODLEVEL2", "" }
2466 },
2467 {
2468 // fuse mask description
2469 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2470 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2471 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2472 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2473 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2474 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2475 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2476 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2477 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2478 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2479 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2480 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2481 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2482 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2483 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2484 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2485 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2486 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2487 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2488 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2489 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2490 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2491 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2492 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2493 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2494 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2495 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2496 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2497 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2498 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2499 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2500 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2501 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2502 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2503 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2504 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2505 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2506 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2507 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2508 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2509 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2510 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2511 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2512 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2513 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2514 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2515 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2516 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2517 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2518 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2519 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2520 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2521 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2522 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2523 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
2524
2525 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
2526 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
2527 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
2528 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" },
2529
2530 { "BODLEVEL=111", "Brown-out detection disabled" },
2531 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2532 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2533 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2534 },
2535 {
2536 // lock
2537 { 0, "Lock1", "" },
2538 { 1, "Lock2", "" },
2539 { 2, "BootLock1", "" },
2540 { 3, "BootLock2", "" },
2541 { 4, "BootLoad1", "" },
2542 { 5, "BootLoad2", "" }
2543 },
2544 {
2545 // lock mask description
2546 { "Lock=11", "Mode 1: No memory lock features enabled" },
2547 { "Lock=10", "Mode 2: Further programming disabled" },
2548 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2549
2550 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2551 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2552 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2553 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2554
2555 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2556 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2557 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2558 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2559 }
2560 },
2561
2562 {
2563 { ATmega640 },
2564 {
2565 // fuse
2566 { 0, "CKSEL0", "" },
2567 { 1, "CKSEL1", "" },
2568 { 2, "CKSEL2", "" },
2569 { 3, "CKSEL3", "" },
2570 { 4, "SUT0", "" },
2571 { 5, "SUT1", "" },
2572 { 6, "CKOUT", "Clock output on PORTE7" },
2573 { 7, "CKDIV8", "Divide clock by 8 internally" },
2574 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2575 { 9, "BOOTSZ0", "" },
2576 { 10, "BOOTSZ1", "" },
2577 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2578 { 12, "WDTON", "Watch-dog Timer always on" },
2579 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2580 { 14, "JTAGEN", "JTAG Interface Enabled" },
2581 { 15, "OCDEN", "On-Chip Debug Enabled" },
2582 { 16, "BODLEVEL0", "" },
2583 { 17, "BODLEVEL1", "" },
2584 { 18, "BODLEVEL2", "" }
2585 },
2586 {
2587 // fuse mask description
2588 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2589 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2590 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2591 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2592 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2593 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2594 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2595 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2596 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2597 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2598 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2599 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2600 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2601 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2602 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2603 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2604 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2605 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2606 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2607 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2608 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2609 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2610 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2611 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2612 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2613 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2614 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2615 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2616 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2617 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2618 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2619 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2620 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2621 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2622 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2623 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2624 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2625 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2626 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2627 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2628 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2629 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2630 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2631 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2632 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2633 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2634 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2635 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2636 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2637 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2638 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2639 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2640 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2641 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2642 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
2643
2644 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
2645 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
2646 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
2647 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" },
2648
2649 { "BODLEVEL=111", "Brown-out detection disabled" },
2650 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2651 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2652 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2653 },
2654 {
2655 // lock
2656 { 0, "Lock1", "" },
2657 { 1, "Lock2", "" },
2658 { 2, "BootLock1", "" },
2659 { 3, "BootLock2", "" },
2660 { 4, "BootLoad1", "" },
2661 { 5, "BootLoad2", "" }
2662 },
2663 {
2664 // lock mask description
2665 { "Lock=11", "Mode 1: No memory lock features enabled" },
2666 { "Lock=10", "Mode 2: Further programming disabled" },
2667 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2668
2669 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2670 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2671 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2672 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2673
2674 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2675 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2676 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2677 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2678 }
2679 },
2680
2681 {
2682 { ATmega1280 },
2683 {
2684 // fuse
2685 { 0, "CKSEL0", "" },
2686 { 1, "CKSEL1", "" },
2687 { 2, "CKSEL2", "" },
2688 { 3, "CKSEL3", "" },
2689 { 4, "SUT0", "" },
2690 { 5, "SUT1", "" },
2691 { 6, "CKOUT", "Clock output on PORTE7" },
2692 { 7, "CKDIV8", "Divide clock by 8 internally" },
2693 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2694 { 9, "BOOTSZ0", "" },
2695 { 10, "BOOTSZ1", "" },
2696 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2697 { 12, "WDTON", "Watch-dog Timer always on" },
2698 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2699 { 14, "JTAGEN", "JTAG Interface Enabled" },
2700 { 15, "OCDEN", "On-Chip Debug Enabled" },
2701 { 16, "BODLEVEL0", "" },
2702 { 17, "BODLEVEL1", "" },
2703 { 18, "BODLEVEL2", "" }
2704 },
2705 {
2706 // fuse mask description
2707 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2708 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2709 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2710 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2711 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2712 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2713 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2714 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2715 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2716 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2717 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2718 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2719 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2720 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2721 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2722 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2723 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2724 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2725 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2726 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2727 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2728 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2729 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2730 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2731 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2732 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2733 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2734 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2735 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2736 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2737 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2738 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2739 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2740 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2741 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2742 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2743 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2744 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2745 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2746 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2747 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2748 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2749 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2750 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2751 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2752 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2753 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2754 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2755 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2756 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2757 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2758 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2759 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2760 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2761 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
2762
2763 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
2764 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
2765 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
2766 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" },
2767
2768 { "BODLEVEL=111", "Brown-out detection disabled" },
2769 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2770 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2771 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2772 },
2773 {
2774 // lock
2775 { 0, "Lock1", "" },
2776 { 1, "Lock2", "" },
2777 { 2, "BootLock1", "" },
2778 { 3, "BootLock2", "" },
2779 { 4, "BootLoad1", "" },
2780 { 5, "BootLoad2", "" }
2781 },
2782 {
2783 // lock mask description
2784 { "Lock=11", "Mode 1: No memory lock features enabled" },
2785 { "Lock=10", "Mode 2: Further programming disabled" },
2786 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2787
2788 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2789 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2790 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2791 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2792
2793 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2794 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2795 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2796 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2797 }
2798 },
2799
2800 {
2801 { ATmega1281 },
2802 {
2803 // fuse
2804 { 0, "CKSEL0", "" },
2805 { 1, "CKSEL1", "" },
2806 { 2, "CKSEL2", "" },
2807 { 3, "CKSEL3", "" },
2808 { 4, "SUT0", "" },
2809 { 5, "SUT1", "" },
2810 { 6, "CKOUT", "Clock output on PORTE7" },
2811 { 7, "CKDIV8", "Divide clock by 8 internally" },
2812 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2813 { 9, "BOOTSZ0", "" },
2814 { 10, "BOOTSZ1", "" },
2815 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2816 { 12, "WDTON", "Watch-dog Timer always on" },
2817 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2818 { 14, "JTAGEN", "JTAG Interface Enabled" },
2819 { 15, "OCDEN", "On-Chip Debug Enabled" },
2820 { 16, "BODLEVEL0", "" },
2821 { 17, "BODLEVEL1", "" },
2822 { 18, "BODLEVEL2", "" }
2823 },
2824 {
2825 // fuse mask description
2826 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2827 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2828 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2829 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2830 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2831 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2832 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2833 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2834 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2835 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2836 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2837 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2838 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2839 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2840 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2841 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2842 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2843 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2844 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2845 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2846 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2847 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2848 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2849 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2850 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2851 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2852 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2853 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2854 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2855 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2856 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2857 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2858 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2859 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2860 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2861 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2862 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2863 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2864 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2865 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2866 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2867 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2868 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2869 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2870 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2871 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2872 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2873 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2874 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2875 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2876 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2877 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2878 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2879 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2880 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
2881
2882 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
2883 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
2884 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
2885 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" },
2886
2887 { "BODLEVEL=111", "Brown-out detection disabled" },
2888 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
2889 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
2890 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
2891 },
2892 {
2893 // lock
2894 { 0, "Lock1", "" },
2895 { 1, "Lock2", "" },
2896 { 2, "BootLock1", "" },
2897 { 3, "BootLock2", "" },
2898 { 4, "BootLoad1", "" },
2899 { 5, "BootLoad2", "" }
2900 },
2901 {
2902 // lock mask description
2903 { "Lock=11", "Mode 1: No memory lock features enabled" },
2904 { "Lock=10", "Mode 2: Further programming disabled" },
2905 { "Lock=00", "Mode 3: Further programming and verification disabled" },
2906
2907 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
2908 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
2909 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
2910 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
2911
2912 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
2913 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
2914 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
2915 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2916 }
2917 },
2918
2919 {
2920 { ATmega2560 },
2921 {
2922 // fuse
2923 { 0, "CKSEL0", "" },
2924 { 1, "CKSEL1", "" },
2925 { 2, "CKSEL2", "" },
2926 { 3, "CKSEL3", "" },
2927 { 4, "SUT0", "" },
2928 { 5, "SUT1", "" },
2929 { 6, "CKOUT", "Clock output on PORTE7" },
2930 { 7, "CKDIV8", "Divide clock by 8 internally" },
2931 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
2932 { 9, "BOOTSZ0", "" },
2933 { 10, "BOOTSZ1", "" },
2934 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
2935 { 12, "WDTON", "Watch-dog Timer always on" },
2936 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
2937 { 14, "JTAGEN", "JTAG Interface Enabled" },
2938 { 15, "OCDEN", "On-Chip Debug Enabled" },
2939 { 16, "BODLEVEL0", "" },
2940 { 17, "BODLEVEL1", "" },
2941 { 18, "BODLEVEL2", "" }
2942 },
2943 {
2944 // fuse mask description
2945 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
2946 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
2947 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
2948 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
2949 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
2950 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
2951 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
2952 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
2953 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
2954 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
2955 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
2956 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
2957 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2958 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
2959 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
2960 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2961 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
2962 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2963 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
2964 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
2965 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
2966 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
2967 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
2968 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
2969 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
2970 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
2971 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
2972 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
2973 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
2974 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
2975 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
2976 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
2977 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
2978 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
2979 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
2980 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
2981 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
2982 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
2983 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
2984 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
2985 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
2986 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
2987 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
2988 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
2989 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
2990 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
2991 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
2992 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
2993 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
2994 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
2995 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
2996 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
2997 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
2998 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
2999 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
3000
3001 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
3002 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
3003 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
3004 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" },
3005
3006 { "BODLEVEL=111", "Brown-out detection disabled" },
3007 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
3008 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
3009 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
3010 },
3011 {
3012 // lock
3013 { 0, "Lock1", "" },
3014 { 1, "Lock2", "" },
3015 { 2, "BootLock1", "" },
3016 { 3, "BootLock2", "" },
3017 { 4, "BootLoad1", "" },
3018 { 5, "BootLoad2", "" }
3019 },
3020 {
3021 // lock mask description
3022 { "Lock=11", "Mode 1: No memory lock features enabled" },
3023 { "Lock=10", "Mode 2: Further programming disabled" },
3024 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3025
3026 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3027 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3028 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3029 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3030
3031 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3032 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3033 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3034 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
3035 }
3036 },
3037
3038 {
3039 { ATmega2561 },
3040 {
3041 // fuse
3042 { 0, "CKSEL0", "" },
3043 { 1, "CKSEL1", "" },
3044 { 2, "CKSEL2", "" },
3045 { 3, "CKSEL3", "" },
3046 { 4, "SUT0", "" },
3047 { 5, "SUT1", "" },
3048 { 6, "CKOUT", "Clock output on PORTE7" },
3049 { 7, "CKDIV8", "Divide clock by 8 internally" },
3050 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3051 { 9, "BOOTSZ0", "" },
3052 { 10, "BOOTSZ1", "" },
3053 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3054 { 12, "WDTON", "Watch-dog Timer always on" },
3055 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3056 { 14, "JTAGEN", "JTAG Interface Enabled" },
3057 { 15, "OCDEN", "On-Chip Debug Enabled" },
3058 { 16, "BODLEVEL0", "" },
3059 { 17, "BODLEVEL1", "" },
3060 { 18, "BODLEVEL2", "" }
3061 },
3062 {
3063 // fuse mask description
3064 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3065 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
3066 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
3067 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
3068 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
3069 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
3070 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
3071 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
3072 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
3073 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
3074 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
3075 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
3076 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
3077 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
3078 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
3079 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
3080 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
3081 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
3082 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
3083 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
3084 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
3085 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
3086 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
3087 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
3088 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
3089 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
3090 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
3091 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
3092 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
3093 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
3094 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
3095 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
3096 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
3097 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
3098 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
3099 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
3100 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
3101 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
3102 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
3103 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
3104 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
3105 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled" },
3106 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power" },
3107 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power" },
3108 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable" },
3109 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power" },
3110 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power" },
3111 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power" },
3112 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power" },
3113 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms" },
3114 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms" },
3115 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms" },
3116 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
3117 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
3118 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
3119
3120 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
3121 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
3122 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
3123 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" },
3124
3125 { "BODLEVEL=111", "Brown-out detection disabled" },
3126 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
3127 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
3128 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" }
3129 },
3130 {
3131 // lock
3132 { 0, "Lock1", "" },
3133 { 1, "Lock2", "" },
3134 { 2, "BootLock1", "" },
3135 { 3, "BootLock2", "" },
3136 { 4, "BootLoad1", "" },
3137 { 5, "BootLoad2", "" }
3138 },
3139 {
3140 // lock mask description
3141 { "Lock=11", "Mode 1: No memory lock features enabled" },
3142 { "Lock=10", "Mode 2: Further programming disabled" },
3143 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3144
3145 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3146 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3147 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3148 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3149
3150 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3151 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3152 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3153 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
1633 { 0, "CKSEL0", "", "" },
1634 { 1, "CKSEL1", "", "" },
1635 { 2, "CKSEL2", "", "" },
1636 { 3, "CKSEL3", "", "" },
1637 { 4, "SUT0", "", "" },
1638 { 5, "SUT1", "", "" },
1639 { 6, "CKOUT", "Clock output on PORTB1", "" },
1640 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1641 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
1642 { 9, "BOOTSZ0", "", "" },
1643 { 10, "BOOTSZ1", "", "" },
1644 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1645 { 12, "WDTON", "Watch-dog Timer always on", "" },
1646 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1647 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
1648 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
1649 { 16, "BODLEVEL0", "", "" },
1650 { 17, "BODLEVEL1", "", "" },
1651 { 18, "BODLEVEL2", "", "" }
1652 },
1653 {
1654 // fuse mask description
1655 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
1656 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms", "" },
1657 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms", "" },
1658 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms", "" },
1659 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1660 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms", "" },
1661 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms", "" },
1662 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1663 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms", "" },
1664 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1665 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms", "" },
1666 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms", "" },
1667 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1668 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms", "" },
1669 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms", "" },
1670 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1671 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms", "" },
1672 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1673 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms", "" },
1674 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms", "" },
1675 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1676 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms", "" },
1677 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms", "" },
1678 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1679 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms", "" },
1680 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1681 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms", "" },
1682 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms", "" },
1683 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms", "" },
1684 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms", "" },
1685 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms", "" },
1686 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms", "" },
1687 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms", "" },
1688 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms", "" },
1689 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms", "" },
1690 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms", "" },
1691 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms", "" },
1692 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms", "" },
1693 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms", "" },
1694 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms", "" },
1695 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms", "" },
1696 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled", "" },
1697 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power", "" },
1698 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power", "" },
1699 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable", "" },
1700 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power", "" },
1701 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power", "" },
1702 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power", "" },
1703 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power", "" },
1704 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms", "" },
1705 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms", "" },
1706 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms", "" },
1707 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms", "" },
1708 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms", "" },
1709 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms", "" },
1710
1711 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00", "" },
1712 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800", "" },
1713 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00", "" },
1714 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00", "" },
1715
1716 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1717 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1718 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1719 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1720 },
1721 {
1722 // lock
1723 { 0, "Lock1", "", "" },
1724 { 1, "Lock2", "", "" },
1725 { 2, "BootLock1", "", "" },
1726 { 3, "BootLock2", "", "" },
1727 { 4, "BootLoad1", "", "" },
1728 { 5, "BootLoad2", "", "" }
1729 },
1730 {
1731 // lock mask description
1732 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1733 { "Lock=10", "Mode 2: Further programming disabled", "" },
1734 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
1735
1736 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
1737 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
1738 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
1739 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
1740
1741 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
1742 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
1743 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
1744 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
1745 }
1746 },
1747
1748 {
1749 { ATmega640, ATmega644, ATmega1280, ATmega1281, ATmega1284, ATmega2560, ATmega2561 },
1750 {
1751 // fuse
1752 { 0, "CKSEL0", "", "" },
1753 { 1, "CKSEL1", "", "" },
1754 { 2, "CKSEL2", "", "" },
1755 { 3, "CKSEL3", "", "" },
1756 { 4, "SUT0", "", "" },
1757 { 5, "SUT1", "", "" },
1758 { 6, "CKOUT", "Clock output on PORTE7", "" }, // EK: different ports
1759 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
1760 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
1761 { 9, "BOOTSZ0", "", "" },
1762 { 10, "BOOTSZ1", "", "" },
1763 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1764 { 12, "WDTON", "Watch-dog Timer always on", "" },
1765 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1766 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
1767 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
1768 { 16, "BODLEVEL0", "", "" },
1769 { 17, "BODLEVEL1", "", "" },
1770 { 18, "BODLEVEL2", "", "" }
1771 },
1772 {
1773 // fuse mask description
1774 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
1775 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms", "" },
1776 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms", "" },
1777 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms", "" },
1778 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1779 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms", "" },
1780 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms", "" },
1781 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1782 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms", "" },
1783 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1784 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms", "" },
1785 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms", "" },
1786 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1787 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms", "" },
1788 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms", "" },
1789 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1790 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms", "" },
1791 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1792 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms", "" },
1793 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms", "" },
1794 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
1795 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms", "" },
1796 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms", "" },
1797 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
1798 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms", "" },
1799 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
1800 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms", "" },
1801 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms", "" },
1802 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms", "" },
1803 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms", "" },
1804 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms", "" },
1805 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms", "" },
1806 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms", "" },
1807 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms", "" },
1808 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms", "" },
1809 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms", "" },
1810 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms", "" },
1811 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms", "" },
1812 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms", "" },
1813 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms", "" },
1814 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms", "" },
1815 { "CKSEL=0111 SUT=01", "Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled", "" },
1816 { "CKSEL=0111 SUT=10", "Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power", "" },
1817 { "CKSEL=0111 SUT=11", "Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power", "" },
1818 { "CKSEL=0110 SUT=10", "Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable", "" },
1819 { "CKSEL=0110 SUT=11", "Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power", "" },
1820 { "CKSEL=0111 SUT=00", "Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power", "" },
1821 { "CKSEL=0110 SUT=00", "Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power", "" },
1822 { "CKSEL=0110 SUT=01", "Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power", "" },
1823 { "CKSEL=0011 SUT=00", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms", "" },
1824 { "CKSEL=0011 SUT=01", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms", "" },
1825 { "CKSEL=0011 SUT=10", "Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms", "" },
1826 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms", "" },
1827 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms", "" },
1828 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms", "" },
1829
1830 { "BOOTSZ=01", "Boot Flash section size=2048 words Boot start address=$n800", "ATmega640: $7800, ATmega644: $7800, ATmega1280: $F800, ATmega1281: $F800, ATmega1284: $F800, ATmega2560: $1800 ATmega2560: $1800" },
1831 { "BOOTSZ=00", "Boot Flash section size=4096 words Boot start address=$n000", "ATmega640: $7000, ATmega644: $7000, ATmega1280: $F000, ATmega1281: $F000, ATmega1284: $F000, ATmega2560: $1000 ATmega2560: $1000" },
1832 { "BOOTSZ=11", "Boot Flash section size=512 words Boot start address=$nE00", "ATmega640: $7E00, ATmega644: $7E00, ATmega1280: $FE00, ATmega1281: $FE00, ATmega1284: $FE00, ATmega2560: $1E00 ATmega2560: $1E00" },
1833 { "BOOTSZ=10", "Boot Flash section size=1024 words Boot start address=$nC00", "ATmega640: $7C00, ATmega644: $7C00, ATmega1280: $FC00, ATmega1281: $FC00, ATmega1284: $FC00, ATmega2560: $1C00 ATmega2560: $1C00" },
1834
1835 { "BODLEVEL=111", "Brown-out detection disabled", "" },
1836 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
1837 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
1838 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" }
1839 },
1840 {
1841 // lock
1842 { 0, "Lock1", "", "" },
1843 { 1, "Lock2", "", "" },
1844 { 2, "BootLock1", "", "" },
1845 { 3, "BootLock2", "", "" },
1846 { 4, "BootLoad1", "", "" },
1847 { 5, "BootLoad2", "", "" }
1848 },
1849 {
1850 // lock mask description
1851 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1852 { "Lock=10", "Mode 2: Further programming disabled", "" },
1853 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
1854
1855 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
1856 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
1857 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
1858 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
1859
1860 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
1861 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
1862 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
1863 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
31541864 }
31551865 },
31561866
31581868 { ATmega603 }, // ???
31591869 {
31601870 // fuse
3161 { 0, "SUT0", "" },
3162 { 1, "SUT1", "" },
3163 { 3, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3164 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
3165 },
3166 {
3167 // fuse mask description
3168 { "SUT=00", "Start-up time=5 CPU cycles" },
3169 { "SUT=01", "Start-up time=0.5 ms" },
3170 { "SUT=10", "Start-up time=4.0 ms" },
3171 { "SUT=11", "Start-up time=16.0 ms" }
3172 },
3173 {
3174 // lock
3175 { 1, "Lock1", "" },
3176 { 2, "Lock2", "" }
3177 },
3178 {
3179 // lock mask description
3180 { "Lock=11", "Mode 1: No memory lock features enabled" },
3181 { "Lock=10", "Mode 2: Further programming disabled" },
3182 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1871 { 0, "SUT0", "", "" },
1872 { 1, "SUT1", "", "" },
1873 { 3, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1874 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
1875 },
1876 {
1877 // fuse mask description
1878 { "SUT=00", "Start-up time=5 CPU cycles", "" },
1879 { "SUT=01", "Start-up time=0.5 ms", "" },
1880 { "SUT=10", "Start-up time=4.0 ms", "" },
1881 { "SUT=11", "Start-up time=16.0 ms", "" }
1882 },
1883 {
1884 // lock
1885 { 1, "Lock1", "", "" },
1886 { 2, "Lock2", "", "" }
1887 },
1888 {
1889 // lock mask description
1890 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1891 { "Lock=10", "Mode 2: Further programming disabled", "" },
1892 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
31831893 }
31841894 },
31851895
31871897 { ATmega103 },
31881898 {
31891899 // fuse
3190 { 0, "SUT0", "" },
3191 { 1, "SUT1", "" },
3192 { 3, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3193 { 5, "SPIEN", "Serial program downloading (SPI) enabled" }
3194 },
3195 {
3196 // fuse mask description
3197 { "SUT=00", "Start-up time=5 CPU cycles" },
3198 { "SUT=01", "Start-up time=0.5 ms" },
3199 { "SUT=10", "Start-up time=4.0 ms" },
3200 { "SUT=11", "Start-up time=16.0 ms" }
3201 },
3202 {
3203 // lock
3204 { 1, "Lock1", "" },
3205 { 2, "Lock2", "" }
3206 },
3207 {
3208 // lock mask description
3209 { "Lock=11", "Mode 1: No memory lock features enabled" },
3210 { "Lock=10", "Mode 2: Further programming disabled" },
3211 { "Lock=00", "Mode 3: Further programming and verification disabled" }
1900 { 0, "SUT0", "", "" },
1901 { 1, "SUT1", "", "" },
1902 { 3, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1903 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" }
1904 },
1905 {
1906 // fuse mask description
1907 { "SUT=00", "Start-up time=5 CPU cycles", "" },
1908 { "SUT=01", "Start-up time=0.5 ms", "" },
1909 { "SUT=10", "Start-up time=4.0 ms", "" },
1910 { "SUT=11", "Start-up time=16.0 ms", "" }
1911 },
1912 {
1913 // lock
1914 { 1, "Lock1", "", "" },
1915 { 2, "Lock2", "", "" }
1916 },
1917 {
1918 // lock mask description
1919 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
1920 { "Lock=10", "Mode 2: Further programming disabled", "" },
1921 { "Lock=00", "Mode 3: Further programming and verification disabled", "" }
32121922 }
32131923 },
32141924
32161926 { ATmega8 },
32171927 {
32181928 // fuse
3219 { 0, "CKSEL0", "" },
3220 { 1, "CKSEL1", "" },
3221 { 2, "CKSEL2", "" },
3222 { 3, "CKSEL3", "" },
3223 { 4, "SUT0", "" },
3224 { 5, "SUT1", "" },
3225 { 6, "BODEN", "Brown-out detection enabled" },
3226 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3227 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3228 { 9, "BOOTSZ0", "" },
3229 { 10, "BOOTSZ1", "" },
3230 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3231 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses" },
3232 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3233 { 14, "WDTON", "Watch-dog Timer always on" },
3234 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)" }
3235 },
3236 {
3237 // fuse mask description
3238 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3239 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
3240 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
3241 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
3242 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
3243 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
3244 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
3245 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
3246 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
3247 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
3248 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
3249 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
3250 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
3251 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
3252 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
3253 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
3254 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
3255 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
3256 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
3257 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
3258 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
3259 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
3260 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
3261 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
3262 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
3263 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
3264 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
3265 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
3266 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
3267 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
3268 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
3269 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
3270 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
3271 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
3272 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
3273 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
3274 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
3275 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
3276 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
3277 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
3278 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
3279 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
3280 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
3281 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
3282 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
3283 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
3284 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
3285 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
3286 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
3287 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
3288 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
3289 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
3290 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
3291 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
3292 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
3293 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
3294 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
3295 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
3296
3297 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$0C00" },
3298 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$0800" },
3299 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$0F00" },
3300 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$0E00" }
3301 },
3302 {
3303 // lock
3304 { 0, "Lock1", "" },
3305 { 1, "Lock2", "" },
3306 { 2, "BootLock1", "" },
3307 { 3, "BootLock2", "" },
3308 { 4, "BootLoad1", "" },
3309 { 5, "BootLoad2", "" }
3310 },
3311 {
3312 // lock mask description
3313 { "Lock=11", "Mode 1: No memory lock features enabled" },
3314 { "Lock=10", "Mode 2: Further programming disabled" },
3315 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3316
3317 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3318 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3319 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3320 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3321
3322 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3323 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3324 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3325 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
3326 }
3327 },
3328
3329 {
3330 { ATmega8515 },
3331 {
3332 // fuse
3333 { 0, "CKSEL0", "" },
3334 { 1, "CKSEL1", "" },
3335 { 2, "CKSEL2", "" },
3336 { 3, "CKSEL3", "" },
3337 { 4, "SUT0", "" },
3338 { 5, "SUT1", "" },
3339 { 6, "BODEN", "Brown-out detection enabled" },
3340 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3341 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3342 { 9, "BOOTSZ0", "" },
3343 { 10, "BOOTSZ1", "" },
3344 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3345 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
3346 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3347 { 14, "WDTON", "Watch-dog Timer always on" },
3348 { 15, "S8515C", "AT90S4414/8515 compatibility mode" }
3349 },
3350 {
3351 // fuse mask description
3352 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3353 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
3354 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
3355 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
3356 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
3357 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
3358 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
3359 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
3360 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
3361 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
3362 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
3363 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
3364 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
3365 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
3366 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
3367 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
3368 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
3369 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
3370 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
3371 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
3372 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
3373 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
3374 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
3375 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
3376 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
3377 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
3378 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
3379 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
3380 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
3381 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
3382 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
3383 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
3384 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
3385 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
3386 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
3387 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
3388 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
3389 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
3390 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
3391 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
3392 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
3393 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
3394 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
3395 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
3396 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
3397 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
3398 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
3399 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
3400 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
3401 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
3402 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
3403 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
3404 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
3405 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
3406 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
3407 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
3408 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
3409 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
3410
3411 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$0C00" },
3412 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$0800" },
3413 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$0F00" },
3414 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$0E00" }
3415 },
3416 {
3417 // lock
3418 { 0, "Lock1", "" },
3419 { 1, "Lock2", "" },
3420 { 2, "BootLock1", "" },
3421 { 3, "BootLock2", "" },
3422 { 4, "BootLoad1", "" },
3423 { 5, "BootLoad2", "" }
3424 },
3425 {
3426 // lock mask description
3427 { "Lock=11", "Mode 1: No memory lock features enabled" },
3428 { "Lock=10", "Mode 2: Further programming disabled" },
3429 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3430
3431 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3432 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3433 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3434 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3435
3436 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3437 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3438 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3439 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
3440 }
3441 },
3442
3443 {
3444 { ATmega8535 },
3445 {
3446 // fuse
3447 { 0, "CKSEL0", "" },
3448 { 1, "CKSEL1", "" },
3449 { 2, "CKSEL2", "" },
3450 { 3, "CKSEL3", "" },
3451 { 4, "SUT0", "" },
3452 { 5, "SUT1", "" },
3453 { 6, "BODEN", "Brown-out detection enabled" },
3454 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3455 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3456 { 9, "BOOTSZ0", "" },
3457 { 10, "BOOTSZ1", "" },
3458 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3459 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
3460 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3461 { 14, "WDTON", "Watch-dog Timer always on" },
3462 { 15, "S8515C", "AT90S4414/8515 compatibility mode" }
3463 },
3464 {
3465 // fuse mask description
3466 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3467 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
3468 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
3469 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
3470 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
3471 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
3472 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
3473 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
3474 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
3475 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
3476 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
3477 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
3478 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
3479 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
3480 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
3481 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
3482 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
3483 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
3484 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
3485 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
3486 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
3487 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
3488 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
3489 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
3490 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
3491 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
3492 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
3493 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
3494 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
3495 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
3496 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
3497 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
3498 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
3499 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
3500 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
3501 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
3502 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
3503 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
3504 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
3505 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
3506 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
3507 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
3508 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
3509 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
3510 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
3511 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
3512 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
3513 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
3514 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
3515 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
3516 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
3517 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
3518 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
3519 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
3520 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
3521 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
3522 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
3523 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
3524
3525 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$0C00" },
3526 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$0800" },
3527 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$0F00" },
3528 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$0E00" }
3529 },
3530 {
3531 // lock
3532 { 0, "Lock1", "" },
3533 { 1, "Lock2", "" },
3534 { 2, "BootLock1", "" },
3535 { 3, "BootLock2", "" },
3536 { 4, "BootLoad1", "" },
3537 { 5, "BootLoad2", "" }
3538 },
3539 {
3540 // lock mask description
3541 { "Lock=11", "Mode 1: No memory lock features enabled" },
3542 { "Lock=10", "Mode 2: Further programming disabled" },
3543 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3544
3545 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3546 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3547 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3548 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3549
3550 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3551 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3552 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3553 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
3554 }
3555 },
3556
3557 {
3558 { ATmega64 },
3559 {
3560 // fuse
3561 { 0, "CKSEL0", "" },
3562 { 1, "CKSEL1", "" },
3563 { 2, "CKSEL2", "" },
3564 { 3, "CKSEL3", "" },
3565 { 4, "SUT0", "" },
3566 { 5, "SUT1", "" },
3567 { 6, "BODEN", "Brown-out detection enabled" },
3568 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3569 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3570 { 9, "BOOTSZ0", "" },
3571 { 10, "BOOTSZ1", "" },
3572 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3573 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
3574 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3575 { 14, "JTAGEN", "JTAG Interface Enabled" },
3576 { 15, "OCDEN", "On-Chip Debug Enabled" },
3577 { 16, "WDTON", "Watchdog Timer always on" },
3578 { 17, "M103C", "ATmega103 Compatibility Mode" }
3579 },
3580 {
3581 // fuse mask description
3582 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3583 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
3584 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
3585 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
3586 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
3587 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
3588 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
3589 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
3590 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
3591 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
3592 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
3593 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
3594 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
3595 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
3596 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
3597 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
3598 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
3599 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
3600 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
3601 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
3602 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
3603 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
3604 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
3605 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
3606 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
3607 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
3608 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
3609 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
3610 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
3611 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
3612 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
3613 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
3614 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
3615 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
3616 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
3617 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
3618 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
3619 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
3620 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
3621 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
3622 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
3623 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
3624 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
3625 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
3626 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
3627 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
3628 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
3629 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
3630 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
3631 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
3632 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
3633 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
3634 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
3635 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
3636 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
3637 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
3638 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
3639 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
3640
3641 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$7C00" },
3642 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$7800" },
3643 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$7F00" },
3644 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$7E00" }
3645 },
3646 {
3647 // lock
3648 { 0, "Lock1", "" },
3649 { 1, "Lock2", "" },
3650 { 2, "BootLock1", "" },
3651 { 3, "BootLock2", "" },
3652 { 4, "BootLoad1", "" },
3653 { 5, "BootLoad2", "" }
3654 },
3655 {
3656 // lock mask description
3657 { "Lock=11", "Mode 1: No memory lock features enabled" },
3658 { "Lock=10", "Mode 2: Further programming disabled" },
3659 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3660
3661 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3662 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3663 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3664 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3665
3666 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3667 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3668 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3669 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
3670 }
3671 },
3672
3673 {
3674 { ATmega128 },
3675 {
3676 // fuse
3677 { 0, "CKSEL0", "" },
3678 { 1, "CKSEL1", "" },
3679 { 2, "CKSEL2", "" },
3680 { 3, "CKSEL3", "" },
3681 { 4, "SUT0", "" },
3682 { 5, "SUT1", "" },
3683 { 6, "BODEN", "Brown-out detection enabled" },
3684 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3685 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3686 { 9, "BOOTSZ0", "" },
3687 { 10, "BOOTSZ1", "" },
3688 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3689 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
3690 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3691 { 14, "JTAGEN", "JTAG Interface Enabled" },
3692 { 15, "OCDEN", "On-Chip Debug Enabled" },
3693 { 16, "WDTON", "Watchdog Timer always on" },
3694 { 17, "M103C", "ATmega103 Compatibility Mode" }
3695 },
3696 {
3697 // fuse mask description
3698 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3699 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
3700 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
3701 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
3702 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
3703 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
3704 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
3705 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
3706 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
3707 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
3708 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
3709 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
3710 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
3711 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
3712 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
3713 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
3714 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
3715 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
3716 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
3717 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
3718 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
3719 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
3720 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
3721 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
3722 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
3723 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
3724 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
3725 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
3726 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
3727 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
3728 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
3729 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
3730 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
3731 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
3732 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
3733 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
3734 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
3735 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
3736 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
3737 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
3738 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
3739 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
3740 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
3741 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
3742 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
3743 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
3744 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
3745 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
3746 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
3747 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
3748 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
3749 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
3750 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
3751 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
3752 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
3753 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
3754 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
3755 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
3756
3757 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$FC00" },
3758 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$F800" },
3759 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$FF00" },
3760 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$FE00" }
3761 },
3762 {
3763 // lock
3764 { 0, "Lock1", "" },
3765 { 1, "Lock2", "" },
3766 { 2, "BootLock1", "" },
3767 { 3, "BootLock2", "" },
3768 { 4, "BootLoad1", "" },
3769 { 5, "BootLoad2", "" }
3770 },
3771 {
3772 // lock mask description
3773 { "Lock=11", "Mode 1: No memory lock features enabled" },
3774 { "Lock=10", "Mode 2: Further programming disabled" },
3775 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3776
3777 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3778 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3779 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3780 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3781
3782 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3783 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3784 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3785 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
1929 { 0, "CKSEL0", "", "" },
1930 { 1, "CKSEL1", "", "" },
1931 { 2, "CKSEL2", "", "" },
1932 { 3, "CKSEL3", "", "" },
1933 { 4, "SUT0", "", "" },
1934 { 5, "SUT1", "", "" },
1935 { 6, "BODEN", "Brown-out detection enabled", "" },
1936 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
1937 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
1938 { 9, "BOOTSZ0", "", "" },
1939 { 10, "BOOTSZ1", "", "" },
1940 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
1941 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses", "" },
1942 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
1943 { 14, "WDTON", "Watch-dog Timer always on", "" },
1944 { 15, "RSTDISBL", "Reset Disabled (Enable PC6 as i/o pin)", "" }
1945 },
1946 {
1947 // fuse mask description
1948 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
1949 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms", "" },
1950 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms", "" },
1951 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms", "" },
1952 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms", "" },
1953 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms", "" },
1954 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms", "" },
1955 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms", "" },
1956 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms", "" },
1957 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms", "" },
1958 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms", "" },
1959 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms", "" },
1960 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms", "" },
1961 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms", "" },
1962 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms", "" },
1963 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms", "" },
1964 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms", "" },
1965 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms", "" },
1966 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms", "" },
1967 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms", "" },
1968 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms", "" },
1969 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms", "" },
1970 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms", "" },
1971 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms", "" },
1972 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms", "" },
1973 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms", "" },
1974 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms", "" },
1975 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms", "" },
1976 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms", "" },
1977 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms", "" },
1978 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms", "" },
1979 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms", "" },
1980 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms", "" },
1981 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms", "" },
1982 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms", "" },
1983 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms", "" },
1984 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms", "" },
1985 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms", "" },
1986 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms", "" },
1987 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms", "" },
1988 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms", "" },
1989 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms", "" },
1990 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms", "" },
1991 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms", "" },
1992 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms", "" },
1993 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms", "" },
1994 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms", "" },
1995 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms", "" },
1996 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms", "" },
1997 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms", "" },
1998 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms", "" },
1999 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms", "" },
2000 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms", "" },
2001 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms", "" },
2002 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms", "" },
2003 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms", "" },
2004 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms", "" },
2005 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms", "" },
2006
2007 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$0C00", "" },
2008 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$0800", "" },
2009 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$0F00", "" },
2010 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$0E00", "" }
2011 },
2012 {
2013 // lock
2014 { 0, "Lock1", "", "" },
2015 { 1, "Lock2", "", "" },
2016 { 2, "BootLock1", "", "" },
2017 { 3, "BootLock2", "", "" },
2018 { 4, "BootLoad1", "", "" },
2019 { 5, "BootLoad2", "", "" }
2020 },
2021 {
2022 // lock mask description
2023 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2024 { "Lock=10", "Mode 2: Further programming disabled", "" },
2025 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2026
2027 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2028 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2029 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2030 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2031
2032 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2033 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2034 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2035 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
2036 }
2037 },
2038
2039 {
2040 { ATmega8515, ATmega8535 },
2041 {
2042 // fuse
2043 { 0, "CKSEL0", "", "" },
2044 { 1, "CKSEL1", "", "" },
2045 { 2, "CKSEL2", "", "" },
2046 { 3, "CKSEL3", "", "" },
2047 { 4, "SUT0", "", "" },
2048 { 5, "SUT1", "", "" },
2049 { 6, "BODEN", "Brown-out detection enabled", "" },
2050 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
2051 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2052 { 9, "BOOTSZ0", "", "" },
2053 { 10, "BOOTSZ1", "", "" },
2054 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
2055 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)", "" },
2056 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2057 { 14, "WDTON", "Watch-dog Timer always on", "" },
2058 { 15, "S8515C", "AT90S4414/8515 compatibility mode", "" }
2059 },
2060 {
2061 // fuse mask description
2062 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
2063 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms", "" },
2064 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms", "" },
2065 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms", "" },
2066 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms", "" },
2067 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms", "" },
2068 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms", "" },
2069 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms", "" },
2070 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms", "" },
2071 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms", "" },
2072 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms", "" },
2073 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms", "" },
2074 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms", "" },
2075 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms", "" },
2076 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms", "" },
2077 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms", "" },
2078 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms", "" },
2079 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms", "" },
2080 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms", "" },
2081 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms", "" },
2082 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms", "" },
2083 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms", "" },
2084 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms", "" },
2085 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms", "" },
2086 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms", "" },
2087 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms", "" },
2088 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms", "" },
2089 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms", "" },
2090 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms", "" },
2091 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms", "" },
2092 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms", "" },
2093 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms", "" },
2094 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms", "" },
2095 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms", "" },
2096 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2097 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2098 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2099 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2100 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2101 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2102 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2103 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2104 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2105 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2106 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2107 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2108 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms", "" },
2109 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms", "" },
2110 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms", "" },
2111 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms", "" },
2112 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms", "" },
2113 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms", "" },
2114 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms", "" },
2115 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms", "" },
2116 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms", "" },
2117 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms", "" },
2118 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms", "" },
2119 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms", "" },
2120
2121 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$0C00", "" },
2122 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$0800", "" },
2123 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$0F00", "" },
2124 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$0E00", "" }
2125 },
2126 {
2127 // lock
2128 { 0, "Lock1", "", "" },
2129 { 1, "Lock2", "", "" },
2130 { 2, "BootLock1", "", "" },
2131 { 3, "BootLock2", "", "" },
2132 { 4, "BootLoad1", "", "" },
2133 { 5, "BootLoad2", "", "" }
2134 },
2135 {
2136 // lock mask description
2137 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2138 { "Lock=10", "Mode 2: Further programming disabled", "" },
2139 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2140
2141 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2142 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2143 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2144 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2145
2146 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2147 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2148 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2149 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
2150 }
2151 },
2152
2153 {
2154 { ATmega64, ATmega128 },
2155 {
2156 // fuse
2157 { 0, "CKSEL0", "", "" },
2158 { 1, "CKSEL1", "", "" },
2159 { 2, "CKSEL2", "", "" },
2160 { 3, "CKSEL3", "", "" },
2161 { 4, "SUT0", "", "" },
2162 { 5, "SUT1", "", "" },
2163 { 6, "BODEN", "Brown-out detection enabled", "" },
2164 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
2165 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2166 { 9, "BOOTSZ0", "", "" },
2167 { 10, "BOOTSZ1", "", "" },
2168 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
2169 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)", "" },
2170 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2171 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
2172 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
2173 { 16, "WDTON", "Watchdog Timer always on", "" },
2174 { 17, "M103C", "ATmega103 Compatibility Mode", "" }
2175 },
2176 {
2177 // fuse mask description
2178 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
2179 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms", "" },
2180 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms", "" },
2181 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms", "" },
2182 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms", "" },
2183 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms", "" },
2184 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms", "" },
2185 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms", "" },
2186 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms", "" },
2187 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms", "" },
2188 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms", "" },
2189 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms", "" },
2190 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms", "" },
2191 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms", "" },
2192 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms", "" },
2193 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms", "" },
2194 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms", "" },
2195 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms", "" },
2196 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms", "" },
2197 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms", "" },
2198 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms", "" },
2199 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms", "" },
2200 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms", "" },
2201 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms", "" },
2202 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms", "" },
2203 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms", "" },
2204 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms", "" },
2205 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms", "" },
2206 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms", "" },
2207 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms", "" },
2208 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms", "" },
2209 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms", "" },
2210 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms", "" },
2211 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms", "" },
2212 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2213 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2214 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2215 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2216 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2217 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2218 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2219 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2220 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2221 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2222 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2223 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2224 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms", "" },
2225 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms", "" },
2226 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms", "" },
2227 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms", "" },
2228 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms", "" },
2229 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms", "" },
2230 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms", "" },
2231 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms", "" },
2232 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms", "" },
2233 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms", "" },
2234 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms", "" },
2235 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms", "" },
2236
2237 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$xC00", "ATmega64: $7C00, ATmega128: $FC00" },
2238 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$x800", "ATmega64: $7800, ATmega128: $F800" },
2239 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$xF00", "ATmega64: $7F00, ATmega128: $FF00" },
2240 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$xE00", "ATmega64: $7E00, ATmega128: $FE00" }
2241 },
2242 {
2243 // lock
2244 { 0, "Lock1", "", "" },
2245 { 1, "Lock2", "", "" },
2246 { 2, "BootLock1", "", "" },
2247 { 3, "BootLock2", "", "" },
2248 { 4, "BootLoad1", "", "" },
2249 { 5, "BootLoad2", "", "" }
2250 },
2251 {
2252 // lock mask description
2253 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2254 { "Lock=10", "Mode 2: Further programming disabled", "" },
2255 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2256
2257 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2258 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2259 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2260 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2261
2262 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2263 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2264 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2265 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
37862266 }
37872267 },
37882268
37902270 { ATmega16 },
37912271 {
37922272 // fuse
3793 { 0, "CKSEL0", "" },
3794 { 1, "CKSEL1", "" },
3795 { 2, "CKSEL2", "" },
3796 { 3, "CKSEL3", "" },
3797 { 4, "SUT0", "" },
3798 { 5, "SUT1", "" },
3799 { 6, "BODEN", "Brown-out detection enabled" },
3800 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3801 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3802 { 9, "BOOTSZ0", "" },
3803 { 10, "BOOTSZ1", "" },
3804 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
3805 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
3806 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
3807 { 14, "JTAGEN", "JTAG Interface Enabled" },
3808 { 15, "OCDEN", "On-Chip Debug Enabled" }
3809 },
3810 {
3811 // fuse mask description
3812 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
3813 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
3814 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
3815 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
3816 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
3817 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
3818 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
3819 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
3820 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
3821 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
3822 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
3823 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
3824 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
3825 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
3826 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
3827 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
3828 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
3829 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
3830 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
3831 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
3832 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
3833 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
3834 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
3835 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
3836 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
3837 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
3838 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
3839 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
3840 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
3841 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
3842 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
3843 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
3844 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
3845 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
3846 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
3847 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
3848 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
3849 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
3850 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
3851 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
3852 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
3853 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
3854 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
3855 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
3856 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
3857 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
3858 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
3859 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
3860 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
3861 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
3862 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
3863 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
3864 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
3865 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
3866 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
3867 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
3868 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
3869 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
3870
3871 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$1C00" },
3872 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$1800" },
3873 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$1F00" },
3874 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$1E00" }
3875 },
3876 {
3877 // lock
3878 { 0, "Lock1", "" },
3879 { 1, "Lock2", "" },
3880 { 2, "BootLock1", "" },
3881 { 3, "BootLock2", "" },
3882 { 4, "BootLoad1", "" },
3883 { 5, "BootLoad2", "" }
3884 },
3885 {
3886 // lock mask description
3887 { "Lock=11", "Mode 1: No memory lock features enabled" },
3888 { "Lock=10", "Mode 2: Further programming disabled" },
3889 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3890
3891 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3892 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3893 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3894 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3895
3896 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3897 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3898 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3899 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2273 { 0, "CKSEL0", "", "" },
2274 { 1, "CKSEL1", "", "" },
2275 { 2, "CKSEL2", "", "" },
2276 { 3, "CKSEL3", "", "" },
2277 { 4, "SUT0", "", "" },
2278 { 5, "SUT1", "", "" },
2279 { 6, "BODEN", "Brown-out detection enabled", "" },
2280 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
2281 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2282 { 9, "BOOTSZ0", "", "" },
2283 { 10, "BOOTSZ1", "", "" },
2284 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
2285 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)", "" },
2286 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2287 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
2288 { 15, "OCDEN", "On-Chip Debug Enabled", "" }
2289 },
2290 {
2291 // fuse mask description
2292 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
2293 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms", "" },
2294 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms", "" },
2295 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms", "" },
2296 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms", "" },
2297 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms", "" },
2298 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms", "" },
2299 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms", "" },
2300 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms", "" },
2301 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms", "" },
2302 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms", "" },
2303 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms", "" },
2304 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms", "" },
2305 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms", "" },
2306 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms", "" },
2307 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms", "" },
2308 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms", "" },
2309 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms", "" },
2310 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms", "" },
2311 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms", "" },
2312 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms", "" },
2313 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms", "" },
2314 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms", "" },
2315 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms", "" },
2316 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms", "" },
2317 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms", "" },
2318 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms", "" },
2319 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms", "" },
2320 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms", "" },
2321 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms", "" },
2322 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms", "" },
2323 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms", "" },
2324 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms", "" },
2325 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms", "" },
2326 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2327 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2328 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2329 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2330 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2331 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2332 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2333 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2334 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2335 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2336 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2337 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2338 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms", "" },
2339 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms", "" },
2340 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms", "" },
2341 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms", "" },
2342 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms", "" },
2343 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms", "" },
2344 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms", "" },
2345 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms", "" },
2346 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms", "" },
2347 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms", "" },
2348 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms", "" },
2349 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms", "" },
2350
2351 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$1C00", "" },
2352 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$1800", "" },
2353 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$1F00", "" },
2354 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$1E00", "" }
2355 },
2356 {
2357 // lock
2358 { 0, "Lock1", "", "" },
2359 { 1, "Lock2", "", "" },
2360 { 2, "BootLock1", "", "" },
2361 { 3, "BootLock2", "", "" },
2362 { 4, "BootLoad1", "", "" },
2363 { 5, "BootLoad2", "", "" }
2364 },
2365 {
2366 // lock mask description
2367 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2368 { "Lock=10", "Mode 2: Further programming disabled", "" },
2369 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2370
2371 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2372 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2373 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2374 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2375
2376 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2377 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2378 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2379 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
39002380 }
39012381 },
39022382
39042384 { ATmega161 },
39052385 {
39062386 // fuse
3907 { 0, "CKSEL0", "" },
3908 { 1, "CKSEL1", "" },
3909 { 2, "CKSEL2", "" },
3910 { 3, "SUT", "Start-up time" },
3911 { 4, "SPIEN", "Serial program downloading (SPI) enabled" },
3912 { 5, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" }
3913
3914 },
3915 {
3916 // fuse mask description
3917 { "CKSEL=000", "External Clock; fast rising power" },
3918 { "CKSEL=001", "External Clock; BOD Enabled or power-on reset" },
3919 { "CKSEL=010", "Crystal Oscillator; slowly rising power" },
3920 { "CKSEL=011", "Crystal Oscillator; fast rising power" },
3921 { "CKSEL=100", "Crystal Oscillator; BOD Enabled or power-on reset" },
3922 { "CKSEL=101", "Ceramic Resonator / External Clock; Slowly rising power" },
3923 { "CKSEL=110", "Ceramic Resonator; fast rising power" },
3924 { "CKSEL=111", "Ceramic Resonator; BOD Enabled or power-on reset" }
3925
3926 },
3927 {
3928 // lock
3929 { 0, "Lock1", "" },
3930 { 1, "Lock2", "" },
3931 { 2, "BootLock1", "" },
3932 { 3, "BootLock2", "" },
3933 { 4, "BootLoad1", "" },
3934 { 5, "BootLoad2", "" }
3935 },
3936 {
3937 // lock mask description
3938 { "Lock=11", "Mode 1: No memory lock features enabled" },
3939 { "Lock=10", "Mode 2: Further programming disabled" },
3940 { "Lock=00", "Mode 3: Further programming and verification disabled" },
3941
3942 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
3943 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
3944 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
3945 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
3946
3947 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
3948 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
3949 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
3950 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2387 { 0, "CKSEL0", "", "" },
2388 { 1, "CKSEL1", "", "" },
2389 { 2, "CKSEL2", "", "" },
2390 { 3, "SUT", "Start-up time", "" },
2391 { 4, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2392 { 5, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" }
2393
2394 },
2395 {
2396 // fuse mask description
2397 { "CKSEL=000", "External Clock; fast rising power", "" },
2398 { "CKSEL=001", "External Clock; BOD Enabled or power-on reset", "" },
2399 { "CKSEL=010", "Crystal Oscillator; slowly rising power", "" },
2400 { "CKSEL=011", "Crystal Oscillator; fast rising power", "" },
2401 { "CKSEL=100", "Crystal Oscillator; BOD Enabled or power-on reset", "" },
2402 { "CKSEL=101", "Ceramic Resonator / External Clock; Slowly rising power", "" },
2403 { "CKSEL=110", "Ceramic Resonator; fast rising power", "" },
2404 { "CKSEL=111", "Ceramic Resonator; BOD Enabled or power-on reset", "" }
2405
2406 },
2407 {
2408 // lock
2409 { 0, "Lock1", "", "" },
2410 { 1, "Lock2", "", "" },
2411 { 2, "BootLock1", "", "" },
2412 { 3, "BootLock2", "", "" },
2413 { 4, "BootLoad1", "", "" },
2414 { 5, "BootLoad2", "", "" }
2415 },
2416 {
2417 // lock mask description
2418 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2419 { "Lock=10", "Mode 2: Further programming disabled", "" },
2420 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2421
2422 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2423 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2424 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2425 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2426
2427 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2428 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2429 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2430 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
39512431 }
39522432 },
39532433
39552435 { ATmega163 },
39562436 {
39572437 // fuse
3958 { 0, "CKSEL0", "" },
3959 { 1, "CKSEL1", "" },
3960 { 2, "CKSEL2", "" },
3961 { 3, "CKSEL3", "" },
3962 { 5, "SPIEN", "Serial program downloading (SPI) enabled" },
3963 { 6, "BODEN", "Brown-out detection enabled" },
3964 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
3965 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
3966 { 9, "BOOTSZ0", "" },
3967 { 10, "BOOTSZ1", "" }
3968 },
3969 {
3970 // fuse mask description
3971 { "CKSEL=0000", "External Clock fast rising power" },
3972 { "CKSEL=0001", "External Clock BOD enabled" },
3973 { "CKSEL=0010", "Internal RC Ocsillator slowly rising power" },
3974 { "CKSEL=0011", "Internal RC Ocsillator fast rising power" },
3975 { "CKSEL=0100", "Internal RC Oscillator BOD enabled" },
3976 { "CKSEL=0101", "External RC Oscillator slowly rising power" },
3977 { "CKSEL=0110", "External RC Oscillator fast rising power" },
3978 { "CKSEL=0111", "External RC Oscillator BOD enabled" },
3979 { "CKSEL=1000", "External Low-Frequency Crystal" },
3980 { "CKSEL=1001", "External Low-Frequency Crystal" },
3981 { "CKSEL=1010", "Crystal Oscillator slowly rising power" },
3982 { "CKSEL=1011", "Crystal Oscillator fast rising power" },
3983 { "CKSEL=1100", "Crystal Oscillator BOD enabled" },
3984 { "CKSEL=1101", "Ceramic Resonator/External Clock slowly rising power" },
3985 { "CKSEL=1110", "Ceramic Resonator fast rising power" },
3986 { "CKSEL=1111", "Ceramic Resonator BOD enabled" },
3987
3988 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$1C00" },
3989 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$1800" },
3990 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$1F00" },
3991 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$1E00" }
3992 },
3993 {
3994 // lock
3995 { 0, "Lock1", "" },
3996 { 1, "Lock2", "" },
3997 { 2, "BootLock1", "" },
3998 { 3, "BootLock2", "" },
3999 { 4, "BootLoad1", "" },
4000 { 5, "BootLoad2", "" }
4001 },
4002 {
4003 // lock mask description
4004 { "Lock=11", "Mode 1: No memory lock features enabled" },
4005 { "Lock=10", "Mode 2: Further programming disabled" },
4006 { "Lock=00", "Mode 3: Further programming and verification disabled" },
4007
4008 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
4009 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
4010 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
4011 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
4012
4013 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
4014 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
4015 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
4016 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2438 { 0, "CKSEL0", "", "" },
2439 { 1, "CKSEL1", "", "" },
2440 { 2, "CKSEL2", "", "" },
2441 { 3, "CKSEL3", "", "" },
2442 { 5, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2443 { 6, "BODEN", "Brown-out detection enabled", "" },
2444 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
2445 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2446 { 9, "BOOTSZ0", "", "" },
2447 { 10, "BOOTSZ1", "", "" }
2448 },
2449 {
2450 // fuse mask description
2451 { "CKSEL=0000", "External Clock fast rising power", "" },
2452 { "CKSEL=0001", "External Clock BOD enabled", "" },
2453 { "CKSEL=0010", "Internal RC Ocsillator slowly rising power", "" },
2454 { "CKSEL=0011", "Internal RC Ocsillator fast rising power", "" },
2455 { "CKSEL=0100", "Internal RC Oscillator BOD enabled", "" },
2456 { "CKSEL=0101", "External RC Oscillator slowly rising power", "" },
2457 { "CKSEL=0110", "External RC Oscillator fast rising power", "" },
2458 { "CKSEL=0111", "External RC Oscillator BOD enabled", "" },
2459 { "CKSEL=1000", "External Low-Frequency Crystal", "" },
2460 { "CKSEL=1001", "External Low-Frequency Crystal", "" },
2461 { "CKSEL=1010", "Crystal Oscillator slowly rising power", "" },
2462 { "CKSEL=1011", "Crystal Oscillator fast rising power", "" },
2463 { "CKSEL=1100", "Crystal Oscillator BOD enabled", "" },
2464 { "CKSEL=1101", "Ceramic Resonator/External Clock slowly rising power", "" },
2465 { "CKSEL=1110", "Ceramic Resonator fast rising power", "" },
2466 { "CKSEL=1111", "Ceramic Resonator BOD enabled", "" },
2467
2468 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$1C00", "" },
2469 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$1800", "" },
2470 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$1F00", "" },
2471 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$1E00", "" }
2472 },
2473 {
2474 // lock
2475 { 0, "Lock1", "", "" },
2476 { 1, "Lock2", "", "" },
2477 { 2, "BootLock1", "", "" },
2478 { 3, "BootLock2", "", "" },
2479 { 4, "BootLoad1", "", "" },
2480 { 5, "BootLoad2", "", "" }
2481 },
2482 {
2483 // lock mask description
2484 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2485 { "Lock=10", "Mode 2: Further programming disabled", "" },
2486 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2487
2488 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2489 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2490 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2491 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2492
2493 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2494 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2495 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2496 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
40172497 }
40182498 },
40192499
40212501 { ATmega162 },
40222502 {
40232503 // fuse
4024 { 0, "CKSEL0", "" },
4025 { 1, "CKSEL1", "" },
4026 { 2, "CKSEL2", "" },
4027 { 3, "CKSEL3", "" },
4028 { 4, "SUT0", "" },
4029 { 5, "SUT1", "" },
4030 { 6, "CKOUT", "Clock output on PORTB0" },
4031 { 7, "CKDIV8", "Divide clock by 8 internally" },
4032 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
4033 { 9, "BOOTSZ0", "" },
4034 { 10, "BOOTSZ1", "" },
4035 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
4036 { 12, "WDTON", "Watchdog timer always on" },
4037 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
4038 { 14, "JTAGEN", "JTAG Interface Enabled" },
4039 { 15, "OCDEN", "On-Chip Debug Enabled" },
4040 { 17, "BODLEVEL0", "" },
4041 { 18, "BODLEVEL1", "" },
4042 { 19, "BODLEVEL1", "" },
4043 { 20, "M161C", "ATmega161 compatibility mode" }
4044 },
4045 {
4046 // fuse mask description
4047 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
4048 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
4049 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
4050 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
4051 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
4052 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
4053 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
4054 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
4055 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
4056 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
4057 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
4058 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
4059 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
4060 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
4061 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
4062 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
4063 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
4064 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
4065 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
4066 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
4067 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
4068 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
4069 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
4070 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
4071 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
4072 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
4073 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
4074 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
4075 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
4076 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
4077 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
4078 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
4079 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
4080 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
4081 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
4082 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
4083 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; Int. Cap." },
4084 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
4085 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; Int. Cap." },
4086 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
4087 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; Int. Cap." },
4088 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
4089 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; Int. Cap." },
4090 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
4091 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; Int. Cap." },
4092 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
4093 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; Int. Cap." },
4094 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
4095 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
4096 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
4097
4098 { "BODLEVEL=111", "Brown-out detection disabled" },
4099 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
4100 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
4101 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" },
4102
4103 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$1C00" },
4104 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$1800" },
4105 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$1F00" },
4106 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$1E00" }
4107 },
4108 {
4109 // lock
4110 { 0, "Lock1", "" },
4111 { 1, "Lock2", "" },
4112 { 2, "BootLock1", "" },
4113 { 3, "BootLock2", "" },
4114 { 4, "BootLoad1", "" },
4115 { 5, "BootLoad2", "" }
4116 },
4117 {
4118 // lock mask description
4119 { "Lock=11", "Mode 1: No memory lock features enabled" },
4120 { "Lock=10", "Mode 2: Further programming disabled" },
4121 { "Lock=00", "Mode 3: Further programming and verification disabled" },
4122
4123 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
4124 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
4125 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
4126 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
4127
4128 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
4129 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
4130 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
4131 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2504 { 0, "CKSEL0", "", "" },
2505 { 1, "CKSEL1", "", "" },
2506 { 2, "CKSEL2", "", "" },
2507 { 3, "CKSEL3", "", "" },
2508 { 4, "SUT0", "", "" },
2509 { 5, "SUT1", "", "" },
2510 { 6, "CKOUT", "Clock output on PORTB0", "" },
2511 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
2512 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2513 { 9, "BOOTSZ0", "", "" },
2514 { 10, "BOOTSZ1", "", "" },
2515 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
2516 { 12, "WDTON", "Watchdog timer always on", "" },
2517 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2518 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
2519 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
2520 { 17, "BODLEVEL0", "", "" },
2521 { 18, "BODLEVEL1", "", "" },
2522 { 19, "BODLEVEL2", "", "" },
2523 { 20, "M161C", "ATmega161 compatibility mode", "" }
2524 },
2525 {
2526 // fuse mask description
2527 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
2528 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms", "" },
2529 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms", "" },
2530 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms", "" },
2531 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms", "" },
2532 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms", "" },
2533 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms", "" },
2534 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms", "" },
2535 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms", "" },
2536 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms", "" },
2537 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms", "" },
2538 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms", "" },
2539 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
2540 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms", "" },
2541 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms", "" },
2542 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
2543 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms", "" },
2544 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
2545 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms", "" },
2546 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms", "" },
2547 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
2548 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms", "" },
2549 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms", "" },
2550 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
2551 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms", "" },
2552 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
2553 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms", "" },
2554 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms", "" },
2555 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms", "" },
2556 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms", "" },
2557 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms", "" },
2558 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms", "" },
2559 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms", "" },
2560 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms", "" },
2561 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms", "" },
2562 { "CKSEL=0100 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms", "" },
2563 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; Int. Cap.", "" },
2564 { "CKSEL=0100 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms", "" },
2565 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; Int. Cap.", "" },
2566 { "CKSEL=0100 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms", "" },
2567 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; Int. Cap.", "" },
2568 { "CKSEL=0101 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms", "" },
2569 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; Int. Cap.", "" },
2570 { "CKSEL=0101 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms", "" },
2571 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; Int. Cap.", "" },
2572 { "CKSEL=0101 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms", "" },
2573 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; Int. Cap.", "" },
2574 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms", "" },
2575 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms", "" },
2576 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms", "" },
2577
2578 { "BODLEVEL=111", "Brown-out detection disabled", "" },
2579 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
2580 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
2581 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" },
2582
2583 { "BOOTSZ=01", "Boot Flash section size=512 words Boot start address=$1E00", "" },
2584 { "BOOTSZ=00", "Boot Flash section size=1024 words Boot start address=$1C00", "" },
2585 { "BOOTSZ=11", "Boot Flash section size=128 words Boot start address=$1F80", "" },
2586 { "BOOTSZ=10", "Boot Flash section size=256 words Boot start address=$1F00", "" }
2587 },
2588 {
2589 // lock
2590 { 0, "Lock1", "", "" },
2591 { 1, "Lock2", "", "" },
2592 { 2, "BootLock1", "", "" },
2593 { 3, "BootLock2", "", "" },
2594 { 4, "BootLoad1", "", "" },
2595 { 5, "BootLoad2", "", "" }
2596 },
2597 {
2598 // lock mask description
2599 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2600 { "Lock=10", "Mode 2: Further programming disabled", "" },
2601 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2602
2603 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2604 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2605 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2606 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2607
2608 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2609 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2610 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2611 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
41322612 }
41332613 },
41342614
41362616 { ATmega169 },
41372617 {
41382618 // fuse
4139 { 0, "CKSEL0", "" },
4140 { 1, "CKSEL1", "" },
4141 { 2, "CKSEL2", "" },
4142 { 3, "CKSEL3", "" },
4143 { 4, "SUT0", "" },
4144 { 5, "SUT1", "" },
4145 { 6, "CKOUT", "Clock output on PORTE7" },
4146 { 7, "CKDIV8", "Divide clock by 8 internally" },
4147 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
4148 { 9, "BOOTSZ0", "" },
4149 { 10, "BOOTSZ1", "" },
4150 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
4151 { 12, "WDTON", "Watchdog timer always on" },
4152 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
4153 { 14, "JTAGEN", "JTAG Interface Enabled" },
4154 { 15, "OCDEN", "On-Chip Debug Enabled" },
4155 { 16, "RSTDISBL", "Reset Disabled (Enable PG5 as i/o pin)" },
4156 { 17, "BODLEVEL0", "" },
4157 { 18, "BODLEVEL1", "" },
4158 { 19, "BODLEVEL2", "" }
4159 },
4160 {
4161 // fuse mask description
4162 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
4163 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms" },
4164 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms" },
4165 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms" },
4166 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms" },
4167 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms" },
4168 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms" },
4169 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms" },
4170 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms" },
4171 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms" },
4172 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms" },
4173 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms" },
4174 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms" },
4175 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms" },
4176 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms" },
4177 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms" },
4178 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms" },
4179 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms" },
4180 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms" },
4181 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms" },
4182 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms" },
4183 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms" },
4184 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms" },
4185 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms" },
4186 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms" },
4187 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms" },
4188 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms" },
4189 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms" },
4190 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms" },
4191 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms" },
4192 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms" },
4193 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms" },
4194 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms" },
4195 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms" },
4196 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms" },
4197 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms" },
4198 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms" },
4199 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms" },
4200 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms" },
4201 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms" },
4202 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms" },
4203 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms" },
4204 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms" },
4205 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms" },
4206
4207 { "BODLEVEL=111", "Brown-out detection disabled" },
4208 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V" },
4209 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V" },
4210 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V" },
4211
4212 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$1C00" },
4213 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$1800" },
4214 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$1F00" },
4215 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$1E00" }
4216 },
4217 {
4218 // lock
4219 { 0, "Lock1", "" },
4220 { 1, "Lock2", "" },
4221 { 2, "BootLock1", "" },
4222 { 3, "BootLock2", "" },
4223 { 4, "BootLoad1", "" },
4224 { 5, "BootLoad2", "" }
4225 },
4226 {
4227 // lock mask description
4228 { "Lock=11", "Mode 1: No memory lock features enabled" },
4229 { "Lock=10", "Mode 2: Further programming disabled" },
4230 { "Lock=00", "Mode 3: Further programming and verification disabled" },
4231
4232 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
4233 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
4234 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
4235 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
4236
4237 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
4238 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
4239 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
4240 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2619 { 0, "CKSEL0", "", "" },
2620 { 1, "CKSEL1", "", "" },
2621 { 2, "CKSEL2", "", "" },
2622 { 3, "CKSEL3", "", "" },
2623 { 4, "SUT0", "", "" },
2624 { 5, "SUT1", "", "" },
2625 { 6, "CKOUT", "Clock output on PORTE7", "" },
2626 { 7, "CKDIV8", "Divide clock by 8 internally", "" },
2627 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2628 { 9, "BOOTSZ0", "", "" },
2629 { 10, "BOOTSZ1", "", "" },
2630 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
2631 { 12, "WDTON", "Watchdog timer always on", "" },
2632 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2633 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
2634 { 15, "OCDEN", "On-Chip Debug Enabled", "" },
2635 { 16, "RSTDISBL", "Reset Disabled (Enable PG5 as i/o pin)", "" },
2636 { 17, "BODLEVEL0", "", "" },
2637 { 18, "BODLEVEL1", "", "" },
2638 { 19, "BODLEVEL2", "", "" }
2639 },
2640 {
2641 // fuse mask description
2642 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
2643 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4.1 ms", "" },
2644 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 65 ms", "" },
2645 { "CKSEL=1001 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms", "" },
2646 { "CKSEL=1001 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms", "" },
2647 { "CKSEL=1001 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms", "" },
2648 { "CKSEL=1000 SUT=10", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms", "" },
2649 { "CKSEL=1000 SUT=11", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms", "" },
2650 { "CKSEL=1001 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms", "" },
2651 { "CKSEL=1000 SUT=00", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms", "" },
2652 { "CKSEL=1000 SUT=01", "Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms", "" },
2653 { "CKSEL=1011 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms", "" },
2654 { "CKSEL=1011 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
2655 { "CKSEL=1011 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms", "" },
2656 { "CKSEL=1010 SUT=10", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms", "" },
2657 { "CKSEL=1010 SUT=11", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
2658 { "CKSEL=1011 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms", "" },
2659 { "CKSEL=1010 SUT=00", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
2660 { "CKSEL=1010 SUT=01", "Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms", "" },
2661 { "CKSEL=1101 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms", "" },
2662 { "CKSEL=1101 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms", "" },
2663 { "CKSEL=1101 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms", "" },
2664 { "CKSEL=1100 SUT=10", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms", "" },
2665 { "CKSEL=1100 SUT=11", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms", "" },
2666 { "CKSEL=1101 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms", "" },
2667 { "CKSEL=1100 SUT=00", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms", "" },
2668 { "CKSEL=1100 SUT=01", "Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms", "" },
2669 { "CKSEL=1111 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms", "" },
2670 { "CKSEL=1111 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms", "" },
2671 { "CKSEL=1111 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms", "" },
2672 { "CKSEL=1110 SUT=10", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms", "" },
2673 { "CKSEL=1110 SUT=11", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms", "" },
2674 { "CKSEL=1111 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms", "" },
2675 { "CKSEL=1110 SUT=00", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms", "" },
2676 { "CKSEL=1110 SUT=01", "Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms", "" },
2677 { "CKSEL=0110 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms", "" },
2678 { "CKSEL=0110 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms", "" },
2679 { "CKSEL=0110 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms", "" },
2680 { "CKSEL=0111 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms", "" },
2681 { "CKSEL=0111 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms", "" },
2682 { "CKSEL=0111 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms", "" },
2683 { "CKSEL=0010 SUT=00", "Int. RC Osc.; Start-up time: 6 CK + 0 ms", "" },
2684 { "CKSEL=0010 SUT=01", "Int. RC Osc.; Start-up time: 6 CK + 4.1 ms", "" },
2685 { "CKSEL=0010 SUT=10", "Int. RC Osc.; Start-up time: 6 CK + 65 ms", "" },
2686
2687 { "BODLEVEL=111", "Brown-out detection disabled", "" },
2688 { "BODLEVEL=110", "Brown-out detection level at VCC=1.8 V", "" },
2689 { "BODLEVEL=101", "Brown-out detection level at VCC=2.7 V", "" },
2690 { "BODLEVEL=100", "Brown-out detection level at VCC=4.3 V", "" },
2691
2692 { "BOOTSZ=01", "Boot Flash section size=512 words Boot start address=$1E00", "" },
2693 { "BOOTSZ=00", "Boot Flash section size=1024 words Boot start address=$1C00", "" },
2694 { "BOOTSZ=11", "Boot Flash section size=128 words Boot start address=$1F80", "" },
2695 { "BOOTSZ=10", "Boot Flash section size=256 words Boot start address=$1F00", "" }
2696 },
2697 {
2698 // lock
2699 { 0, "Lock1", "", "" },
2700 { 1, "Lock2", "", "" },
2701 { 2, "BootLock1", "", "" },
2702 { 3, "BootLock2", "", "" },
2703 { 4, "BootLoad1", "", "" },
2704 { 5, "BootLoad2", "", "" }
2705 },
2706 {
2707 // lock mask description
2708 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2709 { "Lock=10", "Mode 2: Further programming disabled", "" },
2710 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2711
2712 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2713 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2714 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2715 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2716
2717 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2718 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2719 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2720 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
42412721 }
42422722 },
42432723
42452725 { ATmega323 },
42462726 {
42472727 // fuse
4248 { 0, "CKSEL0", "" },
4249 { 1, "CKSEL1", "" },
4250 { 2, "CKSEL2", "" },
4251 { 3, "CKSEL3", "" },
4252 { 6, "BODEN", "Brown-out detection enabled" },
4253 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
4254 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
4255 { 9, "BOOTSZ0", "" },
4256 { 10, "BOOTSZ1", "" },
4257 { 11, "EESAVE", "Preserve EEPROM memory during through Chip Erase Cycle" },
4258 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
4259 { 14, "JTAGEN", "JTAG Enabled" },
4260 { 15, "OCDEN", "On-Chip Debug Enabled" }
4261 },
4262 {
4263 // fuse mask description
4264 { "CKSEL=0000", "External Clock fast rising power" },
4265 { "CKSEL=0001", "External Clock BOD enabled" },
4266 { "CKSEL=0010", "Internal RC Ocsillator slowly rising power" },
4267 { "CKSEL=0011", "Internal RC Ocsillator fast rising power" },
4268 { "CKSEL=0100", "Internal RC Oscillator BOD enabled" },
4269 { "CKSEL=0101", "External RC Oscillator slowly rising power" },
4270 { "CKSEL=0110", "External RC Oscillator fast rising power" },
4271 { "CKSEL=0111", "External RC Oscillator BOD enabled" },
4272 { "CKSEL=1000", "External Low-Frequency Crystal" },
4273 { "CKSEL=1001", "External Low-Frequency Crystal" },
4274 { "CKSEL=1010", "Crystal Oscillator slowly rising power" },
4275 { "CKSEL=1011", "Crystal Oscillator fast rising power" },
4276 { "CKSEL=1100", "Crystal Oscillator BOD enabled" },
4277 { "CKSEL=1101", "Ceramic Resonator/External Clock slowly rising power" },
4278 { "CKSEL=1110", "Ceramic Resonator fast rising power" },
4279 { "CKSEL=1111", "Ceramic Resonator BOD enabled" },
4280
4281 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00" },
4282 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800" },
4283 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00" },
4284 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00" }
4285 },
4286 {
4287 // lock
4288 { 0, "Lock1", "" },
4289 { 1, "Lock2", "" },
4290 { 2, "BootLock1", "" },
4291 { 3, "BootLock2", "" },
4292 { 4, "BootLoad1", "" },
4293 { 5, "BootLoad2", "" }
4294 },
4295 {
4296 // lock mask description
4297 { "Lock=11", "Mode 1: No memory lock features enabled" },
4298 { "Lock=10", "Mode 2: Further programming disabled" },
4299 { "Lock=00", "Mode 3: Further programming and verification disabled" },
4300
4301 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
4302 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
4303 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
4304 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
4305
4306 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
4307 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
4308 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
4309 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2728 { 0, "CKSEL0", "", "" },
2729 { 1, "CKSEL1", "", "" },
2730 { 2, "CKSEL2", "", "" },
2731 { 3, "CKSEL3", "", "" },
2732 { 6, "BODEN", "Brown-out detection enabled", "" },
2733 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
2734 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2735 { 9, "BOOTSZ0", "", "" },
2736 { 10, "BOOTSZ1", "", "" },
2737 { 11, "EESAVE", "Preserve EEPROM memory during through Chip Erase Cycle", "" },
2738 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2739 { 14, "JTAGEN", "JTAG Enabled", "" },
2740 { 15, "OCDEN", "On-Chip Debug Enabled", "" }
2741 },
2742 {
2743 // fuse mask description
2744 { "CKSEL=0000", "External Clock fast rising power", "" },
2745 { "CKSEL=0001", "External Clock BOD enabled", "" },
2746 { "CKSEL=0010", "Internal RC Ocsillator slowly rising power", "" },
2747 { "CKSEL=0011", "Internal RC Ocsillator fast rising power", "" },
2748 { "CKSEL=0100", "Internal RC Oscillator BOD enabled", "" },
2749 { "CKSEL=0101", "External RC Oscillator slowly rising power", "" },
2750 { "CKSEL=0110", "External RC Oscillator fast rising power", "" },
2751 { "CKSEL=0111", "External RC Oscillator BOD enabled", "" },
2752 { "CKSEL=1000", "External Low-Frequency Crystal", "" },
2753 { "CKSEL=1001", "External Low-Frequency Crystal", "" },
2754 { "CKSEL=1010", "Crystal Oscillator slowly rising power", "" },
2755 { "CKSEL=1011", "Crystal Oscillator fast rising power", "" },
2756 { "CKSEL=1100", "Crystal Oscillator BOD enabled", "" },
2757 { "CKSEL=1101", "Ceramic Resonator/External Clock slowly rising power", "" },
2758 { "CKSEL=1110", "Ceramic Resonator fast rising power", "" },
2759 { "CKSEL=1111", "Ceramic Resonator BOD enabled", "" },
2760
2761 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00", "" },
2762 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800", "" },
2763 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00", "" },
2764 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00", "" }
2765 },
2766 {
2767 // lock
2768 { 0, "Lock1", "", "" },
2769 { 1, "Lock2", "", "" },
2770 { 2, "BootLock1", "", "" },
2771 { 3, "BootLock2", "", "" },
2772 { 4, "BootLoad1", "", "" },
2773 { 5, "BootLoad2", "", "" }
2774 },
2775 {
2776 // lock mask description
2777 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2778 { "Lock=10", "Mode 2: Further programming disabled", "" },
2779 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2780
2781 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2782 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2783 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2784 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2785
2786 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2787 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2788 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2789 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
43102790 }
43112791 },
43122792
43142794 { ATmega32 },
43152795 {
43162796 // fuse
4317 { 0, "CKSEL0", "" },
4318 { 1, "CKSEL1", "" },
4319 { 2, "CKSEL2", "" },
4320 { 3, "CKSEL3", "" },
4321 { 4, "SUT0", "" },
4322 { 5, "SUT1", "" },
4323 { 6, "BODEN", "Brown-out detection enabled" },
4324 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V" },
4325 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)" },
4326 { 9, "BOOTSZ0", "" },
4327 { 10, "BOOTSZ1", "" },
4328 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle" },
4329 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)" },
4330 { 13, "SPIEN", "Serial program downloading (SPI) enabled" },
4331 { 14, "JTAGEN", "JTAG Interface Enabled" },
4332 { 15, "OCDEN", "On-Chip Debug Enabled" }
4333 },
4334 {
4335 // fuse mask description
4336 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms" },
4337 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms" },
4338 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms" },
4339 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms" },
4340 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms" },
4341 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms" },
4342 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms" },
4343 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms" },
4344 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms" },
4345 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms" },
4346 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms" },
4347 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms" },
4348 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms" },
4349 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms" },
4350 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms" },
4351 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms" },
4352 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms" },
4353 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms" },
4354 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms" },
4355 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms" },
4356 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms" },
4357 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms" },
4358 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms" },
4359 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms" },
4360 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms" },
4361 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms" },
4362 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms" },
4363 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms" },
4364 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms" },
4365 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms" },
4366 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms" },
4367 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms" },
4368 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms" },
4369 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms" },
4370 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms" },
4371 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms" },
4372 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms" },
4373 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms" },
4374 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms" },
4375 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms" },
4376 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms" },
4377 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms" },
4378 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms" },
4379 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms" },
4380 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms" },
4381 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms" },
4382 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms" },
4383 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms" },
4384 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms" },
4385 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms" },
4386 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms" },
4387 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms" },
4388 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms" },
4389 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms" },
4390 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms" },
4391 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms" },
4392 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms" },
4393 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms" },
4394
4395 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00" },
4396 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800" },
4397 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00" },
4398 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00" }
4399 },
4400 {
4401 // lock
4402 { 0, "Lock1", "" },
4403 { 1, "Lock2", "" },
4404 { 2, "BootLock1", "" },
4405 { 3, "BootLock2", "" },
4406 { 4, "BootLoad1", "" },
4407 { 5, "BootLoad2", "" }
4408 },
4409 {
4410 // lock mask description
4411 { "Lock=11", "Mode 1: No memory lock features enabled" },
4412 { "Lock=10", "Mode 2: Further programming disabled" },
4413 { "Lock=00", "Mode 3: Further programming and verification disabled" },
4414
4415 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section" },
4416 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section" },
4417 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section" },
4418 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section" },
4419
4420 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section" },
4421 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section" },
4422 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section" },
4423 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section" }
2797 { 0, "CKSEL0", "", "" },
2798 { 1, "CKSEL1", "", "" },
2799 { 2, "CKSEL2", "", "" },
2800 { 3, "CKSEL3", "", "" },
2801 { 4, "SUT0", "", "" },
2802 { 5, "SUT1", "", "" },
2803 { 6, "BODEN", "Brown-out detection enabled", "" },
2804 { 7, "/BODLEVEL", "NOT Brown-out detection level at VCC=2.7 V", "" },
2805 { 8, "BOOTRST", "Boot Reset vector Enabled (default address=$0000)", "" },
2806 { 9, "BOOTSZ0", "", "" },
2807 { 10, "BOOTSZ1", "", "" },
2808 { 11, "EESAVE", "Preserve EEPROM memory through the Chip Erase cycle", "" },
2809 { 12, "CKOPT", "CKOPT fuse (operation dependent of CKSEL fuses)", "" },
2810 { 13, "SPIEN", "Serial program downloading (SPI) enabled", "" },
2811 { 14, "JTAGEN", "JTAG Interface Enabled", "" },
2812 { 15, "OCDEN", "On-Chip Debug Enabled", "" }
2813 },
2814 {
2815 // fuse mask description
2816 { "CKSEL=0000 SUT=00", "Ext. Clock; Start-up time: 6 CK + 0 ms", "" },
2817 { "CKSEL=0000 SUT=01", "Ext. Clock; Start-up time: 6 CK + 4 ms", "" },
2818 { "CKSEL=0000 SUT=10", "Ext. Clock; Start-up time: 6 CK + 64 ms", "" },
2819 { "CKSEL=1111 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 0 ms", "" },
2820 { "CKSEL=1111 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 4 ms", "" },
2821 { "CKSEL=1111 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 16K CK + 64 ms", "" },
2822 { "CKSEL=1110 SUT=10", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 0 ms", "" },
2823 { "CKSEL=1110 SUT=11", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 4 ms", "" },
2824 { "CKSEL=1111 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 1K CK + 64 ms", "" },
2825 { "CKSEL=1110 SUT=00", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 4 ms", "" },
2826 { "CKSEL=1110 SUT=01", "Ext. Crystal/Resonator High Freq.; Start-up time: 258 CK + 64 ms", "" },
2827 { "CKSEL=1011 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 0 ms", "" },
2828 { "CKSEL=1011 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 4 ms", "" },
2829 { "CKSEL=1011 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 16K CK + 64 ms", "" },
2830 { "CKSEL=1010 SUT=10", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 0 ms", "" },
2831 { "CKSEL=1010 SUT=11", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 4 ms", "" },
2832 { "CKSEL=1011 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 1K CK + 64 ms", "" },
2833 { "CKSEL=1010 SUT=00", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 4 ms", "" },
2834 { "CKSEL=1010 SUT=01", "Ext. Crystal/Resonator Low Freq.; Start-up time: 258 CK + 64 ms", "" },
2835 { "CKSEL=1101 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 0 ms", "" },
2836 { "CKSEL=1101 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 4 ms", "" },
2837 { "CKSEL=1101 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 16K CK + 64 ms", "" },
2838 { "CKSEL=1100 SUT=10", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 0 ms", "" },
2839 { "CKSEL=1100 SUT=11", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 4 ms", "" },
2840 { "CKSEL=1101 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 1K CK + 64 ms", "" },
2841 { "CKSEL=1100 SUT=00", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 4 ms", "" },
2842 { "CKSEL=1100 SUT=01", "Ext. Crystal/Resonator Medium Freq.; Start-up time: 258 CK + 64 ms", "" },
2843 { "CKSEL=1001 SUT=00", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4 ms", "" },
2844 { "CKSEL=1001 SUT=01", "Ext. Low-Freq. Crystal; Start-up time: 1K CK + 64 ms", "" },
2845 { "CKSEL=1001 SUT=10", "Ext. Low-Freq. Crystal; Start-up time: 32K CK + 64 ms", "" },
2846 { "CKSEL=0101 SUT=00", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 0 ms", "" },
2847 { "CKSEL=0101 SUT=01", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 4 ms", "" },
2848 { "CKSEL=0101 SUT=10", "Ext. RC Osc. - 0.9 MHz; Start-up time: 18 CK + 64 ms", "" },
2849 { "CKSEL=0101 SUT=11", "Ext. RC Osc. - 0.9 MHz; Start-up time: 6 CK + 4 ms", "" },
2850 { "CKSEL=0110 SUT=00", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2851 { "CKSEL=0110 SUT=01", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2852 { "CKSEL=0110 SUT=10", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2853 { "CKSEL=0110 SUT=11", "Ext. RC Osc. 0.9 MHz - 3.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2854 { "CKSEL=0111 SUT=00", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2855 { "CKSEL=0111 SUT=01", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2856 { "CKSEL=0111 SUT=10", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2857 { "CKSEL=0111 SUT=11", "Ext. RC Osc. 3.0 MHz - 8.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2858 { "CKSEL=1000 SUT=00", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 0 ms", "" },
2859 { "CKSEL=1000 SUT=01", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 4 ms", "" },
2860 { "CKSEL=1000 SUT=10", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 18 CK + 64 ms", "" },
2861 { "CKSEL=1000 SUT=11", "Ext. RC Osc. 8.0 MHz - 12.0 MHz; Start-up time: 6 CK + 4 ms", "" },
2862 { "CKSEL=0001 SUT=00", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 0 ms", "" },
2863 { "CKSEL=0001 SUT=01", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 4 ms", "" },
2864 { "CKSEL=0001 SUT=10", "Int. RC Osc. 1 MHz; Start-up time: 6 CK + 64 ms", "" },
2865 { "CKSEL=0010 SUT=00", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 0 ms", "" },
2866 { "CKSEL=0010 SUT=01", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 4 ms", "" },
2867 { "CKSEL=0010 SUT=10", "Int. RC Osc. 2 MHz; Start-up time: 6 CK + 64 ms", "" },
2868 { "CKSEL=0011 SUT=00", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 0 ms", "" },
2869 { "CKSEL=0011 SUT=01", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 4 ms", "" },
2870 { "CKSEL=0011 SUT=10", "Int. RC Osc. 4 MHz; Start-up time: 6 CK + 64 ms", "" },
2871 { "CKSEL=0100 SUT=00", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 0 ms", "" },
2872 { "CKSEL=0100 SUT=01", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 4 ms", "" },
2873 { "CKSEL=0100 SUT=10", "Int. RC Osc. 8 MHz; Start-up time: 6 CK + 64 ms", "" },
2874
2875 { "BOOTSZ=01", "Boot Flash section size=1024 words Boot start address=$3C00", "" },
2876 { "BOOTSZ=00", "Boot Flash section size=2048 words Boot start address=$3800", "" },
2877 { "BOOTSZ=11", "Boot Flash section size=256 words Boot start address=$3F00", "" },
2878 { "BOOTSZ=10", "Boot Flash section size=512 words Boot start address=$3E00", "" }
2879 },
2880 {
2881 // lock
2882 { 0, "Lock1", "", "" },
2883 { 1, "Lock2", "", "" },
2884 { 2, "BootLock1", "", "" },
2885 { 3, "BootLock2", "", "" },
2886 { 4, "BootLoad1", "", "" },
2887 { 5, "BootLoad2", "", "" }
2888 },
2889 {
2890 // lock mask description
2891 { "Lock=11", "Mode 1: No memory lock features enabled", "" },
2892 { "Lock=10", "Mode 2: Further programming disabled", "" },
2893 { "Lock=00", "Mode 3: Further programming and verification disabled", "" },
2894
2895 { "BootLock=11", "Application Protection Mode 1: No lock on SPM and LPM in Application Section", "" },
2896 { "BootLock=10", "Application Protection Mode 2: SPM prohibited in Application Section", "" },
2897 { "BootLock=00", "Application Protection Mode 3: LPM and SPM prohibited in Application Section", "" },
2898 { "BootLock=01", "Application Protection Mode 4: LPM prohibited in Application Section", "" },
2899
2900 { "BootLoad=11", "Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section", "" },
2901 { "BootLoad=10", "Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section", "" },
2902 { "BootLoad=00", "Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section", "" },
2903 { "BootLoad=01", "Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section", "" }
44242904 }
44252905 },
44262906
44342914 },
44352915 {
44362916 // lock
4437 { 0, "FOSC0", "" },
4438 { 1, "FOSC1", "" },
4439 { 2, "WDTE", "Watchdog timer enable" },
4440 { 3, "CP", "Code protection bit" },
4441 { 4, "/MCLRE", "NOT MCLR enable bit" }
4442 },
4443 {
4444 // lock mask description
4445 { "FOSC=11", "EXTRC - external RC oscillator" },
4446 { "FOSC=10", "INTRC - internal RC oscillator" },
4447 { "FOSC=01", "XT oscillator" },
4448 { "FOSC=00", "LP oscillator" }
2917 { 0, "FOSC0", "", "" },
2918 { 1, "FOSC1", "", "" },
2919 { 2, "WDTE", "Watchdog timer enable", "" },
2920 { 3, "CP", "Code protection bit", "" },
2921 { 4, "/MCLRE", "NOT MCLR enable bit", "" }
2922 },
2923 {
2924 // lock mask description
2925 { "FOSC=11", "EXTRC - external RC oscillator", "" },
2926 { "FOSC=10", "INTRC - internal RC oscillator", "" },
2927 { "FOSC=01", "XT oscillator", "" },
2928 { "FOSC=00", "LP oscillator", "" }
44492929 }
44502930 },
44512931
44592939 },
44602940 {
44612941 // lock
4462 { 0, "FOSC0", "" },
4463 { 1, "FOSC1", "" },
4464 { 2, "FOSC2", "" },
4465 { 3, "WDTE", "Watchdog Timer Enable" },
4466 { 4, "/PWRTE", "NOT Power-up Timer Enable" },
4467 { 5, "CP0", "" },
4468 { 6, "CP1", "" },
4469 { 7, "MCLRE", "Master Clear Reset Enable" },
4470 { 8, "CP0", "" },
4471 { 9, "CP1", "" },
4472 { 10, "CP0", "" },
4473 { 11, "CP1", "" },
4474 { 12, "CP0", "" },
4475 { 13, "CP1", "" }
4476 },
4477 {
4478 // lock mask description
4479 { "FOSC=111", "EXTRC, Clockout on OSC2" },
4480 { "FOSC=110", "EXTRC, OSC2 is I/O" },
4481 { "FOSC=101", "INTRC, Clockout on OSC2" },
4482 { "FOSC=100", "INTRC, OSC2 is I/O" },
4483 { "FOSC=011", "Invalid Selection" },
4484 { "FOSC=010", "HS Oscillator" },
4485 { "FOSC=001", "XT Oscillator" },
4486 { "FOSC=000", "LP Oscillator" },
4487
4488 { "CP=11", "Code protection off" },
4489 { "CP=10", "Locations 400h through 7FEh code protected" },
4490 { "CP=01", "Locations 200h through 7FEh code protected" },
4491 { "CP=00", "All memory is code protected" }
2942 { 0, "FOSC0", "", "" },
2943 { 1, "FOSC1", "", "" },
2944 { 2, "FOSC2", "", "" },
2945 { 3, "WDTE", "Watchdog Timer Enable", "" },
2946 { 4, "/PWRTE", "NOT Power-up Timer Enable", "" },
2947 { 5, "CP0", "", "" },
2948 { 6, "CP1", "", "" },
2949 { 7, "MCLRE", "Master Clear Reset Enable", "" },
2950 { 8, "CP0", "", "" },
2951 { 9, "CP1", "", "" },
2952 { 10, "CP0", "", "" },
2953 { 11, "CP1", "", "" },
2954 { 12, "CP0", "", "" },
2955 { 13, "CP1", "", "" }
2956 },
2957 {
2958 // lock mask description
2959 { "FOSC=111", "EXTRC, Clockout on OSC2", "" },
2960 { "FOSC=110", "EXTRC, OSC2 is I/O", "" },
2961 { "FOSC=101", "INTRC, Clockout on OSC2", "" },
2962 { "FOSC=100", "INTRC, OSC2 is I/O", "" },
2963 { "FOSC=011", "Invalid Selection", "" },
2964 { "FOSC=010", "HS Oscillator", "" },
2965 { "FOSC=001", "XT Oscillator", "" },
2966 { "FOSC=000", "LP Oscillator", "" },
2967
2968 { "CP=11", "Code protection off", "" },
2969 { "CP=10", "Locations 400h through 7FEh code protected", "" },
2970 { "CP=01", "Locations 200h through 7FEh code protected", "" },
2971 { "CP=00", "All memory is code protected", "" }
44922972 }
44932973 },
44942974
45022982 },
45032983 {
45042984 // lock
4505 { 0, "FOSC0", "" },
4506 { 1, "FOSC1", "" },
4507 { 2, "WDTE", "Watchdog timer enable" },
4508 { 3, "/PWRTE", "NOT Power-up Timer Enable" },
4509 { 4, "CP", "Code protection" }
4510 },
4511 {
4512 // lock mask description
4513 { "FOSC=11", "EXTRC - external RC oscillator" },
4514 { "FOSC=10", "INTRC - internal RC oscillator" },
4515 { "FOSC=01", "XT oscillator" },
4516 { "FOSC=00", "LP oscillator" }
2985 { 0, "FOSC0", "", "" },
2986 { 1, "FOSC1", "", "" },
2987 { 2, "WDTE", "Watchdog timer enable", "" },
2988 { 3, "/PWRTE", "NOT Power-up Timer Enable", "" },
2989 { 4, "CP", "Code protection", "" }
2990 },
2991 {
2992 // lock mask description
2993 { "FOSC=11", "EXTRC - external RC oscillator", "" },
2994 { "FOSC=10", "INTRC - internal RC oscillator", "" },
2995 { "FOSC=01", "XT oscillator", "" },
2996 { "FOSC=00", "LP oscillator", "" }
45172997 }
45182998 },
45192999
45273007 },
45283008 {
45293009 // lock
4530 { 0, "FOSC0", "" },
4531 { 1, "FOSC1", "" },
4532 { 2, "WDTE", "Watchdog Timer Enable" },
4533 { 3, "/PWRTE", "NOT Power-up Timer Enable" },
4534 { 4, "CP0", "" },
4535 { 5, "CP1", "" },
4536 { 6, "BODEN", "Brown-out Reset Enable" },
4537 { 7, "LVP", "Low Voltage In-Circuit Serial Programming Enable" },
4538 { 8, "CPD", "Data EE Memory Code Protection" },
4539 { 9, "WRT", "FLASH Program Memory Write Enable" },
4540 { 11, "DEBUG", "In-Circuit Debugger Mode" },
4541 { 12, "CP0", "" },
4542 { 13, "CP1", "" }
4543 },
4544 {
4545 // lock mask description
4546 { "FOSC=11", "RC oscillator" },
4547 { "FOSC=10", "HS oscillator" },
4548 { "FOSC=01", "XT oscillator" },
4549 { "FOSC=00", "LP oscillator" },
4550
4551 { "CP=11", "Code protection off" },
4552 { "CP=10", "1F00h to 1FFFh code protected" },
4553 { "CP=01", "1000h to 1FFFh code protected" },
4554 { "CP=00", "0000h to 1FFFh code protected" }
3010 { 0, "FOSC0", "", "" },
3011 { 1, "FOSC1", "", "" },
3012 { 2, "WDTE", "Watchdog Timer Enable", "" },
3013 { 3, "/PWRTE", "NOT Power-up Timer Enable", "" },
3014 { 4, "CP0", "", "" },
3015 { 5, "CP1", "", "" },
3016 { 6, "BODEN", "Brown-out Reset Enable", "" },
3017 { 7, "LVP", "Low Voltage In-Circuit Serial Programming Enable", "" },
3018 { 8, "CPD", "Data EE Memory Code Protection", "" },
3019 { 9, "WRT", "FLASH Program Memory Write Enable", "" },
3020 { 11, "DEBUG", "In-Circuit Debugger Mode", "" },
3021 { 12, "CP0", "", "" },
3022 { 13, "CP1", "", "" }
3023 },
3024 {
3025 // lock mask description
3026 { "FOSC=11", "RC oscillator", "" },
3027 { "FOSC=10", "HS oscillator", "" },
3028 { "FOSC=01", "XT oscillator", "" },
3029 { "FOSC=00", "LP oscillator", "" },
3030
3031 { "CP=11", "Code protection off", "" },
3032 { "CP=10", "1F00h to 1FFFh code protected", "" },
3033 { "CP=01", "1000h to 1FFFh code protected", "" },
3034 { "CP=00", "0000h to 1FFFh code protected", "" }
45553035 }
45563036 },
45573037
45653045 },
45663046 {
45673047 // lock
4568 { 0, "FOSC0", "" },
4569 { 1, "FOSC1", "" },
4570 { 2, "WDTEN", "Watchdog Timer Enable" },
4571 { 3, "/PWRTEN", "NOT Power-up Timer Enable" },
4572 { 6, "BOREN", "Brown-out Reset Enable" },
4573 { 7, "LVP", "Low-Voltage (Single-Supply)" },
4574 { 8, "CPD", "Data EEPROM Memory Code Protection" },
4575 { 9, "WRT0", "" },
4576 { 11, "WRT1", "" },
4577 { 12, "DEBUG", "In-Circuit Debugger Mode" },
4578 { 14, "CP", "Flash Program Memory Code Protection" }
4579 },
4580 {
4581 // lock mask description
4582 { "FOSC=11", "RC oscillator" },
4583 { "FOSC=10", "HS oscillator" },
4584 { "FOSC=01", "XT oscillator" },
4585 { "FOSC=00", "LP oscillator" },
4586
4587 { "WRT=11", "Write protection off; all program memory may be written to by EECON control" },
4588 { "WRT=10", "0000h to 00FFh write-protected; 0100h to 0FFFh may be written to by EECON control" },
4589 { "WRT=01", "0000h to 03FFh write-protected; 0400h to 0FFFh may be written to by EECON control" },
4590 { "WRT=11", "0000h to 07FFh write-protected; 0800h to 0FFFh may be written to by EECON control" }
3048 { 0, "FOSC0", "", "" },
3049 { 1, "FOSC1", "", "" },
3050 { 2, "WDTEN", "Watchdog Timer Enable", "" },
3051 { 3, "/PWRTEN", "NOT Power-up Timer Enable", "" },
3052 { 6, "BOREN", "Brown-out Reset Enable", "" },
3053 { 7, "LVP", "Low-Voltage (Single-Supply)", "" },
3054 { 8, "CPD", "Data EEPROM Memory Code Protection", "" },
3055 { 9, "WRT0", "", "" },
3056 { 11, "WRT1", "", "" },
3057 { 12, "DEBUG", "In-Circuit Debugger Mode", "" },
3058 { 14, "CP", "Flash Program Memory Code Protection", "" }
3059 },
3060 {
3061 // lock mask description
3062 { "FOSC=11", "RC oscillator", "" },
3063 { "FOSC=10", "HS oscillator", "" },
3064 { "FOSC=01", "XT oscillator", "" },
3065 { "FOSC=00", "LP oscillator", "" },
3066
3067 { "WRT=11", "Write protection off; all program memory may be written to by EECON control", "" },
3068 { "WRT=10", "0000h to 00FFh write-protected; 0100h to 0FFFh may be written to by EECON control", "" },
3069 { "WRT=01", "0000h to 03FFh write-protected; 0400h to 0FFFh may be written to by EECON control", "" },
3070 { "WRT=11", "0000h to 07FFh write-protected; 0800h to 0FFFh may be written to by EECON control", "" }
45913071 }
45923072 },
45933073
46013081 },
46023082 {
46033083 // lock
4604 { 0, "FOSC0", "" },
4605 { 1, "FOSC1", "" },
4606 { 2, "WDTEN", "Watchdog Timer Enable" },
4607 { 3, "/PWRTEN", "NOT Power-up Timer Enable" },
4608 { 4, "FOSC2", "" },
4609 { 5, "MCLRE", "RA5/MCLR pin function select" },
4610 { 6, "BOREN", "Brown-out Detect Reset Enable" },
4611 { 7, "LVP", "Low Voltage Programming Enable" },
4612 { 8, "CPD", "Data Code Protection" },
4613 { 10, "CP0", "" },
4614 { 11, "CP1", "" },
4615 { 12, "CP0", "" },
4616 { 13, "CP1", "" }
4617 },
4618 {
4619 // lock mask description
4620 { "FOSC=111", "ER oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN" },
4621 { "FOSC=110", "ER oscillator: I/O function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN" },
4622 { "FOSC=101", "INTRC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN" },
4623 { "FOSC=100", "INTRC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN" },
4624 { "FOSC=011", "EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN" },
4625 { "FOSC=010", "HS oscillator: High speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN" },
4626 { "FOSC=001", "XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN" },
4627 { "FOSC=000", "LP oscillator: Low power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN" },
4628
4629 { "CP=11", "Program memory code protection off" },
4630 { "CP=10", "Program memory code protection off" },
4631 { "CP=01", "0200h-03FFh code protected" },
4632 { "CP=00", "0000h-03FFh code protected" }
3084 { 0, "FOSC0", "", "" },
3085 { 1, "FOSC1", "", "" },
3086 { 2, "WDTEN", "Watchdog Timer Enable", "" },
3087 { 3, "/PWRTEN", "NOT Power-up Timer Enable", "" },
3088 { 4, "FOSC2", "", "" },
3089 { 5, "MCLRE", "RA5/MCLR pin function select", "" },
3090 { 6, "BOREN", "Brown-out Detect Reset Enable", "" },
3091 { 7, "LVP", "Low Voltage Programming Enable", "" },
3092 { 8, "CPD", "Data Code Protection", "" },
3093 { 10, "CP0", "", "" },
3094 { 11, "CP1", "", "" },
3095 { 12, "CP0", "", "" },
3096 { 13, "CP1", "", "" }
3097 },
3098 {
3099 // lock mask description
3100 { "FOSC=111", "ER oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN", "" },
3101 { "FOSC=110", "ER oscillator: I/O function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN", "" },
3102 { "FOSC=101", "INTRC oscillator: CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN", "" },
3103 { "FOSC=100", "INTRC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN", "" },
3104 { "FOSC=011", "EC: I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN", "" },
3105 { "FOSC=010", "HS oscillator: High speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN", "" },
3106 { "FOSC=001", "XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN", "" },
3107 { "FOSC=000", "LP oscillator: Low power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN", "" },
3108
3109 { "CP=11", "Program memory code protection off", "" },
3110 { "CP=10", "Program memory code protection off", "" },
3111 { "CP=01", "0200h-03FFh code protected", "" },
3112 { "CP=00", "0000h-03FFh code protected", "" }
46333113 }
46343114 }
46353115 };
5151 class fuseModalDialog : public QDialog, public cTranslator, public Ui::FuseDialog
5252 {
5353 Q_OBJECT
54 public: //---------------------------------------- public
54 public:
5555 fuseModalDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly = false, const QString &msg = "");
5656 virtual ~fuseModalDialog(); // Destructor
5757
6464 void onRead();
6565 void onProg();
6666
67 protected: //--------------------------------------- protected
67 protected:
6868
6969
7070 private:
7575 int eepFindFuses(long type);
7676
7777
78 private: //--------------------------------------- private
78 private:
7979 static QVector<ChipBits> eep_bits;
8080
8181 e2CmdWindow *cmdw;
3939 #define ALL_TYPE 0x7 // (PROG_TYPE|DATA_TYPE|CONFIG_TYPE)
4040
4141
42
4342 #define NO_OF_FILETYPE LAST_FT
4443 enum FileType
4544 {
6564 EASYI2C_IO,
6665 DT006_API,
6766 DT006_IO,
68 // JDM_IO,
6967 LINUXSYSFS_IO,
68 FTDI_JTAGKEY,
69 PONYPROG_FT,
70 //PONYPROG_RPI,
7071 LAST_HT
7172 };
7273
9495 LAST_BT
9596 };
9697
98 class VidPid
99 {
100 public:
101
102 VidPid(unsigned int _vid = 0, unsigned int _pid = 0)
103 {
104 vid = _vid;
105 pid = _pid;
106 }
107 VidPid(const VidPid &p2)
108 {
109 vid = p2.vid;
110 pid = p2.pid;
111 }
112 bool operator==(const VidPid &a)
113 {
114 return (a.pid == pid && a.vid == vid);
115 }
116 VidPid &operator=(const VidPid &a)
117 {
118 vid = a.vid;
119 pid = a.pid;
120 return *this;
121 }
122 unsigned int vid;
123 unsigned int pid;
124 };
97125
98126 #endif
99
100
101
3636 #include <QDebug>
3737 #include <QtCore>
3838
39 #ifdef Q_OS_LINUX
40 # include <unistd.h>
41 #else
42 # ifdef __BORLANDC__
43 # define __inline__
44 # else // _MICROSOFT_ VC++
45 # define __inline__ __inline
46 # define _export
47 # endif
48 #endif
49
50 #define SCLTIMEOUT 900 // enable SCL check and timing (for slaves that hold down the SCL line to slow the transfer)
51
5239 #define BUSYDELAY 100
5340 #define SDATIMEOUT 200
5441
55 // Constructor
5642 I2CBus::I2CBus(BusInterface *ptr)
5743 : BusIO(ptr)
5844 {
59 shot_delay = 0;
60 }
61
62 // Destructor
45 }
46
6347 I2CBus::~I2CBus()
6448 {
6549 Close();
6751
6852 int I2CBus::CheckBusy()
6953 {
70 register int count;
71
72 for (count = BUSYDELAY; count > 0 && isSCLSDAuno(); count--)
73 {
74 WaitUsec(1);
75 }
76
77 return (count ? IICERR_BUSBUSY : 0);
78 }
54 if (busI->CheckDataLines(BUSYDELAY, 1, 1))
55 {
56 return OK;
57 }
58 else
59 {
60 return IICERR_BUSBUSY;
61 }
62 }
63
64 /** I2CBus specification **
65 -- Standard I2CBus --
66 SCL
67 T-low = 5 usec min
68 T-high = 4 usec min
69
70 SCL
71 Data setup time = 300 nsec min
72 Data hold time = 300 nsec min
73
74 ALL
75 fall time = 300 nsec max
76 rise time = 1 usec max
77
78 -- Fast I2CBus --
79 SCL
80 T-low = 1.3 usec min
81 T-high = 0.6 usec min
82
83 ALL
84 fall time = 300 nsec max
85 rise time = 300 nsec max
86 **/
7987
8088 int I2CBus::SendStart()
8189 {
8290 register int err;
8391
84 setSCLSDA();
92 setSDA();
93 ShotDelay(2); //Help repeated start condition
94 setSCL();
95
8596 #ifdef SCLTIMEOUT
86
8797 if (getSCL() == 0)
8898 {
8999 int k;
98108 return IICERR_SCLCONFLICT;
99109 }
100110 }
101
111 #endif
112 ShotDelay(2);
113
114 int recoveryCnt = 0;
115 while (CheckBusy() != OK && recoveryCnt++ < 3)
116 {
117 //Recover I2C
118 RecoverSlave();
119 }
120
121 if ((err = CheckBusy()) != OK)
122 {
123 return err;
124 }
125
126 clearSDA();
127 ShotDelay(4); // tHD;STA = 4 usec
128 clearSCL();
129 ShotDelay();
130
131 return OK;
132 }
133
134 int I2CBus::SendStop()
135 {
136 clearSCL();
137 ShotDelay(2);
138 clearSDA();
139 ShotDelay(2);
140 setSCL();
141
142 #ifdef SCLTIMEOUT
143 if (getSCL() == 0)
144 {
145 int k;
146
147 for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
148 {
149 WaitUsec(1);
150 }
151
152 if (k == 0)
153 {
154 qWarning() << Q_FUNC_INFO << "*** SCL error";
155 return IICERR_SCLCONFLICT;
156 }
157 }
102158 #else
103 WaitUsec(shot_delay / 2);
159 ShotDelay();
104160 #endif
105
106 if ((err = CheckBusy()))
161 ShotDelay(5); // tSU;STOP = 4.7 usec
162 setSDA();
163 ShotDelay(2);
164
165 if (getSDA() == 0)
166 {
167 qWarning() << Q_FUNC_INFO << "*** SDA error";
168 return IICERR_SDACONFLICT;
169 }
170
171 //tBUF = 4.7 usec
172 ShotDelay(2);
173
174 return OK;
175 }
176
177 int I2CBus::SendBitMast(int inbit)
178 {
179 int err = OK;
180 busI->xferBit(err, inbit, xMODE_WRONLY);
181
182 return err;
183 }
184
185 int I2CBus::RecBitMast()
186 {
187 int err = OK;
188 setSDA();
189 int rv = busI->xferBit(err, 1, xMODE_RDONLY);
190 if (err == OK)
191 {
192 return rv;
193 }
194 else
107195 {
108196 return err;
109197 }
110
111 clearSDA();
112 WaitUsec(shot_delay); // tHD;STA = 4 usec
113 clearSCL();
114 WaitUsec(shot_delay / 2);
115
116 return 0;
117 }
118
119 int I2CBus::SendStop()
120 {
121 clearSCL();
122 WaitUsec(shot_delay + 1);
123 clearSDA();
124 WaitUsec(shot_delay + 1);
198 }
199
200 void I2CBus::RecoverSlave()
201 {
202 int k;
203
204 for (k = 0; k < 9; k++)
205 {
206 SendBitMast(1);
207 if (getSDA() != 0)
208 {
209 break;
210 }
211 }
125212 setSCL();
126 #ifdef SCLTIMEOUT
127
128 if (getSCL() == 0)
129 {
130 int k;
131
132 for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
133 {
134 WaitUsec(1);
135 }
136
137 if (k == 0)
138 {
139 // qDebug() << "I2CBus::SendStop() *** SCL error";
140 return IICERR_SCLCONFLICT;
141 }
142 }
143
144 #else
145 WaitUsec(shot_delay / 2);
146 #endif
147 WaitUsec(shot_delay + 1); // tSU;STOP = 4.7 usec
213 ShotDelay();
214 }
215
216 int I2CBus::WriteByte(int by, bool lsb)
217 {
218 int err = OK;
219
220 busI->xferByte(err, by, xMODE_WRONLY, 8, lsb);
221
222 if (err == OK)
223 {
224 //Receive Ack
225 setSDA();
226 int lrb = busI->xferBit(err, 1, xMODE_RDONLY);
227
228 if (err == OK)
229 {
230 if (lrb)
231 {
232 err = IICERR_NOTACK;
233 }
234 }
235 }
236 return err;
237 }
238
239 int I2CBus::ReadByte(int ack, bool lsb)
240 {
241 int err = OK;
148242 setSDA();
149 WaitUsec(shot_delay / 2 + 1);
150
151 if (getSDA() == 0)
152 {
153 // qDebug() << "I2CBus::SendStop() *** SDA error";
154 return IICERR_SDACONFLICT;
155 }
156
157 //tBUF = 4.7 usec
158 WaitUsec(shot_delay);
159
160 return 0;
161 }
162
163 int I2CBus::SendBitMast(int b)
164 {
165 bitSDA(b);
166 WaitUsec(shot_delay / 2 + 1); // tSU;DAT = 250 nsec (tLOW / 2 = 2 usec)
167 setSCL();
168
169 /* Se SCL e` ancora 0 significa che uno Slave sta` rallentando
170 * il trasferimento, attendi che SCL si rialzi */
171 if (getSCL() == 0)
172 {
173 #ifdef SCLTIMEOUT
174 int k;
175
176 for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
177 {
178 WaitUsec(1);
179 }
180
181 if (k == 0)
182 {
183 return IICERR_SCLCONFLICT;
184 }
185
186 #endif
187 }
188
189 WaitUsec(shot_delay / 2); // tHIGH / 2 = 2 usec
190
191 if (!getSDA() != !b)
192 {
193 return IICERR_SDACONFLICT;
194 }
195
196 WaitUsec(shot_delay / 2); // tHIGH / 2 = 2 usec
197 clearSCL();
198 WaitUsec(shot_delay / 2); // tHD;DATA = 300 nsec (tLOW / 2 = 2 usec)
199
200 return 0;
201 }
202
203 // returns a negative number if there's an error, 0 or 1 otherwise
204 int I2CBus::RecBitMast()
205 {
206 register uint8_t b;
207
208 setSDA(); // to receive data SDA must be high
209 WaitUsec(shot_delay / 2 + 1); // tSU;DAT = 250 nsec (tLOW / 2 = 2 usec)
210 setSCL();
211
212 /* Se SCL e` ancora 0 significa che uno Slave sta` rallentando
213 * il trasferimento, attendi che SCL si rialzi */
214 if (getSCL() == 0)
215 {
216 #ifdef SCLTIMEOUT
217 int k;
218
219 for (k = SCLTIMEOUT; getSCL() == 0 && k > 0; k--)
220 {
221 WaitUsec(1);
222 }
223
224 if (k == 0)
225 {
226 return IICERR_SCLCONFLICT;
227 }
228
229 #endif
230 }
231
232 WaitUsec(shot_delay / 2); // tHIGH / 2 = 2 usec
233 b = getSDA();
234 WaitUsec(shot_delay / 2); // tHIGH / 2 = 2 usec
235 clearSCL();
236 WaitUsec(shot_delay / 2); // tHD;DATA = 300 nsec (tLOW / 2 = 2 usec)
237
238 return b;
239 }
240
241 // OK, ora ci alziamo di un livello: operiamo sul byte
242 int I2CBus::SendByteMast(int by)
243 {
244 int lrb, k;
245
246 for (k = 7; k >= 0; k--)
247 if ((lrb = SendBitMast(by & (1 << k))))
248 {
249 return lrb;
250 }
251
252 lrb = RecBitMast(); // acknowledge bit
253
254 if (lrb < 0) // < 0 means that an error occured
255 {
256 return lrb;
257 }
258
259 if (lrb)
260 {
261 return IICERR_NOTACK;
262 }
263
264 return 0;
265 }
266
267 int I2CBus::SendByteMastLSB(int by)
268 {
269 int lrb, k;
270
271 for (k = 0; k < 8; k++)
272 if ((lrb = SendBitMast(by & (1 << k))))
273 {
274 return lrb;
275 }
276
277 lrb = RecBitMast(); // acknowledge bit
278
279 if (lrb < 0) // < 0 means that an error occured
280 {
281 return lrb;
282 }
283
284 if (lrb)
285 {
286 return IICERR_NOTACK;
287 }
288
289 return 0;
290 }
291
292 int I2CBus::RecByteMast(int ack)
293 {
294 int k, lrb, val = 0;
295
296 for (k = 7; k >= 0; k--)
297 {
298 lrb = RecBitMast();
299
300 if (lrb < 0)
301 {
302 return lrb;
303 }
304
305 if (lrb)
306 {
307 val |= 1 << k;
308 }
309 }
310
311 if ((k = SendBitMast(ack))) // send the ack
312 {
313 return k;
314 }
315
316 setSDA(); // release SDA line to the slave trasmitter
317
318 return val;
319 }
320
321 int I2CBus::RecByteMastLSB(int ack)
322 {
323 int k, lrb, val = 0;
324
325 for (k = 0; k < 8; k++)
326 {
327 lrb = RecBitMast();
328
329 if (lrb < 0)
330 {
331 return lrb;
332 }
333
334 if (lrb)
335 {
336 val |= 1 << k;
337 }
338 }
339
340 if ((k = SendBitMast(ack))) // send the ack
341 {
342 return k;
343 }
344
345 setSDA(); // release SDA line to the slave trasmitter
346
347 return val;
243 int rv = busI->xferByte(err, 0xff, xMODE_RDONLY, 8, lsb);
244 if (err == OK)
245 {
246 //Send Ack
247 busI->xferBit(err, ack, xMODE_WRONLY);
248 }
249 if (err == OK)
250 {
251 return rv;
252 }
253 else
254 {
255 return err;
256 }
348257 }
349258
350259 void I2CBus::SetDelay()
355264 switch (val)
356265 {
357266 case TURBO:
358 n = 0; // as fast as your PC can
267 n = 1; // as fast as your PC can (dangerous)
359268 break;
360269
361270 case FAST:
367276 break;
368277
369278 case VERYSLOW:
370 n = 100;
279 n = 80;
371280 break;
372281
373282 case ULTRASLOW:
374 n = 1000;
283 n = 500;
375284 break;
376285
377286 default:
379288 break;
380289 }
381290
382 BusIO::SetDelay(n);
383
384 qDebug() << "I2CBus::SetDelay() = " << n;
291 Q_CHECK_PTR(busI);
292 busI->SetDelay(n);
293
294 qDebug() << Q_FUNC_INFO << "=" << n;
385295 }
386296
387297 long I2CBus::Read(int slave, uint8_t *data, long length, int page_size)
388298 {
389299 long len;
390300
391 qDebug() << "I2CBus::Read(" << slave << ", " << (void *) data << ", " << length << ") - IN";
301 //qDebug() << Q_FUNC_INFO << "(" << (hex) << slave << "," << (void *)data << "," << (dec) << length << ") - IN";
392302 len = StartRead(slave, data, length);
393303
394304 if (len == length)
397307 len = 0;
398308 }
399309
400 qDebug() << "I2CBus::Read() = " << len << ", err_no = " << err_no << " - OUT";
310 //qDebug() << Q_FUNC_INFO << "=" << len << ", err_no =" << err_no << " - OUT";
401311
402312 return len;
403313 }
406316 {
407317 long len;
408318
409 qDebug() << "I2CBus::Write(" << slave << ", " << (hex) << data << ", " << (dec) << length << ") - IN";
319 //qDebug() << Q_FUNC_INFO << "(" << (hex) << slave << "," << data << "," << (dec) << length << ") - IN";
410320
411321 len = StartWrite(slave, data, length);
412322
416326 len = 0;
417327 }
418328
419 qDebug() << "I2CBus::Write() = " << len << ", err_no = " << err_no << " - OUT";
329 //qDebug() << Q_FUNC_INFO << "=" << len << ", err_no =" << err_no << " - OUT";
420330
421331 return len;
422 }
423
424 int I2CBus::ReadByte(int ack, int lsb)
425 {
426 if (lsb)
427 {
428 return RecByteMastLSB(ack);
429 }
430 else
431 {
432 return RecByteMast(ack);
433 }
434 }
435
436 int I2CBus::WriteByte(int by, int lsb)
437 {
438 if (lsb)
439 {
440 return SendByteMastLSB(by);
441 }
442 else
443 {
444 return SendByteMast(by);
445 }
446332 }
447333
448334 int I2CBus::Start(uint8_t slave)
456342 return err_no;
457343 }
458344
459 if ((temp = SendByteMast(slave)) != 0)
345 if ((temp = WriteByte(slave)) != OK)
460346 {
461347 err_no = (temp == IICERR_NOTACK) ? IICERR_NOADDRACK : temp;
462348 last_addr = slave;
463349 return err_no;
464350 }
465351
466 return 0;
352 return OK;
467353 }
468354
469355 /* se length e` zero, viene ricevuto un byte senza ack per cercare di
476362 int temp;
477363 long len = length;
478364
479 qDebug() << "I2CBus::StartRead(" << slave << ", " << (hex) << data << ", " << (dec) << length << ") - IN";
365 //qDebug() << Q_FUNC_INFO << "(" << (hex) << slave << "," << data << "," << (dec) << length << ") - IN";
480366
481367 if (len > 0)
482368 {
487373 return 0;
488374 }
489375
490 if ((temp = SendByteMast(slave | 1)) != 0)
376 if ((temp = WriteByte(slave | 1)) != 0)
491377 {
492378 err_no = (temp == IICERR_NOTACK) ? IICERR_NOADDRACK : temp;
493379 last_addr = slave | 1;
496382
497383 while (len > 1)
498384 {
499 if ((temp = RecByteMast(0)) < 0)
385 if ((temp = ReadByte(0)) < 0)
500386 {
501387 err_no = temp;
502388 goto fineR;
508394 }
509395
510396 // last byte received without acknowledge
511 if ((temp = RecByteMast(1)) < 0)
397 if ((temp = ReadByte(1)) < 0)
512398 {
513399 err_no = temp;
514400 goto fineR;
520406 err_no = 0;
521407
522408 fineR:
523 qDebug() << "I2CBus::StartRead() = " << (long)(length - len) << ", err_no = " << err_no << " - OUT";
409 //qDebug() << Q_FUNC_INFO << "=" << (long)(length - len) << ", err_no =" << err_no << " - OUT";
524410
525411 return length - len;
526412 }
530416 int error;
531417 long len = length;
532418
533 qDebug() << "I2CBus::StartWrite(" << slave << ", " << (hex) << data << ", " << (dec) << length << ") - IN";
419 //qDebug() << Q_FUNC_INFO << "(" << (hex) << slave << "," << data << "," << (dec) << length << ") - IN";
534420
535421 if (len == 0)
536422 {
543429 return 0;
544430 }
545431
546 if ((error = SendByteMast(slave & 0xFE)))
432 if ((error = WriteByte(slave & 0xFE)))
547433 {
548434 err_no = (error == IICERR_NOTACK) ? IICERR_NOADDRACK : error;
549435 last_addr = slave & 0xFE;
552438
553439 while (len > 0)
554440 {
555 if ((error = SendByteMast(*data++)) != 0)
441 if ((error = WriteByte(*data++)) != 0)
556442 {
557443 err_no = error;
558444 goto fineW;
562448 }
563449
564450 fineW:
565 qDebug() << "I2CBus::StartWrite() = " << (long)(length - len) << ", err_no = " << err_no << " - OUT";
451 //qDebug() << Q_FUNC_INFO << "=" << (long)(length - len) << ", err_no =" << err_no << " - OUT";
566452
567453 return length - len;
568454 }
569455
570456 int I2CBus::Stop(void)
571457 {
572 qDebug() << "I2CBus::Stop() - IN";
458 //qDebug() << Q_FUNC_INFO << "- IN";
573459
574460 err_no = SendStop() ? IICERR_STOP : 0;
575461
576 qDebug() << "I2CBus::Stop() = " << err_no << " - OUT";
462 //qDebug() << Q_FUNC_INFO << "=" << err_no << "- OUT";
577463
578464 return err_no;
579465 }
580466
581467 int I2CBus::Reset(void)
582468 {
583 qDebug() << "I2CBus::Reset() - IN";
469 qDebug() << Q_FUNC_INFO << "- IN";
584470
585471 SetDelay();
586472
587473 uint8_t c;
588474 Read(0x00, &c, 0);
589475 setSCLSDA();
590 WaitMsec(100); //tolto il commento il 25/01/1999 e raddoppiato per permettere il funzionamento della 2402 non Cmos
591
592 qDebug() << "I2CBus::Reset() - OUT";
476 WaitMsec(100); //a big delay to allow no-CMOS 2402 to work
477
478 qDebug() << Q_FUNC_INFO << "- OUT";
593479
594480 return OK;
595481 }
596482
597483 void I2CBus::Close(void)
598484 {
599 qDebug() << "I2CBus::Close() busI=" << (hex) << busI << (dec);
485 qDebug() << Q_FUNC_INFO << "busI=" << (hex) << busI << (dec);
600486
601487 setSCLSDA();
602488 BusIO::Close();
3030
3131 class I2CBus : public BusIO
3232 {
33 public: //------------------------------- public
33 public:
3434 I2CBus(BusInterface *ptr = 0);
3535 virtual ~I2CBus();
3636
3838 long Write(int slave, uint8_t const *data, long length, int page_size = 0);
3939
4040 int Start(uint8_t slave);
41 int ReadByte(int ack, int lsb = 0);
42 int WriteByte(int by, int lsb = 0);
41 int ReadByte(int ack, bool lsb = false);
42 int WriteByte(int by, bool lsb = false);
4343 long StartRead(uint8_t slave, uint8_t *data, long length);
4444 long StartWrite(uint8_t slave, uint8_t const *data, long length);
4545 int Stop();
4646 int Reset();
4747
48 virtual int Open(int port)
49 {
50 Q_CHECK_PTR(busI);
51 busI->SetI2CMode(true);
52 return BusIO::Open(port);
53 }
54
4855 void Close();
4956 int TestPort(int port);
50 // int Calibration(int slave = 0xA0);
57 //int Calibration(int slave = 0xA0);
5158
5259 void SetDelay();
5360
54 protected: //------------------------------- protected
61 protected:
5562
63 void RecoverSlave();
5664 int CheckBusy();
5765 int SendStart();
5866 int SendStop();
5967 int SendBitMast(int b);
6068 int RecBitMast();
61 int SendByteMast(int by);
62 int SendByteMastLSB(int by);
63 int RecByteMast(int ack);
64 int RecByteMastLSB(int ack);
6569
66 private: //------------------------------- private
67
70 private:
6871
6972 void setSCLSDA()
7073 {
5151 IMBus::IMBus(BusInterface *ptr)
5252 : BusIO(ptr)
5353 {
54 qDebug() << "IMBus::IMBus()";
54 qDebug() << Q_FUNC_INFO;
5555
5656 StatusLocation = 526; //526 for NVM3060, 14 for MDA2062
5757 SecondaryAddress = false;
6262 // Distruttore
6363 IMBus::~IMBus()
6464 {
65 qDebug() << "IMBus::~IMBus()";
66
67 // Close();
65 qDebug() << Q_FUNC_INFO;
6866 }
6967
7068 void IMBus::SetStatusLocation(int val)
109107 break;
110108
111109 case FAST:
112 n = 3;
110 n = 4;
113111 break;
114112
115113 case SLOW:
116 n = 18;
114 n = 30;
117115 break;
118116
119117 case VERYSLOW:
120 n = 80;
118 n = 100;
121119 break;
122120
123121 case ULTRASLOW:
125123 break;
126124
127125 default:
128 n = 5; //Default (< 100KHz)
129 break;
130 }
131
132 BusIO::SetDelay(n);
133
134 qDebug() << "IMBus::SetDelay() = " << n;
126 n = 10; //Default (< 100KHz)
127 break;
128 }
129
130 Q_CHECK_PTR(busI);
131 busI->SetDelay(n);
132
133 qDebug() << Q_FUNC_INFO << "=" << n;
135134 }
136135
137136 int IMBus::SendDataBit(int b)
138137 {
139 clearCLK(); //set clock low
140 bitDI(b);
141 WaitUsec(shot_delay);
142 setCLK(); //device latch data bit now!
143 WaitUsec(shot_delay);
144
145 return OK;
146 }
147
148 // ritorna un numero negativo se c'e` un errore, altrimenti 0 o 1
138 //clearCLK(); //set clock low
139 //bitDI(b);
140 //ShotDelay();
141 //setCLK(); //device latch data bit now!
142 //ShotDelay();
143
144 int err = OK;
145 setCLK();
146 busI->xferBit(err, b, SPI_MODE_3 | xMODE_WRONLY);
147
148 return err;
149 }
150
151 // return negative number in case of error, otherwise received bit (0 or 1)
149152 int IMBus::RecDataBit()
150153 {
151 register uint8_t b;
152
153 clearCLK(); //the eeprom set data now
154 WaitUsec(shot_delay);
155 setCLK();
156 b = getDO();
157 WaitUsec(shot_delay);
158
159 return b;
154 //clearCLK(); //the eeprom set data now
155 //ShotDelay();
156 //setCLK();
157 //b = getDO();
158 //ShotDelay();
159
160 int err = OK;
161 setCLK();
162 int rv = busI->xferBit(err, 1, SPI_MODE_3 | xMODE_RDONLY);
163 if (err == OK)
164 {
165 return rv;
166 }
167 else
168 {
169 return err;
170 }
160171 }
161172
162173 int IMBus::IdentPulse()
163174 {
164175 clearIdent();
165 WaitUsec(shot_delay);
176 ShotDelay(6);
166177 setIdent();
167 WaitUsec(shot_delay);
178 ShotDelay(2);
168179
169180 return OK;
170181 }
172183 //byte operations
173184 int IMBus::SendAddrWord(int wo)
174185 {
175 int k;
176
186 int err = OK;
187
188 setCLK();
177189 clearIdent();
178190
179191 //From LSB to MSB
180 for (k = 0; k < 8; k++)
181 {
182 SendDataBit(wo & (1 << k));
183 }
192 //for (int k = 0; k < 8; k++)
193 // SendDataBit(wo & (1 << k));
194 busI->xferByte(err, wo, SPI_MODE_3 | xMODE_WRONLY, 8, true);
184195
185196 setCLK();
186197 setDI();
187198 setIdent();
188
189 return OK;
199 ShotDelay(2); //1.5 usec
200
201 return err;
190202 }
191203
192204 int IMBus::SendDataWord(long wo, int wlen)
193205 {
194 int k;
206 int err = OK;
207
208 setCLK();
209 setIdent();
195210
196211 //From LSB to MSB
197 for (k = 0; k < wlen; k++)
198 {
199 SendDataBit(wo & (1 << k));
200 }
212 //for (int k = 0; k < wlen; k++)
213 // SendDataBit(wo & (1 << k));
214 busI->xferWord(err, wo, SPI_MODE_3 | xMODE_WRONLY, wlen, true);
201215
202216 setCLK();
203217 setDI();
204218
205 return OK;
219 return err;
206220 }
207221
208222 int IMBus::RecDataWord(int wlen)
209223 {
210 int k, val = 0;
224 int err = OK;
211225
212226 setCLK();
213227 setDI();
214
215 for (k = 0; k < wlen; k++)
216 if (RecDataBit())
217 {
218 val |= 1 << k;
219 }
220
221 return val;
228 setIdent();
229
230 //int val = 0;
231 //for (int k = 0; k < wlen; k++)
232 // if (RecDataBit())
233 // val |= 1 << k;
234 int rv = busI->xferWord(err, 0xffff, SPI_MODE_3 | xMODE_RDONLY, wlen, true);
235 if (err == OK)
236 {
237 return rv;
238 }
239 else
240 {
241 return err;
242 }
222243 }
223244
224245 int IMBus::WaitReadyAfterWrite(int addr, int delay, long timeout)
3030
3131 class IMBus : public BusIO
3232 {
33 public: //------------------------------- public
33 public:
3434 IMBus(BusInterface *ptr = 0);
3535 virtual ~IMBus();
3636
4646 void SetDataMode(int val);
4747 void SetProgDelay(int val);
4848
49 protected: //------------------------------- protected
49 protected:
5050
5151 int SendAddrWord(int wo);
5252 int SendDataWord(long wo, int wlen = 8);
6464 busI->SetControlLine(0);
6565 }
6666
67 private: //------------------------------- private
67 private:
6868
6969 int StatusLocation;
7070 bool SecondaryAddress;
3434 class e2CmdWindow;
3535
3636
37 //======================>>> infoModalDialog::infoModalDialog <<<==================
3837 e24xx_infoModalDialog::e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc, long size, const QString title) :
3938 QDialog(bw)
4039 {
8685 }
8786
8887
89 //===================>>> infoModalDialog::~infoModalDialog <<<====================
9088 e24xx_infoModalDialog::~e24xx_infoModalDialog()
9189 {
9290 qDebug() << "infoModalDialog::~infoModalDialog()";
9997 }
10098
10199
102 //======================>>> infoModalDialog::infoModalDialog <<<==================
103100 other_infoModalDialog::other_infoModalDialog(QWidget *bw, long fsize, long esize, uint16_t crc, const QString title) :
104101 QDialog(bw)
105102 {
140137 }
141138
142139
143 //===================>>> infoModalDialog::~infoModalDialog <<<====================
144140 other_infoModalDialog::~other_infoModalDialog()
145141 {
146142 qDebug() << "infoModalDialog::~infoModalDialog()";
4242 class e24xx_infoModalDialog : public QDialog, public cTranslator, public Ui::EditDialog
4343 {
4444 Q_OBJECT
45 public: //---------------------------------------- public
45 public:
4646 e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc, long size, const QString title = translate(STR_MSGDEVINFO));
4747 virtual ~e24xx_infoModalDialog(); // Destructor
4848 // virtual int infoAction(char* msg = "Device Info");
5050 private slots:
5151 void onOk();
5252
53 protected: //--------------------------------------- protected
53 protected:
5454
55 private: //--------------------------------------- private
55 private:
5656
5757 };
5858
6161 class other_infoModalDialog : public QDialog, public cTranslator, public Ui::EditDialog
6262 {
6363 Q_OBJECT
64 public: //---------------------------------------- public
64 public:
6565 other_infoModalDialog(QWidget *bw, long fsize, long esize, uint16_t crc, const QString title = translate(STR_MSGDEVINFO));
6666 virtual ~other_infoModalDialog(); // Destructor
6767 // virtual int infoAction(char* msg = "Device Info");
6969 private slots:
7070 void onOk();
7171
72 protected: //--------------------------------------- protected
72 protected:
7373
74 private: //--------------------------------------- private
74 private:
7575
7676 };
7777
7979 class notesModalDialog : public QDialog, public cTranslator, public Ui::NotesDialog
8080 {
8181 Q_OBJECT
82 public: //---------------------------------------- public
82 public:
8383 notesModalDialog(QWidget *bw, QString &id, QString &cm, const QString title = translate(STR_MSGDEVNOTE));
8484 virtual ~notesModalDialog(); // Destructor
8585 // QString GetId();
8989 private slots:
9090 void onOk();
9191
92 protected: //--------------------------------------- protected
92 protected:
9393
94 private: //--------------------------------------- private
94 private:
9595 QString *id_ptr;
9696 QString *cm_ptr;
9797
104104 class editModalDialog : public QDialog, public cTranslator, public Ui::EditDialog
105105 {
106106 Q_OBJECT
107 public: //---------------------------------------- public
107 public:
108108 editModalDialog(QWidget *bw, int curval = 0, const QString title = translate(STR_MSGEDITBUG));
109109 virtual ~editModalDialog(); // Destructor
110110 // virtual int editAction(char* msg, int &retval);
114114 void onOk();
115115 void onEdit();
116116
117 protected: //--------------------------------------- protected
117 protected:
118118
119 private: //--------------------------------------- private
119 private:
120120 int oldval;
121121 };
122122
124124 class editModalDialog2 : public QDialog, public cTranslator, public Ui::EditDialog
125125 {
126126 Q_OBJECT
127 public: //---------------------------------------- public
127 public:
128128 editModalDialog2(QWidget *bw, const QString curval = "", const QString title = translate(STR_MSGEDITBUG));
129129 virtual ~editModalDialog2(); // Destructor
130130 // virtual int editAction(char* msg, char *text, int len);
133133 private slots:
134134 void onOk();
135135
136 protected: //--------------------------------------- protected
136 protected:
137137
138 private: //--------------------------------------- private
138 private:
139139 QString val;
140140 };
141141 #endif
2929
3030 #include "types.h"
3131 #include "globals.h"
32 #include "interfconv.h"
3233
3334 struct Interf2Index
3435 {
3637 int index;
3738 QString name;
3839 HInterfaceType type;
40 VidPid vp;
41 InterfPins pins;
42 int port;
3943 };
4044
45 //RaspberryPi default pins
46 #define DEF_GPIO_CTRL 23 //Rst pin 16
47 #define DEF_GPIO_DATAIN 27 //Miso pin 13
48 #define DEF_GPIO_DATAOUT 17 //Mosi pin 11
49 #define DEF_GPIO_CLOCK 24 //Clock pin 18
50
51 #define DEF_MPSSE_CTRL 9 //ACBUS1
52 #define DEF_MPSSE_DATAIN 2 //ADBUS2
53 #define DEF_MPSSE_DATAOUT 1 //ADBUS1
54 #define DEF_MPSSE_CLOCK 0 //ADBUS0
55
4156 static QVector<Interf2Index> index_interface =
4257 {
43 //AutoTag
4458 //Interfaces vector
45 {0, 0, "SI-ProgAPI", SIPROG_API},
46 {0, 1, "SI-ProgI/O", SIPROG_IO},
47 {0, 2, "JDM-API", JDM_API},
48 {1, 0, "AvrISP-API", AVRISP},
49 {1, 1, "AvrISP-I/O", AVRISP_IO},
50 {1, 2, "DT-006-API", DT006_API},
51 {1, 3, "DT-006-I/O", DT006_IO},
52 {1, 4, "EasyI2C-API", EASYI2C_API},
53 {1, 5, "EasyI2C-I/O", EASYI2C_IO},
54 {1, 6, "Linux SysFs GPIO", LINUXSYSFS_IO},
59 {INTERF_COM, 0, "SI-ProgAPI", SIPROG_API},
60 {INTERF_COM, 1, "SI-ProgI/O", SIPROG_IO},
61 {INTERF_COM, 2, "JDM-API", JDM_API},
62 {INTERF_LPT, 0, "AvrISP-API", AVRISP},
63 {INTERF_LPT, 1, "AvrISP-I/O", AVRISP_IO},
64 {INTERF_LPT, 2, "DT-006-API", DT006_API},
65 {INTERF_LPT, 3, "DT-006-I/O", DT006_IO},
66 {INTERF_LPT, 4, "EasyI2C-API", EASYI2C_API},
67 {INTERF_LPT, 5, "EasyI2C-I/O", EASYI2C_IO},
68 {INTERF_USB, 0, "FTDI PonyProgFT", PONYPROG_FT, VidPid(0x0403, 0x6e38), {3, 2, 1, 0, /* 4 */ -1, 5, 7, 6}, FTDI_PORTA},
69 {INTERF_USB, 1, "FTDI JtagKey", FTDI_JTAGKEY, VidPid(0x0403, 0xcff8), {9, 2, 1, 0, -1, -1, -1, -1}, FTDI_PORTA},
70 {INTERF_GPIO, 0, "Linux SysFs GPIO", LINUXSYSFS_IO, VidPid(), {23, 27, 17, 24, -1, -1, -1, -1}},
71 //{INTERF_GPIO, 1, "PonyProgRPi", PONYPROG_RPI},
5572 };
5673
74 int TypeToInterfPort(HInterfaceType type)
75 {
76 for (int k = 0; k < index_interface.count(); k++)
77 {
78 if (index_interface.at(k).type == type)
79 {
80 return index_interface.at(k).port;
81 }
82 }
83
84 return -1;
85 }
86
87 bool TypeToInterfPins(HInterfaceType type, InterfPins &pins)
88 {
89 for (int k = 0; k < index_interface.count(); k++)
90 {
91 if (index_interface.at(k).type == type)
92 {
93 pins = index_interface.at(k).pins;
94 return true;
95 }
96 }
97
98 return false;
99 }
100
101 bool TypeToInterfVidPid(HInterfaceType type, unsigned int &vid, unsigned int &pid)
102 {
103 for (int k = 0; k < index_interface.count(); k++)
104 {
105 if (index_interface.at(k).type == type)
106 {
107 vid = index_interface.at(k).vp.vid;
108 pid = index_interface.at(k).vp.pid;
109 return true;
110 }
111 }
112
113 return false;
114 }
115
116 VidPid TypeToInterfVidPid(HInterfaceType type)
117 {
118 VidPid rv;
119
120 for (int k = 0; k < index_interface.count(); k++)
121 {
122 if (index_interface.at(k).type == type)
123 {
124 rv = index_interface.at(k).vp;
125 break;
126 }
127 }
128
129 return rv;
130 }
131
57132 QStringList GetInterfList(int vector)
58133 {
59134 QStringList lst;
69144 return lst;
70145 }
71146
72 // EK 2017
73147 HInterfaceType NameToInterfType(const QString &name)
74148 {
75149 if (name.length())
96170 return LAST_HT;
97171 }
98172
99
100173 QString TypeToInterfName(HInterfaceType type)
101174 {
102175 for (int k = 0; k < index_interface.count(); k++)
110183 return "";
111184 }
112185
113
114186 int TypeToInterfVector(HInterfaceType type)
115187 {
116188 for (int k = 0; k < index_interface.count(); k++)
124196 return -1;
125197 }
126198
127
128199 int TypeToInterfIndex(HInterfaceType type)
129200 {
130201 for (int k = 0; k < index_interface.count(); k++)
137208
138209 return -1;
139210 }
140
141211
142212 HInterfaceType VindexToInterfType(int vector, int index)
143213 {
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // http://ponyprog.sourceforge.net //
7 // //
8 //-------------------------------------------------------------------------//
9 // //
10 // This program is free software; you can redistribute it and/or //
11 // modify it under the terms of the GNU General Public License //
12 // as published by the Free Software Foundation; either version2 of //
13 // the License, or (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
18 // General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program (see LICENSE); if not, write to the //
22 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
23 // //
24 //=========================================================================//
25
26 #ifndef INTERFCONV_H
27 #define INTERFCONV_H
28
29 #include "globals.h"
30
31 enum
32 {
33 FTDI_PORTA = 0,
34 FTDI_PORTB,
35 FTDI_PORTC,
36 FTDI_PORTD
37 };
38
39 struct InterfPins
40 {
41 int ctrl;
42 int datain;
43 int dataout;
44 int clock;
45 int clockin;
46 int poweron;
47 int enbus;
48 int ctrlin;
49 };
50
51 enum
52 { //Directly correspond to setup interface dialog tab index
53 INTERF_USB = 0,
54 INTERF_COM,
55 INTERF_LPT,
56 INTERF_GPIO
57 };
58
59 extern QStringList GetInterfList(int vector);
60 extern HInterfaceType NameToInterfType(const QString &name);
61 extern QString TypeToInterfName(HInterfaceType type);
62 extern int TypeToInterfVector(HInterfaceType type);
63 extern int TypeToInterfIndex(HInterfaceType type);
64 extern HInterfaceType VindexToInterfType(int vector, int index);
65 extern bool TypeToInterfVidPid(HInterfaceType type, unsigned int &vid, unsigned int &pid);
66 extern VidPid TypeToInterfVidPid(HInterfaceType type);
67 extern bool TypeToInterfPins(HInterfaceType type, InterfPins &pins);
68 extern int TypeToInterfPort(HInterfaceType type);
69
70 #endif // INTERFCONV_H
4848
4949 #include "e2awinfo.h"
5050
51 //======================>>> IntelFileBuf::IntelFileBuf <<<=======================
5251 IntelFileBuf::IntelFileBuf(e2AppWinInfo *wininfo)
5352 : FileBuf(wininfo)
5453 {
5554 file_type = INTEL;
5655 }
5756
58 //======================>>> IntelFileBuf::~IntelFileBuf <<<=======================
5957 IntelFileBuf::~IntelFileBuf()
6058 {
6159 }
127125
128126 out << ":";
129127
130 if (rval)
131 {
132 int checksum = 0;
133 int len = 2;
134
135 //byte count
136 out << QString().sprintf("%02X", len & 0xFF);
137 checksum += len & 0xFF;
138
139 //addr field
140 out << QString().sprintf("%04X", 0);
141
142 if (linear_address)
143 {
144 //record type
145 out << QString().sprintf("%02X", LIN_ADDR_RECORD & 0xFF);
146 checksum += LIN_ADDR_RECORD & 0xFF;
147
148 //adjust extended linear address
149 curaddr >>= 16;
150 }
151 else
152 {
153 //record type
154 out << QString().sprintf("%02X", SEG_ADDR_RECORD & 0xFF);
155 checksum += SEG_ADDR_RECORD & 0xFF;
156
157 //adjust extended segmented address
158 curaddr >>= 4;
159 }
160
161 out << QString().sprintf("%04lX", curaddr & 0xFFFF);
162 checksum += (curaddr >> 8) & 0xFF;
163 checksum += curaddr & 0xFF;
164
165 out << QString().sprintf("%02X\n", (~checksum + 1) & 0xFF);
166 }
128 int checksum = 0;
129 int len = 2;
130
131 //byte count
132 out << QString().sprintf("%02X", len & 0xFF);
133 checksum += len & 0xFF;
134
135 //addr field
136 out << QString().sprintf("%04X", 0);
137
138 if (linear_address)
139 {
140 //record type
141 out << QString().sprintf("%02X", LIN_ADDR_RECORD & 0xFF);
142 checksum += LIN_ADDR_RECORD & 0xFF;
143
144 //adjust extended linear address
145 curaddr >>= 16;
146 }
147 else
148 {
149 //record type
150 out << QString().sprintf("%02X", SEG_ADDR_RECORD & 0xFF);
151 checksum += SEG_ADDR_RECORD & 0xFF;
152
153 //adjust extended segmented address
154 curaddr >>= 4;
155 }
156
157 out << QString().sprintf("%04lX", curaddr & 0xFFFF);
158 checksum += (curaddr >> 8) & 0xFF;
159 checksum += curaddr & 0xFF;
160
161 out << QString().sprintf("%02X\n", (~checksum + 1) & 0xFF);
167162
168163 return rval;
169164 }
171166
172167 #define min(a,b) ( (a < b) ? a : b )
173168
174 //======================>>> IntelFileBuf::Save <<<=======================
175169 int IntelFileBuf::Save(int savetype, long relocation_offset)
176170 {
177171 QFile fh(FileBuf::GetFileName());
260254 }
261255
262256
263 //======================>>> IntelFileBuf::Load <<<=======================
264257 int IntelFileBuf::Load(int loadtype, long relocation_offset)
265258 {
266259 int rval = OK;
306299
307300 QTextStream stream(&fh);
308301
309 while (!fh.atEnd())
302 while (!stream.atEnd())
310303 {
311304 riga = stream.readLine();
312305
313306 // char *s;
314307 int pos;
315 int k;
316308
317309 if ((pos = riga.indexOf(":")) < 0)
318310 {
387379
388380 bool ok = true;
389381 uint8_t *p;
382 unsigned int k;
390383
391384 for (k = 0, p = dp + laddr; k < bcount && ok; k++)
392385 {
3535
3636 class IntelFileBuf : public FileBuf
3737 {
38 public: //---------------------------------------- public
38 public:
3939
4040 IntelFileBuf(e2AppWinInfo *wininfo = 0);
4141 virtual ~IntelFileBuf();
4343 virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0);
4444 virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0);
4545
46 protected: //--------------------------------------- protected
46 protected:
4747
48 private: //--------------------------------------- private
48 private:
4949
5050 int WriteRecord(QFile &fh, uint8_t *bptr, long curaddr, long recsize, int fmt);
5151 int WriteAddressRecord(QFile &fh, long curaddr, bool linear_address = false);
260260
261261 if (IsInstalled())
262262 {
263 int control = cmdWin->GetPolarity();
263 unsigned int control = cmdWin->GetPolarity();
264264 uint8_t cpreg = GetLastData();
265265
266266 if (control & CLOCKINV)
292292
293293 if (IsInstalled())
294294 {
295 int control = cmdWin->GetPolarity();
295 unsigned int control = cmdWin->GetPolarity();
296296 uint8_t cpreg = GetLastData();
297297
298298 if (control & CLOCKINV)
376376 qDebug() << "AvrISPInterface::TestPort(" << port << ") IN";
377377
378378 int ret_val = TestSave(port);
379 Wait w;
380379
381380 if (ret_val == OK)
382381 {
3030
3131 class AvrISPInterface : public LptExtInterface
3232 {
33 public: //------------------------------- public
33 public:
3434 AvrISPInterface(bool use_io = false);
3535
3636 virtual int Open(int com_no);
5050 int SetPower(bool onoff);
5151 void SetControlLine(int res = 1);
5252
53 protected: //------------------------------- protected
53 protected:
5454
55 private: //------------------------------- private
55 private:
5656 int GetPresence();
5757 };
5858
3030
3131 class JdmInterface : public SIProgInterface
3232 {
33 public: //------------------------------- public
33 public:
3434
3535 // virtual int Open(int com_no);
3636 // virtual void Close();
4040 SIProgInterface::SetDataOut(sda);
4141 }
4242
43 protected: //------------------------------- protected
43 protected:
4444
45 private: //------------------------------- private
45 private:
4646
4747 };
4848
199199 return OK;
200200 }
201201
202 int LinuxSysFsInterface::InitPins()
203 {
204 pin_ctrl = E2Profile::GetGpioPinCtrl();
205 pin_datain = E2Profile::GetGpioPinDataIn();
206 pin_dataout = E2Profile::GetGpioPinDataOut();
207 pin_clock = E2Profile::GetGpioPinClock();
208
209 qDebug() << "LinuxSysFsInterface::InitPins Ctrl=" << pin_ctrl << ", Clock= " << pin_clock;
210 qDebug() << "DataIn=" << pin_datain << ", DataOut=" << pin_dataout;
211
212 #ifdef Q_OS_LINUX
213 fd_ctrl = gpio_open(pin_ctrl, GPIO_OUT);
214 fd_clock = gpio_open(pin_clock, GPIO_OUT);
215 fd_datain = gpio_open(pin_datain, GPIO_IN);
216 fd_dataout = gpio_open(pin_dataout, GPIO_OUT);
202 int LinuxSysFsInterface::InitPins(int idx)
203 {
204 if (pins.ctrl == 0 && pins.clock == 0 && pins.datain == 0 && pins.dataout == 0)
205 {
206 qWarning() << "LinuxSysFsInterface::InitPins() Unconfigured pins";
207 return E2ERR_OPENFAILED;
208 }
209
210 qDebug() << "LinuxSysFsInterface::InitPins Ctrl=" << pins.ctrl << ", Clock= " << pins.clock;
211 qDebug() << "DataIn=" << pins.datain << ", DataOut=" << pins.dataout;
212
213 #ifdef Q_OS_LINUX
214 fd_ctrl = gpio_open(pins.ctrl, GPIO_OUT);
215 fd_clock = gpio_open(pins.clock, GPIO_OUT);
216 fd_datain = gpio_open(pins.datain, GPIO_IN);
217 fd_dataout = gpio_open(pins.dataout, GPIO_OUT);
217218
218219 if (fd_ctrl < 0 || fd_clock < 0 || fd_datain < 0 || fd_dataout < 0)
219220 {
228229 void LinuxSysFsInterface::DeInitPins()
229230 {
230231 #ifdef Q_OS_LINUX
231 gpio_close(pin_ctrl, fd_ctrl);
232 gpio_close(pin_clock, fd_clock);
233 gpio_close(pin_datain, fd_datain);
234 gpio_close(pin_dataout, fd_dataout);
232 gpio_close(pins.ctrl, fd_ctrl);
233 gpio_close(pins.clock, fd_clock);
234 gpio_close(pins.datain, fd_datain);
235 gpio_close(pins.dataout, fd_dataout);
235236 fd_ctrl = fd_clock = fd_datain = fd_dataout = -1;
236237 #endif
237238 }
238239
239 int LinuxSysFsInterface::Open(int com_no)
240 {
241 qDebug() << "LinuxSysFsInterface::Open(" << com_no << ") IN";
240 int LinuxSysFsInterface::Open(int port_no)
241 {
242 qDebug() << Q_FUNC_INFO << " (" << port_no << ") IN";
242243
243244 int ret_val = OK;
244245
245 if (GetInstalled() != com_no)
246 {
247 if ((ret_val = InitPins()) == OK)
248 {
249 Install(com_no);
250 }
251 }
252
253 qDebug() << "LinuxSysFsInterface::Open() = " << ret_val << " OUT";
246 if (GetInstalled() != port_no)
247 {
248 if ((ret_val = InitPins(port_no)) == OK)
249 {
250 Install(port_no);
251 }
252 }
253
254 qDebug() << Q_FUNC_INFO << " = " << ret_val << " OUT";
254255
255256 return ret_val;
256257 }
257258
258259 void LinuxSysFsInterface::Close()
259260 {
260 qDebug() << "LinuxSysFsInterface::Close() IN";
261 qDebug() << Q_FUNC_INFO << " IN";
261262
262263 if (IsInstalled())
263264 {
266267 DeInstall();
267268 }
268269
269 qDebug() << "LinuxSysFsInterface::Close() OUT";
270 qDebug() << Q_FUNC_INFO << " OUT";
270271 }
271272
272273 // Per l'AVR e` la linea di RESET
273274 void LinuxSysFsInterface::SetControlLine(int res)
274275 {
275 qDebug() << "LinuxSysFsInterface::SetControlLine(" << res << ") *** Inst=" << IsInstalled() << ", fd=" << fd_ctrl;
276
277 if (IsInstalled())
278 {
276 qDebug() << Q_FUNC_INFO << " (" << res << ") *** Inst=" << IsInstalled() << ", fd=" << fd_ctrl;
277
278 if (IsInstalled())
279 {
280 #ifdef Q_OS_LINUX
279281 if (cmdWin->GetPolarity() & RESETINV)
280282 {
281283 res = !res;
282284 }
283285
284 #ifdef Q_OS_LINUX
285286 int ret;
286287
287288 if (res)
304305
305306 void LinuxSysFsInterface::SetDataOut(int sda)
306307 {
307 qDebug() << "LinuxSysFsInterface::SetDataOut(" << sda << ") *** Inst=" << IsInstalled() << ", fd=" << fd_dataout;
308
309 if (IsInstalled())
310 {
308 qDebug() << Q_FUNC_INFO << "(" << sda << ") *** Inst=" << IsInstalled() << ", fd=" << fd_dataout;
309
310 if (IsInstalled())
311 {
312 #ifdef Q_OS_LINUX
311313 if ((cmdWin->GetPolarity() & DOUTINV))
312314 {
313315 sda = !sda;
314316 }
315317
316 #ifdef Q_OS_LINUX
317318 int ret;
318319
319320 if (sda)
336337
337338 void LinuxSysFsInterface::SetClock(int scl)
338339 {
339 qDebug() << "LinuxSysFsInterface::SetClock(" << scl << ") *** Inst=" << IsInstalled() << ", fd=" << fd_clock;
340
341 if (IsInstalled())
342 {
340 qDebug() << Q_FUNC_INFO << "(" << scl << ") *** Inst=" << IsInstalled() << ", fd=" << fd_clock;
341
342 if (IsInstalled())
343 {
344 #ifdef Q_OS_LINUX
343345 if ((cmdWin->GetPolarity() & CLOCKINV))
344346 {
345347 scl = !scl;
346348 }
347349
348 #ifdef Q_OS_LINUX
349350 int ret;
350351
351352 if (scl)
368369
369370 void LinuxSysFsInterface::SetClockData()
370371 {
371 qDebug() << "LinuxSysFsInterface::SetClockData() *** Inst=" << IsInstalled();
372 qDebug() << Q_FUNC_INFO << " *** Inst=" << IsInstalled();
372373
373374 if (IsInstalled())
374375 {
377378 }
378379 }
379380
380
381381 void LinuxSysFsInterface::ClearClockData()
382382 {
383 qDebug() << "LinuxSysFsInterface::ClearClockData() *** Inst=" << IsInstalled();
383 qDebug() << Q_FUNC_INFO << " *** Inst=" << IsInstalled();
384384
385385 if (IsInstalled())
386386 {
407407 qWarning("LinuxSysFsInterface::GetDataIn() read failed (%d)\n", ret);
408408 exit(1);
409409 }
410 #endif
411 qDebug() << "LinuxSysFsInterface::GetDataIn()=" << val << ", fd=" << fd_datain;
410 qDebug() << Q_FUNC_INFO << "=" << val << ", fd=" << fd_datain;
412411
413412 if (cmdWin->GetPolarity() & DININV)
414413 {
415 return !val;
416 }
417 else
418 {
419 return val;
420 }
414 val = !val;
415 }
416 #endif
417 return val;
421418 }
422419 else
423420 {
432429
433430 int LinuxSysFsInterface::IsClockDataUP()
434431 {
435 qDebug() << "LinuxSysFsInterface::IsClockDataUP() *** Inst=" << IsInstalled();
432 qDebug() << Q_FUNC_INFO << " *** Inst=" << IsInstalled();
436433
437434 return GetDataIn();
438435 }
439436
440437 int LinuxSysFsInterface::IsClockDataDOWN()
441438 {
442 qDebug() << "LinuxSysFsInterface::IsClockDataDOWN() *** Inst=" << IsInstalled();
439 qDebug() << Q_FUNC_INFO << " *** Inst=" << IsInstalled();
443440
444441 return !GetDataIn();
445442 }
446
447 /**
448 int LinuxSysFsInterface::TestPort(int com_no)
449 {
450 qDebug() << "LinuxSysFsInterface::TestPort(%d) IN"<< com_no;
451 int ret_val = TestSave(com_no);
452
453 if (ret_val == OK)
454 {
455 int a,b;
456 Wait w;
457
458 ret_val = E2ERR_OPENFAILED;
459
460 SetClockData();
461 w.WaitMsec(50);
462 a = (GetCPWReg() & WF_SCL) ? 1 : 0;
463 b = GetPresence() ? 1 : 0;
464
465 if (a == b)
466 {
467 ClearClockData();
468 w.WaitMsec(50);
469 a = (GetCPWReg() & WF_SCL) ? 1 : 0;
470 b = GetPresence() ? 1 : 0;
471
472 if (a == b)
473 {
474 SetClockData();
475 w.WaitMsec(50);
476 a = (GetCPWReg() & WF_SCL) ? 1 : 0;
477 b = GetPresence() ? 1 : 0;
478
479 if (a == b)
480 ret_val = OK;
481 }
482 }
483 }
484 TestRestore();
485 qDebug() << "LinuxSysFsInterface::TestPort() = %d OUT"<< ret_val;
486
487 return ret_val;
488 }
489 **/
2828
2929 #include "businter.h"
3030
31
3231 class LinuxSysFsInterface : public BusInterface
3332 {
34 public: //------------------------------- public
33 public:
3534 LinuxSysFsInterface();
3635 virtual ~LinuxSysFsInterface();
3736
4746 virtual int IsClockDataUP();
4847 virtual int IsClockDataDOWN();
4948
50 // virtual int TestPort(int port);
49 //virtual int TestPort(int port);
5150
5251 int SetPower(bool onoff);
5352 void SetControlLine(int res = 1);
5453
55 protected: //------------------------------- protected
56 // int GetPresence() const;
54 protected:
55 //int GetPresence() const;
5756
58 private: //------------------------------- private
59 int InitPins();
57 private:
58 int InitPins(int idx);
6059 void DeInitPins();
61
62 int pin_ctrl;
63 int pin_datain;
64 int pin_dataout;
65 int pin_clock;
6660
6761 int fd_ctrl;
6862 int fd_datain;
3232
3333 class LptExtInterface : public BusInterface
3434 {
35 public: //------------------------------- public
35 public:
3636 LptExtInterface(bool use_io = false)
3737 {
3838 io_mode = use_io;
5151 io_mode = use_io;
5252 }
5353
54 protected: //------------------------------- protected
54 protected:
5555
5656 int InDataPort(int port_no = -1)
5757 {
8888 return io_mode ? lptio.GetLastCtrl() : lpt.GetLastCtrl();
8989 }
9090
91 private: //------------------------------- private
91 private:
9292
9393 static LPTInterface lpt;
9494 static LPTIOInterface lptio;
3131
3232 class LPTIOInterface : public PortInterface
3333 {
34 public: //------------------------------- public
34 public:
3535 LPTIOInterface();
3636 virtual ~LPTIOInterface();
3737
5757 return last_ctrl;
5858 }
5959
60 protected: //------------------------------- protected
60 protected:
6161
62 private: //------------------------------- private
62 private:
6363
6464 int lpt_port;
6565 uint8_t last_ctrl, last_data;
4848
4949 class LPTInterface
5050 {
51 public: //------------------------------- public
51 public:
5252 LPTInterface();
5353 virtual ~LPTInterface();
5454
7070 return last_ctrl;
7171 }
7272
73 protected: //------------------------------- protected
73 protected:
7474
75 private: //------------------------------- private
75 private:
7676 #ifdef Q_OS_LINUX
7777 int hLpt;
7878 #endif
2626 #include "types.h"
2727 #include "globals.h"
2828
29
3029 #include "e2profil.h"
3130 #include "microbus.h"
3231 #include "errcode.h"
3635 #include <QDebug>
3736 #include <QtCore>
3837
39 #ifdef Q_OS_LINUX
40 # include <unistd.h>
41 #else
42 # ifdef __BORLANDC__
43 # define __inline__
44 # else // _MICROSOFT_ VC++
45 # define __inline__ __inline
46 # define _export
47 # endif
48 #endif
49
50 // Costruttore
5138 MicroWireBus::MicroWireBus(BusInterface *ptr)
5239 : BusIO(ptr)
5340 {
54 qDebug() << "MicroWireBus::MicroWireBus()";
55 }
56
57 // Distruttore
41 qDebug() << Q_FUNC_INFO;
42 }
43
5844 MicroWireBus::~MicroWireBus()
5945 {
60 qDebug() << "MicroWireBus::~MicroWireBus()";
61
62 // Close();
46 qDebug() << Q_FUNC_INFO;
6347 }
6448
6549 void MicroWireBus::SetDelay()
7054 switch (val)
7155 {
7256 case TURBO:
73 n = 0; // as fast as your PC can
57 n = 1; // as fast as your PC can
7458 break;
7559
7660 case FAST:
77 n = 1;
61 n = 5;
7862 break;
7963
8064 case SLOW:
81 n = 10;
65 n = 50;
8266 break;
8367
8468 case VERYSLOW:
85 n = 80;
69 n = 200;
8670 break;
8771
8872 case ULTRASLOW:
89 n = 500;
73 n = 800;
9074 break;
9175
9276 default:
93 n = 5; //Default (< 100KHz)
94 break;
95 }
96
97 BusIO::SetDelay(n);
98
99 qDebug() << "MicroWire::SetDelay() = " << n;
100 }
101
77 n = 10; //Default (< 100KHz)
78 break;
79 }
80
81 Q_CHECK_PTR(busI);
82 busI->SetDelay(n);
83
84 qDebug() << Q_FUNC_INFO << "=" << n;
85 }
10286
10387 int MicroWireBus::SendDataBit(int b)
10488 {
105 clearCLK(); //si assicura che SCK low
106 bitDI(b);
107
108 WaitUsec(shot_delay);
109
110 setCLK(); //device latch data bit now!
111
112 WaitUsec(shot_delay);
113
114 clearCLK();
115
116 return OK;
117 }
118
119 // ritorna un numero negativo se c'e` un errore, altrimenti 0 o 1
89 //clearCLK(); //si assicura che SCK low
90 //bitDI(b);
91 //ShotDelay();
92 //setCLK(); //device latch data bit now!
93 //ShotDelay();
94 //clearCLK();
95
96 int err = OK;
97 busI->xferBit(err, b, SPI_MODE_0 | xMODE_WRONLY);
98
99 return err;
100 }
101
120102 int MicroWireBus::RecDataBit()
121103 {
122 register uint8_t b;
123
124 clearCLK(); //si assicura che SCK low
125
126 WaitUsec(shot_delay);
127
128 setCLK();
129
130 WaitUsec(shot_delay);
131
132 b = getDO();
133 clearCLK();
134
135 return b;
104 //clearCLK(); //si assicura che SCK low
105 //ShotDelay();
106 //setCLK();
107 //ShotDelay();
108 //b = getDO();
109 //clearCLK();
110
111 int err = OK;
112 int rv = busI->xferBit(err, 1, SPI_MODE_1 | xMODE_RDONLY);
113 if (err == OK)
114 {
115 return rv;
116 }
117 else
118 {
119 return err;
120 }
136121 }
137122
138123 int MicroWireBus::RecDataBitShort()
139124 {
140 clearCLK(); //si assicura che SCK low
141 WaitUsec(shot_delay);
125 clearCLK(); //be sure SCK low
126 ShotDelay();
142127 return getDO();
143128 }
144129
145 // OK, ora ci alziamo di un livello: operiamo sul byte
146 int MicroWireBus::SendDataWord(int wo, int wlen, int lsb)
147 {
148 int k;
149
150 clearCLK();
151
152 if (lsb)
153 {
154 //Dal meno significativo al piu` significativo
155 for (k = 0; k < wlen; k++)
156 {
157 SendDataBit(wo & (1 << k));
158 }
159 }
160 else //Dal piu` significativo al meno significativo
161 {
162 for (k = wlen - 1; k >= 0; k--)
163 {
164 SendDataBit(wo & (1 << k));
165 }
166 }
167
130 int MicroWireBus::SendDataWord(int wo, int wlen, bool lsb)
131 {
132 int err = OK;
133 clearCLK();
134 busI->xferWord(err, wo, SPI_MODE_0 | xMODE_WRONLY, wlen, lsb);
168135 clearDI();
169136
170 return OK;
137 return err;
171138 }
172139
173140 //Standard Receive data word
174 int MicroWireBus::RecDataWord(int wlen, int lsb)
175 {
176 int k, val = 0;
177
178 clearCLK();
179
180 if (lsb)
181 {
182 for (k = 0; k < wlen; k++)
183 if (RecDataBit())
184 {
185 val |= (1 << k);
186 }
141 int MicroWireBus::RecDataWord(int wlen, bool lsb)
142 {
143 int err = OK;
144 clearCLK();
145 int rv = busI->xferWord(err, 0xffff, SPI_MODE_1 | xMODE_RDONLY, wlen, lsb);
146 if (err == OK)
147 {
148 return rv;
187149 }
188150 else
189151 {
190 for (k = wlen - 1; k >= 0; k--)
191 if (RecDataBit())
192 {
193 val |= (1 << k);
194 }
195 }
196
197 return val;
152 return err;
153 }
198154 }
199155
200156 //Receive Data word with the first clock pulse shortened.
201157 // In case of the device doesn't leave a clock pulse to switch
202158 // from DataOut to DataIn after the command
203 int MicroWireBus::RecDataWordShort(int wlen, int lsb)
204 {
205 int k, val = 0;
206
207 clearCLK();
208
209 if (wlen > 0)
210 {
211 if (lsb)
212 {
213 val = RecDataBitShort() ? 1 : 0;
214
215 for (k = 1; k < wlen; k++)
216 if (RecDataBit())
217 {
218 val |= (1 << k);
219 }
220 }
221 else
222 {
223 val = RecDataBitShort() ? 1 << (wlen - 1) : 0;
224
225 for (k = wlen - 2; k >= 0; k--)
226 if (RecDataBit())
227 {
228 val |= (1 << k);
229 }
230 }
231 }
232
233 return val;
159 int MicroWireBus::RecDataWordShort(int wlen, bool lsb)
160 {
161 int valb = 0, valw = 0;
162
163 Q_ASSERT(wlen > 1);
164
165 clearCLK();
166 valb = RecDataBitShort() ? 1 : 0;
167 valw = RecDataWord(wlen - 1, lsb);
168
169 if (lsb)
170 {
171 return (valw << 1) | valb;
172 }
173 else
174 {
175 return (valb << (wlen - 1)) | valw;
176 }
234177 }
235178
236179 int MicroWireBus::WaitReadyAfterWrite(long timeout)
237180 {
238181 clearCLK();
239 ClearReset(); //27/05/98
240
241 WaitUsec(shot_delay);
242
243 SetReset(); //27/05/98
244
245 WaitUsec(shot_delay);
246
182 ClearReset(); //27/05/98
183 ShotDelay();
184 SetReset(); //27/05/98
185 ShotDelay();
247186 clearCLK();
248187
249188 long k;
250
251 for (k = timeout; k > 0 && !getDO(); k--)
252 {
253 WaitUsec(1); //07/08/99 ** try to fix temporization (so to need only one global calibration)
254 }
255
256 qDebug() << "MicroWireBus::WaitReadyAfterWrite() = " << k;
189 for (k = timeout; k > 0 && !getDO(); k--)
190 {
191 WaitUsec(1);
192 }
193
194 qDebug() << Q_FUNC_INFO << "=" << k;
257195
258196 return k ? OK : E2P_TIMEOUT;
259197 }
260198
261199 int MicroWireBus::Reset(void)
262200 {
263 qDebug() << "MicroWireBus::Reset()";
201 qDebug() << Q_FUNC_INFO;
264202
265203 SetDelay();
266204
267205 clearCLK();
268 //clearDI(); //27/05/98
206 //clearDI(); //27/05/98
269207 setDI();
270208
271 ClearReset(); //Da un impulso sul reset
272 WaitMsec(1); //27/05/98
209 ClearReset(); //Pulse the reset
210 WaitMsec(1); //27/05/98
273211 SetReset();
274212
275213 WaitMsec(50);
277215 return OK;
278216 }
279217
280
281218 int MicroWireBus::CalcAddressSize(int mem_size) const
282219 {
283220 if (mem_size-- <= 0)
288225 int k;
289226
290227 for (k = 15; k > 0; k--)
228 {
291229 if (mem_size & (1 << k))
292230 {
293231 break;
294232 }
233 }
295234
296235 return k + 1;
297236 }
298
3434
3535 class MicroWireBus : public BusIO
3636 {
37 public: //------------------------------- public
37 public:
3838 MicroWireBus(BusInterface *ptr = nullptr);
3939 virtual ~MicroWireBus();
4040
41 // long Read(int addr, uint8_t *data, long length);
42 // long Write(int addr, uint8_t const *data, long length);
41 //long Read(int addr, uint8_t *data, long length);
42 //long Write(int addr, uint8_t const *data, long length);
4343
4444 int Reset();
4545
4747
4848 void SetDelay();
4949
50 protected: //------------------------------- protected
50 protected:
5151
52 int SendDataWord(int wo, int wlen, int lsb = 0);
53 int RecDataWord(int wlen, int lsb = 0);
54 int RecDataWordShort(int wlen, int lsb = 0);
52 int SendDataWord(int wo, int wlen, bool lsb = false);
53 int RecDataWord(int wlen, bool lsb = false);
54 int RecDataWordShort(int wlen, bool lsb = false);
5555 int WaitReadyAfterWrite(long timeout = 50000);
5656
5757 int SendAddress(int addr, int alen)
6868 busI->SetControlLine(0);
6969 }
7070
71 private: //------------------------------- private
71 private:
7272
7373 int SendDataBit(int b);
7474 int RecDataBit();
4747 #include "errcode.h"
4848 #include "crc.h"
4949
50 // #include "e2awinfo.h"
51
52 //======================>>> MotorolaSFileBuf::MotorolaSFileBuf <<<=======================
5350 MotorolaSFileBuf::MotorolaSFileBuf(e2AppWinInfo *wininfo)
54 : FileBuf(wininfo)
51 : FileBuf(wininfo),
52 highestPC(NULL),
53 highestAddr(0),
54 lowestAddr(0x7fffffff),
55 valid_record_count(0)
5556 {
5657 file_type = MOTOS;
57
58 highestPC = NULL;
59 highestAddr = 0;
60 lowestAddr = 0x7fffffff;
6158 }
62
63 //======================>>> MotorolaSFileBuf::~MotorolaS1FileBuf <<<=======================
64 MotorolaSFileBuf::~MotorolaSFileBuf()
65 {
66 }
67
6859
6960 int MotorolaSFileBuf::WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr, long recsize, int fmt)
7061 {
193184
194185 #define min(a,b) ( (a < b) ? a : b )
195186
196 //======================>>> MotorolaSFileBuf::Save <<<=======================
197187 int MotorolaSFileBuf::Save(int savetype, long relocation_offset)
198188 {
199189 QFile fh(FileBuf::GetFileName());
303293 }
304294
305295
306 //======================>>> MotorolaSFileBuf::Load <<<=======================
307296 int MotorolaSFileBuf::Load(int loadtype, long relocation_offset)
308297 {
309298 int rval = OK;
369358
370359 if (nocopy_mode)
371360 {
372 if ((highestAddr - lowestAddr) > GetBufSize())
361 if (((int)highestAddr - (int)lowestAddr) > GetBufSize())
373362 {
374363 rval = BUFFEROVERFLOW;
375364 }
426415 return rval;
427416 }
428417
429 //======================>>> MotorolaSFileBuf::ParseRecord <<<=======================
430418 /* Function: ParseRecord
431419 ** Parses an S-record in the buffer and writes it into the buffer
432420 ** if it is has a valid checksum.
436424 */
437425 int MotorolaSFileBuf::ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *buf_endP, long offset, int nocopy)
438426 {
439 long addrL;
440 uint8_t cksmB, // checksum of addr, count, & data length
441 *bufPC = 0; // Pointer into memory array
442 int i, countN, // Number of bytes represented in record
443 oheadN = 0, // Number of overhead (addr + chksum) bytes
444 tvalN; // Temp for check checksum
427 unsigned long addrL;
428 uint8_t cksmB, // checksum of addr, count, & data length
429 *bufPC = 0; // Pointer into memory array
430 unsigned int oheadN = 0, // Number of overhead (addr + chksum) bytes
431 tvalN; // Temp for check checksum
445432 int unknow_rec = 0;
433 unsigned int countN; // Number of bytes represented in record
446434
447435 if (lbufPC[0] == '\n' || lbufPC[0] == '\r')
448436 {
510498 cksmB = 0;
511499 countN++; /* Bump counter to read final checksum too */
512500
513 for (i = 1; i <= countN; i++)
501 for (unsigned int i = 1; i <= countN; i++)
514502 {
515503 sscanf(lbufPC + i * 2, "%2X", &tvalN); /* Scan a 2 hex digit byte */
516504 cksmB += (uint8_t)tvalN;
533521 lowestAddr = addrL;
534522 }
535523
536 if (addrL < offset)
524 if ((long)addrL < offset)
537525 {
538526 return BUFFERUNDERFLOW;
539527 }
549537 cksmB = 0;
550538 countN++; /* Bump counter to read final checksum too */
551539
552 for (i = 1; i <= countN; i++)
540 for (unsigned int i = 1; i <= countN; i++)
553541 {
554542 sscanf(lbufPC + i * 2, "%2X", &tvalN); /* Scan a 2 hex digit byte */
555543 cksmB += (uint8_t)tvalN;
3636
3737 class MotorolaSFileBuf : public FileBuf
3838 {
39 public: //---------------------------------------- public
39 public:
4040
4141 MotorolaSFileBuf(e2AppWinInfo *wininfo = 0);
42 virtual ~MotorolaSFileBuf();
42 //virtual ~MotorolaSFileBuf();
4343
4444 virtual int Load(int loadtype = ALL_TYPE, long relocation_offset = 0);
4545 virtual int Save(int savetype = ALL_TYPE, long relocation_offset = 0);
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
49 private: //--------------------------------------- private
49 private:
5050
5151 int WriteRecord(QTextStream &outs, uint8_t *bptr, long curaddr, long recsize, int fmt);
5252 int ParseRecord(char *lbufPC, uint8_t *buf_startP, uint8_t *buf_endP, long offset, int nocopy);
5353
5454 uint8_t *highestPC;
55 long highestAddr;
56 long lowestAddr;
55 unsigned long highestAddr;
56 unsigned long lowestAddr;
5757
5858 int valid_record_count; //incremented by ParseRecord for each valid record found
5959 };
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // http://ponyprog.sourceforge.net //
7 // //
8 //-------------------------------------------------------------------------//
9 // //
10 // This program is free software; you can redistribute it and/or //
11 // modify it under the terms of the GNU General Public License //
12 // as published by the Free Software Foundation; either version2 of //
13 // the License, or (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
18 // General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program (see LICENSE); if not, write to the //
22 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
23 // //
24 //=========================================================================//
25 // FTDI mpsse IO
26
27 #include "mpsse_interf.h"
28 #include "errcode.h"
29 #include "e2cmdw.h"
30
31 #include <QtCore>
32 #include <QDebug>
33 #include <QProcess>
34 #include <QString>
35
36 MpsseInterface::MpsseInterface()
37 : cmdbuf(),
38 pin_directions(0),
39 ignore_last_data(true),
40 last_data(0),
41 read_data(0),
42 pin_ctrl(0),
43 pin_ctrlin(0),
44 pin_datain(0),
45 pin_dataout(0),
46 pin_clock(0),
47 pin_clockin(0),
48 pin_poweron(0),
49 ftdi_port(FTDI_PORTA),
50 test_step(0)
51 {
52 qDebug() << Q_FUNC_INFO;
53 }
54
55 MpsseInterface::~MpsseInterface()
56 {
57 qDebug() << Q_FUNC_INFO;
58
59 Close();
60 }
61
62 void MpsseInterface::ConfigPins(int pinum_ctrl, int pinum_datain, int pinum_dataout, int pinum_clock, int pinum_clockin, int pinum_poweron, int pinum_enbus, int pinnum_ctrlin)
63 {
64 BusInterface::ConfigPins(pinum_ctrl, pinum_datain, pinum_dataout, pinum_clock, pinum_clockin, pinum_poweron, pinum_enbus, pinnum_ctrlin);
65
66 if (pinum_ctrl >= 0)
67 {
68 pin_ctrl = 1 << pinum_ctrl;
69 }
70
71 if (pinum_datain >= 0)
72 {
73 pin_datain = 1 << pinum_datain;
74 }
75
76 if (pinum_dataout >= 0)
77 {
78 pin_dataout = 1 << pinum_dataout;
79 }
80
81 if (pinum_clock >= 0)
82 {
83 pin_clock = 1 << pinum_clock;
84 }
85 if (pinnum_ctrlin >= 0)
86 {
87 pin_ctrlin = 1 << pinnum_ctrlin;
88 }
89
90 if (pinum_clockin >= 0)
91 {
92 pin_clockin = 1 << pinum_clockin;
93 }
94
95 if (pinum_poweron >= 0)
96 {
97 pin_poweron = 1 << pinum_poweron;
98 }
99
100 if (pinum_enbus >= 0)
101 {
102 pin_enbus = 1 << pinum_enbus;
103 }
104 }
105
106 int MpsseInterface::InitPins()
107 {
108 int result;
109
110 result = ctx.set_bitmode(0, BITMODE_RESET);
111 if (result == 0)
112 {
113 ignore_last_data = true;
114 last_data = 0;
115 pin_directions = 0;
116
117 if (pin_ctrl == 0 && pin_clock == 0 && pin_datain == 0 && pin_dataout == 0)
118 {
119 qWarning() << Q_FUNC_INFO << " Unconfigured pins";
120 return E2ERR_OPENFAILED;
121 }
122
123 qDebug() << Q_FUNC_INFO << (hex)
124 << " Ctrl=" << pin_ctrl
125 << ", Clock=" << pin_clock << ", ClockIn=" << pin_clockin
126 << ", DataIn=" << pin_datain << ", DataOut=" << pin_dataout
127 << ", Poweron=" << pin_poweron << ", EnBus=" << pin_enbus;
128
129 result = ctx.set_bitmode(0, BITMODE_MPSSE);
130 if (result == 0)
131 {
132 ctx.flush();
133 cmdbuf.clear();
134
135 int new_data = 0;
136
137 if (GetI2CMode())
138 {
139 cmdbuf.append(EN_3_PHASE);
140 new_data |= pin_dataout | pin_clock; //I2C need pins high
141 new_data &= ~pin_enbus;
142 }
143 else
144 {
145 cmdbuf.append(DIS_3_PHASE);
146 new_data |= pin_enbus;
147 }
148
149 //cmdbuf.append(LOOPBACK_END);
150 //cmdbuf.append(DIS_ADAPTIVE);
151
152 //00011011 --> 0x1B
153 int new_directions = pin_ctrl | pin_dataout | pin_clock | pin_poweron | pin_enbus;
154 if (usb_vp == TypeToInterfVidPid(FTDI_JTAGKEY))
155 {
156 new_directions |= (1 << 4) | (1 << 11); //hack
157 }
158
159 //Force update
160 last_data = ~new_data & 0xffff;
161 pin_directions = ~new_directions & 0xffff;
162 SendPins(new_data, new_directions); //set pins to ZERO
163 result = Flush();
164 WaitMsec(10);
165 }
166 }
167
168 return result;
169 }
170
171 void MpsseInterface::DeInitPins()
172 {
173 //ctx.set_bitmode(0, BITMODE_RESET);
174 }
175
176 int MpsseInterface::SetFrequency(uint32_t freq)
177 {
178 int32_t divisor, sysclock;
179
180 Q_ASSERT(freq > 0);
181
182 if (freq > 6000000)
183 {
184 sysclock = 60000000;
185 cmdbuf.append(DIS_DIV_5);
186 }
187 else
188 {
189 sysclock = 12000000;
190 cmdbuf.append(EN_DIV_5);
191 }
192
193 divisor = (sysclock / (2 * freq)) - 1;
194 if (divisor < 0)
195 {
196 qDebug() << Q_FUNC_INFO << "Frequency high" << freq;
197 divisor = 0;
198 }
199
200 if (divisor > 65535)
201 {
202 qDebug() << Q_FUNC_INFO << "Frequency low" << freq;
203 divisor = 65535;
204 }
205
206 qDebug() << Q_FUNC_INFO << "Frequency" << (sysclock / (2 * (divisor + 1))) << ", Divisor" << divisor << ", SysClock" << sysclock;
207
208 cmdbuf.append(TCK_DIVISOR);
209 cmdbuf.append(divisor & 0xff);
210 cmdbuf.append((divisor >> 8) & 0xff);
211
212 return Flush();
213 }
214
215 int MpsseInterface::Open(int port)
216 {
217 qDebug() << Q_FUNC_INFO << "(" << port << (hex) << usb_vp.vid << ":" << usb_vp.pid << ") IN";
218
219 int ret_val = OK;
220
221 if (GetInstalled() != port)
222 {
223 ftdi_port = TypeToInterfPort(cmdWin->GetInterfaceType());
224
225 ftdi_interface interf = INTERFACE_A;
226
227 if (ftdi_port == FTDI_PORTB)
228 {
229 interf = INTERFACE_B;
230 }
231 else if (ftdi_port == FTDI_PORTC)
232 {
233 interf = INTERFACE_C;
234 }
235 else if (ftdi_port == FTDI_PORTD)
236 {
237 interf = INTERFACE_D;
238 }
239
240 int result = ctx.set_interface(interf);
241 if (result == 0)
242 {
243 std::string sdesc, sser;
244
245 //result = ctx.open(usb_vp.vid, usb_vp.pid);
246 result = ctx.open(usb_vp.vid, usb_vp.pid, sdesc, sser, port);
247 }
248 if (result == 0)
249 {
250 ctx.reset();
251 //ctx.flush();
252 ctx.set_read_chunk_size(256);
253 ctx.set_write_chunk_size(1024);
254 //ctx.set_event_char();
255 //ctx.set_error_char();
256 //ctx.set_usb_read_timeout(0);
257 //ctx.set_usb_write_timeout(5000);
258 ctx.set_latency(1);
259 result = InitPins();
260 if (result == 0)
261 {
262 Install(port);
263 }
264 else
265 {
266 ctx.close();
267 ret_val = E2ERR_OPENFAILED;
268 }
269 }
270 else
271 {
272 qWarning() << Q_FUNC_INFO << ctx.error_string();
273 ret_val = E2ERR_OPENFAILED;
274 }
275 }
276
277 qDebug() << Q_FUNC_INFO << "=" << ret_val << "OUT";
278
279 return ret_val;
280 }
281
282 void MpsseInterface::Close()
283 {
284 qDebug() << Q_FUNC_INFO << "IN - Installed: " << IsInstalled();
285
286 if (IsInstalled())
287 {
288 SetPower(false);
289 DeInitPins();
290 ctx.close();
291 DeInstall();
292 }
293 }
294
295 int MpsseInterface::Flush()
296 {
297 int ret = OK;
298
299 if (!cmdbuf.isEmpty())
300 {
301 ret = ctx.write(cmdbuf.getBuffer(), cmdbuf.getSize());
302 if (ret == cmdbuf.getSize())
303 {
304 cmdbuf.clear();
305 ret = OK;
306 }
307 else
308 {
309 qWarning() << Q_FUNC_INFO << "write failed:" << ctx.error_string();
310 ret = -1;
311 }
312 }
313 return ret;
314 }
315
316 void MpsseInterface::SetDelay(int delay)
317 {
318 if (delay >= 0)
319 {
320 uint32_t freq = 0xffffffff; //maximum frequency
321
322 if (delay > 0)
323 {
324 freq = 1000000 / (delay * 2);
325 if (GetI2CMode())
326 {
327 freq = freq * 3 / 2; //3PHASE_CLOCKING
328 }
329 }
330 SetFrequency(freq);
331 }
332 BusInterface::SetDelay(delay);
333 }
334
335 void MpsseInterface::ShotDelay(int n)
336 {
337 if (BusInterface::GetDelay() > 0) //avoid any delay if 0
338 {
339 if (GetI2CMode())
340 {
341 n *= 3; //I2CBus use 3_PHASE clock
342 }
343 while (n-- > 0)
344 {
345 cmdbuf.append(SET_BITS_LOW);
346 cmdbuf.append(last_data & 0xff);
347 cmdbuf.append(pin_directions & 0xff);
348 }
349 }
350 }
351
352 int MpsseInterface::SendPins(int new_data, int new_directions)
353 {
354 int ch_data, ch_dir;
355
356 if (cmdbuf.almostFull())
357 {
358 Flush();
359 }
360
361 if (new_directions >= 0) //-1 don't change directions
362 {
363 ch_dir = (new_directions ^ pin_directions) & 0xffff;
364 }
365 else
366 {
367 new_directions = pin_directions;
368 ch_dir = 0;
369 }
370
371 //new_data &= ~((1 << 4) | (1 << 11));
372
373 //what's changed
374 ch_data = (new_data ^ last_data) & 0xffff;
375 if (ignore_last_data)
376 {
377 ch_data |= 0xff;
378 }
379
380 if ((ch_data & 0x00ff) != 0 || (ch_dir & 0x00ff) != 0) //low byte
381 {
382 cmdbuf.append(SET_BITS_LOW);
383 cmdbuf.append(new_data & 0xff);
384 cmdbuf.append(new_directions & 0xff);
385 }
386 if ((ch_data & 0xff00) != 0 || (ch_dir & 0xff00) != 0) //high byte
387 {
388 cmdbuf.append(SET_BITS_HIGH);
389 cmdbuf.append((new_data >> 8) & 0xff);
390 cmdbuf.append((new_directions >> 8) & 0xff);
391 }
392
393 //if (queue_mode || Flush() == OK)
394 {
395 ignore_last_data = false;
396 last_data = new_data;
397 pin_directions = new_directions;
398 }
399
400 return OK;
401 }
402
403 int MpsseInterface::GetPins()
404 {
405 if (cmdbuf.almostFull(3))
406 {
407 Flush();
408 }
409
410 cmdbuf.append(GET_BITS_LOW);
411 cmdbuf.append(GET_BITS_HIGH);
412 cmdbuf.append(SEND_IMMEDIATE);
413
414 int ret = Flush();
415 if (ret == OK)
416 {
417 uint8_t buf[2];
418 int timeout = 10000;
419 do
420 {
421 ret = ctx.read(buf, 2);
422 if (ret < 0)
423 {
424 qWarning() << Q_FUNC_INFO << "read failed:" << ctx.error_string();
425 return -1;
426 }
427 }
428 while (ret == 0 && --timeout > 0);
429
430 if (timeout > 0)
431 {
432 ret = ((int)buf[1] << 8) | buf[0];
433 }
434 else
435 {
436 ret = E2P_TIMEOUT;
437 }
438 }
439 return ret;
440 }
441
442 int MpsseInterface::GetLowPinsMulti(int bufsiz, uint8_t *buf, int len)
443 {
444 if (len > bufsiz)
445 {
446 len = bufsiz;
447 }
448
449 if (cmdbuf.almostFull(len))
450 {
451 Flush();
452 }
453
454 for (int k = 0; k < len; k++)
455 {
456 cmdbuf.append(GET_BITS_LOW);
457 }
458 cmdbuf.append(SEND_IMMEDIATE);
459
460 int ret = Flush();
461 if (ret == OK)
462 {
463 int timeout = 10000;
464 do
465 {
466 ret = ctx.read(buf, len);
467 if (ret < 0)
468 {
469 qWarning() << Q_FUNC_INFO << "read failed:" << ctx.error_string();
470 return -1;
471 }
472 }
473 while (ret == 0 && --timeout > 0);
474
475 if (timeout == 0)
476 {
477 ret = E2P_TIMEOUT;
478 }
479 }
480 return ret;
481 }
482
483 bool MpsseInterface::CheckDataLines(int len, int sda, int scl)
484 {
485 uint8_t buf[512];
486 bool test = false;
487
488 Q_ASSERT(len > 0);
489 Q_ASSERT(len <= (int)sizeof(buf));
490
491 if (GetLowPinsMulti(sizeof(buf), buf, len) == len)
492 {
493 test = true;
494
495 for (int k = 0; test && k < len; k++)
496 {
497 if (sda == 0 && scl == 0)
498 {
499 test = IsClockDataDOWN(buf[k]);
500 }
501 else if (sda > 0 && scl > 0)
502 {
503 test = IsClockDataUP(buf[k]);
504 }
505 else
506 {
507 bool test_sda = true, test_scl = true;
508
509 if (sda > 0)
510 {
511 test_sda = GetDataIn(buf[k]);
512 }
513 else if (sda == 0)
514 {
515 test_sda = !GetDataIn(buf[k]);
516 }
517
518 if (scl > 0)
519 {
520 test_scl = GetClock(buf[k]);
521 }
522 else if (scl == 0)
523 {
524 test_scl = !GetClock(buf[k]);
525 }
526
527 test = (test_sda && test_scl);
528 }
529 }
530 }
531
532 return test;
533 }
534
535
536 int MpsseInterface::xferBit(int &err, int b, int mode)
537 {
538 int cmd = MPSSE_BITMODE;
539 int len = 0; //0 --> 1bit
540 int by = (b != 0) ? 0xff : 0;
541 uint8_t ret_byte = 0;
542
543 //We accept 0 --> default R+W, SPIMODE_WRONLY --> W, SPIMODE_RDONLY --> R, (SPIMODE_WRONLY|SPIMODE_RDONLY) --> Invalid
544 Q_ASSERT((mode & (xMODE_WRONLY | xMODE_RDONLY)) != (xMODE_WRONLY | xMODE_RDONLY));
545
546 if ((mode & xMODE_WRONLY) != 0)
547 {
548 cmd |= MPSSE_DO_WRITE;
549
550 if ((mode & SPIMODE_MASK) == 0 || (mode & SPIMODE_MASK) == 3)
551 {
552 cmd |= MPSSE_WRITE_NEG;
553 }
554 }
555 else if ((mode & xMODE_RDONLY) != 0)
556 {
557 cmd |= MPSSE_DO_READ;
558
559 if ((mode & SPIMODE_MASK) == 1 || (mode & SPIMODE_MASK) == 2)
560 {
561 cmd |= MPSSE_READ_NEG;
562 }
563 }
564 else
565 {
566 cmd |= (MPSSE_DO_WRITE | MPSSE_DO_READ);
567
568 if ((mode & SPIMODE_MASK) == 0 || (mode & SPIMODE_MASK) == 3)
569 {
570 cmd |= MPSSE_WRITE_NEG;
571 }
572 else
573 {
574 cmd |= MPSSE_READ_NEG;
575 }
576 }
577
578 err = OK;
579
580 if (cmdbuf.almostFull())
581 {
582 Flush();
583 }
584
585 cmdbuf.append(cmd);
586 cmdbuf.append(len);
587 if ((cmd & MPSSE_DO_WRITE) != 0)
588 {
589 cmdbuf.append(by);
590 }
591
592 if ((cmd & MPSSE_DO_READ) != 0)
593 {
594 cmdbuf.append(SEND_IMMEDIATE);
595
596 int ret = Flush();
597 if (ret == OK)
598 {
599 int timeout = 1000;
600 do
601 {
602 ret = ctx.read(&ret_byte, 1);
603 if (ret < 0)
604 {
605 qWarning() << Q_FUNC_INFO << "read failed:" << ctx.error_string();
606 err = -1;
607 }
608 }
609 while (ret == 0 && --timeout > 0);
610
611 if (ret == 1)
612 {
613 err = OK;
614 }
615 else
616 {
617 err = E2P_TIMEOUT;
618 }
619 }
620 }
621 ignore_last_data = true;
622
623 return (ret_byte & 1);
624 }
625
626 uint8_t MpsseInterface::xferByte(int &err, uint8_t by, int mode, int bpw, bool lsb_first)
627 {
628 int cmd = MPSSE_BITMODE;
629 int len = bpw - 1; //0 --> 1bit, .. 7 --> 8bits
630 uint8_t ret_byte = 0;
631
632 if (lsb_first)
633 {
634 cmd |= MPSSE_LSB;
635 }
636
637 //We accept 0 --> default R+W, SPIMODE_WRONLY --> W, SPIMODE_RDONLY --> R, (SPIMODE_WRONLY|SPIMODE_RDONLY) --> Invalid
638 Q_ASSERT((mode & (xMODE_WRONLY | xMODE_RDONLY)) != (xMODE_WRONLY | xMODE_RDONLY));
639 Q_ASSERT(bpw <= 8);
640
641 if ((mode & xMODE_WRONLY) != 0)
642 {
643 cmd |= MPSSE_DO_WRITE;
644
645 if ((mode & SPIMODE_MASK) == 0 || (mode & SPIMODE_MASK) == 3)
646 {
647 cmd |= MPSSE_WRITE_NEG;
648 }
649 }
650 else if ((mode & xMODE_RDONLY) != 0)
651 {
652 cmd |= MPSSE_DO_READ;
653
654 if ((mode & SPIMODE_MASK) == 1 || (mode & SPIMODE_MASK) == 2)
655 {
656 cmd |= MPSSE_READ_NEG;
657 }
658 }
659 else
660 {
661 cmd |= (MPSSE_DO_WRITE | MPSSE_DO_READ);
662
663 if ((mode & SPIMODE_MASK) == 0 || (mode & SPIMODE_MASK) == 3)
664 {
665 cmd |= MPSSE_WRITE_NEG;
666 }
667 else
668 {
669 cmd |= MPSSE_READ_NEG;
670 }
671 }
672
673 err = OK;
674
675 if (cmdbuf.almostFull())
676 {
677 Flush();
678 }
679
680 cmdbuf.append(cmd);
681 cmdbuf.append(len);
682 if ((cmd & MPSSE_DO_WRITE) != 0)
683 {
684 cmdbuf.append(by);
685 }
686
687 if ((cmd & MPSSE_DO_READ) != 0)
688 {
689 cmdbuf.append(SEND_IMMEDIATE);
690
691 int ret = Flush();
692 if (ret == OK)
693 {
694 int timeout = 1000;
695 do
696 {
697 ret = ctx.read(&ret_byte, 1);
698 if (ret < 0)
699 {
700 qWarning() << Q_FUNC_INFO << "read failed:" << ctx.error_string();
701 err = -1;
702 }
703 }
704 while (ret == 0 && --timeout > 0);
705
706 if (ret == 1)
707 {
708 err = OK;
709 }
710 else
711 {
712 err = E2P_TIMEOUT;
713 }
714 }
715 }
716 ignore_last_data = true;
717
718 return ret_byte;
719 }
720
721 unsigned long MpsseInterface::xferWord(int &err, unsigned long word_out, int mode, int bpw, bool lsb_first)
722 {
723 int nbit, nshift;
724 unsigned long word_in = 0;
725
726 if (lsb_first)
727 {
728 nshift = 0;
729 do
730 {
731 nbit = (bpw > 8) ? 8 : bpw;
732 word_in |= (xferByte(err, word_out & 0xff, mode, nbit, true) << nshift);
733 word_out >>= 8;
734 bpw -= nbit;
735 nshift += nbit;
736 }
737 while (bpw > 0);
738 }
739 else
740 {
741 nbit = bpw % 8;
742 nshift = (bpw / 8) * 8;
743 if (nbit > 0)
744 {
745 word_in <<= 8;
746 word_in |= xferByte(err, ((word_out >> nshift) & 0xff) << (8 - nbit), mode, nbit, false);
747 bpw -= nbit;
748 }
749 while (bpw > 0)
750 {
751 nshift -= 8;
752 word_in <<= 8;
753 word_in |= xferByte(err, (word_out >> nshift) & 0xff, mode, 8, false);
754 bpw -= 8;
755 }
756 }
757
758 return word_in;
759 }
760
761 int MpsseInterface::SetPower(bool onoff)
762 {
763 qDebug() << Q_FUNC_INFO << "(" << onoff << ")";
764
765 if (IsInstalled() && pin_poweron > 0)
766 {
767 if ((cmdWin->GetPolarity() & POWERINV))
768 {
769 onoff = !onoff;
770 }
771
772 int val = onoff ? 1 : 0;
773
774 SendPins(OutDataMask(pin_poweron, val));
775 Flush();
776 }
777
778 return OK;
779 }
780
781 void MpsseInterface::SetControlLine(int res)
782 {
783 //qDebug() << Q_FUNC_INFO << "(" << res << ") *** Inst=" << IsInstalled();
784
785 if (IsInstalled())
786 {
787 if (cmdWin->GetPolarity() & RESETINV)
788 {
789 res = !res;
790 }
791
792 if (SendPins(OutDataMask(pin_ctrl, (res != 0))) != OK)
793 {
794 qWarning() << Q_FUNC_INFO << "write failed.";
795 }
796 }
797 }
798
799 void MpsseInterface::SetDataOut(int sda)
800 {
801 //qDebug() << Q_FUNC_INFO << "(" << sda << ") *** Inst=" << IsInstalled();
802
803 if (IsInstalled())
804 {
805 if ((cmdWin->GetPolarity() & DOUTINV))
806 {
807 sda = !sda;
808 }
809
810 if (SendPins(OutDataMask(pin_dataout, (sda != 0))) != OK)
811 {
812 qWarning() << Q_FUNC_INFO << "write failed.";
813 }
814 }
815 }
816
817 void MpsseInterface::SetClock(int scl)
818 {
819 //qDebug() << Q_FUNC_INFO << "(" << scl << ") *** Inst=" << IsInstalled();
820
821 if (IsInstalled())
822 {
823 if ((cmdWin->GetPolarity() & CLOCKINV))
824 {
825 scl = !scl;
826 }
827
828 if (SendPins(OutDataMask(pin_clock, (scl != 0))) != OK)
829 {
830 qWarning() << Q_FUNC_INFO << "write failed.";
831 }
832 }
833 }
834
835 void MpsseInterface::SetClockData()
836 {
837 //qDebug() << Q_FUNC_INFO << "*** Inst=" << IsInstalled();
838
839 if (IsInstalled())
840 {
841 int scl = 1, sda = 1;
842
843 if ((cmdWin->GetPolarity() & CLOCKINV))
844 {
845 scl = !scl;
846 }
847
848 if ((cmdWin->GetPolarity() & DOUTINV))
849 {
850 sda = !sda;
851 }
852
853 int n_data = OutDataMask(pin_clock, scl);
854 if (SendPins(OutDataMask(n_data, pin_dataout, sda)) != OK)
855 {
856 qWarning() << Q_FUNC_INFO << "write failed.";
857 }
858 }
859 }
860
861 void MpsseInterface::ClearClockData()
862 {
863 //qDebug() << Q_FUNC_INFO << "*** Inst=" << IsInstalled();
864
865 if (IsInstalled())
866 {
867 int scl = 0, sda = 0;
868
869 if ((cmdWin->GetPolarity() & CLOCKINV))
870 {
871 scl = !scl;
872 }
873
874 if ((cmdWin->GetPolarity() & DOUTINV))
875 {
876 sda = !sda;
877 }
878
879 int n_data = OutDataMask(pin_clock, scl);
880 if (SendPins(OutDataMask(n_data, pin_dataout, sda)) != OK)
881 {
882 qWarning() << Q_FUNC_INFO << "write failed.";
883 }
884 }
885 }
886
887 int MpsseInterface::GetCtrlIn(int val)
888 {
889 if (pin_ctrlin == 0)
890 {
891 return -1;
892 }
893 else
894 {
895 return (val & pin_ctrlin) ? 1 : 0;
896 }
897 }
898
899 int MpsseInterface::GetDataIn(int val)
900 {
901 val = (val & pin_datain) ? 1 : 0;
902
903 if (cmdWin->GetPolarity() & DININV)
904 {
905 return !val;
906 }
907 else
908 {
909 return val;
910 }
911 }
912
913 int MpsseInterface::GetDataIn()
914 {
915 if (IsInstalled())
916 {
917 int val = GetPins();
918 if (val < 0)
919 {
920 qWarning() << Q_FUNC_INFO << "read failed.";
921 return val;
922 }
923 else
924 {
925 return GetDataIn(val);
926 }
927 }
928 else
929 {
930 return E2ERR_NOTINSTALLED;
931 }
932 }
933
934 int MpsseInterface::GetClock(int val)
935 {
936 if (pin_clockin == 0)
937 {
938 return 1;
939 }
940 else
941 {
942 return (val & pin_clockin) ? 1 : 0;
943 }
944 }
945
946 int MpsseInterface::GetClock()
947 {
948 if (pin_clockin == 0)
949 {
950 return 1;
951 }
952 else
953 {
954 if (IsInstalled())
955 {
956 int val = GetPins();
957 if (val < 0)
958 {
959 qWarning() << Q_FUNC_INFO << "read failed.";
960 return val;
961 }
962 else
963 {
964 return GetClock(val);
965 }
966 }
967 else
968 {
969 return E2ERR_NOTINSTALLED;
970 }
971 }
972 }
973
974 int MpsseInterface::IsClockDataUP(int val)
975 {
976 if (pin_clockin == 0)
977 {
978 return GetDataIn(val);
979 }
980 else
981 {
982 return (GetClock(val) && GetDataIn(val));
983 }
984 }
985
986 int MpsseInterface::IsClockDataUP()
987 {
988 if (IsInstalled())
989 {
990 int val = GetPins();
991 if (val < 0)
992 {
993 qWarning() << Q_FUNC_INFO << "read failed.";
994 return val;
995 }
996 else
997 {
998 return IsClockDataUP(val);
999 }
1000 }
1001 else
1002 {
1003 return E2ERR_NOTINSTALLED;
1004 }
1005 }
1006
1007 int MpsseInterface::IsClockDataDOWN(int val)
1008 {
1009 if (pin_clockin == 0)
1010 {
1011 return !GetDataIn(val);
1012 }
1013 else
1014 {
1015 return (!GetClock(val) && !GetDataIn(val));
1016 }
1017 }
1018
1019 int MpsseInterface::IsClockDataDOWN()
1020 {
1021 if (IsInstalled())
1022 {
1023 int val = GetPins();
1024 if (val < 0)
1025 {
1026 qWarning() << Q_FUNC_INFO << "read failed.";
1027 return val;
1028 }
1029 else
1030 {
1031 return IsClockDataDOWN(val);
1032 }
1033 }
1034 else
1035 {
1036 return E2ERR_NOTINSTALLED;
1037 }
1038 }
1039
1040 int MpsseInterface::GetPresence(int mask, int val)
1041 {
1042 qDebug() << Q_FUNC_INFO << "() *** Inst=" << IsInstalled();
1043
1044 if (IsInstalled())
1045 {
1046 int pinval = GetPins();
1047 if (pinval < 0)
1048 {
1049 qWarning() << Q_FUNC_INFO << "read failed.";
1050 return val;
1051 }
1052 else
1053 {
1054 return ((pinval & mask) == val) ? OK : E2ERR_OPENFAILED;
1055 }
1056 }
1057 else
1058 {
1059 return E2ERR_NOTINSTALLED;
1060 }
1061 }
1062
1063 #include <QMessageBox>
1064
1065 int MpsseInterface::TestPort(int port_no)
1066 {
1067 #if 1
1068 test_step = 0;
1069 #endif
1070 qDebug() << Q_FUNC_INFO << "(port_no:" << port_no << ", test_step:" << test_step << ") IN";
1071
1072 int ret_val = TestSave(port_no);
1073
1074 if (ret_val == OK)
1075 {
1076 if (TypeToInterfVidPid(PONYPROG_FT) == usb_vp)
1077 {
1078 if (test_step++ > 0)
1079 {
1080 bool test_inv = false;
1081 int errcount = 0;
1082
1083 if (test_step > 2)
1084 {
1085 QMessageBox mbox;
1086 mbox.setText("Passo " + QString::number(test_step) + " Insert check-board");
1087 mbox.exec();
1088
1089 test_step = 0;
1090 SendPins(OutDataMask(pin_enbus, 0));
1091 }
1092 else
1093 {
1094 QMessageBox mbox;
1095 mbox.setText("Passo " + QString::number(test_step) + " Remove check-board");
1096 mbox.exec();
1097
1098 SendPins(OutDataMask(pin_enbus, 1));
1099 }
1100
1101 int val, pmask_clkin = (1 << 4), seto;
1102
1103 SetPower(true);
1104 w.WaitMsec(150);
1105
1106 for (seto = 1; seto >= 0; seto--)
1107 {
1108 int geti = test_inv ? !seto : seto;
1109
1110 SendPins(OutDataMask(pin_dataout, seto));
1111 w.WaitMsec(100);
1112 val = GetPins();
1113 if (val < 0)
1114 {
1115 return E2ERR_NOTINSTALLED;
1116 }
1117 if ((val & pin_datain) != 0)
1118 val = 1;
1119 else
1120 val = 0;
1121 if (val != geti)
1122 {
1123 qWarning() << Q_FUNC_INFO << " Data Write " << seto << " read " << val << "(" << geti << ")";
1124 errcount++;
1125 }
1126 }
1127
1128 for (seto = 1; seto >= 0; seto--)
1129 {
1130 int geti = test_inv ? !seto : seto;
1131
1132 SendPins(OutDataMask(pin_clock, seto));
1133 w.WaitMsec(100);
1134 val = GetPins();
1135 if (val < 0)
1136 {
1137 return E2ERR_NOTINSTALLED;
1138 }
1139 if ((val & pmask_clkin) != 0)
1140 val = 1;
1141 else
1142 val = 0;
1143 if (val != geti)
1144 {
1145 qWarning() << Q_FUNC_INFO << " Clock Write " << seto << " read " << val << "(" << geti << ")";
1146 errcount++;
1147 }
1148 }
1149
1150 SendPins(OutDataMask(pin_enbus, 1));
1151 SendPins(OutDataMask(pin_ctrl|pin_dataout|pin_clock, 0));
1152 SetPower(false);
1153
1154 if (errcount > 0)
1155 {
1156 ret_val = E2ERR_NOTINSTALLED;
1157 }
1158 }
1159 else
1160 {
1161 //PonyProgFT
1162 w.WaitMsec(10);
1163 ret_val = GetPresence(0x0700, 0);
1164
1165 if (ret_val == OK)
1166 {
1167 SendPins(OutDataMask(pin_enbus, 1)); //en_bus active low
1168 SendPins(OutDataMask(pin_ctrl|pin_dataout|pin_clock, 0));
1169 SetPower(true);
1170 w.WaitMsec(150);
1171 int val = GetPins();
1172 if (val < 0 || GetCtrlIn(val) != 1)
1173 {
1174 if (GetDataIn(val) != 1)
1175 {
1176 ret_val = E2ERR_IOTEST;
1177 }
1178 else
1179 {
1180 ret_val = E2ERR_NOTINSTALLED;
1181 }
1182 }
1183 else
1184 {
1185 SendPins(OutDataMask(pin_ctrl, 1));
1186 w.WaitMsec(100);
1187 val = GetPins();
1188 if (val < 0 || GetCtrlIn(val) != 0)
1189 {
1190 ret_val = E2ERR_NOTINSTALLED;
1191 }
1192 }
1193 SendPins(OutDataMask(pin_ctrl|pin_dataout|pin_clock, 0));
1194 SetPower(false);
1195 }
1196 }
1197 }
1198 else if (TypeToInterfVidPid(FTDI_JTAGKEY) == usb_vp)
1199 {
1200 //JtagKey
1201 ret_val = OK;
1202 }
1203 else
1204 {
1205 ret_val = E2ERR_NOTINSTALLED;
1206 }
1207 }
1208
1209 TestRestore();
1210
1211 qDebug() << Q_FUNC_INFO << "() = " << ret_val << " OUT";
1212
1213 return ret_val;
1214 }
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // http://ponyprog.sourceforge.net //
7 // //
8 //-------------------------------------------------------------------------//
9 // //
10 // This program is free software; you can redistribute it and/or //
11 // modify it under the terms of the GNU General Public License //
12 // as published by the Free Software Foundation; either version2 of //
13 // the License, or (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
18 // General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program (see LICENSE); if not, write to the //
22 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
23 // //
24 //=========================================================================//
25
26 #ifndef _MPSSE_INTERFACE_H
27 #define _MPSSE_INTERFACE_H
28
29 #include "businter.h"
30 #include "ftdi.hpp"
31 #include "interfconv.h"
32
33 class MpsseCommandQueue
34 {
35 public:
36 MpsseCommandQueue()
37 {
38 clear();
39 }
40
41 void clear()
42 {
43 cmdidx = 0;
44 }
45
46 int getSize()
47 {
48 return cmdidx;
49 }
50
51 bool append(uint8_t dat)
52 {
53 if (cmdidx < sizeof(cmdbuf))
54 {
55 cmdbuf[cmdidx++] = dat;
56 return true;
57 }
58 else
59 {
60 return false;
61 }
62 }
63
64 uint8_t *getBuffer()
65 {
66 return cmdbuf;
67 }
68
69 bool isFull()
70 {
71 return (cmdidx >= sizeof(cmdbuf));
72 }
73
74 bool almostFull(int n = 6)
75 {
76 return (cmdidx >= sizeof(cmdbuf) - n);
77 }
78
79 bool isEmpty()
80 {
81 return (cmdidx == 0);
82 }
83
84 private:
85 uint8_t cmdbuf[1024];
86 unsigned int cmdidx;
87 };
88
89 class MpsseInterface : public BusInterface
90 {
91 public:
92 MpsseInterface();
93 virtual ~MpsseInterface();
94
95 virtual int Open(int port);
96 virtual void Close();
97
98 virtual void SetDataOut(int sda = 1);
99 virtual void SetClock(int scl = 1);
100 virtual int GetDataIn();
101 virtual int GetDataIn(int val);
102 virtual int GetClock();
103 virtual int GetClock(int val);
104 virtual void SetClockData();
105 virtual void ClearClockData();
106 virtual int IsClockDataUP(int val);
107 virtual int IsClockDataUP();
108 virtual int IsClockDataDOWN(int val);
109 virtual int IsClockDataDOWN();
110 virtual bool CheckDataLines(int len = 1, int sda = -1, int scl = -1);
111
112 virtual int TestPort(int port);
113
114 int SetPower(bool onoff);
115 void SetControlLine(int res = 1);
116
117 //void List();
118 virtual int Flush();
119
120 virtual int xferBit(int &err, int b, int mode = 0);
121 virtual uint8_t xferByte(int &err, uint8_t by, int mode = 0, int bpw = 8, bool lsb_first = false);
122 virtual unsigned long xferWord(int &err, unsigned long word_out, int mode = 0, int bpw = 8, bool lsb_first = false);
123
124 virtual void SetDelay(int delay);
125 virtual void ShotDelay(int n = 1);
126
127 virtual void ConfigPins(int pinum_ctrl = -1, int pinum_datain = -1, int pinum_dataout = -1, int pinum_clock = -1, int pinum_clockin = -1, int pinum_poweron = -1, int pinum_enbus = -1, int pinnum_ctrlin = -1);
128
129 static QStringList find_all(unsigned int vendor, unsigned int product)
130 {
131 QStringList retList;
132 struct ftdi_device_list *dlist = 0;
133 struct ftdi_context ftdi;
134
135 ftdi_init(&ftdi);
136 int count = ftdi_usb_find_all(&ftdi, &dlist, vendor, product);
137 if (count > 0)
138 {
139 // Iterate list
140 struct ftdi_device_list *l = dlist;
141 for (int k = 0; l != 0 && k < count; l = l->next, k++)
142 {
143 char man[256];
144 char desc[256];
145 char ser[256];
146 int rv = ftdi_usb_get_strings(&ftdi, l->dev,
147 man, sizeof(man),
148 desc, sizeof(desc),
149 ser, sizeof(ser));
150 if (rv == 0)
151 {
152 qDebug() << "Man : " << QString(man)
153 << "Desc: " << QString(desc)
154 << "Ser : " << QString(ser);
155 retList << QString(ser) + " / " + QString(desc);
156 }
157 }
158 ftdi_list_free(&dlist);
159 }
160 ftdi_deinit(&ftdi);
161
162 return retList;
163 }
164
165 protected:
166 int GetPresence(int mask, int val);
167 int GetCtrlIn(int val);
168
169 private:
170 int InitPins();
171 void DeInitPins();
172
173 int SetFrequency(uint32_t freq);
174 int SendPins(int new_data, int new_directions = -1);
175 int GetPins();
176 int GetLowPinsMulti(int bufsiz, uint8_t *buf, int len);
177
178 //utility to set/reset/toggle a pin
179 unsigned int OutDataMask(int old_val, int mask, int val)
180 {
181 if (val == 0)
182 {
183 return old_val & ~mask;
184 }
185 else if (val == 1)
186 {
187 return old_val | mask;
188 }
189 else
190 {
191 return old_val ^ mask;
192 }
193 }
194 unsigned int OutDataMask(int mask, int val)
195 {
196 return OutDataMask(last_data, mask, val);
197 }
198
199 Ftdi::Context ctx;
200
201 MpsseCommandQueue cmdbuf;
202
203 int pin_directions;
204
205 bool ignore_last_data;
206 int last_data;
207 int read_data;
208
209 int pin_ctrl;
210 int pin_ctrlin; //0 if unused
211 int pin_datain;
212 int pin_dataout;
213 int pin_clock;
214 int pin_clockin; //0 if unused
215 int pin_poweron; //0 if unused
216 int pin_enbus; //0 if unused
217
218 int ftdi_port;
219
220 int test_step;
221 };
222
223 #endif
3232
3333 #include "e2cmdw.h"
3434
35 //=====>>> Costruttore <<<======
3635 Nvm3060::Nvm3060(e2AppWinInfo *wininfo, BusIO *busp)
3736 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
3837 {
3938 qDebug() << "Nvm3060::Nvm3060()";
4039 }
4140
42 //--- Distruttore
4341 Nvm3060::~Nvm3060()
4442 {
4543 qDebug() << "Nvm3060::~Nvm3060()";
4644 }
4745
4846 // determina il numero di banchi (dimensione) dell'eeprom
49 //---
5047 int Nvm3060::Probe(int probe_size)
5148 {
5249 qDebug() << "Nvm3060::Probe(" << probe_size << ")";
3434
3535 class Nvm3060 : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 Nvm3060(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~Nvm3060();
4444 int Write(int probe = 1, int type = ALL_TYPE);
4545 int Verify(int type = ALL_TYPE);
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 IMBus *GetBus()
5050 {
5151 return static_cast<IMBus *>(Device::GetBus());
5252 }
5353
54 private: //--------------------------------------- private
54 private:
5555
5656 };
5757 #endif
151151
152152 if (IsInstalled())
153153 {
154 int control = cmdWin->GetPolarity();
154 unsigned int control = cmdWin->GetPolarity();
155155
156156 if ((control & CLOCKINV) && (control & DOUTINV))
157157 {
184184
185185 if (IsInstalled())
186186 {
187 int control = cmdWin->GetPolarity();
187 unsigned int control = cmdWin->GetPolarity();
188188
189189 if ((control & CLOCKINV) && (control & DOUTINV))
190190 {
259259 if (ret_val == OK)
260260 {
261261 ret_val = E2ERR_OPENFAILED;
262 Wait w;
263262
264263 SetPower(false);
265264 w.WaitMsec(100);
3131
3232 class SIProgInterface : public BusInterface, public RS232Interface
3333 {
34 public: //------------------------------- public
34 public:
3535 SIProgInterface();
3636 // virtual ~SIProgInterface();
3737
5454 int SetPower(bool onoff);
5555 void SetControlLine(int res = 1);
5656
57 protected: //------------------------------- protected
57 protected:
5858
59 private: //------------------------------- private
59 private:
6060
6161 };
6262
3434
3535 #define CONFIG_SIZE ( 8 * sizeof(uint16_t) )
3636
37 //=====>>> Costruttore <<<======
3837 Pic125xx::Pic125xx(e2AppWinInfo *wininfo, BusIO *busp)
3938 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
4039 {
4140 config_word = 0xffff;
4241 }
4342
44 //--- Distruttore
4543 Pic125xx::~Pic125xx()
4644 {
4745 }
3434
3535 class Pic125xx : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 Pic125xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~Pic125xx();
4848 int SecurityRead(uint32_t &bits);
4949 int SecurityWrite(uint32_t bits);
5050
51 protected: //--------------------------------------- protected
51 protected:
5252
5353 Pic12Bus *GetBus()
5454 {
5959 // virtual int WriteProg();
6060 virtual int VerifyProg(unsigned char *localbuf);
6161
62 private: //--------------------------------------- private
62 private:
6363
6464 uint16_t config_word;
6565 };
3131 #include <QtCore>
3232
3333 #include "e2cmdw.h"
34
35 #ifdef Q_OS_LINUX
36 # include <unistd.h>
37 #else
38 # ifdef __BORLANDC__
39 # define __inline__
40 # else // _MICROSOFT_ VC++
41 # define __inline__ __inline
42 # define _export
43 # endif
44 #endif
4534
4635 #define MAX_PROG_PULSES 8
4736
6453 // BeginProgOnlyCode(0x18) //Begin Programming Only Cycle
6554 EndProgCode(0x0e)
6655 {
67 qDebug() << "Pic12Bus::Pic12Bus()";
56 qDebug() << Q_FUNC_INFO << "()";
6857
6958 OverProgrammingMult = 11; //Default OverProgramming X value (x11)
7059 OverProgrammingAdd = 0; //Default OverProgramming + value (+0)
10897 break;
10998 }
11099
111 BusIO::SetDelay(n);
112
113 qDebug() << "PIC12Bus::SetDelay() = " << n;
100 busI->SetDelay(n);
101
102 qDebug() << Q_FUNC_INFO << "() = " << n;
114103 }
115104
116105 int Pic12Bus::SendDataBit(int b)
117106 {
118 setCLK(); //set SCK high
119 bitDI(b);
120
121 WaitUsec(shot_delay);
122
123 clearCLK(); //device latch data bit now!
124
125 WaitUsec(shot_delay);
107 //setCLK(); //set SCK high
108 //bitDI(b);
109 //ShotDelay();
110 //clearCLK(); //device latch data bit now!
111 //ShotDelay();
112
113 int err = OK;
114 clearCLK();
115 busI->xferBit(err, b, SPI_MODE_1 | xMODE_WRONLY);
126116
127117 return OK;
128118 }
130120 // returns a negative number in case of error, 0 or 1 otherwise
131121 int Pic12Bus::RecDataBit()
132122 {
133 register uint8_t b;
134
135 setCLK(); //set SCK high (Pic output data now)
136
137 WaitUsec(shot_delay);
138
139 b = getDO(); // sampling data on falling edge
123 //setCLK(); //set SCK high (Pic output data now)
124 //ShotDelay();
125 //b = getDO(); // sampling data on falling edge
126 //clearCLK();
127 //ShotDelay();
128
129 int err = OK;
140130 clearCLK();
141
142 WaitUsec(shot_delay);
143
144 return b;
145 }
146
147 // OK, ora ci alziamo di un livello: operiamo sul byte
131 int rv = busI->xferBit(err, 1, SPI_MODE_1 | xMODE_RDONLY);
132 if (err == OK)
133 {
134 return rv;
135 }
136 else
137 {
138 return err;
139 }
140 }
141
148142 int Pic12Bus::SendDataWord(long wo, int wlen)
149143 {
150 int k;
144 int err = OK;
151145
152146 clearCLK();
153147 clearDI();
154148
155149 //transmit lsb first
156 for (k = 0; k < wlen; k++)
157 {
158 SendDataBit(wo & (1 << k));
159 }
150 //for (int k = 0; k < wlen; k++)
151 // SendDataBit(wo & (1 << k));
152 busI->xferWord(err, wo, SPI_MODE_1 | xMODE_WRONLY, wlen, true);
160153
161154 setDI();
162155
163156 //1 usec from a command to the next
164 WaitUsec(shot_delay / 4 + 1);
157 //WaitUsec(GetDelay() / 4 + 1);
158 ShotDelay(2);
165159
166160 return OK;
167161 }
168162
169163 long Pic12Bus::RecDataWord(int wlen)
170164 {
171 int k;
172 long val = 0;
165 int err = OK;
173166
174167 clearCLK();
175168 setDI();
176169
177170 //receive lsb first
178 for (k = 0; k < wlen; k++)
179 if (RecDataBit())
180 {
181 val |= 1 << k;
182 }
183
184 WaitUsec(shot_delay / 4 + 1);
185
186 return val;
171 //long val = 0;
172 //for (int k = 0; k < wlen; k++)
173 // if (RecDataBit())
174 // val |= 1 << k;
175 ShotDelay();
176 int rv = busI->xferWord(err, 0xffff, SPI_MODE_1 | xMODE_RDONLY, wlen, true);
177
178 //WaitUsec(GetDelay() / 4 + 1);
179 ShotDelay(2);
180
181 if (err == OK)
182 {
183 return rv;
184 }
185 else
186 {
187 return err;
188 }
187189 }
188190
189191 int Pic12Bus::Reset(void)
190192 {
191 qDebug() << "Pic12Bus::Reset() IN";
193 qDebug() << Q_FUNC_INFO << " IN";
192194
193195 SetDelay();
194196
208210
209211 current_address = -1;
210212
211 qDebug() << "Pic12Bus::Reset() OUT";
213 qDebug() << Q_FUNC_INFO << " OUT";
212214
213215 return OK;
214216 }
215217
216218 long Pic12Bus::ReadConfig(uint16_t &data)
217219 {
218 qDebug() << "Pic12Bus::ReadConfig(" << (hex) << data << (dec) << ") IN";
219
220220 // Reset();
221221
222222 uint8_t *bp = (uint8_t *)&data;
239239 #endif
240240 IncAddress(1);
241241
242 qDebug() << "Pic12Bus::ReadConfig(" << (hex) << data << (dec) << ") OUT";
242 qDebug() << Q_FUNC_INFO << "(" << (hex) << val << ") OUT";
243243
244244 return OK;
245245 }
247247
248248 long Pic12Bus::WriteConfig(uint16_t data)
249249 {
250 qDebug() << "Pic12Bus::WriteConfig(" << (hex) << data << (dec) << ") IN";
250 qDebug() << Q_FUNC_INFO << "(" << (hex) << data << ") IN";
251251
252252 // Reset();
253253
271271
272272 IncAddress(1);
273273
274 qDebug() << "Pic12Bus::WriteConfig(" << (hex) << data << (dec) << ") OUT";
275
276274 return OK;
277275 }
278276
313311 {
314312 long len;
315313
316 qDebug() << "Pic12Bus::Read(" << addr << ", " << (hex) << data << ", " << (dec) << length << ") IN";
314 qDebug() << Q_FUNC_INFO << "(" << addr << ", " << (hex) << data << ", " << (dec) << length << ") IN";
315
317316 ReadStart();
318317 length >>= 1; //contatore da byte a word
319318
350349
351350 len <<= 1; //contatore da word a byte
352351
353 qDebug() << "Pic12Bus::Read() = " << len << " OUT";
352 qDebug() << Q_FUNC_INFO << "() = " << len << " OUT";
354353
355354 return len;
356355 }
358357 long Pic12Bus::Write(int addr, uint8_t const *data, long length, int page_size)
359358 {
360359 long len;
361 int rv = OK;
362
363 qDebug() << "Pic12Bus::Write(" << addr << ", " << (hex) << data << ", " << (dec) << length << ") IN";
360
361 qDebug() << Q_FUNC_INFO << "(" << addr << ", " << (hex) << data << ", " << (dec) << length << ") IN";
362
364363 WriteStart();
365364 length >>= 1; //contatore da byte a word
366365
380379 val = (uint16_t)(*data++);
381380 val |= (uint16_t)(*data++) << 8;
382381 #endif
383 rv = WriteProgWord(val, length - 1);
382 int rv = WriteProgWord(val, length - 1);
384383
385384 if (rv != OK)
386385 {
401400 len <<= 1; //contatore da word a byte
402401 }
403402
404 qDebug() << "Pic12Bus::Write() = " << len << " ** " << GetLastProgrammedAddress() << " OUT";
403 qDebug() << Q_FUNC_INFO << "() = " << len << " ** " << GetLastProgrammedAddress() << " OUT";
405404
406405 return len;
407406 }
411410 int k;
412411 int rval = OK;
413412
414 qDebug() << "Pic12Bus::WriteProgWord(" << (hex) << val << ", " << (dec) << current_address << ") IN";
413 qDebug() << Q_FUNC_INFO << "(" << (hex) << val << ", " << (dec) << current_address << ") IN";
415414
416415 //Check for RC calibration location
417416 if (current_address == rc_addr)
500499 }
501500 }
502501
503 qDebug() << "Pic12Bus::WriteProgWord() = " << rval << " OUT";
502 qDebug() << Q_FUNC_INFO << "() = " << rval << " OUT";
504503
505504 return rval;
506505 }
507506
508507 void Pic12Bus::IncAddress(int n)
509508 {
510 qDebug() << "Pic12Bus::IncAddress(" << n << ") IN";
509 qDebug() << Q_FUNC_INFO << "(" << n << ") IN";
511510
512511 while (n--)
513512 {
515514 current_address++;
516515 }
517516
518 qDebug() << "Pic12Bus::IncAddress() OUT ** cur_addr = " << current_address;
517 qDebug() << Q_FUNC_INFO << "() OUT ** cur_addr = " << current_address;
519518 }
520519
521520 int Pic12Bus::ProgramPulse(uint16_t val, int verify, int width)
522521 {
523522 int rval = OK;
524523
525 qDebug() << "Pic12Bus::ProgramPulse(" << (hex) << val << ", " << (dec) << verify << ", " << width << ") IN";
524 qDebug() << Q_FUNC_INFO << "(" << (hex) << val << ", " << (dec) << verify << ", " << width << ") IN";
526525
527526 SendCmdCode(LoadProgCode);
528527 SendProgCode(val);
540539 rval = CompareSingleWord(val, RecvProgCode(), ProgMask);
541540 }
542541
543 qDebug() << "Pic12Bus::ProgramPulse() = " << rval << " OUT";
542 qDebug() << Q_FUNC_INFO << "() = " << rval << " OUT";
544543
545544 return rval;
546545 }
3232
3333 class Pic12Bus : public BusIO
3434 {
35 public: //------------------------------- public
35 public:
3636 Pic12Bus(BusInterface *ptr = 0);
3737 virtual ~Pic12Bus();
3838
5656 long BlankCheck(long length);
5757 void IncAddress(int n);
5858
59 protected: //------------------------------- protected
59 protected:
6060
6161 int SendDataWord(long wo, int wlen = 16);
6262 long RecDataWord(int wlen = 16);
124124 // const uint8_t BeginProgOnlyCode;
125125 const uint8_t EndProgCode;
126126
127 private: //------------------------------- private
127 private:
128128
129129 int SendDataBit(int b);
130130 int RecDataBit();
3333 #include "e2cmdw.h"
3434 #include "e2awinfo.h"
3535
36 //=====>>> Costruttore <<<======
3736 Pic168xx::Pic168xx(e2AppWinInfo *wininfo, BusIO *busp)
3837 : Pic16xx(wininfo, busp)
3938 {
4039 }
4140
42 //--- Distruttore
4341 Pic168xx::~Pic168xx()
4442 {
4543 }
3232
3333 class Pic168xx : public Pic16xx
3434 {
35 public: //---------------------------------------- public
35 public:
3636
3737 Pic168xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
3838 virtual ~Pic168xx();
4242 int Write(int probe = 1, int type = ALL_TYPE);
4343 // int Verify(int type = ALL_TYPE);
4444
45 protected: //--------------------------------------- protected
45 protected:
4646
4747 PicBus *GetBus()
4848 {
5252 int QueryType(long &type);
5353 int CodeProtectAdjust(uint16_t &config, int read = 0);
5454
55 private: //--------------------------------------- private
55 private:
5656
5757 };
5858 #endif
3232
3333 #define CONFIG_SIZE ( 8 * sizeof(uint16_t) )
3434
35 //=====>>> Costruttore <<<======
3635 Pic16xx::Pic16xx(e2AppWinInfo *wininfo, BusIO *busp)
3736 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
3837 {
4443 }
4544 }
4645
47 //--- Distruttore
4846 Pic16xx::~Pic16xx()
4947 {
5048 }
3434
3535 class Pic16xx : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 Pic16xx(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~Pic16xx();
5050 int SecurityRead(uint32_t &bits);
5151 int SecurityWrite(uint32_t bits);
5252
53 protected: //--------------------------------------- protected
53 protected:
5454
5555 PicBus *GetBus()
5656 {
6868 **/
6969 virtual int CodeProtectAdjust(uint16_t &config, int read = 0);
7070
71 private: //--------------------------------------- private
71 private:
7272
7373 };
7474 #endif
3636
3737 class e2CmdWindow;
3838
39 #ifdef Q_OS_LINUX
40 # include <unistd.h>
41 #else
42 # ifdef __BORLANDC__
43 # define __inline__
44 # else // _MICROSOFT_ VC++
45 # define __inline__ __inline
46 # define _export
47 # endif
48 #endif
49
50 // Constructor
5139 PicBus::PicBus(BusInterface *ptr)
5240 : BusIO(ptr),
5341 DataMask(0xff),
5442 ProgMask(0x3fff),
55 ReadProgCode(0x04), //Read Data from Program Memory *
56 LoadProgCode(0x02), //Load Data for Program Memory *
57 ReadDataCode(0x05), //Read Data from Data Memory *
58 LoadDataCode(0x03), //Load Data for Data Memory *
59 LoadConfigCode(0x00), //Load Configuration *
60 IncAddressCode(0x06), //Increment Address *
61 EraseProgMem(0x09), //Bulk Erase Program Memory *
62 EraseDataMem(0x0b), //Bulk Erase Data Memory *
63 BeginEraseProgCode(0x08), //Begin Erase Programming Cycle *
64 BeginProgOnlyCode(0x18) //Begin Programming Only Cycle
65 {
66 }
67
68 // Desctructor
69 PicBus::~PicBus()
70 {
71 // Close();
43 ReadProgCode(0x04), //Read Data from Program Memory
44 LoadProgCode(0x02), //Load Data for Program Memory
45 ReadDataCode(0x05), //Read Data from Data Memory
46 LoadDataCode(0x03), //Load Data for Data Memory
47 LoadConfigCode(0x00), //Load Configuration
48 IncAddressCode(0x06), //Increment Address
49 EraseProgMem(0x09), //Bulk Erase Program Memory
50 EraseDataMem(0x0b), //Bulk Erase Data Memory
51 BeginEraseProgCode(0x08), //Begin Erase Programming Cycle
52 BeginProgOnlyCode(0x18) //Begin Programming Only Cycle
53 {
7254 }
7355
7456 void PicBus::SetDelay()
9981 break;
10082
10183 default:
102 n = 6; //Default (< 100KHz)
84 n = 6; //Default (< 100KHz)
10385 break;
10486 }
10587
106 BusIO::SetDelay(n);
107
108 qDebug() << "PICBus::SetDelay() = " << n;
88 Q_CHECK_PTR(busI);
89 busI->SetDelay(n);
90
91 qDebug() << Q_FUNC_INFO << "=" << n;
10992 }
11093
11194 int PicBus::SendDataBit(int b)
11295 {
113 setCLK(); //set SCK high
114 bitDI(b);
115
116 WaitUsec(shot_delay);
117
118 clearCLK(); //device latch data bit now!
119
120 WaitUsec(shot_delay);
121
122 return OK;
96 //setCLK(); //set SCK high
97 //bitDI(b);
98 //ShotDelay();
99 //clearCLK(); //device latch data bit now!
100 //ShotDelay();
101
102 int err = OK;
103 clearCLK();
104 busI->xferBit(err, b, SPI_MODE_1 | xMODE_WRONLY);
105
106 return err;
123107 }
124108
125109 // returns a negative number in case of error, 0 or 1 otherwise
126110 int PicBus::RecDataBit()
127111 {
128 register uint8_t b;
129
130 setCLK(); //set SCK high (Pic output data now)
131
132 WaitUsec(shot_delay);
133
134 b = getDO(); // sampling data on falling edge
112 //setCLK(); //set SCK high (Pic output data now)
113 //ShotDelay();
114 //b = getDO(); // sampling data on falling edge
115 //clearCLK();
116 //ShotDelay();
117
118 int err = OK;
135119 clearCLK();
136
137 WaitUsec(shot_delay);
138
139 return b;
140 }
141
142 #define CMD2CMD_DELAY 4000
143
144 // OK, ora ci alziamo di un livello: operiamo sul byte
120 int rv = busI->xferBit(err, 1, SPI_MODE_1 | xMODE_RDONLY);
121 if (err == OK)
122 {
123 return rv;
124 }
125 else
126 {
127 return err;
128 }
129 }
130
145131 int PicBus::SendDataWord(long wo, int wlen)
146132 {
147 int k;
133 int err = OK;
148134
149135 clearCLK();
150136 clearDI();
151
152137 WaitUsec(busI->GetCmd2CmdDelay());
153
154 //transmit lsb first
155 for (k = 0; k < wlen; k++)
156 {
157 SendDataBit(wo & (1 << k));
158 }
159
138 busI->xferWord(err, wo, SPI_MODE_1 | xMODE_WRONLY, wlen, true);
160139 setDI();
161140
162141 //1 usec from a command to the next
163 // WaitUsec(shot_delay/4+1);
164
165 return OK;
142 //WaitUsec(shot_delay/4+1);
143
144 return err;
166145 }
167146
168147 long PicBus::RecDataWord(int wlen)
169148 {
170 int k;
171 long val = 0;
149 int err = OK;
172150
173151 clearCLK();
174152 clearDI();
175
176153 WaitUsec(busI->GetCmd2CmdDelay());
177154 setDI();
178 WaitUsec(2);
179
180 //receive lsb first
181 for (k = 0; k < wlen; k++)
182 if (RecDataBit())
183 {
184 val |= 1 << k;
185 }
186
187 // WaitUsec(shot_delay/4+1);
188
189 return val;
155 ShotDelay();
156 int rv = busI->xferWord(err, 0xffff, SPI_MODE_1 | xMODE_RDONLY, wlen, true);
157
158 //WaitUsec(shot_delay/4+1);
159
160 if (err == OK)
161 {
162 return rv;
163 }
164 else
165 {
166 return err;
167 }
190168 }
191169
192170 int PicBus::SendCmdCode(int opcode)
231209 {
232210 SetDelay();
233211
234 SetMCLR(); //First bogus entry to charge capacitors
212 SetMCLR(); //First bogus entry to charge capacitors
235213 WaitMsec(150);
236214
237215 clearDI();
238 ClearMCLR(); //Now reset the micro
239 setCLK(); //keep Vdd on
216 ClearMCLR(); //Now reset the micro
217 setCLK(); //keep Vdd on
240218 WaitUsec(1000);
241219
242 clearCLK(); //Prepare for Program mode entry
220 clearCLK(); //Prepare for Program mode entry
243221 WaitUsec(1000);
244222
245 SetMCLR(); //Program mode entry
223 SetMCLR(); //Program mode entry
246224 WaitMsec(10);
247225
248226 return OK;
276254
277255 long PicBus::ReadConfig(uint16_t *data)
278256 {
257 Q_CHECK_PTR(data);
258
279259 if (data == 0) //read only configuration word
280260 {
281261 return BADPARAM;
317297
318298 long PicBus::WriteConfig(uint16_t *data)
319299 {
300 Q_CHECK_PTR(data);
301
320302 if (data == 0)
321303 {
322304 return BADPARAM;
412394 //Data is 8 bit, while Program is 14 bit (i.e. 16 bit)
413395 if (addr == 0)
414396 {
415 length >>= 1; //contatore da byte a word
397 length >>= 1;
416398 }
417399
418400 for (len = 0; len < length; len++)
419401 {
420 //
421402 //Send command opcode
422403 if (addr)
423404 {
454435 }
455436 }
456437
438 WaitMsec(1); //Flush
457439 ReadEnd();
458440
459441 if (addr == 0)
460442 {
461 len <<= 1; //contatore da word a byte
443 len <<= 1;
462444 }
463445
464446 return len;
472454
473455 if (addr == 0)
474456 {
475 length >>= 1; //contatore da byte a word
457 length >>= 1;
476458 }
477459
478460 for (len = 0; len < length; len++)
534516 }
535517 }
536518
519 WaitMsec(1); //Flush
537520 WriteEnd();
538521
539522 if (addr == 0)
540523 {
541 len <<= 1; //contatore da word a byte
524 len <<= 1;
542525 }
543526
544527 return len;
582565
583566 if ((retval = CompareSingleWord(val1, val2, ProgMask)))
584567 {
585 break; //Stop if a difference
568 break; //Stop if a difference is detected
586569 }
587570 }
588571 }
3131
3232 class PicBus : public BusIO
3333 {
34 public: //------------------------------- public
34 public:
3535 PicBus(BusInterface *ptr = 0);
36 virtual ~PicBus();
36 //virtual ~PicBus();
3737
3838 long Read(int addr, uint8_t *data, long length, int page_size = 0);
3939 long Write(int addr, uint8_t const *data, long length, int page_size = 0);
5252
5353 void SetDelay();
5454
55 protected: //------------------------------- protected
56
55 protected:
5756 int SendDataWord(long wo, int wlen = 16);
5857 long RecDataWord(int wlen = 16);
5958 int WaitReadyAfterWrite(long timeout = 5000);
8887 const uint8_t BeginEraseProgCode;
8988 const uint8_t BeginProgOnlyCode;
9089
91 private: //------------------------------- private
92
90 private:
9391 int SendDataBit(int b);
9492 int RecDataBit();
9593
122120 {
123121 return busI->GetDataIn();
124122 }
125
126123 };
127124
128125 #endif
3131
3232 #include <QtCore>
3333
34 #ifdef Q_OS_LINUX
35 # include <unistd.h>
36 #else
37 # ifdef __BORLANDC__
38 # define __inline__
39 # else // _MICROSOFT_ VC++
40 # define __inline__ __inline
41 # define _export
42 # endif
43 #endif
44
45 // Costruttore
4634 PicBusNew::PicBusNew(BusInterface *ptr)
4735 : PicBus(ptr)
4836 {
5543 return OK;
5644 }
5745
58 int PicBusNew::Reset(void)
59 {
60 return PicBus::Reset();
61 }
62
6346 long PicBusNew::Write(int addr, uint8_t const *data, long length, int page_size)
6447 {
6548 long len;
6851
6952 if (addr == 0)
7053 {
71 length >>= 1; //contatore da byte a word
54 length >>= 1; //convert counter from byte to word
7255 }
7356
7457 for (len = 0; len < length; len++)
136119 break;
137120 }
138121 }
122 WaitMsec(1); //Flush
139123
140124 WriteEnd();
141125
142126 if (addr == 0)
143127 {
144 len <<= 1; //contatore da word a byte
128 len <<= 1; //convert counter from word to byte
145129 }
146130
147131 return len;
3030
3131 class PicBusNew : public PicBus
3232 {
33 public: //------------------------------- public
33 public:
3434 PicBusNew(BusInterface *ptr = 0);
3535
36 // long Read(int addr, uint8_t *data, long length);
3736 long Write(int addr, uint8_t const *data, long length, int page_size = 0);
3837
39 int Reset();
40
41 protected: //------------------------------- protected
38 protected:
4239
4340 int WaitReadyAfterWrite(long timeout = 5000);
4441
45 private: //------------------------------- private
42 private:
4643
4744 };
4845
229229
230230 if (IsInstalled())
231231 {
232 int control = cmdWin->GetPolarity();
232 unsigned int control = cmdWin->GetPolarity();
233233 uint8_t cpreg = GetCPWReg();
234234
235235 if (control & CLOCKINV)
261261
262262 if (IsInstalled())
263263 {
264 int control = cmdWin->GetPolarity();
264 unsigned int control = cmdWin->GetPolarity();
265265 uint8_t cpreg = GetCPWReg();
266266
267267 if (control & CLOCKINV)
349349 if (ret_val == OK)
350350 {
351351 int a, b;
352 Wait w;
353352
354353 ret_val = E2ERR_OPENFAILED;
355354
3131
3232 class PonyIOInterface : public BusInterface, public PortInterface
3333 {
34 public: //------------------------------- public
34 public:
3535 PonyIOInterface();
3636 virtual ~PonyIOInterface();
3737
5252 int SetPower(bool onoff);
5353 void SetControlLine(int res = 1);
5454
55 protected: //------------------------------- protected
55 protected:
5656 int GetPresence() const;
5757
58 private: //------------------------------- private
58 private:
5959
6060 };
6161
658658 QString buf;
659659 int Count = 0; // return value (can be greater than nports)
660660
661 QFile fh("detect_ports_NT.log");
661 QString fname;
662 QFileInfo fi(E2Profile::GetConfigFile());
663 if (fi.exists())
664 {
665 fname = fi.canonicalPath();
666 }
667 else
668 {
669 fname = qApp->applicationDirPath();
670 }
671 fname.append("/detect_ports_NT.log");
672 QFile fh(fname);
662673
663674 if (!fh.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
664675 {
669680
670681 out << "Enter DetectPortsNT(" << ServiceName << ", " << PortFormat << ", " << (hex) << ports << (dec) << ", " << nports << ")\n";
671682
672 memset(ports, 0, nports * sizeof(base_len)); // Clear port array
683 if (ports != 0)
684 {
685 memset(ports, 0, nports * sizeof(base_len)); // Clear port array
686 }
687
673688 HKEY hCCS; // Open the registry (first stage)
674689 retval = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet", 0, KEY_PERMISSIONS, &hCCS);
675690
749764 {
750765 out << strbuf2 << (dec) << " [0]=" << p[0] << ", [1]=" << p[1] << ", [2]=" << (hex) << p[2] << "h, [3]=" << p[3] << "h, [4]=" << (dec) << p[4] << "\n";
751766
752 ports[Index].base = p[2]; // We got one
753 ports[Index].len = p[4]; // (NO check for typical ISA addresses anymore!!)
767 if (ports != 0)
768 {
769 ports[Index].base = p[2]; // We got one
770 ports[Index].len = p[4]; // (NO check for typical ISA addresses anymore!!)
771 }
754772 }
755773 }
756774 else
4646
4747 struct base_len
4848 {
49 int base, len;
49 unsigned int base, len;
5050 };
5151
5252 class PortInterface
5353 {
54 public: //------------------------------- public
54 public:
5555 PortInterface();
5656 virtual ~PortInterface();
5757
8080 virtual int OutPort(int val, int no = -1);
8181 virtual int OutPortMask(int mask, int val);
8282
83 protected: //------------------------------- protected
83 protected:
8484 uint8_t GetCPWReg()
8585 {
8686 return cpwreg;
9494 read_port; // Number of input port (read I/O port address)
9595 uint8_t cpwreg; // write register image in memory (the content is the same of the hardware register)
9696
97 private: //------------------------------- private
97 private:
9898 int IOperm(int a, int b, int c);
9999
100100 void DetectPorts();
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // http://ponyprog.sourceforge.net //
7 // //
8 //-------------------------------------------------------------------------//
9 // //
10 // This program is free software; you can redistribute it and/or //
11 // modify it under the terms of the GNU General Public License //
12 // as published by the Free Software Foundation; either version2 of //
13 // the License, or (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
18 // General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program (see LICENSE); if not, write to the //
22 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
23 // //
24 //=========================================================================//
25
26 #include "prefdialog.h"
27 #include "ui_prefdialog.h"
28
29 #include "e2profil.h"
30
31 // ULTRASLOW = 0,
32 // VERYSLOW,
33 // SLOW,
34 // NORMAL,
35 // FAST,
36 // TURBO
37
38 PrefDialog::PrefDialog(QWidget *parent, const QString title) :
39 QDialog(parent),
40 ui(new Ui::PrefDialog)
41 {
42 ui->setupUi(this);
43 setWindowTitle(title);
44
45 QStringList speedItems = (QStringList() << "Slowest" << "Very Slow" << "Slow" << "Normal" << "Fast" << "Fastest");
46 ui->cbxBusSpeedSPI->addItems(speedItems);
47 ui->cbxBusSpeedI2C->addItems(speedItems);
48 ui->cbxBusSpeedIM->addItems(speedItems);
49 ui->cbxBusSpeedPIC->addItems(speedItems);
50 ui->cbxBusSpeedSDE->addItems(speedItems);
51 ui->cbxBusSpeedMicroWire->addItems(speedItems);
52
53 ui->lblBusSpeedSPI->setText("SPI Bus Speed");
54 ui->lblBusSpeedI2C->setText("I2C Bus Speed");
55 ui->lblBusSpeedIM->setText("IM Bus Speed");
56 ui->lblBusSpeedPIC->setText("PIC Bus Speed");
57 ui->lblBusSpeedSDE->setText("SDE Bus Speed");
58 ui->lblBusSpeedMicroWire->setText("MicroWire Bus Speed");
59
60 ui->cbxBusSpeedSPI->setCurrentIndex(E2Profile::GetSPISpeed());
61 ui->cbxBusSpeedI2C->setCurrentIndex(E2Profile::GetI2CSpeed());
62 ui->cbxBusSpeedIM->setCurrentIndex(E2Profile::GetIMBusSpeed());
63 ui->cbxBusSpeedPIC->setCurrentIndex(E2Profile::GetPICSpeed());
64 ui->cbxBusSpeedSDE->setCurrentIndex(E2Profile::GetSDESpeed());
65 ui->cbxBusSpeedMicroWire->setCurrentIndex(E2Profile::GetMicroWireSpeed());
66
67 ui->label_1->setText("Power Up Delay");
68 ui->label_2->setText("SPI Reset pulse");
69 ui->label_3->setText("SPI Delay After Reset");
70 ui->label_4->setText("AT89 Delay After Reset");
71 ui->label_5->setText("AVR Delay After Reset");
72 ui->label_6->setText("JDM Delay Cmd-to-Cmd");
73
74 ui->lineEdit_1->setToolTip("A Delay to let the board Power Up completely (milli sec)");
75 ui->lineEdit_2->setToolTip("Duration of SPI Reset pulse in milli sec");
76 ui->lineEdit_3->setToolTip("Delay for the first command after the reset pulse for SPI devices (milli sec)");
77 ui->lineEdit_4->setToolTip("Delay after reset for AT89xx devices, it increments the SPI delay (milli sec)");
78 ui->lineEdit_5->setToolTip("Delay after reset for AVR devices, it increments the SPI delay (milli sec)");
79 ui->lineEdit_6->setToolTip("Delay between two consecutive commands for JDM interface (micro sec)");
80
81 QValidator *validator = new QIntValidator(1, 999, this);
82 ui->lineEdit_1->setValidator(validator);
83 ui->lineEdit_2->setValidator(validator);
84 ui->lineEdit_3->setValidator(validator);
85 ui->lineEdit_4->setValidator(validator);
86 ui->lineEdit_5->setValidator(validator);
87 ui->lineEdit_6->setValidator(new QIntValidator(100, 10000, this));
88
89 ui->lineEdit_1->setText(QString::number(E2Profile::GetPowerUpDelay()));
90 ui->lineEdit_2->setText(QString::number(E2Profile::GetSPIResetPulse()));
91 ui->lineEdit_3->setText(QString::number(E2Profile::GetSPIDelayAfterReset()));
92 ui->lineEdit_4->setText(QString::number(E2Profile::GetAT89DelayAfterReset()));
93 ui->lineEdit_5->setText(QString::number(E2Profile::GetAVRDelayAfterReset()));
94 ui->lineEdit_6->setText(QString::number(E2Profile::GetJDMCmd2CmdDelay()));
95 }
96
97 PrefDialog::~PrefDialog()
98 {
99 delete ui;
100 }
101
102 void PrefDialog::on_buttonBox_accepted()
103 {
104 E2Profile::SetSPISpeed(ui->cbxBusSpeedSPI->currentIndex());
105 E2Profile::SetI2CSpeed(ui->cbxBusSpeedI2C->currentIndex());
106 E2Profile::SetIMBusSpeed(ui->cbxBusSpeedIM->currentIndex());
107 E2Profile::SetPICSpeed(ui->cbxBusSpeedPIC->currentIndex());
108 E2Profile::SetSDESpeed(ui->cbxBusSpeedSDE->currentIndex());
109 E2Profile::SetMicroWireSpeed(ui->cbxBusSpeedMicroWire->currentIndex());
110
111 E2Profile::SetPowerUpDelay(ui->lineEdit_1->text().toInt());
112 E2Profile::SetSPIResetPulse(ui->lineEdit_2->text().toInt());
113 E2Profile::SetSPIDelayAfterReset(ui->lineEdit_3->text().toInt());
114 E2Profile::SetAT89DelayAfterReset(ui->lineEdit_4->text().toInt());
115 E2Profile::SetAVRDelayAfterReset(ui->lineEdit_5->text().toInt());
116 E2Profile::SetJDMCmd2CmdDelay(ui->lineEdit_6->text().toUInt());
117 }
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // http://ponyprog.sourceforge.net //
7 // //
8 //-------------------------------------------------------------------------//
9 // //
10 // This program is free software; you can redistribute it and/or //
11 // modify it under the terms of the GNU General Public License //
12 // as published by the Free Software Foundation; either version2 of //
13 // the License, or (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
18 // General Public License for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program (see LICENSE); if not, write to the //
22 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
23 // //
24 //=========================================================================//
25
26 #ifndef PREFDIALOG_H
27 #define PREFDIALOG_H
28
29 #include <QDialog>
30
31 namespace Ui
32 {
33 class PrefDialog;
34 }
35
36 class PrefDialog : public QDialog
37 {
38 Q_OBJECT
39
40 public:
41 explicit PrefDialog(QWidget *parent, const QString title);
42 ~PrefDialog();
43
44 private slots:
45 void on_buttonBox_accepted();
46
47 private:
48 Ui::PrefDialog *ui;
49 };
50
51 #endif // PREFDIALOG_H
3232 #include "eeptypes.h"
3333 #include "globals.h"
3434
35
36
37 //======================>>> progOptionDialog::progOptionDialog <<<==================
3835 progOptionDialog::progOptionDialog(QWidget *bw, long type, int &reload, int &reep, int &erase, int &flash, int &eeprom, int &lock, const QString title) :
3936 QDialog(bw)
4037 {
5451 //Checked
5552 for (int k = 0; k < chk.count(); k++)
5653 {
57 chk[k]->setChecked((prog_opt & (1 << k)) ? 1 : 0);
54 chk[k]->setChecked((prog_opt & (1 << k)) ? true : false);
5855 }
5956
6057 connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
6360 qDebug() << "progOptionDialog::progOptionDialog()";
6461 }
6562
66 //===================>>> progOptionDialog::~progOptionDialog <<<====================
6763 progOptionDialog::~progOptionDialog()
6864 {
6965 qDebug() << "progOptionDialog::~progOptionDialog()";
9793
9894 accept();
9995 }
100
4141 class progOptionDialog : public QDialog, public cTranslator, public Ui::ProgOptDialog
4242 {
4343 Q_OBJECT
44 public: //---------------------------------------- public
44 public:
4545 progOptionDialog(QWidget *bw, long type, int &reload, int &reep, int &erase, int &flash, int &eeprom, int &lock, const QString title = translate(STR_MSGPROGOPT));
4646 virtual ~progOptionDialog(); // Destructor
4747
4848 private slots:
4949 void onOk();
5050
51 protected: //--------------------------------------- protected
51 protected:
5252
5353 private:
5454 void setTextWidgets();
5555
56 private: //--------------------------------------- private
56 private:
5757 QVector <QCheckBox *> chk;
5858 e2CmdWindow *cmdw;
5959 };
4343
4444 class RS232Interface
4545 {
46 public: //------------------------------- public
46 public:
4747
4848 RS232Interface();
4949 virtual ~RS232Interface();
6767 int GetSerialCTS() const;
6868 int SetSerialRTSDTR(int state);
6969
70 protected: //------------------------------- protected
70 protected:
7171
7272 void WaitForTxEmpty();
7373
74 private: //------------------------------- private
74 private:
7575
7676 QString m_devname;
7777
3232
3333 #include <QDebug>
3434
35 //=====>>> Costruttore <<<======
3635 Sde2506::Sde2506(e2AppWinInfo *wininfo, BusIO *busp)
3736 : Device(wininfo, busp, 1 /*BANK_SIZE*/)
3837 {
3938 qDebug() << "Sde2506::Sde2506()";
4039 }
4140
42 //--- Distruttore
4341 Sde2506::~Sde2506()
4442 {
4543 qDebug() << "Sde2506::~Sde2506()";
4644 }
4745
4846 // determina il numero di banchi (dimensione) dell'eeprom
49 //---
5047 int Sde2506::Probe(int probe_size)
5148 {
5249 qDebug() << "Sde2506::Probe(" << probe_size << ")";
3434
3535 class Sde2506 : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 Sde2506(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040 virtual ~Sde2506();
4444 int Write(int probe = 1, int type = ALL_TYPE);
4545 int Verify(int type = ALL_TYPE);
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 Sde2506Bus *GetBus()
5050 {
5151 return static_cast<Sde2506Bus *>(Device::GetBus());
5252 }
5353
54 private: //--------------------------------------- private
54 private:
5555
5656 };
5757 #endif
3232
3333 #include "e2cmdw.h"
3434
35 #ifdef Q_OS_LINUX
36 # include <unistd.h>
37 #else
38 # ifdef __BORLANDC__
39 # define __inline__
40 # else // _MICROSOFT_ VC++
41 # define __inline__ __inline
42 # define _export
43 # endif
44 #endif
45
46 // Costruttore
4735 Sde2506Bus::Sde2506Bus(BusInterface *ptr)
4836 : BusIO(ptr)
4937 {
50 qDebug() << "Sde2506Bus::Sde2506Bus()";
51 }
52
53 // Distruttore
38 qDebug() << Q_FUNC_INFO;
39 }
40
5441 Sde2506Bus::~Sde2506Bus()
5542 {
56 qDebug() << "Sde2506Bus::~Sde2506Bus()";
57
58 // Close();
43 qDebug() << Q_FUNC_INFO;
5944 }
6045
6146 void Sde2506Bus::SetDelay()
6651 switch (val)
6752 {
6853 case TURBO:
69 n = 1; // as fast as your PC can
54 n = 1;
7055 break;
7156
7257 case FAST:
9075 break;
9176 }
9277
93 BusIO::SetDelay(n);
94
95 qDebug() << "Sde2506Bus::SetDelay() = " << n;
78 Q_CHECK_PTR(busI);
79 busI->SetDelay(n);
80
81 qDebug() << Q_FUNC_INFO << "=" << n;
9682 }
9783
9884 int Sde2506Bus::SendDataBit(int b)
9985 {
100 clearCLK(); //si assicura che SCK low
101 WaitUsec(shot_delay);
102 setCLK();
103 bitDI(b);
104 WaitUsec(shot_delay);
105 clearCLK(); //device latch data bit now!
86 //clearCLK(); //si assicura che SCK low
87 //ShotDelay();
88 //setCLK();
89 //bitDI(b);
90 //ShotDelay();
91 //clearCLK(); //device latch data bit now!
92
93 int err = OK;
94 clearCLK();
95 busI->xferBit(err, b, SPI_MODE_1 | xMODE_WRONLY);
96
97 return err;
98 }
99
100 int Sde2506Bus::RecDataBit()
101 {
102 //clearCLK(); //the eeprom set data now
103 //ShotDelay();
104 //setCLK();
105 //b = getDO();
106 //ShotDelay(); //hold time
107 //clearCLK();
108
109 int err = OK;
110 clearCLK();
111 int rv = busI->xferBit(err, 1, SPI_MODE_0 | xMODE_RDONLY);
112 if (err == OK)
113 {
114 return rv;
115 }
116 else
117 {
118 return err;
119 }
120 }
121
122 int Sde2506Bus::SendDataWord(int wo, int wlen)
123 {
124 int err = OK;
125
126 clearCLK();
127 ShotDelay();
128 busI->xferWord(err, wo, SPI_MODE_1 | xMODE_WRONLY, wlen, true);
129 setDI();
130
131 return err;
132 }
133
134 int Sde2506Bus::RecDataWord(int wlen)
135 {
136 int err = OK;
137 clearCLK();
138 int rv = busI->xferWord(err, 0xffff, SPI_MODE_0 | xMODE_RDONLY, wlen, true);
139 if (err == OK)
140 {
141 return rv;
142 }
143 else
144 {
145 return err;
146 }
147 }
148
149 int Sde2506Bus::WaitReadyAfterWrite(long timeout)
150 {
151 WaitMsec(15);
106152
107153 return OK;
108154 }
109155
110 // ritorna un numero negativo se c'e` un errore, altrimenti 0 o 1
111 int Sde2506Bus::RecDataBit()
112 {
113 register uint8_t b;
114
115 clearCLK(); //the eeprom set data now
116 WaitUsec(shot_delay);
117 setCLK();
118 b = getDO();
119 WaitUsec(shot_delay); //hold time
120 clearCLK();
121
122 return b;
123 }
124
125 // OK, ora ci alziamo di un livello: operiamo sul byte
126 int Sde2506Bus::SendDataWord(int wo, int wlen)
127 {
128 int k;
129
130 clearCLK();
131
132 //From LSB to MSB
133 for (k = 0; k < wlen; k++)
134 {
135 SendDataBit(wo & (1 << k));
136 }
137
138 WaitUsec(shot_delay);
139 setDI();
156 int Sde2506Bus::Reset(void)
157 {
158 qDebug() << Q_FUNC_INFO;
159
160 SetDelay();
161
162 clearCLK(); //clock = 0
163 setDI(); //data = 1
164 setCE(); //CE = 1
140165
141166 return OK;
142167 }
143168
144 int Sde2506Bus::RecDataWord(int wlen)
145 {
146 int k, val = 0;
147
148 clearCLK();
149 setDI();
150
151 for (k = 0; k < wlen; k++)
152 if (RecDataBit())
153 {
154 val |= 1 << k;
155 }
156
157 return val;
158 }
159
160 int Sde2506Bus::WaitReadyAfterWrite(long timeout)
161 {
162 WaitMsec(15);
163
164 return OK;
165 }
166
167 int Sde2506Bus::Reset(void)
168 {
169 qDebug() << "Sde2506Bus::Reset()";
170
171 SetDelay();
172
173 clearCLK(); //clock = 0
174 setDI(); //data = 1
175 setCE(); //CE = 1
176
177 return OK;
178 }
179
180169 long Sde2506Bus::Read(int addr, uint8_t *data, long length, int page_size)
181170 {
182 qDebug() << "Sde2506Bus::Read(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
171 qDebug() << Q_FUNC_INFO << "(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
183172 ReadStart();
184173
185174 long len;
190179
191180 //Send command opcode
192181 SendAddress(addr++);
193 SendControlBit(0); //SB = 0 --> Read op
182 SendControlBit(0); //SB = 0 --> Read op
194183 WaitUsec(5);
195184 clearCE();
185 ShotDelay();
196186
197187 SendDataBit(1);
198188 *data++ = RecDataWord();
199189
200 WaitUsec(shot_delay + 1);
190 ShotDelay(2);
201191 setCE();
202192
203193 if ((len % 4) == 0)
208198 }
209199 }
210200 }
201 WaitMsec(1); //Flush
211202
212203 ReadEnd();
213 qDebug() << "Sde2506Bus::Read() = " << len;
204 qDebug() << Q_FUNC_INFO << "=" << len;
214205
215206 return len;
216207 }
229220 SendDataWord(*data++);
230221 SendAddress(curaddr);
231222
232 SendControlBit(1); //SB = 1 --> Write/Erase op
233 WaitUsec(5);
223 SendControlBit(1); //SB = 1 --> Write/Erase op
224 ShotDelay(2); //WaitUsec(5);
234225 clearCE();
235226
236 SendDataBit(1); //Start erase
227 SendDataBit(1); //Start erase
237228 setDI();
238229 WaitReadyAfterWrite();
239 setCE(); //End erase
240
241 WaitUsec(shot_delay / 2 + 1); //perform write
230 setCE(); //End erase
231
232 ShotDelay(); //WaitUsec(GetDelay() / 2 + 1); //perform write
242233 clearDI();
243 WaitUsec(shot_delay);
234 ShotDelay();
244235 clearCE();
245236
246 SendDataBit(0); //Start write
237 SendDataBit(0); //Start write
247238 setDI();
248239 WaitReadyAfterWrite();
249 setCE(); //End write
240 setCE(); //End write
241 ShotDelay();
250242
251243 if ((curaddr & 1))
252244 {
256248 }
257249 }
258250 }
251 WaitMsec(1); //Flush
259252
260253 WriteEnd();
261254
3131
3232 class Sde2506Bus : public BusIO
3333 {
34 public: //------------------------------- public
34 public:
3535 Sde2506Bus(BusInterface *ptr = 0);
3636 virtual ~Sde2506Bus();
3737
4242
4343 void SetDelay();
4444
45 protected: //------------------------------- protected
45 protected:
4646
4747 int SendDataWord(int wo, int wlen = 8);
4848 int RecDataWord(int wlen = 8);
6666 busI->SetControlLine(1);
6767 }
6868
69 private: //------------------------------- private
69 private:
7070
7171 int SendDataBit(int b);
7272 int RecDataBit();
2323 // //
2424 //=========================================================================//
2525
26
2726 #include <QDebug>
2827
2928 #include "types.h"
3029 #include "sernumdlg.h"
3130
32
33 //=========================>>> SerNumDialog::SerNumDialog <<<====================
3431 SerNumDialog::SerNumDialog(QWidget *bw, const QString title) :
3532 QDialog(bw)
3633 {
3734 setupUi(this);
3835
3936 setWindowTitle(title);
37 setTextWidgets();
38
39 E2Profile::readDialogSettings(this, false);
4040
4141 loc = 0;
4242 val = 0;
5050 autoinc = E2Profile::GetSerialNumAutoInc();
5151 fmt = E2Profile::GetSerialNumFormat();
5252
53
54 setTextWidgets();
55
56 loc = (loc < 0) ? 0 : loc;
57 size = (size < 0 || size > 4) ? 4 : size;
58 memtype = (memtype == 0 || memtype == 1) ? memtype : 0;
53 if (loc < 0)
54 {
55 loc = 0;
56 }
57 if (size < 0 || size > 4)
58 {
59 size = 4;
60 }
61
62 txiLoc->setText(QString().sprintf("0x%04lX", loc));
63 txiLen->setText(QString().sprintf("%d", size));
64 txiVal->setText(QString().sprintf("%lu", val));
65
66 chkMemOffset->setChecked(memtype);
67 chkAutoInc->setChecked(autoinc);
68
69 if (fmt == FMT_LITTLE_ENDIAN)
70 {
71 rdbLittleEnd->setChecked(true);
72 rdbBigEnd->setChecked(false);
73 }
74 else
75 {
76 rdbLittleEnd->setChecked(false);
77 rdbBigEnd->setChecked(true);
78 }
79
80 connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
81 connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
82
83 qDebug() << Q_FUNC_INFO;
84 }
85
86 SerNumDialog::~SerNumDialog()
87 {
88 qDebug() << Q_FUNC_INFO;
89 }
90
91 void SerNumDialog::setTextWidgets()
92 {
93 pushOk->setText(translate(STR_BTNOK));
94 pushCancel->setText(translate(STR_BTNCANC));
5995
6096 lblLoc->setText(translate(STR_MSGADDRESS));
6197 lblLen->setText(translate(STR_MSGSIZE2));
6298 lblVal->setText(translate(STR_MSGVALUE));
6399
64 QString str;
65 str = QString().sprintf("0x%04lX", loc);
66 txiLoc->setText(str);
67
68 str = QString().sprintf("%d", size);
69 txiLen->setText(str);
70
71 str = QString().sprintf("%lu", (unsigned long)val);
72 txiVal->setText(str);
73
74 chkMemOffset->setChecked(memtype);
75 chkAutoInc->setChecked(autoinc);
76
77 if (fmt == FMT_LITTLE_ENDIAN)
78 {
79 rdbLittleEnd->setChecked(true);
80 rdbBigEnd->setChecked(false);
81 }
82 else
83 {
84 rdbLittleEnd->setChecked(false);
85 rdbBigEnd->setChecked(true);
86 }
87
88 connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
89 connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
90
91 qDebug() << "SerNumDialog::SerNumDialog()";
92 }
93
94 //======================>>> SerNumDialog::~SerNumDialog <<<======================
95 SerNumDialog::~SerNumDialog()
96 {
97 qDebug() << "SerNumDialog::~SerNumDialog()";
98 }
99
100
101 void SerNumDialog::setTextWidgets()
102 {
103 pushOk->setText(translate(STR_BTNOK));
104 pushCancel->setText(translate(STR_BTNCANC));
105
106 lblLoc->setText(translate(STR_MSGADDRESS));
107 lblLen->setText(translate(STR_MSGSIZE2));
108 lblVal->setText(translate(STR_MSGVALUE));
109
110100 chkMemOffset->setText(translate(STR_MSGOFFSET));
111101 chkAutoInc->setText(translate(STR_MSGSNAUTOINC));
112102
115105 rdbLittleEnd->setText(translate(STR_MSGLITTLEEND));
116106 rdbBigEnd->setText(translate(STR_MSGBIGENDIAN));
117107 }
118
119108
120109 void SerNumDialog::onOk()
121110 {
182171 E2Profile::SetSerialNumFormat(fmt);
183172 E2Profile::SetSerialNumAutoInc(autoinc);
184173
174 E2Profile::writeDialogSettings(this, false);
175
185176 accept();
186177 }
187178
188179
189
190 //=========================>>> OscCalibDialog::OscCalibDialog <<<====================
191180 OscCalibDialog::OscCalibDialog(QWidget *bw, e2AppWinInfo *aw, const QString title) :
192181 QDialog(bw)
193182 {
194183 setupUi(this);
195
196184 setWindowTitle(title);
197185
198186 loc = 0;
199187 val = 0;
200188 memtype = false;
189 enabled = false;
201190 size = 1;
202191
203 qDebug() << "OscCalibDialog::OscCalibDialog()";
204
205 E2Profile::GetCalibrationAddress(loc, size, memtype);
192 qDebug() << Q_FUNC_INFO;
193
194 E2Profile::readDialogSettings(this, false);
195
196 E2Profile::GetCalibrationAddress(enabled, loc, size, memtype);
206197
207198 lblLoc->setText(translate(STR_MSGADDRESS));
208199 lblVal->setText(translate(STR_MSGVALUE));
209200
210201 chkMemOffset->setText(translate(STR_MSGOFFSET));
211
212 QString str1;
213 QString str3;
202 chkEnabled->setText(translate(STR_CALIBRENABLED));
214203
215204 loc = (loc < 0) ? 0 : loc;
216205
217 str1 = QString().sprintf("0x%04lX", loc);
218 str3 = QString().sprintf("%d", val);
219
220 txiLoc->setText(str1);
221 txiVal->setText(str3);
206 txiLoc->setText(QString().sprintf("0x%04lX", loc));
207 txiVal->setText(QString().sprintf("%d", val));
222208
223209 chkMemOffset->setChecked(memtype);
224
210 chkEnabled->setChecked(enabled);
225211
226212 pushOk->setText(translate(STR_BTNOK));
227213 pushCancel->setText(translate(STR_BTNCANC));
234220 awip = aw;
235221 }
236222
237
238 //======================>>> OscCalibDialog::~OscCalibDialog <<<======================
239223 OscCalibDialog::~OscCalibDialog()
240224 {
241 qDebug() << "OscCalibDialog::~OscCalibDialog()";
242 }
243
225 qDebug() << Q_FUNC_INFO;
226 }
244227
245228 void OscCalibDialog::onOk()
246229 {
247 bool ok;
248 long i = txiLoc->text().toLong(&ok);
249
250 if (ok == true)
230 bool ok1, ok2;
231 long i = txiLoc->text().toLong(&ok1, 0);
232
233 if (ok1)
251234 {
252235 loc = i;
253236 }
256239 QPalette *palette = new QPalette();
257240 palette->setColor(QPalette::Text, Qt::red);
258241 txiLoc->setPalette(*palette);
259
260 return;
261 }
262
263 long v = txiVal->text().toLong(&ok);
264
265 if (ok == true)
266 {
267 val = (uint8_t)v;
242 }
243
244 int v = txiVal->text().toInt(&ok2, 0);
245
246 if (ok2)
247 {
248 val = v;
268249 }
269250 else
270251 {
271252 QPalette *palette = new QPalette();
272253 palette->setColor(QPalette::Text, Qt::red);
273254 txiVal->setPalette(*palette);
274
275 return;
276 }
277
278 memtype = chkMemOffset->isChecked();
279
280 E2Profile::SetCalibrationAddress(loc, size, memtype);
281
282 accept();
283 }
284
255 }
256
257 if (ok1 && ok2)
258 {
259 memtype = chkMemOffset->isChecked();
260 enabled = chkEnabled->isChecked();
261
262 E2Profile::SetCalibrationAddress(enabled, loc, size, memtype);
263 E2Profile::writeDialogSettings(this, false);
264
265 accept();
266 }
267 }
285268
286269 void OscCalibDialog::onRead()
287270 {
288 int val;
289 val = awip->ReadOscCalibration();
290 QString str = QString().sprintf("0x%02X", val);
291 txiVal->setText(str);
292 }
293
271 int val = awip->ReadOscCalibration();
272 if (val >= 0)
273 {
274 txiVal->setText(QString().sprintf("0x%02X", val));
275 }
276 else
277 {
278 qWarning() << "Error " << val;
279 //if (verbose != verboseNo)
280 //{
281 // rval = OnError(rval);
282 //}
283 QPalette *palette = new QPalette();
284 palette->setColor(QPalette::Text, Qt::red);
285 txiVal->setPalette(*palette);
286 txiVal->setText(QString("Error %1").arg(val));
287 }
288 }
4242 class SerNumDialog : public QDialog, public cTranslator, public Ui::SNCfgDialog
4343 {
4444 Q_OBJECT
45 public: //---------------------------------------- public
45 public:
4646 SerNumDialog(QWidget *bw, const QString title = translate(STR_MSGSERNUMCFG));
4747 virtual ~SerNumDialog(); // Destructor
4848
4949 private slots:
5050 void onOk();
5151
52 protected: //--------------------------------------- protected
52 protected:
5353
54 private: //--------------------------------------- private
54 private:
5555 void setTextWidgets();
5656 private:
5757 long loc;
58 uint32_t val;
58 unsigned long val;
5959 bool memtype;
6060 bool autoinc;
6161 int size;
6666 class OscCalibDialog : public QDialog, public cTranslator, public Ui::OscCalibrDialog
6767 {
6868 Q_OBJECT
69 public: //---------------------------------------- public
69 public:
7070 OscCalibDialog(QWidget *bw, e2AppWinInfo *aw, const QString title = translate(STR_MSGOSCCALIBCFG));
7171 virtual ~OscCalibDialog(); // Destructor
7272
7474 void onOk();
7575 void onRead();
7676
77 protected: //--------------------------------------- protected
77 protected:
7878
79 private: //--------------------------------------- private
79 private:
8080 long loc;
81 uint8_t val;
81 int val;
8282 bool memtype;
83 bool enabled;
8384 int size;
8485
8586 e2AppWinInfo *awip;
2929 #include "spi-bus.h"
3030 #include "errcode.h"
3131
32
3332 #include "e2cmdw.h"
3433
3534 #include <QDebug>
3635 #include <QtCore>
3736
38 #ifdef Q_OS_LINUX
39 # include <unistd.h>
40 #else
41 # ifdef __BORLANDC__
42 # define __inline__
43 # else // _MICROSOFT_ VC++
44 # define __inline__ __inline
45 # define _export
46 # endif
47 #endif
48
49 // Costruttore
50 SPIBus::SPIBus(BusInterface *ptr, bool cpha)
37 SPIBus::SPIBus(BusInterface *ptr, bool cpha, bool cpol)
5138 : BusIO(ptr),
52 fall_edge_sample(cpha)
39 m_cpol(cpol),
40 m_cpha(cpha)
5341 {
5442 }
5543
56 // Distruttore
5744 SPIBus::~SPIBus()
5845 {
59 // Close();
6046 }
6147
6248 void SPIBus::SetDelay()
9177 break;
9278 }
9379
94 BusIO::SetDelay(n);
80 Q_CHECK_PTR(busI);
81 busI->SetDelay(n);
9582
96 qDebug() << "SPIBus::SetDelay() = " << n;
83 qDebug() << Q_FUNC_INFO << "() = " << n;
9784 }
9885
9986
10087 int SPIBus::SendDataBit(int b)
10188 {
102 if (fall_edge_sample)
89 int err = OK;
90 busI->xferBit(err, b, GetMode() | xMODE_WRONLY);
91
92 return err;
93 }
94
95 int SPIBus::RecDataBit()
96 {
97 int err = OK;
98 int rv = busI->xferBit(err, 1, GetMode() | xMODE_RDONLY);
99 if (err == OK)
103100 {
104 setSCK(); //be sure the SCK line is high
105 bitMOSI(b);
106 WaitUsec(shot_delay);
107 clearSCK(); //slave latches data bit now!
108 WaitUsec(shot_delay);
101 return rv;
109102 }
110103 else
111104 {
112 clearSCK(); //be sure the SCK line is low
113 bitMOSI(b);
114 WaitUsec(shot_delay);
115 setSCK(); //slave latches data bit now!
116 WaitUsec(shot_delay);
117 clearSCK();
105 return err;
118106 }
119
120 return OK;
121107 }
122108
123 // ritorna un numero negativo se c'e` un errore, altrimenti 0 o 1
124 int SPIBus::RecDataBit()
125 {
126 register uint8_t b;
127
128 if (fall_edge_sample)
129 {
130 setSCK(); //be sure the SCK line is high
131 WaitUsec(shot_delay);
132 clearSCK();
133 b = getMISO();
134 WaitUsec(shot_delay);
135 }
136 else
137 {
138 clearSCK(); //be sure the SCK line is low
139 WaitUsec(shot_delay);
140 setSCK();
141 b = getMISO();
142 WaitUsec(shot_delay);
143 clearSCK();
144 }
145
146 return b;
147 }
148
149 // OK, ora ci alziamo di un livello: operiamo sul byte
150109 int SPIBus::SendDataByte(int by)
151110 {
152 int k;
111 int err = OK;
112 busI->xferByte(err, by, GetMode() | xMODE_WRONLY);
153113
154 clearSCK();
155
156 //MSbit (7) sent first
157 for (k = 7; k >= 0; k--)
158 {
159 SendDataBit(by & (1 << k));
160 }
161
162 setMOSI();
163
164 return OK;
114 return err;
165115 }
166116
167117 int SPIBus::RecDataByte()
168118 {
169 int k, val = 0;
170
171 setMOSI();
172 clearSCK();
173
174 for (k = 7; k >= 0; k--)
175 if (RecDataBit())
176 {
177 val |= 1 << k;
178 }
179
180 return val;
119 int err = OK;
120 int rv = busI->xferByte(err, 0xff, GetMode() | xMODE_RDONLY);
121 if (err == OK)
122 {
123 return rv;
124 }
125 else
126 {
127 return err;
128 }
181129 }
182
183130
184131 int SPIBus::Reset(void)
185132 {
186 qDebug() << "SPIBus::Reset() I";
133 qDebug() << Q_FUNC_INFO << "IN";
187134
188135 SetDelay();
189136
190 clearSCK(); // Dal datasheet AVR
191 setMOSI(); // the datasheet don't specify, but we need to provide power from at least one line (MOSI while SCK and RESET are low)
137 clearSCK(); // AVR datasheet
138 setMOSI(); // the datasheet doesn't specify, but with SIProg we need to provide power from at least one line (MOSI while SCK and RESET are low)
192139
193140 WaitMsec(20);
194 ClearReset(); //One pulse on the reset (datasheet AVR)
195 WaitMsec(E2Profile::GetSPIResetPulse()); //AppNote AVR910 suggest >100 msec
141 ClearReset(); //One pulse on the reset (datasheet AVR)
142 WaitMsec(E2Profile::GetSPIResetPulse()); //AppNote AVR910 suggest >100 msec
196143 SetReset();
197144
198145 WaitMsec(E2Profile::GetSPIDelayAfterReset());
199146
200 qDebug() << "SPIBus::Reset() O";
147 qDebug() << Q_FUNC_INFO << "OUT";
201148
202149 return OK;
203150 }
3131
3232 class SPIBus : public BusIO
3333 {
34 public: //------------------------------- public
35 SPIBus(BusInterface *ptr = 0, bool cpha = false);
34 public:
35 SPIBus(BusInterface *ptr = 0, bool cpha = false, bool cpol = false);
3636 virtual ~SPIBus();
3737
3838 virtual int Reset();
3939
4040 void SetDelay();
41
4142 void SetFallingPhase(bool cpha)
4243 {
43 fall_edge_sample = cpha;
44 m_cpha = cpha;
45 }
46 bool GetFallingPhase()
47 {
48 return m_cpha;
49 }
50 void SetClockPolarity(bool cpol)
51 {
52 m_cpol = cpol;
53 }
54 bool GetClockPolarity()
55 {
56 return m_cpol;
4457 }
4558
46 protected: //------------------------------- protected
59 void SetMode(int mode)
60 {
61 m_cpol = ((mode & SPIMODE_CPOL) != 0);
62 m_cpha = ((mode & SPIMODE_CPHA) != 0);
63 }
64 void SetMode(bool cpha, bool cpol)
65 {
66 m_cpol = cpol;
67 m_cpha = cpha;
68 }
69 int GetMode()
70 {
71 int mode = 0;
72 if (m_cpol)
73 {
74 mode |= SPIMODE_CPOL;
75 }
76 if (m_cpha)
77 {
78 mode |= SPIMODE_CPHA;
79 }
80
81 return mode;
82 }
83
84 protected:
4785
4886 int SendDataByte(int by);
4987 int RecDataByte();
71109 int RecDataBit();
72110
73111 private:
112
74113 void bitMOSI(int b)
75114 {
76115 busI->SetDataOut(b);
91130 return busI->GetDataIn();
92131 }
93132
94 bool fall_edge_sample;
133 bool m_cpol; //clock polarity
134 bool m_cpha; //rising edge vs fall edge sample
95135 };
96136
97137 #endif
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // Copyright (C) 2019 LibUSB part, Eduard Kalinowski //
7 // //
8 // http://ponyprog.sourceforge.net //
9 // //
10 //-------------------------------------------------------------------------//
11 // //
12 // This program is free software; you can redistribute it and/or //
13 // modify it under the terms of the GNU General Public License //
14 // as published by the Free Software Foundation; either version2 of //
15 // the License, or (at your option) any later version. //
16 // //
17 // This program is distributed in the hope that it will be useful, //
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
20 // General Public License for more details. //
21 // //
22 // You should have received a copy of the GNU General Public License //
23 // along with this program (see LICENSE); if not, write to the //
24 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
25 // //
26 //=========================================================================//
27
28 #include <QDebug>
29
30 #include "usbwatcher.h"
31
32 static int LIBUSB_CALL hotplug_callback(struct libusb_context *ctx, struct libusb_device *dev,
33 libusb_hotplug_event event, void *user_data)
34 {
35 struct libusb_device_descriptor desc;
36
37 (void)libusb_get_device_descriptor(dev, &desc);
38
39 USBWatcher *w = static_cast<USBWatcher *>(user_data);
40 Q_CHECK_PTR(w);
41
42 if (LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED == event)
43 {
44 w->hotplug_notify(true, desc.idVendor, desc.idProduct);
45 qDebug() << "Connected VID:PID " << (hex) << desc.idVendor << " - " << desc.idProduct;
46 }
47 else if (LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT == event)
48 {
49 w->hotplug_notify(false, desc.idVendor, desc.idProduct);
50 qDebug() << "Disconnected VID:PID " << (hex) << desc.idVendor << " - " << desc.idProduct;
51 }
52
53 return 0;
54 }
55
56 void USBWatcher::doPoll()
57 {
58 if (count > 0)
59 {
60 if (usb_ctx)
61 {
62 struct timeval zero_tv = { .tv_sec = 0, .tv_usec = 0 };
63 //zero_tv.tv_sec = 1; // timeout 1 sec
64
65 int rv = libusb_handle_events_timeout_completed(usb_ctx,
66 const_cast<timeval *>(&zero_tv),
67 NULL);
68 if (rv != LIBUSB_SUCCESS)
69 {
70 qWarning() << "libusb_handle_events_timeout_completed() failed: " << rv;
71 }
72 }
73 else
74 {
75 //Don't support hotplug, simulate it with a timer event
76 emit notify(false, 0, 0);
77 }
78 }
79 }
80
81 USBWatcher::USBWatcher()
82 : cbHandle(0),
83 usb_ctx(0),
84 timer(0),
85 count(0)
86 {
87 vUSB.clear();
88 }
89
90 USBWatcher::~USBWatcher()
91 {
92 hotplug_deregister();
93 }
94
95 void USBWatcher::hotplug_deregister()
96 {
97 if (count > 0)
98 {
99 if (timer)
100 {
101 timer->stop();
102 delete timer;
103 }
104 if (usb_ctx)
105 {
106 libusb_hotplug_deregister_callback(usb_ctx, cbHandle);
107 libusb_exit(usb_ctx);
108 usb_ctx = 0;
109 }
110 count--;
111 }
112 }
113
114 bool USBWatcher::hotplug_register(quint16 vid, quint16 pid)
115 {
116 bool result = false;
117
118 if (count == 0)
119 {
120 int tval = 1000;
121
122 libusb_init(&usb_ctx);
123 if (libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG))
124 {
125 int rc = libusb_hotplug_register_callback(usb_ctx,
126 (libusb_hotplug_event)(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT),
127 LIBUSB_HOTPLUG_ENUMERATE,
128 (vid == 0) ? LIBUSB_HOTPLUG_MATCH_ANY : vid,
129 (pid == 0) ? LIBUSB_HOTPLUG_MATCH_ANY : pid,
130 LIBUSB_HOTPLUG_MATCH_ANY,
131 hotplug_callback,
132 this,
133 &cbHandle);
134 if (LIBUSB_SUCCESS != rc)
135 {
136 libusb_exit(usb_ctx);
137 usb_ctx = 0;
138 }
139 else
140 {
141 tval = 100;
142 result = true;
143 }
144 }
145 else
146 {
147 libusb_exit(usb_ctx);
148 usb_ctx = 0;
149
150 qWarning() << "NO USB HotPlug capability (simulate it with a timer)";
151 }
152
153 QTimer *timer = new QTimer(this);
154 connect(timer, SIGNAL(timeout()), this, SLOT(doPoll()));
155 timer->start(tval);
156 count++;
157 }
158
159 return result;
160 }
0 //=========================================================================//
1 // //
2 // PonyProg - Serial Device Programmer //
3 // //
4 // Copyright (C) 1997-2019 Claudio Lanconelli //
5 // //
6 // Copyright (C) 2019 LibUSB part, Eduard Kalinowski //
7 // //
8 // http://ponyprog.sourceforge.net //
9 // //
10 //-------------------------------------------------------------------------//
11 // //
12 // This program is free software; you can redistribute it and/or //
13 // modify it under the terms of the GNU General Public License //
14 // as published by the Free Software Foundation; either version2 of //
15 // the License, or (at your option) any later version. //
16 // //
17 // This program is distributed in the hope that it will be useful, //
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
20 // General Public License for more details. //
21 // //
22 // You should have received a copy of the GNU General Public License //
23 // along with this program (see LICENSE); if not, write to the //
24 // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
25 // //
26 //=========================================================================//
27
28 #ifndef USBWATCHER_H
29 #define USBWATCHER_H
30
31 #include <QObject>
32 #include <QVector>
33 #include <QTimer>
34
35 #include <libusb-1.0/libusb.h> //Include libsub
36
37 #include "globals.h"
38
39 class USBWatcher : public QObject
40 {
41 Q_OBJECT
42
43 //QThread workerThread;
44
45 public:
46 USBWatcher();
47 ~USBWatcher();
48
49 bool hotplug_register(quint16 vid = 0, quint16 pid = 0);
50
51 void hotplug_notify(bool connected, quint16 vid, quint16 pid)
52 {
53 if (connected)
54 {
55 vUSB.append(VidPid(vid, pid));
56 emit notify(true, vid, pid);
57 }
58 else
59 {
60 int idx = vUSB.indexOf(VidPid(vid, pid));
61 if (idx != -1)
62 {
63 vUSB.remove(idx);
64 }
65 emit notify(false, vid, pid);
66 }
67 }
68
69 signals:
70 void notify(bool connected, quint16 vid, quint16 pid);
71
72 public slots:
73 void doPoll();
74
75 private:
76 void hotplug_deregister();
77
78 QVector <VidPid> vUSB;
79 libusb_hotplug_callback_handle cbHandle;
80 libusb_context *usb_ctx;
81 QTimer *timer;
82 int count;
83 };
84
85 #endif // USBWATCHER_H
86
134134 return Wait::bogokips;
135135 }
136136
137 void Wait::WaitMsec(int msec)
137 void Wait::WaitMsec(unsigned int msec)
138138 {
139139 #ifdef Q_OS_LINUX
140140 usleep(msec * 1000);
157157 #pragma optimize( "", off )
158158 #endif
159159
160 void Wait::WaitUsec(int usec)
161 {
160 void Wait::WaitUsec(unsigned int usec)
161 {
162 if (usec == 0)
163 {
164 return;
165 }
166
162167 if (htimer)
163168 {
164169 #ifdef Q_OS_WIN32
3434
3535 class Wait
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 Wait();
4040 virtual ~Wait();
4141
42 void WaitMsec(int msec);
43 void WaitUsec(int usec);
42 void WaitMsec(unsigned int msec);
43 void WaitUsec(unsigned int usec);
4444
4545 void SetBogoKips();
4646
5151 void SetHwTimer(int ok = -1);
5252 int CheckHwTimer();
5353
54 protected: //--------------------------------------- protected
54 protected:
5555
5656 int GetBogoKips();
5757
58 private: //--------------------------------------- private
58 private:
5959
6060 static int bogokips;
6161 static int htimer;
3131
3232 #include <QDebug>
3333
34 //=====>>> Costruttore <<<======
3534 X2444::X2444(e2AppWinInfo *wininfo, BusIO *busp)
3635 : Device(wininfo, busp, 2)
3736 {
3434
3535 class X2444 : public Device
3636 {
37 public: //---------------------------------------- public
37 public:
3838
3939 X2444(e2AppWinInfo *wininfo = 0, BusIO *busp = 0);
4040
4444
4545 virtual void DefaultBankSize();
4646
47 protected: //--------------------------------------- protected
47 protected:
4848
4949 X2444Bus *GetBus()
5050 {
5151 return static_cast<X2444Bus *>(Device::GetBus());
5252 }
5353
54 private: //--------------------------------------- private
54 private:
5555
5656 };
5757 #endif
3333
3434 #define _BIG_ENDIAN_
3535
36 // Costruttore
3736 X2444Bus::X2444Bus(BusInterface *ptr)
3837 : MicroWireBus(ptr),
3938 ReadCode(06),
4544 loop_timeout(8000),
4645 organization(ORG16)
4746 {
48 qDebug() << "X2444Bus::X2444Bus()";
47 qDebug() << Q_FUNC_INFO;
4948 }
5049
5150 void X2444Bus::SendCmdAddr(int cmd, int addr)
6261
6362 long X2444Bus::Read(int addr, uint8_t *data, long length, int page_size)
6463 {
65 qDebug() << "X2444Bus::Read(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
64 qDebug() << Q_FUNC_INFO << "(" << (hex) << addr << ", " << data << ", " << (dec) << length << ")";
6665 ReadStart();
6766
6867 long len;
8079
8180 //Prima assicuriamoci una recall
8281 clearCS();
83 WaitUsec(shot_delay);
82 ShotDelay();
8483 setCS();
8584
8685 SendCmdAddr(RecallCode, 0xff);
9089 {
9190 //17/08/98 -- now repeat the command every word
9291 clearCS();
93 WaitUsec(shot_delay);
92 ShotDelay();
9493 setCS();
9594
9695 //Send command opcode and address
9796 SendCmdAddr(ReadCode, addr++);
9897
99 //Il primo bit dopo il comando di lettura e` piu` "corto"
100 // cosi` non possiamo utilizzare la normale routine di lettura word
101 uint16_t val = RecDataWordShort(organization, 1);
98 //The first bit after read command is "shorter"
99 // so we have to use a special function
100 uint16_t val = RecDataWordShort(organization, true);
102101
103102 if (organization == ORG16)
104103 {
127126 }
128127
129128 clearCS();
129 WaitMsec(1); //Flush
130130
131131 ReadEnd();
132 qDebug() << "X2444Bus::Read() = " << len;
132 qDebug() << Q_FUNC_INFO << "=" << len;
133133
134134 return len;
135135 }
141141 WriteStart();
142142
143143 clearCS(); //17/08/98 -- may be it's not needed
144 WaitUsec(shot_delay);
144 ShotDelay();
145145 setCS();
146146
147147 //Recall eeprom from ram
148148 SendCmdAddr(RecallCode, 0xff);
149149
150150 clearCS();
151 WaitUsec(shot_delay);
151 ShotDelay();
152152 setCS();
153153
154154 //Write enable
155155 SendCmdAddr(WriteEnableCode, 0xff);
156156
157157 clearCS();
158 WaitUsec(shot_delay);
158 ShotDelay();
159159 setCS();
160160
161161 if (organization == ORG16)
184184
185185 //Send command opcode
186186 SendCmdAddr(WriteCode, curaddr);
187 SendDataWord(val, organization, 1);
188
189 WaitUsec(shot_delay);
187 SendDataWord(val, organization, true);
188
189 ShotDelay();
190190
191191 clearCS();
192 WaitUsec(shot_delay);
192 ShotDelay();
193193 setCS();
194194
195195 if ((curaddr & 1))
203203
204204 SendCmdAddr(StoreCode, 0xff);
205205 clearCS();
206 WaitMsec(10);
206 WaitMsec(10); //Flush
207207
208208 WriteEnd();
209209
3232
3333 class X2444Bus : public MicroWireBus
3434 {
35 public: //------------------------------- public
35 public:
3636 X2444Bus(BusInterface *ptr = 0);
3737
3838 long Read(int addr, uint8_t *data, long length, int page_size = 0);
5050 return organization;
5151 }
5252
53 protected: //------------------------------- protected
53 protected:
5454
5555 void SendCmdAddr(int cmd, int addr);
5656
57 private: //------------------------------- private
57 private:
5858
5959 //Command Opcode
6060 const uint8_t ReadCode;
+0
-1
cmake/.gitignore less more
0 .directory
0 # - try to find libusb-1 library
1 #
2 # Cache Variables: (probably not for direct use in your scripts)
3 # LIBUSB_LIBRARY
4 # LIBUSB_INCLUDE_DIR
5 #
6 # Non-cache variables you should use in your CMakeLists.txt:
7 # LIBUSB_LIBRARIES
8 # LIBUSB_INCLUDE_DIRS
9 # LIBUSB_FOUND - if this is not true, do not attempt to use this library
10 # LIBUSB_VERSION
11 #
12 # Requires these CMake modules:
13 # ProgramFilesGlob
14 # FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
15 #
16 # Original Author:
17 # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
18 # http://academic.cleardefinition.com
19 # Iowa State University HCI Graduate Program/VRAC
20 #
21 # Copyright Iowa State University 2009-2010.
22 # Distributed under the Boost Software License, Version 1.0.
23 # (See accompanying file LICENSE_1_0.txt or copy at
24 # http://www.boost.org/LICENSE_1_0.txt)
25
26
27 set(LIBUSB_ROOT_DIR
28 "${LIBUSB_ROOT_DIR}"
29 CACHE
30 PATH
31 "Root directory to search for libusb-1")
32
33 if(WIN32)
34 include(ProgramFilesGlob)
35 # program_files_fallback_glob(_dirs "LibUSB-Win32")
36 program_files_fallback_glob(_dirs "libusb-1.*")
37 message(STATUS "Found libusb in directory: ${_dirs}" )
38 # program_files_fallback_glob(_dirs "libusb-win32")
39 # message(STATUS "Found libusb in directory: ${_dirs}" )
40 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
41 if(MSVC)
42 set(_lib_suffixes lib/msvc_x64 MS64/static)
43 else()
44 set(_lib_suffixes lib/mingw_x64 MinGW64/dll MinGW64/static)
45 endif()
46 else()
47 if(MSVC)
48 set(_lib_suffixes lib/msvc MS32/static)
49 else() #(COMPILER_IS_GNUCXX)
50 set(_lib_suffixes lib/gcc lib/mingw MinGW32/dll MinGW32/static)
51 endif()
52 endif()
53 else()
54 set(_lib_suffixes)
55 find_package(PkgConfig QUIET)
56 if(PKG_CONFIG_FOUND)
57 pkg_check_modules(PC_LIBUSB libusb-1.0)
58 endif()
59 endif()
60
61 find_path(LIBUSB_INCLUDE_DIR
62 NAMES
63 libusb.h
64 PATHS
65 ${PC_LIBUSB_INCLUDE_DIRS}
66 ${PC_LIBUSB_INCLUDEDIR}
67 ${_dirs}
68 HINTS
69 "${LIBUSB_ROOT_DIR}"
70 PATH_SUFFIXES
71 include/libusb-1.0
72 include
73 libusb-1.0)
74
75 find_library(LIBUSB_LIBRARY
76 NAMES
77 libusb-1.0
78 usb-1.0
79 PATHS
80 ${PC_LIBUSB_LIBRARY_DIRS}
81 ${PC_LIBUSB_LIBDIR}
82 ${_dirs}
83 HINTS
84 "${LIBUSB_ROOT_DIR}"
85 PATH_SUFFIXES
86 ${_lib_suffixes})
87
88 include(FindPackageHandleStandardArgs)
89 find_package_handle_standard_args(Libusb-1.0
90 DEFAULT_MSG
91 LIBUSB_LIBRARY
92 LIBUSB_INCLUDE_DIR)
93
94
95 if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARY)
96 set(LIBUSB_FOUND true)
97 endif()
98
99
100 if(LIBUSB_FOUND)
101 set(LIBUSB_LIBRARIES "${LIBUSB_LIBRARY}")
102
103 set(LIBUSB_INCLUDE_DIRS "${LIBUSB_INCLUDE_DIR}")
104
105 mark_as_advanced(LIBUSB_ROOT_DIR)
106 endif()
107
108 if(LIBUSB_FOUND AND NOT CMAKE_CROSSCOMPILING)
109 if(LIBUSB_SKIP_VERSION_CHECK)
110 message(STATUS "Skipping libusb version number check.")
111 unset(LIBUSB_VERSION)
112 else()
113 message(STATUS "Checking libusb version...")
114
115 if(WIN32)
116 string(REPLACE ".lib" ".dll" LIBUSB_DLL "${LIBUSB_LIBRARIES}")
117 try_run(LIBUSB_VERCHECK_RUN_RESULT
118 LIBUSB_VERCHECK_COMPILED
119 ${CMAKE_HELPERS_BINARY_DIR}
120 ${CMAKE_HELPERS_SOURCE_DIR}/libusb_version.c
121 CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBUSB_INCLUDE_DIRS}"
122 RUN_OUTPUT_VARIABLE LIBUSB_VERSION
123 ARGS "\"${LIBUSB_DLL}\""
124 )
125 else()
126 try_run(LIBUSB_VERCHECK_RUN_RESULT
127 LIBUSB_VERCHECK_COMPILED
128 ${CMAKE_HELPERS_BINARY_DIR}
129 ${CMAKE_HELPERS_SOURCE_DIR}/libusb_version.c
130 CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LIBUSB_INCLUDE_DIRS}" "-DLINK_LIBRARIES=${LIBUSB_LIBRARIES}"
131 RUN_OUTPUT_VARIABLE LIBUSB_VERSION
132 )
133 endif()
134
135 if (NOT LIBUSB_VERCHECK_COMPILED OR NOT LIBUSB_VERCHECK_RUN_RESULT EQUAL 0 )
136 message(STATUS "${LIBUSB_VERSION}")
137 set(LIBUSB_VERSION "0.0.0")
138 message(WARNING "\nFailed to compile (compiled=${LIBUSB_VERCHECK_COMPILED}) or run (retval=${LIBUSB_VERCHECK_RUN_RESULT}) libusb version check.\n"
139 "This may occur if libusb is earlier than v1.0.16.\n"
140 "Setting LIBUSB_VERSION to ${LIBUSB_VERSION}.\n")
141 return()
142 endif()
143 endif()
144 endif()
145
146 #
147 mark_as_advanced(LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR )
148
0 // #include <stdlib.h>
1 #include <stdio.h>
2 // #include <string.h>
3 #include <libusb.h>
4
5 #if WIN32
6 #include <winbase.h>
7 typedef const struct libusb_version * (__stdcall * version_fn)(void);
8 #endif
9
10 int main(int argc, char *argv[])
11 {
12 int status = 0;
13 const struct libusb_version *ver;
14
15 #if WIN32
16
17 if (argc > 1) {
18 HINSTANCE dll;
19 version_fn get_version;
20
21 dll = LoadLibraryA(argv[1]);
22
23 if (!dll) {
24 fprintf(stderr, "Failed to load %s\n", argv[1]);
25 return -1;
26 }
27
28 get_version = (version_fn) GetProcAddress(dll, "libusb_get_version");
29
30 if (get_version) {
31 ver = get_version();
32 printf("%u.%u.%u", ver->major, ver->minor, ver->micro);
33 } else {
34 fprintf(stderr, "Failed to get address of libusb_get_version()\n");
35 status = -1;
36 }
37
38 FreeLibrary(dll);
39 } else {
40 fprintf(stderr, "Windows usage: %s <libusb.dll>\n", argv[0]);
41 return -1;
42 }
43
44 #else
45 ver = libusb_get_version();
46 printf("%u.%u.%u", ver->major, ver->minor, ver->micro);
47 #endif
48
49 return status;
50 }
2424 cmake -DUSE_DEBUGGER=OFF -DUSE_QT5=ON ..
2525 make -j$CPU_NUM
2626 cd ..
27 mv ./$DIRECTORY/ponyprog .
27 #mv ./$DIRECTORY/ponyprog .
2828 fi
+0
-1
desktop/.gitignore less more
0 .directory
+0
-1
distribution/.gitignore less more
0 .directory
5959 # SET( PACKAGE_DEPENDS ${hugr_dependencies} )
6060
6161 SET( PONYPROG_CPACK_PACKAGE_DEPENDS "${PONYPROG_CPACK_PACKAGE_SHLIBDEPS}" )
62 #SET( PONYPROG_CPACK_PACKAGE_DEPENDS "libusb-1.0-0, libftdi1-2, libftdipp1-3, libqt5core5a, libqt5gui5, libqt5widgets5, libqt5multimedia5, libqt5printsupport5" )
6263
63 #SET( PONYPROG_CPACK_PACKAGE_DEPENDS "libhttrack2, libqtcore4, libqtgui4, libc6, libstdc++6" )
64 # SET( PONYPROG_CPACK_PACKAGE_DEPENDS "libhttrack2, libqtcore4, libqtgui4" )
65 # SET( PACKAGE_DEPENDS "libc6 (>= 2.1.3), libhttrack (>= 3.42.1), libqtcore4 (>= 4:4.6.1), libqtgui4 (>= 4:4.5.3), libstdc++6 (>= 4.1.1)" )
64 # SET( PACKAGE_DEPENDS "libc6 (>= 2.1.3), libqtcore4 (>= 4:4.6.1), libqtgui4 (>= 4:4.5.3), libstdc++6 (>= 4.1.1)" )
6665
6766
6867 # SET( PONYPROG_CPACK_PACKAGE_GROUP "Groupe" )
00 -------------------------------------------
1 PonyProg - Serial Device Programmer v3.0.0
1 PonyProg - Serial Device Programmer v3.1.0
22
33 PonyProg is the universal programmer for many serial devices.
44 If you want to know more about PonyProg or just download
5 latest version go to my web site:
5 latest version look at my web site:
66 http://www.LancOS.com
77
88 ---------------------------
0 PowerUpDelay=200
0 [General]
11 LanguageCode=Default
2 SoundEnabled=YES
32 ClearBufferBeforeLoad=YES
43 MDAWriteDelay=0
4
5 [Preferences]
6 SoundEnabled=YES
00 ; PonyProg setup script.
1 ; Copyright by Claudio Lanconelli 1999-2017
1 ; Copyright by Claudio Lanconelli 1999-2019
22
33 [Setup]
44 AppName={#APPNAME}
55 AppPublisher=LancOS
66 AppPublisherURL=http://www.LancOS.com/
7 AppUpdatesURL=http://ponyprog.sourceforge.net
7 AppUpdatesURL=https://github.com/lancos/ponyprog/releases
88 AppVersion={#APPVERSION}
99 AppVerName={#APPNAME} {#APPVERSION}
1010 AppCopyright={#APPCOPYRIGHT}
2121 RestartIfNeededByRun=yes
2222 ;AlwaysRestart=yes
2323
24 ;I never tested with WinNT 3.51, may be we need to replace 3.51 with 4.00
2524 MinVersion=5.0
2625
2726 [Files]
3938
4039 Source: "lang\*"; DestDir: "{app}\lang"
4140
42 Source: "{#APPNAME}.ini"; DestDir: "{app}"; Permissions: users-modify
41 ;Source: "{#APPNAME}.ini"; DestDir: "{app}"; Permissions: users-modify
4342 Source: "{#APPNAME}.html"; DestDir: "{app}"
4443 Source: "oksound.wav"; DestDir: "{app}"
4544 Source: "*.jpg"; DestDir: "{app}"
4847 Source: "installdriver.exe"; DestDir: "{app}"
4948 Source: "inpout32.dll"; DestDir: "{app}"
5049 ;Source: "INPOUT32.DLL"; DestDir: "{sys}"; Flags: sharedfile promptifolder
50 Source: "wdi-simple-64.exe"; DestDir: "{app}"; Flags: replacesameversion promptifolder;
51 Source: "wdi-simple-32.exe"; DestDir: "{app}"; Flags: replacesameversion promptifolder;
5152
5253 [UninstallDelete]
5354 Type: files; Name: "{app}\bogomips.out"
5758 Name: "{group}\Visit LancOS PonyProg Web Site"; Filename: "{app}\PonyProg.url"
5859
5960 [Run]
60 Filename: "{app}\installdriver.exe"; Parameters: "install"; StatusMsg: "Installing I/O driver..."
61 Filename: "{app}\installdriver.exe"; Parameters: "install"; StatusMsg: "Installing legacy COM and LPT I/O driver..."
62 ; call wdi-simple
63 ;
64 ; -n, --name <name> set the device name
65 ; -f, --inf <name> set the inf name
66 ; -m, --manufacturer <name> set the manufacturer name
67 ; -v, --vid <id> set the vendor ID (VID)
68 ; -p, --pid <id> set the product ID (PID)
69 ; -i, --iid <id> set the interface ID (MI)
70 ; -t, --type <driver_type> set the driver to install
71 ; (0=WinUSB, 1=libusb0, 2=libusbK, 3=usbser, 4=custom)
72 ; -d, --dest <dir> set the extraction directory
73 ; -x, --extract extract files only (don't install)
74 ; -c, --cert <certname> install certificate <certname> from the
75 ; embedded user files as a trusted publisher
76 ; --stealth-cert installs certificate above without prompting
77 ; -s, --silent silent mode
78 ; -b, --progressbar=[HWND] display a progress bar during install
79 ; an optional HWND can be specified
80 ; -o, --timeout set timeout (in ms) to wait for any
81 ; pending installations
82 ; -l, --log set log level (0=debug, 4=none)
83 ; -h, --help display usage
84 ;
85 Filename: "{app}\wdi-simple-64.exe"; Flags: "runhidden"; Parameters: " --name PonyProgFT --manufacturer ""Eurek srl"" --vid 0x0403 --pid 0x6e38 --progressbar={wizardhwnd} --timeout 120000"; StatusMsg: "Installing PonyProgFT 64bit USB driver (this may take several seconds) ..."; Check: IsWin64
86 Filename: "{app}\wdi-simple-32.exe"; Flags: "runhidden"; Parameters: " --name PonyProgFT --manufacturer ""Eurek srl"" --vid 0x0403 --pid 0x6e38 --progressbar={wizardhwnd} --timeout 120000"; StatusMsg: "Installing PonyProgFT 32bit USB driver (this may take several seconds) ..."; Check: not IsWin64
6187
6288 [UninstallRun]
6389 Filename: "{app}\installdriver.exe"; Parameters: "remove"
4646 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
4747 )
4848 # MESSAGE("PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}")
49
50 INSTALL(FILES "${PROJECT_SOURCE_DIR}/udev/rules.d/90-ponyprog.rules"
51 DESTINATION "/lib/udev/rules.d/"
52 COMPONENT "application"
53 PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
54 )
4955
5056 INSTALL(FILES "${PROJECT_SOURCE_DIR}/desktop/ponyprog.desktop"
5157 DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications/"
22 # errors shouldn't cause script to exit
33 set +e
44
5 setcap 'cap_sys_tty_config=+ep' /usr/bin/ponyprog
5 #only get the real usernames
6 for usrnm in $(cat /etc/passwd | grep /home | grep -v false | cut -d':' -f1);
7 do
8 usermod -a -G dialout $usrnm
9 done
10
11 #setcap 'cap_sys_tty_config=+ep' /usr/bin/ponyprog
612
713 # clear error termination state
814 set -e
+0
-3
doxygen/.gitignore less more
0 .directory
1 html
2 latex
512512 # directories like "/usr/src/myproject". Separate the files or directories
513513 # with spaces.
514514
515 INPUT = ..
515 INPUT = ../SrcPony
516516
517517 # This tag can be used to specify the character encoding of the source files
518518 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
536536 # should be searched for input files as well. Possible values are YES and NO.
537537 # If left blank NO is used.
538538
539 RECURSIVE = NO
539 RECURSIVE = YES
540540
541541 # The EXCLUDE tag can be used to specify files and/or directories that should
542542 # excluded from the INPUT source files. This way you can easily exclude a
+0
-1
icons/.gitignore less more
0 .directory
0 #!/bin/bash
1
2 SIZES="16 32 48 64"
3
4 for x in ${SIZES}
5 do
6 inkscape --export-png logo${x}.png -w ${x} ponyprog.svg
7 echo ${x}
8 done
9
10 for x in 16 32 48 64
11 do
12 CMD="${CMD} logo${x}.png"
13 done
14 CMDX="${CMD} ponyprog.png"
15
16 convert ${CMDX} ponyprog.ico
17
18 rm ${CMD}
Binary diff not shown
77
88 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport multimedia
99
10 CONFIG += rtti_off exceptions_off warn_on
10 CONFIG += exceptions_off warn_on
1111
1212 TARGET = ponyprog
1313 TEMPLATE = app
1717 MOC_DIR = $$DESTDIR/.moc
1818 RCC_DIR = $$DESTDIR/.qrc
1919 UI_DIR = $$DESTDIR/.ui
20
21 RC_ICONS = icons/ponyprog.ico
2022
2123 APP_NAME = "PonyProg"
2224 APP_LOW_NAME = "ponyprog"
2325 APP_LOW_H_NAME = ".ponyprog"
2426 APP_AUTHOR = "Claudio Lanconelli"
2527 APP_COPYRIGHT = "(C) 1997-2019 $$APP_AUTHOR"
26 APP_VERSION = "3.0.2"
28 APP_VERSION = "3.1.0"
2729 # APP_BUILD_DATE = $$_DATE_
2830 APP_LONG_NAME = "$$APP_NAME $$APP_VERSION"
2931 APP_EMAIL = "PonyProg2000@gmail.com"
171173 SrcPony/filldlg.cpp \
172174 SrcPony/interfconv.cpp \
173175 SrcPony/lptinterf.cpp \
176 SrcPony/mpsse_interf.cpp \
174177 SrcPony/nvm3060.cpp \
175178 SrcPony/pic16xx.cpp \
176179 SrcPony/x2444bus.cpp \
177180 SrcPony/sdebus.cpp \
178181 SrcPony/Translator.cpp \
182 SrcPony/usbwatcher.cpp \
183 SrcPony/prefdialog.cpp \
179184 qhexedit2/src/chunks.cpp \
180185 qhexedit2/src/commands.cpp \
181 qhexedit2/src/qhexedit.cpp \
186 qhexedit2/src/qhexedit.cpp
182187
183188 HEADERS += SrcPony/e2app.h \
184189 SrcPony/e2awinfo.h \
250255 SrcPony/blockmdlg.h \
251256 SrcPony/intfbuf.h \
252257 SrcPony/lptinterf.h \
258 SrcPony/mpsse_interf.h \
253259 SrcPony/nvm3060.h \
254260 SrcPony/pic16xx.h \
255261 SrcPony/ppuser.h \
256262 SrcPony/rs232int.h \
257263 SrcPony/x2444.h \
258264 SrcPony/Translator.h \
265 SrcPony/interfconv.h \
266 SrcPony/usbwatcher.h \
267 SrcPony/prefdialog.h \
259268 qhexedit2/src/chunks.h \
260269 qhexedit2/src/commands.h \
261270 qhexedit2/src/qhexedit.h
269278 SrcPony/forms/mainwindow.ui \
270279 SrcPony/forms/osccalibr.ui \
271280 SrcPony/forms/progoption.ui \
272 SrcPony/forms/sernumcfg.ui
281 SrcPony/forms/sernumcfg.ui \
282 SrcPony/forms/prefdialog.ui
273283
274284 # for next version, when script for ts files convertion is implemented
275285 #TRANSLATIONS += localization/qtbase_cs.ts
284294 # in case of manually installations, not from repositories
285295 unix:!macx: LIBS += -L/usr/local/lib
286296
297 #libftdi
298 unix:!macx: QMAKE_CXXFLAGS += $$system(pkg-config libftdipp1 --cflags)
299 unix:!macx: LIBS += $$system(pkg-config libftdipp1 --libs)
300
301 #win32: FTDIPATH = c:/libftdi1-1.4_devkit_mingw32_24June2018
302 win32: FTDIPATH = c:/libftdi1-1.4git_devkit_x86_x64_14June2018
303 win32: QMAKE_CXXFLAGS += -I $$FTDIPATH/include/libftdi -I $$FTDIPATH/include/libusb-1.0 -I $$FTDIPATH/include
304 win32: LIBS += -L $$FTDIPATH/lib32 -lftdipp1 -lftdi1 -lusb-1.0
287305
288306 # # Make sure QM translations are generated.
289307 # lrelease.input = TRANSLATIONS
0 #################
1 ## Eclipse
2 #################
3
4 *.pydevproject
5 .project
6 .metadata
7 bin/
8 tmp/
9 *.tmp
10 *.bak
11 *.swp
12 *~.nib
13 local.properties
14 .classpath
15 .settings/
16 .loadpath
17
18 # External tool builders
19 .externalToolBuilders/
20
21 # Locally stored "Eclipse launch configurations"
22 *.launch
23
24 # CDT-specific
25 .cproject
26
27 # PDT-specific
28 .buildpath
29
30
31 #################
32 ## Visual Studio
33 #################
34
35 ## Ignore Visual Studio temporary files, build results, and
36 ## files generated by popular Visual Studio add-ons.
37
38 # User-specific files
39 *.suo
40 *.user
41 *.sln.docstates
42
43 # Build results
44
45 [Dd]ebug/
46 [Rr]elease/
47 x64/
48 build/
49 [Bb]in/
50 [Oo]bj/
51
52 # MSTest test Results
53 [Tt]est[Rr]esult*/
54 [Bb]uild[Ll]og.*
55
56 *_i.c
57 *_p.c
58 *.ilk
59 *.meta
60 *.obj
61 *.pch
62 *.pdb
63 *.pgc
64 *.pgd
65 *.rsp
66 *.sbr
67 *.tlb
68 *.tli
69 *.tlh
70 *.tmp_proj
71 *.log
72 *.vspscc
73 *.vssscc
74 .builds
75 *.pidb
76 *.scc
77
78 # Visual C++ cache files
79 ipch/
80 *.aps
81 *.ncb
82 *.opensdf
83 *.sdf
84 *.cachefile
85
86 # Visual Studio profiler
87 *.psess
88 *.vsp
89 *.vspx
90
91 # Guidance Automation Toolkit
92 *.gpState
93
94 # ReSharper is a .NET coding add-in
95 _ReSharper*/
96 *.[Rr]e[Ss]harper
97
98 # TeamCity is a build add-in
99 _TeamCity*
100
101 # DotCover is a Code Coverage Tool
102 *.dotCover
103
104 # NCrunch
105 *.ncrunch*
106 .*crunch*.local.xml
107
108 # Installshield output folder
109 [Ee]xpress/
110
111 # DocProject is a documentation generator add-in
112 DocProject/buildhelp/
113 DocProject/Help/*.HxT
114 DocProject/Help/*.HxC
115 DocProject/Help/*.hhc
116 DocProject/Help/*.hhk
117 DocProject/Help/*.hhp
118 DocProject/Help/Html2
119 DocProject/Help/html
120
121 # Click-Once directory
122 publish/
123
124 # Publish Web Output
125 *.Publish.xml
126 *.pubxml
127 *.publishproj
128
129 # NuGet Packages Directory
130 ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
131 #packages/
132
133 # Windows Azure Build Output
134 csx
135 *.build.csdef
136
137 # Windows Store app package directory
138 AppPackages/
139
140 # Others
141 sql/
142 *.Cache
143 ClientBin/
144 [Ss]tyle[Cc]op.*
145 ~$*
146 *~
147 *.dbmdl
148 *.[Pp]ublish.xml
149 *.pfx
150 *.publishsettings
151
152 # RIA/Silverlight projects
153 Generated_Code/
154
155 # Backup & report files from converting an old project file to a newer
156 # Visual Studio version. Backup files are not needed, because we have git ;-)
157 _UpgradeReport_Files/
158 Backup*/
159 UpgradeLog*.XML
160 UpgradeLog*.htm
161
162 # SQL Server files
163 App_Data/*.mdf
164 App_Data/*.ldf
165
166 #############
167 ## Windows detritus
168 #############
169
170 # Windows image file caches
171 Thumbs.db
172 ehthumbs.db
173
174 # Folder config file
175 Desktop.ini
176
177 # Recycle Bin used on file shares
178 $RECYCLE.BIN/
179
180 # Mac crap
181 .DS_Store
182
183
184 #############
185 ## Python
186 #############
187
188 # PyCharm
189 .idea/
190
191 *.py[cod]
192
193 # Packages
194 *.egg
195 *.egg-info
196 dist/
197 eggs/
198 parts/
199 var/
200 sdist/
201 develop-eggs/
202 .installed.cfg
203
204 # Installer logs
205 pip-log.txt
206
207 # Unit test / coverage reports
208 .coverage
209 .tox
210
211 #Translations
212 *.mo
213
214 #Mr Developer
215 .mr.developer.cfg
216
217 # QtCreator
218 *.pro.user
219 /build-qhexedit-Desktop-Debug/
11
22 environment:
33 matrix:
4 - example: qhexedit
5 name: win32
6 platform: mingw
7 qt: mingw492_32
8
4 - QT: C:\Qt\5.11\msvc2015
5 GENERATOR: Visual Studio 14 2015
6 PLATFORM: X86
7 - QT: C:\Qt\5.11\msvc2015_64
8 GENERATOR: Visual Studio 14 2015 Win64
9 PLATFORM: X64
10
911 clone_folder: c:\dev\qhexedit
1012 clone_depth: 5
1113
12 init:
13 - set PATH=C:\Qt\5.5\%qt%\bin;C:\Qt\Tools\mingw492_32\bin;"C:\Program Files (x86)\NSIS";%PATH%
14
14 install:
15 - set PATH=%QT%\bin\;C:\Qt\Tools\QtCreator\bin\;%PATH%
16
1517 before_build:
16 - cd c:\dev\qhexedit
17 - md build
18 - cd build
19
18 - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM%
19 - qmake --version
20 - echo %PLATFORM%
21 - cd c:\dev\qhexedit
22 - md build
23 - cd build
24 - if "%PLATFORM%" EQU "X64" (qmake -r -spec win32-msvc CONFIG+=x86_64 CONFIG-=debug CONFIG+=release ..\example\qhexedit.pro)
25 - if "%PLATFORM%" EQU "X86" (qmake -r -spec win32-msvc CONFIG+=Win32 CONFIG-=debug CONFIG+=release ..\example\qhexedit.pro)
26
2027 build_script:
21 - qmake ..\example\qhexedit.pro
22 - mingw32-make
23 - windeployqt.exe release\qhexedit.exe
24 - makensis ..\deploy.nsi
25
28 - nmake
29 - windeployqt.exe release\qhexedit.exe
30 - makensis ..\deploy.nsi
31 - copy QHexEdit.exe ..\QHexEdit_%PLATFORM%.exe
32
2633 artifacts:
27 - path: build\QHexEdit.exe
34 - path: QHexEdit_%PLATFORM%.exe
2835
2936 deploy:
30 description: 'Latest QHexEdit Release'
31 provider: GitHub
32 auth_token:
33 secure: swhHkduATse1LV+aYaUVZ5qA6L0ZYbiKnh/xrsINEHP2zP49yelpMRkYIuYg3wDI
34 artifact: build\QHexEdit.exe
35 draft: false
36 prerelease: false
37 on:
38 branch: master # release from master branch only
39 appveyor_repo_tag: true # deploy on tag push only
37 description: 'Latest QHexEdit Release'
38 provider: GitHub
39 auth_token:
40 secure: WEV9mRJC/pC2HFqJMXbLzEfBXAHu8aGDFIR8ARSip9n6jDJyCz3KstjSPM4VsgKc
41 draft: false
42 prerelease: false
43 force_update: true
44 on:
45 branch: master # release from master branch only
46 appveyor_repo_tag: true # deploy on tag push only
0 if [ ! -d build ];then
1 mkdir build
2 else
3 rm -rf build/*
4 fi
5
06 cd build
17 qmake ../example/qhexedit.pro
28 make
0 if [ ! -d build ];then
1 mkdir build
2 else
3 rm -rf build/*
4 fi
5
06 cd build
17
28 # for Qt4 use qt4-qmake
0 #!define VERSION "0.0.1"
1 !define QT "C:\Qt\5.5\mingw492_32\bin\"
2 !define BUILD_DIR "C:\dev\qhexedit\build\release\"
3 !define TRANS_DIR "C:\dev\qhexedit\example\translations\"
4 !define OUTFILE_NAME "C:\dev\qhexedit\build\QHexEdit.exe"
5 !define INSTALLATIONNAME "QHexEdit"
6
7 ;--------------------------------
8 ;Include Modern UI
9
10 !include "MUI2.nsh"
11
12 ;--------------------------------
13 ;General
14
15 ;Name and file
16 Name ${INSTALLATIONNAME}
17 OutFile ${OUTFILE_NAME}
18
19 SetCompressor lzma
20
21 ;Default installation folder
22 InstallDir "$PROGRAMFILES\QHexEdit"
23
24 ;Get installation folder from registry if available
25 InstallDirRegKey HKCU "Software\${INSTALLATIONNAME}" ""
26
27 ;Request application privileges for Windows Vista
28 !define MULTIUSER_EXECUTIONLEVEL Highest
29 !define MULTIUSER_MUI
30 !define MULTIUSER_INSTALLMODE_COMMANDLINE
31 !include MultiUser.nsh
32
33 ;--------------------------------
34 ;Interface Settings
35
36 # !define MUI_HEADERIMAGE
37 # !define MUI_HEADERIMAGE_BITMAP "cm_header.bmp"
38 # !define MUI_HEADERIMAGE_UNBITMAP "cm_un-header.bmp"
39 # !define MUI_WELCOMEFINISHPAGE_BITMAP "cm_wizard.bmp"
40 # !define MUI_UNWELCOMEFINISHPAGE_BITMAP "cm_un-wizard.bmp"
41 # !define MUI_ICON "myIcons.ico"
42 # !define MUI_UNICON "unicon.ico"
43
44 !define MUI_ABORTWARNING
45
46 ;Show all languages, despite user's codepage
47 # !define MUI_LANGDLL_ALLLANGUAGES
48
49 ;--------------------------------
50 ;Language Selection Dialog Settings
51
52 ;Remember the installer language
53 !define MUI_LANGDLL_REGISTRY_ROOT "SHCTX"
54 !define MUI_LANGDLL_REGISTRY_KEY "Software\${INSTALLATIONNAME}"
55 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
56
57 ;Start Menu Folder Page Configuration
58 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
59 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${INSTALLATIONNAME}"
60 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
61
62 ;--------------------------------
63 ;Pages
64 !insertmacro MUI_PAGE_WELCOME
65 # !insertmacro MUI_PAGE_LICENSE $(license)
66 !insertmacro MUI_PAGE_COMPONENTS
67 !insertmacro MULTIUSER_PAGE_INSTALLMODE
68 !insertmacro MUI_PAGE_DIRECTORY
69 !insertmacro MUI_PAGE_INSTFILES
70 !insertmacro MUI_PAGE_FINISH
71
72 !insertmacro MUI_UNPAGE_WELCOME
73 !insertmacro MUI_UNPAGE_CONFIRM
74 !insertmacro MUI_UNPAGE_INSTFILES
75 !insertmacro MUI_UNPAGE_FINISH
76
77 ;--------------------------------
78 ;Languages
79
80 !insertmacro MUI_LANGUAGE "English" ;first language is the default Language
81 !insertmacro MUI_LANGUAGE "German"
82
83 ;--------------------------------
84 ;Reserve Files
85
86 ;If you are using solid compression, files that are required before
87 ;the actual installation should be stored first in the data block,
88 ;because this will make your installer start faster.
89
90 !insertmacro MUI_RESERVEFILE_LANGDLL
91
92 ;--------------------------------
93 ;Installer Sections
94
95 Section ""
96 SetOutPath $INSTDIR
97 File ${BUILD_DIR}qhexedit.exe
98 File /r ${BUILD_DIR}*.dll
99 File ${TRANS_DIR}*.qm
100 WriteUninstaller $INSTDIR\uninstall.exe
101 WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLATIONNAME}" "DisplayName" "QHexEdit Installer"
102 WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLATIONNAME}" "UninstallString" '"$INSTDIR\uninstall.exe"'
103 WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLATIONNAME}" "NoModify" 1
104 WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLATIONNAME}" "NoRepair" 1
105 WriteRegStr SHCTX "Software\${INSTALLATIONNAME}" "" $INSTDIR
106 SectionEnd
107
108 Section $(startmenu) Startmenu
109 CreateDirectory "$SMPROGRAMS\${INSTALLATIONNAME}"
110 CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
111 CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\QHexEdit.lnk" "$INSTDIR\qhexedit.exe" "" "$INSTDIR\qhexedit.exe" 0
112 SectionEnd
113
114 Section /o $(desktop) Desktop
115 CreateShortCut "$DESKTOP\QHexEdit.lnk" "$INSTDIR\qhexedit.exe" "" "$INSTDIR\qhexedit.exe" 0
116 SectionEnd
117
118 ;--------------------------------
119 ;Installer Functions
120
121 Function .onInit
122 !insertmacro MULTIUSER_INIT
123 !insertmacro MUI_LANGDLL_DISPLAY
124 FunctionEnd
125
126 ;--------------------------------
127 ;Descriptions
128
129 #LicenseLangString license ${LANG_ENGLISH} license.rtf
130 #LicenseLangString license ${LANG_GERMAN} license_de.rtf
131
132 LangString startmenu ${LANG_ENGLISH} "Add to Start Menu"
133 LangString startmenu ${LANG_GERMAN} "Eintrag ins Startmenü"
134 LangString DESC_Startmenu ${LANG_ENGLISH} "Add an Entry to the Start Menu"
135 LangString DESC_Startmenu ${LANG_GERMAN} "Einen Eintrag ins Startmenü hinzufügen"
136
137 LangString desktop ${LANG_ENGLISH} "Add a Desktop Icon"
138 LangString desktop ${LANG_GERMAN} "Zum Desktop hinzufügen"
139 LangString DESC_Desktop ${LANG_ENGLISH} "Add an Icon to the Desktop"
140 LangString DESC_Desktop ${LANG_GERMAN} "Einen Eintrag zum Desktop hinzufügen"
141
142 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
143 !insertmacro MUI_DESCRIPTION_TEXT ${Startmenu} $(DESC_Startmenu)
144 !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} $(DESC_Desktop)
145 !insertmacro MUI_FUNCTION_DESCRIPTION_END
146
147 ;--------------------------------
148 ;Uninstaller Section
149
150 Section "Uninstall"
151 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLATIONNAME}"
152 DeleteRegKey SHCTX "Software\${INSTALLATIONNAME}"
153 RMDir /r $INSTDIR
154 Delete "$SMPROGRAMS\${INSTALLATIONNAME}\Uninstall.lnk"
155 Delete "$SMPROGRAMS\${INSTALLATIONNAME}\QHexEdit.lnk"
156 Delete "$DESKTOP\QHexEdit.lnk"
157 RMDir "$SMPROGRAMS\${INSTALLATIONNAME}"
158 SectionEnd
159
160 ;--------------------------------
161 ;Uninstaller Functions
162
163 Function un.onInit
164 !insertmacro MULTIUSER_UNINIT
165 !insertmacro MUI_UNGETLANGUAGE
166 FunctionEnd
2525 searchdialog.ui
2626
2727 OTHER_FILES += \
28 ../readme.md \
29 ../doc/release.txt \
30 ../doc/howtorelease.txt \
3128 ../build-example.bat \
3229 ../build-python-bindings.bat \
3330 ../build-example.sh \
3431 ../build-python-bindings.sh \
35 ../deploy.nsi
32 ../deploy.nsi \
33 ../doc/release.txt \
34 ../doc/howtorelease.txt \
35 ../appveyor.yml \
36 ../readme.md \
37 ../setup.py \
38 ../src/qhexedit.sip
3639
3740 TRANSLATIONS += \
3841 translations/qhexedit_cs.ts \
66
77 QHexEdit takes the data of a QByteArray (setData()) and shows it. You can use the mouse or the keyboard to navigate inside the widget. If you hit the keys (0..9, a..f) you will change the data. Changed data is highlighted and can be accessed via data().
88
9 Normaly QHexEdit works in the overwrite Mode. You can set overwriteMode(false) and insert data. In this case the size of data() increases. It is also possible to delete bytes (del or backspace), here the size of data decreases.
9 Normally QHexEdit works in the overwrite mode. You can set overwrite mode(false) and insert data. In this case the size of data() increases. It is also possible to delete bytes (del or backspace), here the size of data decreases.
1010
11 You can select data with keyboard hits or mouse movements. The copy-key will copy the selected data into the clipboard. The cut-key copies also but delets it afterwards. In overwrite mode, the paste function overwrites the content of the (does not change the length) data. In insert mode, clipboard data will be inserted. The clipboard content is expected in ASCII Hex notation. Unknown characters will be ignored.
12
13 QHexEdit has two edit areas. In the hex area, you can edit in hex notation. On the right, you edit data in ascii mode. Switch between this two areas with tab-key or shift-tab-key.
11 You can select data with keyboard hits or mouse movements. The copy-key will copy the selected data into the clipboard. The cut-key copies also but deletes it afterwards. In overwrite mode, the paste function overwrites the content of the (does not change the length) data. In insert mode, clipboard data will be inserted. The clipboard content is expected in ASCII Hex notation. Unknown characters will be ignored.
1412
1513 QHexEdit comes with undo/redo functionality. All changes can be undone, by pressing the undo-key (usually ctr-z). They can also be redone afterwards. The undo/redo framework is cleared, when setData() sets up a new content for the editor. You can search data inside the content with indexOf() and lastIndexOf(). The replace() function is to change located subdata. This 'replaced' data can also be undone by the undo/redo framework.
1614
113113
114114 setup(
115115 name='QHexEdit',
116 version='0.8.3',
116 version='0.8.6',
117117 ext_modules=[
118118 Extension(
119119 "qhexedit",
0 #include "QHexEditPlugin.h"
1 #include "qhexedit.h"
2
3 #include <QtPlugin>
4
5 QHexEditPlugin::QHexEditPlugin(QObject * parent) : QObject(parent)
6 {
7 initialized = false;
8 }
9
10
11 bool QHexEditPlugin::isContainer() const
12 {
13 return false;
14 }
15
16 bool QHexEditPlugin::isInitialized() const
17 {
18 return initialized;
19 }
20
21 QIcon QHexEditPlugin::icon() const
22 {
23 return QIcon();
24 }
25
26 QString QHexEditPlugin::domXml() const
27 {
28 return "<ui language=\"c++\">\n"
29 " <widget class=\"QHexEdit\" name=\"hexEdit\">\n"
30 " <property name=\"geometry\">\n"
31 " <rect>\n"
32 " <x>0</x>\n"
33 " <y>0</y>\n"
34 " <width>100</width>\n"
35 " <height>100</height>\n"
36 " </rect>\n"
37 " </property>\n"
38 " <property name=\"toolTip\" >\n"
39 " <string>QHexEditWidget</string>\n"
40 " </property>\n"
41 " <property name=\"whatsThis\" >\n"
42 " <string>QHexEdit widget allow to edit the data in hex view.</string>\n"
43 " </property>\n"
44 " </widget>\n"
45 "</ui>\n";
46 }
47
48 QString QHexEditPlugin::group() const
49 {
50 return "Input Widgets";
51 }
52
53 QString QHexEditPlugin::includeFile() const
54 {
55 return "qhexedit.h";
56 }
57
58 QString QHexEditPlugin::name() const
59 {
60 return "QHexEdit";
61 }
62
63 QString QHexEditPlugin::toolTip() const
64 {
65 return "";
66 }
67
68 QString QHexEditPlugin::whatsThis() const
69 {
70 return "";
71 }
72
73 QWidget * QHexEditPlugin::createWidget(QWidget *parent)
74 {
75 return new QHexEdit(parent);
76 }
77
78 void QHexEditPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
79 {
80 if (initialized)
81 return;
82
83 initialized = true;
84 }
85
86 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
87 Q_EXPORT_PLUGIN2(QHexEditPlugin, QHexEditPlugin)
88 #endif
0 #ifndef QHEXEDITPLUGIN_H
1 #define QHEXEDITPLUGIN_H
2
3 #include <QObject>
4
5 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
6 #include <QtDesigner/QDesignerCustomWidgetInterface>
7 #else
8 #include <QDesignerCustomWidgetInterface>
9 #endif
10
11 class QHexEditPlugin : public QObject, public QDesignerCustomWidgetInterface
12 {
13 Q_OBJECT
14 Q_INTERFACES(QDesignerCustomWidgetInterface)
15 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
16 Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QHexEditPlugin")
17 #endif
18
19 public:
20 QHexEditPlugin(QObject * parent = 0);
21
22 bool isContainer() const;
23 bool isInitialized() const;
24 QIcon icon() const;
25 QString domXml() const;
26 QString group() const;
27 QString includeFile() const;
28 QString name() const;
29 QString toolTip() const;
30 QString whatsThis() const;
31 QWidget *createWidget(QWidget *parent);
32 void initialize(QDesignerFormEditorInterface *core);
33
34 private:
35 bool initialized;
36
37 };
38
39 #endif
1313 1. redo (or do) action
1414 2. undo action.
1515
16 CharCommand also supports command compression via mergeWidht(). This allows
17 the user to execute a undo command contation e.g. 3 steps in a single command.
16 CharCommand also supports command compression via mergeWidht(). This enables
17 the user to perform an undo command e.g. 3 steps in a single command.
1818 If you for example insert a new byt "34" this means for the editor doing 3
1919 steps: insert a "00", overwrite it with "03" and the overwrite it with "34". These
2020 3 steps are combined into a single step, insert a "34".
161161 if (size > Q_INT64_C(0x100000000)){ n += 8; size /= Q_INT64_C(0x100000000);}
162162 if (size > 0x10000){ n += 4; size /= 0x10000;}
163163 if (size > 0x100){ n += 2; size /= 0x100;}
164 if (size > 0x10){ n += 1; size /= 0x10;}
164 if (size > 0x10){ n += 1;}
165165
166166 if (n > _addressWidth)
167167 return n;
468468 {
469469 QByteArray ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin());
470470 return toReadable(ba);
471 }
472
473 QString QHexEdit::selectedData()
474 {
475 QByteArray ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()).toHex();
476 return ba;
471477 }
472478
473479 void QHexEdit::setFont(const QFont &font)
859865 qint64 cPos = cursorPosition(event->pos());
860866 if (cPos >= 0)
861867 {
862 resetSelection(cPos);
868 if (event->button() != Qt::RightButton)
869 resetSelection(cPos);
863870 setCursorPosition(cPos);
864871 }
865872 }
946953 if (ch < ' ' || ch > '~')
947954 ch = '.';
948955 r.setRect(pxPosAsciiX2, pxPosY - _pxCharHeight + _pxSelectionSub, _pxCharWidth, _pxCharHeight);
949 painter.fillRect(r, _asciiAreaColor);
956 painter.fillRect(r, (c == _brushSelection.color() || c == _brushHighlighted.color()) ? c : _asciiAreaColor);
950957 painter.setPen(QPen(_asciiFontColor));
951958 painter.drawText(pxPosAsciiX2, pxPosY, QChar(ch));
952959 pxPosAsciiX2 += _pxCharWidth;
957964 painter.setPen(viewport()->palette().color(QPalette::WindowText));
958965 }
959966
960 // paint cursor
961967 // _cursorPosition counts in 2, _bPosFirst counts in 1
962968 int hexPositionInShowData = _cursorPosition - 2 * _bPosFirst;
963969
964970 // due to scrolling the cursor can go out of the currently displayed data
965971 if ((hexPositionInShowData >= 0) && (hexPositionInShowData < _hexDataShown.size()))
966972 {
973 // paint cursor
967974 if (!_readOnly)
968975 {
969976 QColor color;
985992 {
986993 painter.fillRect(QRect(_pxCursorX - pxOfsX, _pxCursorY - _pxCharHeight + _pxSelectionSub, _pxCharWidth, _pxCharHeight), viewport()->palette().dark().color());
987994 if (_editAreaIsAscii)
988 {
995 {
989996 // every 2 hex there is 1 ascii
990997 int asciiPositionInShowData = hexPositionInShowData / 2;
991998
9951002
9961003 painter.drawText(_pxCursorX - pxOfsX, _pxCursorY, QChar(ch));
9971004 }
998 else
999 {
1005 else
1006 {
10001007 QByteArray hex = _hexDataShown.mid(hexPositionInShowData, 1);
10011008 painter.drawText(_pxCursorX - pxOfsX, _pxCursorY, _hexCaps ? hex.toUpper() : hex);
10021009 }
1003 }
1004 }
1010 }
1011 }
10051012
10061013 // emit event, if size has changed
10071014 if (_lastEventSize != _chunks->size())
10871094 }
10881095 }
10891096
1090 int QHexEdit::getSelectionBegin()
1097 qint64 QHexEdit::getSelectionBegin()
10911098 {
10921099 return _bSelectionBegin;
10931100 }
10941101
1095 int QHexEdit::getSelectionEnd()
1102 qint64 QHexEdit::getSelectionEnd()
10961103 {
10971104 return _bSelectionEnd;
10981105 }
1818 /** \mainpage
1919 QHexEdit is a binary editor widget for Qt.
2020
21 \version Version 0.8.3
21 \version Version 0.8.6
2222 \image html qhexedit.png
2323 */
2424
3333 (0..9, a..f) you will change the data. Changed data is highlighted and can be
3434 accessed via data().
3535
36 Normaly QHexEdit works in the overwrite Mode. You can set overwriteMode(false)
36 Normally QHexEdit works in the overwrite mode. You can set overwrite mode(false)
3737 and insert data. In this case the size of data() increases. It is also possible
3838 to delete bytes (del or backspace), here the size of data decreases.
3939
4040 You can select data with keyboard hits or mouse movements. The copy-key will
41 copy the selected data into the clipboard. The cut-key copies also but delets
41 copy the selected data into the clipboard. The cut-key copies also but deletes
4242 it afterwards. In overwrite mode, the paste function overwrites the content of
4343 the (does not change the length) data. In insert mode, clipboard data will be
4444 inserted. The clipboard content is expected in ASCII Hex notation. Unknown
6464 */
6565 Q_PROPERTY(bool addressArea READ addressArea WRITE setAddressArea)
6666
67 /*! Property address area color sets (setAddressAreaColor()) the backgorund
68 color of address areas. You can also read the color (addressAreaColor()).
67 /*! Property address area color sets (setAddressAreaColor()) the background
68 color of address areas. You can also read the color (addressaAreaColor()).
6969 */
7070 Q_PROPERTY(QColor addressAreaColor READ addressAreaColor WRITE setAddressAreaColor)
7171
9090 Q_PROPERTY(QColor hexFontColor READ hexFontColor WRITE setHexFontColor)
9191
9292 /*! Property addressOffset is added to the Numbers of the Address Area.
93 A offset in the address area (left side) is sometimes usefull, whe you show
93 A offset in the address area (left side) is sometimes useful, whe you show
9494 only a segment of a complete memory picture. With setAddressOffset() you set
9595 this property - with addressOffset() you get the current value.
9696 */
107107 /*! Set and get bytes number per line.*/
108108 Q_PROPERTY(int bytesPerLine READ bytesPerLine WRITE setBytesPerLine)
109109
110 /*! Porperty cursorPosition sets or gets the position of the editor cursor
110 /*! Property cursorPosition sets or gets the position of the editor cursor
111111 in QHexEdit. Every byte in data has two cursor positions: the lower and upper
112112 Nibble. Maximum cursor position is factor two of data.size().
113113 */
133133 */
134134 Q_PROPERTY(bool highlighting READ highlighting WRITE setHighlighting)
135135
136 /*! Property highlighting color sets (setHighlightingColor()) the backgorund
136 /*! Property highlighting color sets (setHighlightingColor()) the background
137137 color of highlighted text areas. You can also read the color
138138 (highlightingColor()).
139139 */
140140 Q_PROPERTY(QColor highlightingColor READ highlightingColor WRITE setHighlightingColor)
141141
142 /*! Porperty overwrite mode sets (setOverwriteMode()) or gets (overwriteMode()) the mode
142 /*! Property overwrite mode sets (setOverwriteMode()) or gets (overwriteMode()) the mode
143143 in which the editor works. In overwrite mode the user will overwrite existing data. The
144144 size of data will be constant. In insert mode the size will grow, when inserting
145145 new data.
146146 */
147147 Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode)
148148
149 /*! Property selection color sets (setSelectionColor()) the backgorund
149 /*! Property selection color sets (setSelectionColor()) the background
150150 color of selected text areas. You can also read the color
151151 (selectionColor()).
152152 */
153153 Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor)
154154
155 /*! Porperty readOnly sets (setReadOnly()) or gets (isReadOnly) the mode
155 /*! Property readOnly sets (setReadOnly()) or gets (isReadOnly) the mode
156156 in which the editor works. In readonly mode the the user can only navigate
157157 through the data and select data; modifying is not possible. This
158158 property's default is false.
170170
171171 // Access to data of qhexedit
172172
173 /*! Sets the data of QHexEdit. The QIODevice will be opend just before reading
173 /*! Sets the data of QHexEdit. The QIODevice will be opened just before reading
174174 and closed immediately afterwards. This is to allow other programs to rewrite
175175 the file while editing it.
176176 */
177177 bool setData(QIODevice &iODevice);
178178
179 /*! Givs back the data as a QByteArray starting at position \param pos and
179 /*! Gives back the data as a QByteArray starting at position \param pos and
180180 delivering \param count bytes.
181181 */
182182 QByteArray dataAt(qint64 pos, qint64 count=-1);
183183
184 /*! Givs back the data into a \param iODevice starting at position \param pos
184 /*! Gives back the data into a \param iODevice starting at position \param pos
185185 and delivering \param count bytes.
186186 */
187187 bool write(QIODevice &iODevice, qint64 pos=0, qint64 count=-1);
228228 void replace(qint64 pos, qint64 len, const QByteArray &ba);
229229
230230
231 // Utility functioins
231 // Utility functions
232232 /*! Calc cursor position from graphics position
233233 * \param point from where the cursor position should be calculated
234 * \return Cursor postioin
234 * \return Cursor position
235235 */
236236 qint64 cursorPosition(QPoint point);
237237
238 /*! Ensure the cursor to be visble
238 /*! Ensure the cursor to be visbile
239239 */
240240 void ensureVisible();
241241
242 /*! Find first occurence of ba in QHexEdit data
242 /*! Find first occurrence of ba in QHexEdit data
243243 * \param ba Data to find
244244 * \param from Point where the search starts
245245 * \return pos if fond, else -1
251251 */
252252 bool isModified();
253253
254 /*! Find last occurence of ba in QHexEdit data
254 /*! Find last occurrence of ba in QHexEdit data
255255 * \param ba Data to find
256256 * \param from Point where the search starts
257257 * \return pos if fond, else -1
261261 /*! Gives back a formatted image of the selected content of QHexEdit
262262 */
263263 QString selectionToReadableString();
264
265 /*! Return the selected content of QHexEdit as QByteArray
266 */
267 QString selectedData();
264268
265269 /*! Set Font of QHexEdit
266270 * \param font
373377 void resetSelection(qint64 pos); // set selectionStart and selectionEnd to pos
374378 void resetSelection(); // set selectionEnd to selectionStart
375379 void setSelection(qint64 pos); // set min (if below init) or max (if greater init)
376 int getSelectionBegin();
377 int getSelectionEnd();
380 qint64 getSelectionBegin();
381 qint64 getSelectionEnd();
378382
379383 // Private utility functions
380384 void init();
383387
384388 private slots:
385389 void adjust(); // recalc pixel positions
386 void dataChangedPrivate(int idx=0); // emit dataChanged() signal
390 void dataChangedPrivate(int idx=0); // emit dataChanged() signal
387391 void refresh(); // ensureVisible() and readBuffers()
388392 void updateCursor(); // update blinking cursor
389393
390394 private:
391395 // Name convention: pixel positions start with _px
392 int _pxCharWidth, _pxCharHeight; // char dimensions (dpendend on font)
396 int _pxCharWidth, _pxCharHeight; // char dimensions (dependend on font)
393397 int _pxPosHexX; // X-Pos of HeaxArea
394398 int _pxPosAdrX; // X-Pos of Address Area
395399 int _pxPosAsciiX; // X-Pos of Ascii Area
438442 QBuffer _bData; // buffer, when setup with QByteArray
439443 Chunks *_chunks; // IODevice based access to data
440444 QTimer _cursorTimer; // for blinking cursor
441 qint64 _cursorPosition; // absolute positioin of cursor, 1 Byte == 2 tics
445 qint64 _cursorPosition; // absolute position of cursor, 1 Byte == 2 tics
442446 QRect _cursorRect; // physical dimensions of cursor
443447 QByteArray _data; // QHexEdit's data, when setup with QByteArray
444448 QByteArray _dataShown; // data in the current View
33 QT += core gui
44 TEMPLATE = lib
55
6 VERSION = 4.0.0
6 VERSION = 4.1.0
77
88 DEFINES += QHEXEDIT_EXPORTS
99
3737 bool highlighting();
3838 qint64 lastIndexOf(QByteArray &, qint64);
3939 QString selectionToReadableString();
40 QString selectedData();
4041 void setFont(const QFont &);
4142 QString toReadableString();
4243
0 #! [0] #! [1]
1 greaterThan(QT_MAJOR_VERSION, 4) {
2 QT += widgets uiplugin
3 }
4
5 lessThan(QT_MAJOR_VERSION, 5) {
6 CONFIG += designer
7 }
8
9 CONFIG += plugin
10 #! [0]
11 TARGET = $$qtLibraryTarget($$TARGET)
12 #! [2]
13 TEMPLATE = lib
14 #! [1] #! [2]
15 QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
16
17 #! [3]
18 HEADERS = \
19 qhexedit.h \
20 chunks.h \
21 commands.h \
22 QHexEditPlugin.h
23
24
25 SOURCES = \
26 qhexedit.cpp \
27 chunks.cpp \
28 commands.cpp \
29 QHexEditPlugin.cpp
30
31 #! [3]
32
33 # install
34 target.path = $$[QT_INSTALL_PLUGINS]/designer
35 sources.files = $$SOURCES $$HEADERS *.pro
36 sources.path = $$[QT_INSTALL_EXAMPLES]/designer/QHexEditPlugin
37 INSTALLS += target
38
39 symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
11 #include <cstdlib>
22
33
4 TestChunks::TestChunks(QTextStream &log, QString tName, int size, bool random, int saveFile)
4 TestChunks::TestChunks(QTextStream &log, QString tName, int size, bool random, int saveFile) : _chunks(nullptr)
55 {
66 char hex[] = "0123456789abcdef";
77 srand(0);
0 # udev rule that sets permissions for PonyProg adapters in Linux.
1 # Put this file in /etc/udev/rules.d and reload udev rules (sudo udevadm control --reload) before to attach the adapter
2
3 # CH341A in UART mode
4 #SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5523", MODE="0666", GROUP="plugdev"
5
6 # CH340G in UART mode
7 #SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0666", GROUP="plugdev"
8
9 # CH341A in I2C, SPI mode
10 #SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE="0666", GROUP="plugdev"
11
12 # PonyProgFT
13 SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6e38", MODE="0666", GROUP="plugdev"