diff --git a/.gitmodules b/.gitmodules
index 2bc640ed..11c3ea9d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "dmcp5"]
path = dmcp5
url = git@github.com:c3d/DMCP5_SDK.git
+[submodule "dmcp"]
+ path = dmcp
+ url = git@github.com:c3d/SDKdemo.git
diff --git a/LICENSE.txt b/LICENSE.txt
index 8d5c2aa1..0a041280 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,30 +1,165 @@
-BSD 3-Clause License
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
-Copyright (c) 2015-2022, SwissMicros
-Copyright (c) 2022, Christophe de Dinechin
-All rights reserved.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
+ 0. Additional Definitions.
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/Makefile b/Makefile
index debc9d9a..724e1ec4 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
TARGET = DB48X
PLATFORM = dmcp
VARIANT = DM42
-SDK = dmcp
+SDK = dmcp/dmcp
PGM = pgm
######################################
diff --git a/dmcp b/dmcp
new file mode 160000
index 00000000..93bd92cb
--- /dev/null
+++ b/dmcp
@@ -0,0 +1 @@
+Subproject commit 93bd92cb11a2ddc5c0fca2b41e00f293522f1c52
diff --git a/dmcp/dmcp.h b/dmcp/dmcp.h
deleted file mode 100644
index 27ad1462..00000000
--- a/dmcp/dmcp.h
+++ /dev/null
@@ -1,1022 +0,0 @@
-/*
-
-BSD 3-Clause License
-
-Copyright (c) 2015-2022, SwissMicros
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
-
- 1. Info is released to assist customers using, exploring and extending the product
- 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
- NOMAS material as no support is implied or committed-to by the Manufacturer
- 3. The Manufacturer may reply and/or update materials if and when needed solely
- at their discretion
-
-*/
-#ifndef __SYS_DMCP_H__
-#define __SYS_DMCP_H__
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif // __cplusplus
-
-typedef unsigned int uint;
-
-#include "ff_ifc.h"
-
-
-// ----------------------------------
-
-
-// Configuration
-#define LCD_INVERT_XAXIS
-#define LCD_INVERT_DATA
-// -------
-
-
-#define BLT_OR 0
-#define BLT_ANDN 1
-#define BLT_XOR 2 // 3
-
-#define BLT_NONE 0
-#define BLT_SET 1
-
-
-#ifdef LCD_INVERT_DATA
-# define LCD_EMPTY_VALUE 0xFF
-# define LCD_SET_VALUE 0
-#else
-# define LCD_EMPTY_VALUE 0
-# define LCD_SET_VALUE 0xFF
-#endif
-
-
-
-// HW interface
-void LCD_clear();
-void LCD_power_on();
-void LCD_power_off(int clear);
-void LCD_write_line(uint8_t * buf);
-
-
-void bitblt24(uint32_t x, uint32_t dx, uint32_t y, uint32_t val, int blt_op, int fill);
-
-// Returns pointer to line buffer (doesn't depend on LCD_INVERT_XAXIS)
-uint8_t * lcd_line_addr(int y);
-
-// Drawing Prototypes
-void lcd_clear_buf();
-void lcd_refresh();
-void lcd_refresh_dma();
-void lcd_refresh_wait();
-void lcd_forced_refresh();
-void lcd_refresh_lines(int ln, int cnt);
-
-
-void lcd_fill_rect(uint32_t x, uint32_t y, uint32_t dx, uint32_t dy, int val);
-void lcd_fill_ptrn(int x, int y, int dx, int dy, int ptrn1, int ptrn2);
-
-// Place image into LCD buffer
-void lcd_draw_img(const char* img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y);
-void lcd_draw_img_direct(const char* img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y);
-void lcd_draw_img_part(const char* img, uint32_t xo, uint32_t yo, uint32_t x, uint32_t y, uint32_t dx);
-
-#define LCD_X 400
-#define LCD_Y 240
-#define LCD_LINE_SIZE 50 // LCD_X/8
-#define LCD_LINE_BUF_SIZE (2+LCD_LINE_SIZE+2) // CMD, Line_nr, line data (50 bytes), dummy (2 bytes)
-
-void lcd_fillLine(int ln, uint8_t val);
-void lcd_fillLines(int ln, uint8_t val, int cnt);
-
-
-void lcd_set_buf_cleared(int val);
-int lcd_get_buf_cleared();
-
-uint8_t reverse_byte(uint8_t x);
-
-
-// ----------------------------------
-
-
-// Font structure
-typedef struct {
- const char * name;
- uint8_t width;
- uint8_t height;
- uint8_t baseline;
- uint8_t first_char;
- uint8_t char_cnt;
- uint8_t scale_x;
- uint8_t scale_y;
- uint8_t const * data;
- uint16_t const * offs;
-} line_font_t;
-
-
-#define NR2T(x) (-(x)-1) // x<0
-#define T2NR(x) (-(x)-1) // x>=0
-
-// Font display state
-typedef struct {
- line_font_t const * f; // Current font
- int16_t x, y; // Current x,y position
- int16_t ln_offs; // Line offset (when displaying by line numbers)
- int16_t y_top_grd; // Don't overwrite anything above this line
- int8_t ya; // Lines to fill above the font
- int8_t yb; // Lines to fill below the font
- int8_t xspc; // Space between chars
- int8_t xoffs; // X offset for first char on line
-
- uint8_t fixed; // Draw in fixed width
- uint8_t inv; // Draw inverted
- uint8_t bgfill; // Fill background while drawing
- uint8_t lnfill; // Fill whole lines before writing line
- uint8_t newln; // New line after writing line
- const uint8_t *post_offs; // X-advance character width minus this value (if not-null)
-} disp_stat_t;
-
-void lcd_writeNl(disp_stat_t * ds);
-void lcd_prevLn(disp_stat_t * ds);
-void lcd_writeClr(disp_stat_t * ds);
-void lcd_setLine(disp_stat_t * ds, int ln_nr);
-void lcd_setXY(disp_stat_t * ds, int x, int y);
-
-int lcd_lineHeight(disp_stat_t * ds);
-int lcd_baseHeight(disp_stat_t * ds);
-int lcd_fontWidth(disp_stat_t * ds);
-
-// Font display functions
-void lcd_writeText(disp_stat_t * ds, const char* text);
-// Note that 'text' has to be in RAM
-void lcd_textToBox(disp_stat_t * ds, int x, int width, char *text, int from_right, int align_right);
-
-// Width calculation functions
-int lcd_textWidth(disp_stat_t * ds, const char* text);
-int lcd_charWidth(disp_stat_t * ds, int c);
-
-// Get just text which fits in expected_width
-// Returns index of char which breaks the space limit
-// Optional plen variable can be supplied to get text width up to index limit.
-int lcd_textToWidth(disp_stat_t * ds, const char* text, int expected_width, int * plen);
-// ... alternative version to upper function which takes text from the end
-// returns -1 if whole text fits into 'expected_width'
-int lcd_textToWidthR(disp_stat_t * ds, const char* text, int expected_width, int * plen);
-
-// Just advance ds->x don't print anything
-void lcd_writeTextWidth(disp_stat_t * ds, const char* text);
-
-// Get text which fits in expected width *without breaking words*
-// - word could be broken in the middle only when is placed single long word on line
-int lcd_textForWidth(disp_stat_t * ds, const char* text, int expected_width, int * plen);
-
-
-// Font switching
-int lcd_nextFontNr(int nr);
-int lcd_prevFontNr(int nr);
-void lcd_switchFont(disp_stat_t * ds, int nr);
-int lcd_toggleFontT(int nr);
-
-
-// ----------------------------------
-
-
-// Display screens for calc
-#define DISP_CALC 0
-#define DISP_SYS_MENU 2
-#define DISP_BOOTLOADER 4
-#define DISP_UNIMPLEMENTED 5
-#define DISP_USB_WRITE 6
-#define DISP_MSC_CONNECT_USB 7
-#define DISP_ABOUT 8
-#define DISP_FAT_FORMAT 9
-#define DISP_FAULT 11
-#define DISP_QSPI_BAD_CRC 12
-#define DISP_QSPI_CHECK 13
-#define DISP_MARK_REGION 15
-#define DISP_DISK_TEST 16
-#define DISP_DSKTST_CONNECT_USB 17
-#define DISP_QSPI_CONNECT_USB 18
-#define DISP_OFF_IMAGE_ERR 19
-#define DISP_HELP 21
-#define DISP_BOOTLDR_CON_USB 22
-#define DISP_PROD_DIAG 23
-#define DISP_POWER_CHECK 24
-#define DISP_FLASH_CONNECT_USB 26
-// ----
-
-
-// Display predefined screen by number
-int lcd_for_calc(int what);
-
-
-// == Menu keys
-
-#define LCD_MENU_LINES 32
-
-#define MENU_KEY_LABEL_LEN 12
-#define MENU_KEY_COUNT 6
-
-void lcd_draw_menu_bg();
-void lcd_draw_menu_key(int n, const char *s, int highlight);
-void lcd_draw_menu_keys(const char *keys[]);
-
-void lcd_print(disp_stat_t * ds, const char* fmt, ...);
-
-#define lcd_printAt(ds, ln, ...) do { lcd_setLine(ds, ln); lcd_print(ds, __VA_ARGS__); } while(0)
-#define lcd_printR(ds, ...) do { ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)
-#define lcd_printRAt(ds, ln, ...) do { lcd_setLine(ds, ln); ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)
-
-#define lcd_puts lcd_writeText
-#define lcd_putsAt(ds, ln, str) do { lcd_setLine(ds, ln); lcd_puts(ds,str); } while(0)
-#define lcd_putsR(ds, str) do { ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)
-#define lcd_putsRAt(ds, ln, str) do { lcd_setLine(ds, ln); ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)
-
-
-// ----------------------------------
-
-
-typedef struct {
- uint16_t year;
- uint8_t month;
- uint8_t day;
-} dt_t;
-
-typedef struct {
- uint8_t hour;
- uint8_t min;
- uint8_t sec;
- uint8_t csec;
- uint8_t dow;
-} tm_t;
-
-const char* get_wday_shortcut(int day); // 0 = Monday
-const char* get_month_shortcut(int month); // 1 = Jan
-
-// DOW is julian_day % 7 ... where 0 = Mon
-int julian_day(dt_t *d);
-void julian_to_date(int julian_day, dt_t *d);
-
-
-// ----------------------------------
-
-// System data block
-
-typedef int get_flag_fn_t();
-typedef void set_flag_fn_t(int val);
-
-typedef int run_menu_item_fn_t(uint8_t line_id);
-typedef const char * menu_line_str_fn_t(uint8_t line_id, char * s, const int slen);
-
-typedef void void_fn_t();
-
-
-typedef struct {
- volatile uint32_t calc_state;
- FIL * ppgm_fp;
- const char * key_to_alpha_table;
-
- run_menu_item_fn_t * run_menu_item_app;
- menu_line_str_fn_t * menu_line_str_app;
-
- void_fn_t * after_fat_format;
-
- get_flag_fn_t * get_flag_dmy;
- set_flag_fn_t * set_flag_dmy;
- get_flag_fn_t * is_flag_clk24;
- set_flag_fn_t * set_flag_clk24;
- get_flag_fn_t * is_beep_mute;
- set_flag_fn_t * set_beep_mute;
-
- disp_stat_t * pds_t20;
- disp_stat_t * pds_t24;
- disp_stat_t * pds_fReg;
-
- uint32_t * timer2_counter;
- uint32_t * timer3_counter;
-
- void_fn_t * msc_end_cb;
-
-} sys_sdb_t;
-
-
-#define calc_state (sdb.calc_state)
-#define ppgm_fp (sdb.ppgm_fp)
-
-#define key_to_alpha_table (sdb.key_to_alpha_table)
-
-#define run_menu_item_app (sdb.run_menu_item_app)
-#define menu_line_str_app (sdb.menu_line_str_app)
-
-#define after_fat_format (sdb.after_fat_format)
-
-#define get_flag_dmy (sdb.get_flag_dmy)
-#define set_flag_dmy (sdb.set_flag_dmy)
-#define is_flag_clk24 (sdb.is_flag_clk24)
-#define set_flag_clk24 (sdb.set_flag_clk24)
-#define is_beep_mute (sdb.is_beep_mute)
-#define set_beep_mute (sdb.set_beep_mute)
-#define timer2_counter (sdb.timer2_counter)
-#define timer3_counter (sdb.timer3_counter)
-
-#define msc_end_cb (sdb.msc_end_cb)
-
-
-#define t20 (sdb.pds_t20)
-#define t24 (sdb.pds_t24)
-#define fReg (sdb.pds_fReg)
-
-#define sdb (*((sys_sdb_t*)0x10002000))
-
-
-// ----------------------------------
-
-#define PLATFORM_VERSION "3.24"
-
-// System interface version
-#define PLATFORM_IFC_CNR 3
-#define PLATFORM_IFC_VER 15
-
-// STATIC_ASSERT ...
-#define ASSERT_CONCAT_(a, b) a##b
-#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
-#define STATIC_ASSERT(e,m) ;enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) }
-//#define STATIC_ASSERT(expr, msg) typedef char ASSERT_CONCAT(static_assert_check_, __LINE__) [(expr) ? (+1) : (-1)]
-
-#define _STRINGIFY(x) #x
-#define STR(x) _STRINGIFY(x)
-
-#define BIT(n) (1<<(n))
-
-// ==== HW ID
-uint8_t get_hw_id();
-
-// ==== RTC
-void rtc_read(tm_t * tm, dt_t *dt);
-void rtc_write(tm_t * tm, dt_t *dt);
-void rtc_update_time_sec(int delta_sec);
-uint8_t rtc_read_century();
-void rtc_write_century(uint8_t cent);
-uint8_t rtc_read_min();
-uint8_t rtc_read_sec();
-void rtc_wakeup_delay();
-
-// ==== VBAT
-uint32_t read_power_voltage();
-int get_lowbat_state();
-int get_vbat();
-
-// ==== Buzzer
-// Freq in mHz
-void start_buzzer_freq(uint32_t freq);
-void stop_buzzer();
-void set_buzzer(int pin1val, int pin2val);
-
-void beep_volume_up();
-void beep_volume_down();
-int get_beep_volume();
-
-
-// ==== REGIONS
-uint32_t mark_region(uint32_t id);
-void no_region();
-
-
-// ==== RESET values
-#define NO_SPLASH_MAGIC 0xEACE7362
-#define ALLOC_FAIL_MAGIC 0x363EACE7
-#define CLEAN_RESET_MAGIC 0x3EACE736
-#define RUN_DMCP_MAGIC 0x3CE7EA37
-
-void set_reset_magic(uint32_t value);
-
-
-
-// === RESET STATE FILE
-int is_reset_state_file();
-char * get_reset_state_file();
-void set_reset_state_file(const char * str);
-
-
-// ==== USB functions
-int switch_usb_powered_freq();
-int usb_powered();
-void usb_acm_on();
-int usb_is_on();
-void usb_turn_off();
-void acm_puts(const char *str);
-
-// Aux buf
-#define AUX_BUF_SIZE (5*512)
-
-char * aux_buf_ptr();
-void * write_buf_ptr();
-int write_buf_size();
-
-// Program info structure
-#define PROG_INFO_MAGIC 0xd377C0DE
-
-void program_main();
-
-typedef struct {
- uint32_t pgm_magic;
- uint32_t pgm_size;
- void * pgm_entry;
- uint32_t ifc_cnr;
- uint32_t ifc_ver;
- uint32_t qspi_size;
- uint32_t qspi_crc;
- char pgm_name[16];
- char pgm_ver[16];
- uint32_t required_keymap_id;
-} __packed prog_info_t;
-
-
-// Keyboard
-int read_key(int *k1, int *k2);
-
-
-/////////////////////////////////
-// Low level diagnostics
-/////////////////////////////////
-
-void suspended_bg_key_read();
-void resume_bg_key_read();
-
-// Timer
-uint32_t get_tim1_timer();
-
-// Base frequency 8MHz
-#define TIMER_BASE_FREQ (8000000)
-void start_timer2(uint32_t div32);
-void start_timer3(uint16_t div16);
-void stop_timer2();
-void stop_timer3();
-
-// RTC linear reading
-#define RTCREGS_SS_PER_SEC 256
-
-typedef struct {
- uint32_t dt;
- uint32_t tm;
- uint16_t ss;
-} rtc_time_regs_t;
-
-
-typedef struct {
- rtc_time_regs_t regs;
- uint64_t dsec; // julian day * seconds_per_day
- uint32_t jday; // julian day
- uint32_t sec; // seconds in day
- uint32_t msec; // seconds in day corresponding to current minute (for easy sub-minute updates)
-} rtc_ticks_stat_t;
-
-
-uint32_t get_rtc_ticks();
-rtc_ticks_stat_t* rtc_update_ticks();
-void rtc_set_alarm(tm_t * tm, dt_t *dt);
-void rtc_cancel_alarm();
-
-
-
-// QSPI User area
-int qspi_user_write(uint8_t *data, int size, int offset, int erase);
-uint8_t * qspi_user_addr();
-int qspi_user_size();
-
-
-
-
-// ----------------------------------
-
-
-// Printer
-#define PRINT_GRA_LN 1
-#define PRINT_TXT_LN 0
-
-#define MAX_82240_WIDTH 166
-#define DFLT_82240_LINE_DUR 1800
-
-void print_byte(uint8_t b);
-void print_buffer(uint8_t * buf, int cnt);
-int print_is_ready();
-
-// Printer delay in ms
-uint printer_get_delay();
-void printer_set_delay(uint val);
-
-
-void printer_advance_buf(int what);
-int printer_busy_for(int what);
-
-
-// ----------------------------------
-
-
-// --------------------------------
-// Menu pages
-// --------------------------------
-
-typedef void void_fn_t();
-
-typedef struct {
- const char * name;
- const uint8_t * items;
- const char* const * msg;
- void_fn_t * post_disp;
-} smenu_t;
-
-extern const smenu_t MID_SYS_WARN; // System menu entry warning
-extern const smenu_t MID_SYSTEM; // System menu
-extern const smenu_t MID_FAT_FORMAT; // FAT format menu
-extern const smenu_t MID_DSKTST_ENTER; // Disk test menu
-extern const smenu_t MID_PROD_DIAG; // Production diagnostic screen
-extern const smenu_t MID_PROD_DIAG2; // Production diagnostic screen - selftest version in main menu
-extern const smenu_t MID_DMCP; // Top level system menu
-extern const smenu_t MID_BASE_SETUP; // System setup menu
-extern const smenu_t MID_BAD_KMAP; // Bad keymap menu
-
-
-// --------------------------------
-// Menu items
-// app range 0-127
-// sys range 128-255
-// --------------------------------
-
-#define MI_SYSTEM 192
-#define MI_BOOTLOADER 193
-#define MI_QSPI_LOADER 194
-#define MI_DIAG 195
-#define MI_MSC 196
-#define MI_ABOUT 197
-#define MI_BASE_SETUP 198
-#define MI_BEEP_MUTE 199
-#define MI_SYSTEM_ENTER 200
-#define MI_RELOAD_RESET 201
-#define MI_SET_TIME 202
-#define MI_SET_DATE 203
-#define MI_FF_ENTER 204
-#define MI_FAT_FORMAT 205
-#define MI_DISK_TEST 206
-#define MI_DSKTST_ENTER 207
-#define MI_DISK_INFO 208
-#define MI_LOAD_QSPI 209
-#define MI_SLOW_AUTOREP 210
-
-#define MI_EXIT 211
-
-#define MI_KBD_TEST 212
-#define MI_LCD_TEST 213
-#define MI_IR_TEST 214
-#define MI_BEEP_TEST 215
-#define MI_DMCP_MENU 216
-
-#define MI_SELF_TEST 217
-
-#define MI_RAMFLASH 218
-
-#define MI_PGM_INFO 219
-#define MI_PGM_RUN 220
-#define MI_PGM_LOAD 221
-
-#define MI_RUN_DMCP 222
-
-#define MI_OFF_MODE 223
-
-#define MI_KMAP_PGM_RUN 224
-#define MI_KMAP_DMCP 225
-
-// --------------------------------
-
-
-
-#define MRET_LEAVELIMIT 512
-
-
-
-// --------------------------------
-
-#define MENU_MAX_LEVEL 8
-
-#define MENU_FONT t24
-#define MENU_LCD_LINES 8
-
-#define MENU_RESET 0
-#define MENU_ADD 1
-
-#define MRET_UNIMPL -1
-#define MRET_EXIT -2
-
-// === Date/Time
-
-#define PRINT_DT_TM_SZ 20
-
-
-void rtc_check_unset();
-void run_set_time();
-void run_set_date();
-
-
-// === Base dialogs
-void disp_disk_info(const char * hdr);
-int power_check_screen();
-
-
-// === Base menu functions ===
-int handle_menu(const smenu_t * menu_id, int action, int cur_line);
-
-// === Menu formatting support
-const char * rb_str(int val);
-const char * sel_str(int val);
-char * opt_str(char * s, char const *txt, int val);
-char * date_str(char * s, const char * txt);
-char * time_str(char * s, const char * txt);
-
-// === File selection ===
-
-#define MAX_PGM_FN_LEN 24
-
-typedef int (*file_sel_fn_t)(const char * fpath, const char * fname, void * data);
-
-int file_selection_screen(const char * title, const char * base_dir, const char * ext, file_sel_fn_t sel_fn,
- int disp_new, int overwrite_check, void * data);
-
-
-
-
-// ---------------------------------------------------
-// Item selection screen
-// ---------------------------------------------------
-
-#define ISEL_FILL_ITEMS -100
-#define ISEL_KEY_PRESSED -101
-#define ISEL_EXIT -102
-
-#define ISEL_POST_DRAW -2
-#define ISEL_PRE_DRAW -1
-
-typedef uint16_t list_item_t;
-
-struct item_sel_state;
-typedef void isel_disp_line_fn_t(int lnr, list_item_t *fis, int cur_fnr, struct item_sel_state *st);
-typedef void fis_name_fn_t(struct item_sel_state *st, list_item_t fis, char * nmbuf, int len);
-
-
-typedef struct item_sel_state {
- int fnr;
- int top_nr;
- int8_t lncnt; // Number of LCD lines available
- int8_t roll_lines;
- int8_t key;
-
- list_item_t * fis;
- fis_name_fn_t * fis_name_fn; // Used for sorting
- int max_items;
- int fcnt;
-
- // -- Set by user --
- const char * title; // Screen title
- char * title2; // Optional right part of title
- isel_disp_line_fn_t * disp_line_fn; // Line draw function
- char * lnbuf; // line buffer if app wants to use it for line drawing
- int lnsize; // lnbuf size
-
- void * data; // Custom data (useful for line draw callback)
- void * items; // Custom data for items
-
-} __packed item_sel_state_t;
-
-
-// Initialize item sel structure
-void item_sel_init(item_sel_state_t *st);
-void item_sel_reinit(item_sel_state_t *st);
-
-// upd == 1 -> force repaint
-int item_sel_engine(item_sel_state_t *st, int upd);
-
-// Display header
-void item_sel_header(item_sel_state_t *st, int update);
-
-// ---------------------------------------------------
-
-void msg_box(disp_stat_t * ds, const char * txt, int inv);
-
-
-int run_menu_item_sys(uint8_t line_id);
-
-
-// ----------------------------------
-
-
-#define MAX_LCD_LINE_LEN 40
-
-#define MAX_KEY_NR 37
-#define MAX_FNKEY_NR 43
-
-
-// -------------
-// Key codes
-// -------------
-
-#define KEY_SIGMA 1
-#define KEY_INV 2
-#define KEY_SQRT 3
-#define KEY_LOG 4
-#define KEY_LN 5
-#define KEY_XEQ 6
-#define KEY_STO 7
-#define KEY_RCL 8
-#define KEY_RDN 9
-#define KEY_SIN 10
-#define KEY_COS 11
-#define KEY_TAN 12
-#define KEY_ENTER 13
-#define KEY_SWAP 14
-#define KEY_CHS 15
-#define KEY_E 16
-#define KEY_BSP 17
-#define KEY_UP 18
-#define KEY_7 19
-#define KEY_8 20
-#define KEY_9 21
-#define KEY_DIV 22
-#define KEY_DOWN 23
-#define KEY_4 24
-#define KEY_5 25
-#define KEY_6 26
-#define KEY_MUL 27
-#define KEY_SHIFT 28
-#define KEY_1 29
-#define KEY_2 30
-#define KEY_3 31
-#define KEY_SUB 32
-#define KEY_EXIT 33
-#define KEY_0 34
-#define KEY_DOT 35
-#define KEY_RUN 36
-#define KEY_ADD 37
-
-#define KEY_F1 38
-#define KEY_F2 39
-#define KEY_F3 40
-#define KEY_F4 41
-#define KEY_F5 42
-#define KEY_F6 43
-
-#define KEY_SCREENSHOT 44
-#define KEY_SH_UP 45
-#define KEY_SH_DOWN 46
-
-#define KEY_DOUBLE_RELEASE 99
-
-#define KEY_PAGEUP KEY_DIV
-#define KEY_PAGEDOWN KEY_MUL
-
-
-#define IS_EXIT_KEY(k) ( (k) == KEY_EXIT || (k) == KEY_BSP )
-
-// -----------------------
-// Bit masks operations
-// -----------------------
-#define VAL(x,val) ((x) & (val))
-#define CLR(x,val) val &= ~(x)
-#define SET(x,val) val |= (x)
-#define MSK(x,val) (~(x) & (val))
-#define SETMSK(x,m,val) val = (MSK(m,val)|(x))
-//#define SETBY(c,x,val) (c) ? SET(x,val) : CLR(x,val)
-#define SETBY(c,x,val) if (c) { SET(x,val); } else { CLR(x,val); }
-
-#define ST(x) VAL(x,calc_state)
-#define VAL_ST(x) VAL(x,calc_state)
-#define CLR_ST(x) CLR(x,calc_state)
-#define SET_ST(x) SET(x,calc_state)
-#define SETMSK_ST(x,m) SETMSK(x,m,calc_state)
-#define SETBY_ST(c,x) SETBY(c,x,calc_state)
-
-
-
-#define STAT_CLEAN_RESET BIT(0)
-#define STAT_RUNNING BIT(1)
-#define STAT_SUSPENDED BIT(2)
-#define STAT_KEYUP_WAIT BIT(3)
-#define STAT_OFF BIT(4)
-#define STAT_SOFT_OFF BIT(5)
-#define STAT_MENU BIT(6)
-#define STAT_BEEP_MUTE BIT(7)
-#define STAT_SLOW_AUTOREP BIT(8)
-#define STAT_PGM_END BIT(9)
-#define STAT_CLK_WKUP_ENABLE BIT(10)
-#define STAT_CLK_WKUP_SECONDS BIT(11) // 0 - wakeup runner each minute, 1 - each second
-#define STAT_CLK_WKUP_FLAG BIT(12)
-#define STAT_DMY BIT(13)
-#define STAT_CLK24 BIT(14)
-#define STAT_POWER_CHANGE BIT(15)
-#define STAT_YMD BIT(16)
-#define STAT_ALPHA_TAB_Fn BIT(17) // 1 - alpha table contains also Fn keys (First row)
-
-
-#define STAT_HW_BEEP BIT(28)
-#define STAT_HW_USB BIT(29)
-#define STAT_HW_IR BIT(30)
-
-#define STAT_HW (STAT_HW_BEEP | STAT_HW_USB | STAT_HW_IR)
-
-
-// Screenshots
-#define SCR_DIR "/SCREENS"
-
-// Power OFF images
-#define OFFIMG_DIR "/OFFIMG"
-
-// Help
-#define HELP_INDEX "/HELP/index.htm"
-#define HELP_DIR "/HELP"
-#define HELP_EXT_MASK "*.htm*"
-
-// Screenshot
-int create_screenshot(int report_error);
-
-
-// ---------------------------
-// Key buffer functions
-// ---------------------------
-int key_empty();
-int key_push(int k1);
-int key_tail();
-int key_pop();
-int key_pop_last();
-void key_pop_all();
-
-
-// Key functions
-int key_to_nr(int key);
-void wait_for_key_press();
-int runner_get_key(int *repeat);
-int runner_get_key_delay(int *repeat, uint timeout, uint rep0, uint rep1, uint rep1tout);
-void wait_for_key_release(int tout);
-
-
-
-// ---------------------------
-// Runner get key
-// ---------------------------
-
-int runner_key_tout_value(const int first);
-void runner_key_tout_init(const int slow);
-
-
-// Autorepeat
-int toggle_slow_autorepeat();
-int is_slow_autorepeat();
-
-// Auto off
-void reset_auto_off();
-int is_auto_off();
-int is_menu_auto_off();
-int sys_auto_off_cnt();
-
-// Time/date
-void print_dmy_date(char * s, int const sz, dt_t *dt, const char * append, int shortmon, char sep_arg);
-void print_clk24_time(char * t, int const sz, tm_t *tm, int disp_sec, int disp_dow);
-
-
-// Check and create dir
-// returns 0 on success
-int check_create_dir(const char * dir);
-
-// Set disk label
-void set_fat_label(const char * label);
-
-int file_exists(const char * fn);
-
-// Returns -1 if file doesn't exist
-int file_size(const char * fn);
-
-int sys_disk_ok();
-int sys_disk_write_enable(int val);
-void sys_disk_check_valid();
-int sys_is_disk_write_enable();
-
-void sys_clear_write_buf_used();
-int sys_write_buf_used();
-
-
-// System timers
-void sys_timer_disable(int timer_ix);
-void sys_timer_start(int timer_ix, uint32_t ms_value);
-int sys_timer_active(int timer_ix);
-int sys_timer_timeout(int timer_ix);
-
-// Millisecond delay
-void sys_delay(uint32_t ms_delay);
-
-// Current systick count
-uint32_t sys_tick_count();
-uint32_t sys_current_ms();
-
-// Critical sections
-void sys_critical_start();
-void sys_critical_end();
-
-// Sleep
-void sys_sleep();
-
-// Free memory
-int sys_free_mem();
-
-// System
-void sys_reset();
-
-// Key
-int sys_last_key();
-
-// Aux file
-void make_date_filename(char * str, const char * dir, const char * ext);
-
-
-// ---------------------------
-// Flashing
-// ---------------------------
-
-// Enable flashing
-void sys_flashing_init();
-// Disable flashing
-void sys_flashing_finish();
-
-// Expects address and size aligned with flash block size
-// Returns 0 on success
-int sys_flash_erase_block(void* start_addr, uint32_t size);
-
-// Expects destination address and size are multiples of 8
-// Returns 0 on success
-int sys_flash_write_block(void* dst_addr, uint8_t * src_buf, uint32_t size);
-
-// ---------------------------
-
-
-
-// ----------------------------------
-
-
-void run_help();
-void run_help_file(const char * help_file);
-
-
-
-typedef void user_style_fn_t(char *s, disp_stat_t *ds);
-
-void run_help_file_style(const char * help_file, user_style_fn_t *user_style_fn);
-
-
-// ----------------------------------
-
-
-// Off images
-void draw_power_off_image(int allow_errors);
-void reset_off_image_cycle();
-
-#define BG_COL_PAPER 0xf4f2dc
-#define BG_COL_LCD 0xdff5cc
-
-int update_bmp_file_header(FIL* fp, int width, int height, uint32_t bg_color);
-
-
-// ----------------------------------
-
-
-#include "lft_ifc.h"
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif
diff --git a/dmcp/ff_ifc.h b/dmcp/ff_ifc.h
deleted file mode 100644
index e75d944e..00000000
--- a/dmcp/ff_ifc.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-
-BSD 3-Clause License
-
-Copyright (c) 2015-2022, SwissMicros
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
-
- 1. Info is released to assist customers using, exploring and extending the product
- 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
- NOMAS material as no support is implied or committed-to by the Manufacturer
- 3. The Manufacturer may reply and/or update materials if and when needed solely
- at their discretion
-
-*/
-#ifndef __FF_IFC_H__
-#define __FF_IFC_H__
-
-
-
-/* These types MUST be 16-bit or 32-bit */
-typedef int INT;
-typedef unsigned int UINT;
-
-/* This type MUST be 8-bit */
-typedef unsigned char BYTE;
-
-/* These types MUST be 16-bit */
-typedef short SHORT;
-typedef unsigned short WORD;
-typedef unsigned short WCHAR;
-
-/* These types MUST be 32-bit */
-typedef long LONG;
-typedef unsigned long DWORD;
-
-/* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
-typedef unsigned long long QWORD;
-
-typedef char TCHAR;
-#define _T(x) x
-#define _TEXT(x) x
-
-typedef DWORD FSIZE_t;
-
-typedef struct __FATFS FATFS;
-
-
-typedef struct {
- FATFS* fs;
- WORD id;
- BYTE attr;
- BYTE stat;
- DWORD sclust;
- FSIZE_t objsize;
- UINT lockid;
-} _FDID;
-
-typedef struct {
- _FDID obj;
- BYTE flag;
- BYTE err;
- FSIZE_t fptr;
- DWORD clust;
- DWORD sect;
- DWORD dir_sect;
- BYTE* dir_ptr;
- DWORD* cltbl;
- BYTE buf[512];
-} FIL;
-
-
-/* File access mode and open method flags (3rd argument of f_open) */
-#define FA_READ 0x01
-#define FA_WRITE 0x02
-#define FA_OPEN_EXISTING 0x00
-#define FA_CREATE_NEW 0x04
-#define FA_CREATE_ALWAYS 0x08
-#define FA_OPEN_ALWAYS 0x10
-#define FA_OPEN_APPEND 0x30
-
-
-
-/* File function return code (FRESULT) */
-
-typedef enum {
- FR_OK = 0, /* (0) Succeeded */
- FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
- FR_INT_ERR, /* (2) Assertion failed */
- FR_NOT_READY, /* (3) The physical drive cannot work */
- FR_NO_FILE, /* (4) Could not find the file */
- FR_NO_PATH, /* (5) Could not find the path */
- FR_INVALID_NAME, /* (6) The path name format is invalid */
- FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
- FR_EXIST, /* (8) Access denied due to prohibited access */
- FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
- FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
- FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
- FR_NOT_ENABLED, /* (12) The volume has no work area */
- FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
- FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
- FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
- FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
- FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
- FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */
- FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
-} FRESULT;
-
-
-
-FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
-FRESULT f_close (FIL* fp); /* Close an open file object */
-FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
-FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
-FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
-FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
-FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
-
-#define f_size(fp) ((fp)->obj.objsize)
-#define f_tell(fp) ((fp)->fptr)
-#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
-
-#ifndef EOF
-#define EOF (-1)
-#endif
-
-#endif
diff --git a/dmcp/lft_ifc.h b/dmcp/lft_ifc.h
deleted file mode 100644
index 10636934..00000000
--- a/dmcp/lft_ifc.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
-
-BSD 3-Clause License
-
-Copyright (c) 2015-2022, SwissMicros
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
-
- 1. Info is released to assist customers using, exploring and extending the product
- 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
- NOMAS material as no support is implied or committed-to by the Manufacturer
- 3. The Manufacturer may reply and/or update materials if and when needed solely
- at their discretion
-
-*/
-
-#define LIBRARY_FN_BASE 0x08000201
-
-#define __sysfn_malloc (*(typeof(malloc)*)(LIBRARY_FN_BASE+0))
-#define __sysfn_free (*(typeof(free)*)(LIBRARY_FN_BASE+4))
-#define __sysfn_calloc (*(typeof(calloc)*)(LIBRARY_FN_BASE+8))
-#define __sysfn_realloc (*(typeof(realloc)*)(LIBRARY_FN_BASE+12))
-#define __sysfn__write (*(typeof(_write)*)(LIBRARY_FN_BASE+16))
-#define LCD_clear (*(typeof(LCD_clear)*)(LIBRARY_FN_BASE+20))
-#define LCD_power_on (*(typeof(LCD_power_on)*)(LIBRARY_FN_BASE+24))
-#define LCD_power_off (*(typeof(LCD_power_off)*)(LIBRARY_FN_BASE+28))
-#define LCD_write_line (*(typeof(LCD_write_line)*)(LIBRARY_FN_BASE+32))
-#define bitblt24 (*(typeof(bitblt24)*)(LIBRARY_FN_BASE+36))
-#define lcd_line_addr (*(typeof(lcd_line_addr)*)(LIBRARY_FN_BASE+40))
-#define lcd_clear_buf (*(typeof(lcd_clear_buf)*)(LIBRARY_FN_BASE+44))
-#define lcd_refresh (*(typeof(lcd_refresh)*)(LIBRARY_FN_BASE+48))
-#define lcd_forced_refresh (*(typeof(lcd_forced_refresh)*)(LIBRARY_FN_BASE+52))
-#define lcd_refresh_lines (*(typeof(lcd_refresh_lines)*)(LIBRARY_FN_BASE+56))
-#define lcd_fill_rect (*(typeof(lcd_fill_rect)*)(LIBRARY_FN_BASE+60))
-#define lcd_draw_img (*(typeof(lcd_draw_img)*)(LIBRARY_FN_BASE+64))
-#define lcd_draw_img_direct (*(typeof(lcd_draw_img_direct)*)(LIBRARY_FN_BASE+68))
-#define lcd_draw_img_part (*(typeof(lcd_draw_img_part)*)(LIBRARY_FN_BASE+72))
-#define lcd_fillLine (*(typeof(lcd_fillLine)*)(LIBRARY_FN_BASE+76))
-#define lcd_fillLines (*(typeof(lcd_fillLines)*)(LIBRARY_FN_BASE+80))
-#define lcd_set_buf_cleared (*(typeof(lcd_set_buf_cleared)*)(LIBRARY_FN_BASE+84))
-#define lcd_get_buf_cleared (*(typeof(lcd_get_buf_cleared)*)(LIBRARY_FN_BASE+88))
-#define lcd_writeNl (*(typeof(lcd_writeNl)*)(LIBRARY_FN_BASE+92))
-#define lcd_prevLn (*(typeof(lcd_prevLn)*)(LIBRARY_FN_BASE+96))
-#define lcd_writeClr (*(typeof(lcd_writeClr)*)(LIBRARY_FN_BASE+100))
-#define lcd_setLine (*(typeof(lcd_setLine)*)(LIBRARY_FN_BASE+104))
-#define lcd_setXY (*(typeof(lcd_setXY)*)(LIBRARY_FN_BASE+108))
-#define lcd_lineHeight (*(typeof(lcd_lineHeight)*)(LIBRARY_FN_BASE+112))
-#define lcd_baseHeight (*(typeof(lcd_baseHeight)*)(LIBRARY_FN_BASE+116))
-#define lcd_fontWidth (*(typeof(lcd_fontWidth)*)(LIBRARY_FN_BASE+120))
-#define lcd_writeText (*(typeof(lcd_writeText)*)(LIBRARY_FN_BASE+124))
-#define lcd_textWidth (*(typeof(lcd_textWidth)*)(LIBRARY_FN_BASE+128))
-#define lcd_charWidth (*(typeof(lcd_charWidth)*)(LIBRARY_FN_BASE+132))
-#define lcd_textToWidth (*(typeof(lcd_textToWidth)*)(LIBRARY_FN_BASE+136))
-#define lcd_writeTextWidth (*(typeof(lcd_writeTextWidth)*)(LIBRARY_FN_BASE+140))
-#define lcd_textForWidth (*(typeof(lcd_textForWidth)*)(LIBRARY_FN_BASE+144))
-#define lcd_nextFontNr (*(typeof(lcd_nextFontNr)*)(LIBRARY_FN_BASE+148))
-#define lcd_prevFontNr (*(typeof(lcd_prevFontNr)*)(LIBRARY_FN_BASE+152))
-#define lcd_switchFont (*(typeof(lcd_switchFont)*)(LIBRARY_FN_BASE+156))
-#define lcd_toggleFontT (*(typeof(lcd_toggleFontT)*)(LIBRARY_FN_BASE+160))
-#define lcd_draw_menu_bg (*(typeof(lcd_draw_menu_bg)*)(LIBRARY_FN_BASE+164))
-#define lcd_draw_menu_key (*(typeof(lcd_draw_menu_key)*)(LIBRARY_FN_BASE+168))
-#define lcd_draw_menu_keys (*(typeof(lcd_draw_menu_keys)*)(LIBRARY_FN_BASE+172))
-#define lcd_print (*(typeof(lcd_print)*)(LIBRARY_FN_BASE+176))
-#define lcd_for_calc (*(typeof(lcd_for_calc)*)(LIBRARY_FN_BASE+180))
-#define get_wday_shortcut (*(typeof(get_wday_shortcut)*)(LIBRARY_FN_BASE+184))
-#define get_month_shortcut (*(typeof(get_month_shortcut)*)(LIBRARY_FN_BASE+188))
-#define julian_day (*(typeof(julian_day)*)(LIBRARY_FN_BASE+192))
-#define julian_to_date (*(typeof(julian_to_date)*)(LIBRARY_FN_BASE+196))
-#define get_hw_id (*(typeof(get_hw_id)*)(LIBRARY_FN_BASE+200))
-#define rtc_read (*(typeof(rtc_read)*)(LIBRARY_FN_BASE+204))
-#define rtc_write (*(typeof(rtc_write)*)(LIBRARY_FN_BASE+208))
-#define rtc_read_century (*(typeof(rtc_read_century)*)(LIBRARY_FN_BASE+212))
-#define rtc_write_century (*(typeof(rtc_write_century)*)(LIBRARY_FN_BASE+216))
-#define rtc_read_min (*(typeof(rtc_read_min)*)(LIBRARY_FN_BASE+220))
-#define rtc_read_sec (*(typeof(rtc_read_sec)*)(LIBRARY_FN_BASE+224))
-#define rtc_wakeup_delay (*(typeof(rtc_wakeup_delay)*)(LIBRARY_FN_BASE+228))
-#define read_power_voltage (*(typeof(read_power_voltage)*)(LIBRARY_FN_BASE+232))
-#define get_lowbat_state (*(typeof(get_lowbat_state)*)(LIBRARY_FN_BASE+236))
-#define get_vbat (*(typeof(get_vbat)*)(LIBRARY_FN_BASE+240))
-#define start_buzzer_freq (*(typeof(start_buzzer_freq)*)(LIBRARY_FN_BASE+244))
-#define stop_buzzer (*(typeof(stop_buzzer)*)(LIBRARY_FN_BASE+248))
-#define beep_volume_up (*(typeof(beep_volume_up)*)(LIBRARY_FN_BASE+252))
-#define beep_volume_down (*(typeof(beep_volume_down)*)(LIBRARY_FN_BASE+256))
-#define get_beep_volume (*(typeof(get_beep_volume)*)(LIBRARY_FN_BASE+260))
-#define mark_region (*(typeof(mark_region)*)(LIBRARY_FN_BASE+264))
-#define no_region (*(typeof(no_region)*)(LIBRARY_FN_BASE+268))
-#define set_reset_magic (*(typeof(set_reset_magic)*)(LIBRARY_FN_BASE+272))
-#define is_reset_state_file (*(typeof(is_reset_state_file)*)(LIBRARY_FN_BASE+276))
-#define get_reset_state_file (*(typeof(get_reset_state_file)*)(LIBRARY_FN_BASE+280))
-#define set_reset_state_file (*(typeof(set_reset_state_file)*)(LIBRARY_FN_BASE+284))
-#define usb_powered (*(typeof(usb_powered)*)(LIBRARY_FN_BASE+288))
-#define aux_buf_ptr (*(typeof(aux_buf_ptr)*)(LIBRARY_FN_BASE+292))
-#define write_buf_ptr (*(typeof(write_buf_ptr)*)(LIBRARY_FN_BASE+296))
-#define print_byte (*(typeof(print_byte)*)(LIBRARY_FN_BASE+300))
-#define printer_get_delay (*(typeof(printer_get_delay)*)(LIBRARY_FN_BASE+304))
-#define printer_set_delay (*(typeof(printer_set_delay)*)(LIBRARY_FN_BASE+308))
-#define printer_advance_buf (*(typeof(printer_advance_buf)*)(LIBRARY_FN_BASE+312))
-#define printer_busy_for (*(typeof(printer_busy_for)*)(LIBRARY_FN_BASE+316))
-#define rtc_check_unset (*(typeof(rtc_check_unset)*)(LIBRARY_FN_BASE+320))
-#define run_set_time (*(typeof(run_set_time)*)(LIBRARY_FN_BASE+324))
-#define run_set_date (*(typeof(run_set_date)*)(LIBRARY_FN_BASE+328))
-#define disp_disk_info (*(typeof(disp_disk_info)*)(LIBRARY_FN_BASE+332))
-#define file_selection_screen (*(typeof(file_selection_screen)*)(LIBRARY_FN_BASE+336))
-#define power_check_screen (*(typeof(power_check_screen)*)(LIBRARY_FN_BASE+340))
-#define handle_menu (*(typeof(handle_menu)*)(LIBRARY_FN_BASE+344))
-#define rb_str (*(typeof(rb_str)*)(LIBRARY_FN_BASE+348))
-#define sel_str (*(typeof(sel_str)*)(LIBRARY_FN_BASE+352))
-#define opt_str (*(typeof(opt_str)*)(LIBRARY_FN_BASE+356))
-#define date_str (*(typeof(date_str)*)(LIBRARY_FN_BASE+360))
-#define time_str (*(typeof(time_str)*)(LIBRARY_FN_BASE+364))
-#define read_file_items (*(typeof(read_file_items)*)(LIBRARY_FN_BASE+368))
-#define sort_file_items (*(typeof(sort_file_items)*)(LIBRARY_FN_BASE+372))
-#define create_screenshot (*(typeof(create_screenshot)*)(LIBRARY_FN_BASE+376))
-#define key_empty (*(typeof(key_empty)*)(LIBRARY_FN_BASE+380))
-#define key_push (*(typeof(key_push)*)(LIBRARY_FN_BASE+384))
-#define key_tail (*(typeof(key_tail)*)(LIBRARY_FN_BASE+388))
-#define key_pop (*(typeof(key_pop)*)(LIBRARY_FN_BASE+392))
-#define key_pop_last (*(typeof(key_pop_last)*)(LIBRARY_FN_BASE+396))
-#define key_pop_all (*(typeof(key_pop_all)*)(LIBRARY_FN_BASE+400))
-#define key_to_nr (*(typeof(key_to_nr)*)(LIBRARY_FN_BASE+404))
-#define wait_for_key_press (*(typeof(wait_for_key_press)*)(LIBRARY_FN_BASE+408))
-#define runner_get_key (*(typeof(runner_get_key)*)(LIBRARY_FN_BASE+412))
-#define runner_get_key_delay (*(typeof(runner_get_key_delay)*)(LIBRARY_FN_BASE+416))
-#define wait_for_key_release (*(typeof(wait_for_key_release)*)(LIBRARY_FN_BASE+420))
-#define runner_key_tout_value (*(typeof(runner_key_tout_value)*)(LIBRARY_FN_BASE+424))
-#define runner_key_tout_init (*(typeof(runner_key_tout_init)*)(LIBRARY_FN_BASE+428))
-#define toggle_slow_autorepeat (*(typeof(toggle_slow_autorepeat)*)(LIBRARY_FN_BASE+432))
-#define is_slow_autorepeat (*(typeof(is_slow_autorepeat)*)(LIBRARY_FN_BASE+436))
-#define reset_auto_off (*(typeof(reset_auto_off)*)(LIBRARY_FN_BASE+440))
-#define is_auto_off (*(typeof(is_auto_off)*)(LIBRARY_FN_BASE+444))
-#define is_menu_auto_off (*(typeof(is_menu_auto_off)*)(LIBRARY_FN_BASE+448))
-#define sys_auto_off_cnt (*(typeof(sys_auto_off_cnt)*)(LIBRARY_FN_BASE+452))
-#define print_dmy_date (*(typeof(print_dmy_date)*)(LIBRARY_FN_BASE+456))
-#define print_clk24_time (*(typeof(print_clk24_time)*)(LIBRARY_FN_BASE+460))
-#define check_create_dir (*(typeof(check_create_dir)*)(LIBRARY_FN_BASE+464))
-#define set_fat_label (*(typeof(set_fat_label)*)(LIBRARY_FN_BASE+468))
-#define file_exists (*(typeof(file_exists)*)(LIBRARY_FN_BASE+472))
-#define sys_disk_ok (*(typeof(sys_disk_ok)*)(LIBRARY_FN_BASE+476))
-#define sys_disk_write_enable (*(typeof(sys_disk_write_enable)*)(LIBRARY_FN_BASE+480))
-#define sys_disk_check_valid (*(typeof(sys_disk_check_valid)*)(LIBRARY_FN_BASE+484))
-#define sys_is_disk_write_enable (*(typeof(sys_is_disk_write_enable)*)(LIBRARY_FN_BASE+488))
-#define sys_clear_write_buf_used (*(typeof(sys_clear_write_buf_used)*)(LIBRARY_FN_BASE+492))
-#define sys_write_buf_used (*(typeof(sys_write_buf_used)*)(LIBRARY_FN_BASE+496))
-#define sys_timer_disable (*(typeof(sys_timer_disable)*)(LIBRARY_FN_BASE+500))
-#define sys_timer_start (*(typeof(sys_timer_start)*)(LIBRARY_FN_BASE+504))
-#define sys_timer_active (*(typeof(sys_timer_active)*)(LIBRARY_FN_BASE+508))
-#define sys_timer_timeout (*(typeof(sys_timer_timeout)*)(LIBRARY_FN_BASE+512))
-#define sys_delay (*(typeof(sys_delay)*)(LIBRARY_FN_BASE+516))
-#define sys_tick_count (*(typeof(sys_tick_count)*)(LIBRARY_FN_BASE+520))
-#define sys_current_ms (*(typeof(sys_current_ms)*)(LIBRARY_FN_BASE+524))
-#define sys_critical_start (*(typeof(sys_critical_start)*)(LIBRARY_FN_BASE+528))
-#define sys_critical_end (*(typeof(sys_critical_end)*)(LIBRARY_FN_BASE+532))
-#define sys_sleep (*(typeof(sys_sleep)*)(LIBRARY_FN_BASE+536))
-#define sys_free_mem (*(typeof(sys_free_mem)*)(LIBRARY_FN_BASE+540))
-#define sys_reset (*(typeof(sys_reset)*)(LIBRARY_FN_BASE+544))
-#define sys_last_key (*(typeof(sys_last_key)*)(LIBRARY_FN_BASE+548))
-#define run_help (*(typeof(run_help)*)(LIBRARY_FN_BASE+552))
-#define draw_power_off_image (*(typeof(draw_power_off_image)*)(LIBRARY_FN_BASE+556))
-#define reset_off_image_cycle (*(typeof(reset_off_image_cycle)*)(LIBRARY_FN_BASE+560))
-#define f_open (*(typeof(f_open)*)(LIBRARY_FN_BASE+564))
-#define f_close (*(typeof(f_close)*)(LIBRARY_FN_BASE+568))
-#define f_read (*(typeof(f_read)*)(LIBRARY_FN_BASE+572))
-#define f_write (*(typeof(f_write)*)(LIBRARY_FN_BASE+576))
-#define f_lseek (*(typeof(f_lseek)*)(LIBRARY_FN_BASE+580))
-#define run_help_file (*(typeof(run_help_file)*)(LIBRARY_FN_BASE+584))
-#define set_buzzer (*(typeof(set_buzzer)*)(LIBRARY_FN_BASE+588))
-#define __sysfn_read_key (*(typeof(read_key)*)(LIBRARY_FN_BASE+592))
-#define get_tim1_timer (*(typeof(get_tim1_timer)*)(LIBRARY_FN_BASE+596))
-#define update_bmp_file_header (*(typeof(update_bmp_file_header)*)(LIBRARY_FN_BASE+600))
-#define make_date_filename (*(typeof(make_date_filename)*)(LIBRARY_FN_BASE+604))
-#define reverse_byte (*(typeof(reverse_byte)*)(LIBRARY_FN_BASE+608))
-#define f_rename (*(typeof(f_rename)*)(LIBRARY_FN_BASE+612))
-#define file_size (*(typeof(file_size)*)(LIBRARY_FN_BASE+616))
-#define start_timer2 (*(typeof(start_timer2)*)(LIBRARY_FN_BASE+620))
-#define start_timer3 (*(typeof(start_timer3)*)(LIBRARY_FN_BASE+624))
-#define stop_timer2 (*(typeof(stop_timer2)*)(LIBRARY_FN_BASE+628))
-#define stop_timer3 (*(typeof(stop_timer3)*)(LIBRARY_FN_BASE+632))
-#define __sysfn_suspended_bg_key_read (*(typeof(suspended_bg_key_read)*)(LIBRARY_FN_BASE+636))
-#define __sysfn_resume_bg_key_read (*(typeof(resume_bg_key_read)*)(LIBRARY_FN_BASE+640))
-#define lcd_refresh_dma (*(typeof(lcd_refresh_dma)*)(LIBRARY_FN_BASE+644))
-#define lcd_refresh_wait (*(typeof(lcd_refresh_wait)*)(LIBRARY_FN_BASE+648))
-#define lcd_textToBox (*(typeof(lcd_textToBox)*)(LIBRARY_FN_BASE+652))
-#define item_sel_init (*(typeof(item_sel_init)*)(LIBRARY_FN_BASE+656))
-#define item_sel_reinit (*(typeof(item_sel_reinit)*)(LIBRARY_FN_BASE+660))
-#define item_sel_header (*(typeof(item_sel_header)*)(LIBRARY_FN_BASE+664))
-#define item_sel_engine (*(typeof(item_sel_engine)*)(LIBRARY_FN_BASE+668))
-#define sys_flashing_init (*(typeof(sys_flashing_init)*)(LIBRARY_FN_BASE+672))
-#define sys_flashing_finish (*(typeof(sys_flashing_finish)*)(LIBRARY_FN_BASE+676))
-#define sys_flash_erase_block (*(typeof(sys_flash_erase_block)*)(LIBRARY_FN_BASE+680))
-#define sys_flash_write_block (*(typeof(sys_flash_write_block)*)(LIBRARY_FN_BASE+684))
-#define msg_box (*(typeof(msg_box)*)(LIBRARY_FN_BASE+688))
-#define write_buf_size (*(typeof(write_buf_size)*)(LIBRARY_FN_BASE+692))
-#define get_rtc_ticks (*(typeof(get_rtc_ticks)*)(LIBRARY_FN_BASE+696))
-#define rtc_update_ticks (*(typeof(rtc_update_ticks)*)(LIBRARY_FN_BASE+700))
-#define rtc_set_alarm (*(typeof(rtc_set_alarm)*)(LIBRARY_FN_BASE+704))
-#define rtc_cancel_alarm (*(typeof(rtc_cancel_alarm)*)(LIBRARY_FN_BASE+708))
-#define rtc_update_time_sec (*(typeof(rtc_update_time_sec)*)(LIBRARY_FN_BASE+712))
-#define run_help_file_style (*(typeof(run_help_file_style)*)(LIBRARY_FN_BASE+716))
-#define print_buffer (*(typeof(print_buffer)*)(LIBRARY_FN_BASE+720))
-#define print_is_ready (*(typeof(print_is_ready)*)(LIBRARY_FN_BASE+724))
-#define run_menu_item_sys (*(typeof(run_menu_item_sys)*)(LIBRARY_FN_BASE+728))
-#define lcd_fill_ptrn (*(typeof(lcd_fill_ptrn)*)(LIBRARY_FN_BASE+732))
-#define usb_acm_on (*(typeof(usb_acm_on)*)(LIBRARY_FN_BASE+736))
-#define usb_turn_off (*(typeof(usb_turn_off)*)(LIBRARY_FN_BASE+740))
-#define usb_is_on (*(typeof(usb_is_on)*)(LIBRARY_FN_BASE+744))
-#define acm_puts (*(typeof(acm_puts)*)(LIBRARY_FN_BASE+748))
-#define switch_usb_powered_freq (*(typeof(switch_usb_powered_freq)*)(LIBRARY_FN_BASE+752))
-#define qspi_user_write (*(typeof(qspi_user_write)*)(LIBRARY_FN_BASE+756))
-#define qspi_user_addr (*(typeof(qspi_user_addr)*)(LIBRARY_FN_BASE+760))
-#define qspi_user_size (*(typeof(qspi_user_size)*)(LIBRARY_FN_BASE+764))
-#define f_unlink (*(typeof(f_unlink)*)(LIBRARY_FN_BASE+768))
diff --git a/dmcp/startup_pgm.s b/dmcp/startup_pgm.s
deleted file mode 100644
index 3ce87a85..00000000
--- a/dmcp/startup_pgm.s
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
-*/
-
- .syntax unified
- .cpu cortex-m4
- .fpu softvfp
- .thumb
-
-
-/* == Following section addresses are defined in ld script == */
-
-/* = initialized data should be copied from flash to RAM before pgm start = */
-/* .data section start addr in flash */
-.word _sidata
-/* .data section start addr in RAM */
-.word _sdata
-/* .data section end addr in RAM */
-.word _edata
-
-/* = .bss section should be zeroed before pgm start = */
-/* .bss section start addr in RAM */
-.word _sbss
-/* .bss section end addr */
-.word _ebss
-
-/** **/
-
-
-/**
- Program entry point
-*/
-
- .section .text.Program_Entry
- .weak Program_Entry
- .type Program_Entry, %function
-Program_Entry:
-
-/* Copy the data segment initializers from flash to SRAM */
- ldr r0, =_sidata
- ldr r1, =_sdata
- ldr r2, =_edata
- b CopyDataInit0
-
-CopyDataInit:
- ldr r3, [r0], #4
- str r3, [r1], #4
-CopyDataInit0:
- cmp r1, r2
- bcc CopyDataInit
-
-/* Zero fill the bss segment. */
- movs r0, #0
- ldr r1, =_sbss
- ldr r2, = _ebss
- b FillZerobss0
-
-FillZerobss:
- str r0, [r1], #4
-FillZerobss0:
- cmp r1, r2
- bcc FillZerobss
-
-
-/* Call static constructors */
- bl __libc_init_array
-/* Call the application entry point.*/
- bl program_main
- bl post_main
-
-/* Just for sure as post_main shouldn't return. */
-LoopForever:
- b LoopForever
-
-.size Program_Entry, .-Program_Entry
-
diff --git a/dmcp/sys/pgm_syscalls.c b/dmcp/sys/pgm_syscalls.c
deleted file mode 100644
index 8a2d2136..00000000
--- a/dmcp/sys/pgm_syscalls.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
-
-BSD 3-Clause License
-
-Copyright (c) 2015-2022, SwissMicros
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- The software and related material is released as “NOMAS” (NOt MAnufacturer
-Supported).
-
- 1. Info is released to assist customers using, exploring and extending the
-product
- 2. Do NOT contact the manufacturer with questions, seeking support, etc.
-regarding NOMAS material as no support is implied or committed-to by the
-Manufacturer
- 3. The Manufacturer may reply and/or update materials if and when needed
-solely at their discretion
-
-*/
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-void Program_Entry();
-
-#ifndef PROGRAM_KEYMAP_ID
-# define PROGRAM_KEYMAP_ID 0xffffffff
-#endif
-
-const prog_info_t prog_info = {
- PROG_INFO_MAGIC, // uint32_t pgm_magic;
- 0, // uint32_t pgm_size;
- (void *) Program_Entry, // void * pgm_entry;
- PLATFORM_IFC_CNR, // uint32_t ifc_cnr;
- PLATFORM_IFC_VER, // uint32_t ifc_ver;
- QSPI_DATA_SIZE, // uint32_t qspi_size;
- QSPI_DATA_CRC, // uint32_t qspi_crc;
- PROGRAM_NAME, // char pgm_name[16];
- PROGRAM_VERSION, // char pgm_version[16];
- PROGRAM_KEYMAP_ID // uint32_t required_keymap_id;
-};
-
-
-int _read(int file, char *ptr, int len)
-{
- return len;
-}
-
-
-int _write(int file, char *ptr, int len)
-{
- // Routed to OS, where it is printed to ITM
-#ifdef USER_WRITE
- return USER_WRITE(file, ptr, len);
-#else
- return __sysfn__write(file, ptr, len);
-#endif
-}
-
-
-int _close(int file)
-{
- return -1;
-}
-
-
-int _fstat(int file, struct stat *st)
-{
- st->st_mode = S_IFCHR;
- return 0;
-}
-
-int _isatty(int file)
-{
- return 1;
-}
-
-int _lseek(int file, int ptr, int dir)
-{
- return 0;
-}
-
-int _kill(int pid, int sig)
-{
- errno = EINVAL;
- return -1;
-}
-
-int _getpid(void)
-{
- return 1;
-}
-
-
-void free(void *ptr)
-{
- __sysfn_free(ptr);
-}
-
-
-void *malloc(size_t size)
-{
- return __sysfn_malloc(size);
-}
-
-
-void *calloc(size_t count, size_t nbytes)
-{
- return __sysfn_calloc(count, nbytes);
-}
-
-void *realloc(void *ptr, size_t size)
-{
- return __sysfn_realloc(ptr, size);
-}
-
-
-void *__wrap__malloc_r(struct _reent *pr, size_t size)
-{
- return malloc(size);
-}
-
-void *_calloc_r(struct _reent *pr, size_t nmemb, size_t size)
-{
- return calloc(nmemb, size);
-}
-
-void *_realloc_r(struct _reent *pr, void *ptr, size_t size)
-{
- return realloc(ptr, size);
-}
-
-void _free_r(struct _reent *pr, void *ptr)
-{
- free(ptr);
-}
-
-
-void post_main()
-{
- // Just start DMCP
- set_reset_magic(RUN_DMCP_MAGIC);
- sys_reset();
-}
-
-void __attribute__((__noreturn__)) _exit(int status)
-{
- set_reset_magic(RUN_DMCP_MAGIC);
- sys_reset();
- while(1);
-}
diff --git a/dmcp/sys/sdb.h b/dmcp/sys/sdb.h
deleted file mode 100644
index 9bd3e608..00000000
--- a/dmcp/sys/sdb.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-
-BSD 3-Clause License
-
-Copyright (c) 2015-2019, SwissMicros
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the copyright holder nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
- The software and related material is released as “NOMAS” (NOt MAnufacturer Supported).
-
- 1. Info is released to assist customers using, exploring and extending the product
- 2. Do NOT contact the manufacturer with questions, seeking support, etc. regarding
- NOMAS material as no support is implied or committed-to by the Manufacturer
- 3. The Manufacturer may reply and/or update materials if and when needed solely
- at their discretion
-
-*/
-#ifndef __SYS_SDB_H__
-#define __SYS_SDB_H__
-
-// === IFC START ===
-// System data block
-
-typedef int get_flag_fn_t();
-typedef void set_flag_fn_t(int val);
-
-typedef int run_menu_item_fn_t(uint8_t line_id);
-typedef const char * menu_line_str_fn_t(uint8_t line_id, char * s, const int slen);
-
-typedef void void_fn_t();
-
-
-typedef struct {
- volatile uint32_t calc_state;
- FIL * ppgm_fp;
- const char * key_to_alpha_table;
-
- run_menu_item_fn_t * run_menu_item_app;
- menu_line_str_fn_t * menu_line_str_app;
-
- void_fn_t * after_fat_format;
-
- get_flag_fn_t * is_flag_dmy;
- set_flag_fn_t * set_flag_dmy;
- get_flag_fn_t * is_flag_clk24;
- set_flag_fn_t * set_flag_clk24;
- get_flag_fn_t * is_beep_mute;
- set_flag_fn_t * set_beep_mute;
-
- disp_stat_t * pds_t20;
- disp_stat_t * pds_t24;
- disp_stat_t * pds_fReg;
-
-} sys_sdb_t;
-
-
-#define calc_state (sdb.calc_state)
-#define ppgm_fp (sdb.ppgm_fp)
-
-#define key_to_alpha_table (sdb.key_to_alpha_table)
-
-#define run_menu_item_app (sdb.run_menu_item_app)
-#define menu_line_str_app (sdb.menu_line_str_app)
-
-#define after_fat_format (sdb.after_fat_format)
-
-#define is_flag_dmy (sdb.is_flag_dmy)
-#define set_flag_dmy (sdb.set_flag_dmy)
-#define is_flag_clk24 (sdb.is_flag_clk24)
-#define set_flag_clk24 (sdb.set_flag_clk24)
-#define is_beep_mute (sdb.is_beep_mute)
-#define set_beep_mute (sdb.set_beep_mute)
-
-// === IFC END ===
-
-
-extern sys_sdb_t sdb;
-
-#if 0
-// === IFC START ===
-
-#define t20 (sdb.pds_t20)
-#define t24 (sdb.pds_t24)
-#define fReg (sdb.pds_fReg)
-
-#define sdb (*((sys_sdb_t*)0x10002000))
-
-// === IFC END ===
-#endif
-
-#endif
diff --git a/dmcp5 b/dmcp5
index 2e1baad3..91cb4724 160000
--- a/dmcp5
+++ b/dmcp5
@@ -1 +1 @@
-Subproject commit 2e1baad3b61dfcb05e9df506eb120f0d377affa0
+Subproject commit 91cb47248cf9008b8f71fa8286eb02d86ad577f7