annotate FontPack/base_upperRegion.c @ 1036:5865f0aeb438 Puls_Integration

Radio data integration: Added functionality for displaying radio data as debug message. The USART3 has been configurated for receiption and a function for the visualization of the data has been added to the demo unit (draft implementation). For activation the radio as well as the logger functionality needs to be activated via compile switch. Note that at the moment bluetooth and radio DMA may not be operated in parallel.
author Ideenmodellierer
date Sun, 10 Aug 2025 15:28:59 +0200
parents d492d4b165fb
children 2af07aa38531
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
2 /// -*- coding: UTF-8 -*-
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
3 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
4 /// \file FontPack/./base_upperRegion.c
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
5 /// \brief The beginning of it all. main() is part of this.
36
7801c5d8a562 Update author name for release
heinrichsweikamp
parents: 30
diff changeset
6 /// \author heinrichs weikamp gmbh
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
7 /// \date 31-August-2015
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
8 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
9 /// $Id$
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
10 ///////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
12 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
13 /// This program is free software: you can redistribute it and/or modify
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
14 /// it under the terms of the GNU General Public License as published by
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
15 /// the Free Software Foundation, either version 3 of the License, or
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
16 /// (at your option) any later version.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
17 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
18 /// This program is distributed in the hope that it will be useful,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
21 /// GNU General Public License for more details.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
22 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
23 /// You should have received a copy of the GNU General Public License
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
26 /**
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
27 @verbatim
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
28 ==============================================================================
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
29 ##### New characters in fonts #####
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
30 ==============================================================================
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
31 [..] Use font_tmore.c and add line to corresponding font like font_t54c
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
32 Don't forget to adjust the length of the font in the last line starting
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
33 const tFont .....
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
34
591
0172431fbad9 Minor: Comment translation into English
heinrichsweikamp
parents: 123
diff changeset
35 [..] last char before the big gap, as of 160217
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
36 image_data_FontT24_0x002b[364]
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
37 __attribute__((at( START_T24_FONT + (1647 * 28) ))), START_T24_FONT (0x08142F00 - MINUS_BANK)
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
38
591
0172431fbad9 Minor: Comment translation into English
heinrichsweikamp
parents: 123
diff changeset
39 -> free from 0x0814E490
0172431fbad9 Minor: Comment translation into English
heinrichsweikamp
parents: 123
diff changeset
40 then the logo image_data_ostc_fuer_Tauchcomputer_240px
0172431fbad9 Minor: Comment translation into English
heinrichsweikamp
parents: 123
diff changeset
41 approx 120 kBytes free space available!
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
42
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
43 @endverbatim
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
44 ******************************************************************************
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
45 */
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
46
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
47 /* Includes ------------------------------------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
48
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
49 // From Common/Inc:
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
50 #include "FirmwareData.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
51
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
52
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
53 #ifdef DEBUG
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
54 // From AC6 support:
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
55 #include <stdio.h>
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
56 #include <stdint.h>
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
57 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
58
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
59 //////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
60
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
61 const SFirmwareData font_FirmwareData __attribute__(( section(".font_firmware_data") )) =
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
62 {
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
63 .versionFirst = 1,
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
64 .versionSecond = 0,
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
65 .versionThird = 0,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
66 .versionBeta = 0,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
67
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
68 /* 4 bytes, including trailing 0 */
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
69 .signature = "im",
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
70
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
71 .release_year = 18,
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
72 .release_month = 10,
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
73 .release_day = 04,
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
74 .release_sub = 0,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
75
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
76 /* max 48, including trailing 0 */
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
77 .release_info ="FontPack extension",
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
78
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
79 /* for safety reasons and coming functions */
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
80 .magic[0] = FIRMWARE_MAGIC_FIRST,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
81 .magic[1] = FIRMWARE_MAGIC_SECOND,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
82 .magic[2] = FIRMWARE_MAGIC_FONT, /* the magic byte for fonts*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
83 .magic[3] = FIRMWARE_MAGIC_END
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
84 };
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
85
1030
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
86
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
87 const SFirmwareData font_CustomData __attribute__(( section(".font_custom_data") )) =
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
88 {
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
89 .versionFirst = 1,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
90 .versionSecond = 0,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
91 .versionThird = 0,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
92 .versionBeta = 0,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
93
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
94 /* 4 bytes, including trailing 0 */
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
95 .signature = "im",
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
96
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
97 .release_year = 18,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
98 .release_month = 10,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
99 .release_day = 04,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
100 .release_sub = 0,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
101
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
102 /* max 48, including trailing 0 */
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
103 .release_info ="FontPack extension",
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
104
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
105 /* for safety reasons and coming functions */
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
106 .magic[0] = FIRMWARE_MAGIC_FIRST,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
107 .magic[1] = FIRMWARE_MAGIC_SECOND,
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
108 .magic[2] = FIRMWARE_MAGIC_FONT, /* the magic byte for fonts*/
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
109 .magic[3] = FIRMWARE_MAGIC_END
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
110 };
d492d4b165fb Added custom data header in font part
Ideenmodellierer
parents: 699
diff changeset
111
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
112 //////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
113
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
114 #ifdef BUILD_LIBRARY
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
115 /* Fonts fixed in upper region */
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
116 #include "Fonts/font_awe48.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
117 #include "Fonts/font_T24.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
118 #include "Fonts/font_T42.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
119 #include "Fonts/font_T48_plus.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
120 #include "Fonts/font_T54.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
121 #include "Fonts/font_T84.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
122 #include "Fonts/font_T105.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
123 #include "Fonts/font_T144_plus.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
124
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
125 #include "Fonts/image_ostc.h"
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
126 #else
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
127 #include "gfx_fonts.h"
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
128 #endif
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
129
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
130 /* Images fixed in upper region */
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
131 #include "Fonts/image_battery.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
132 #include "Fonts/image_heinrichs_weikamp.h"
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
133
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
134 /////////////////////////////////////////////////////////////////////////////
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
135
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
136
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
137 #ifdef DEBUG
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
138
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
139 #define ASSERT(e) \
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
140 do { if( ! (e) ) { ++errors; printf("FAIL at %3d: %s \n", __LINE__, #e); errorflag = 1;} } while(0)
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
141
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
142 #define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max)
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
143
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 591
diff changeset
144 #if DEBUG_STLINK_V2
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
145 extern void initialise_monitor_handles(void);
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 591
diff changeset
146 #endif
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
147
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
148 static int errors = 0;
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
149 static uint8_t errorflag = 0;
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
150
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
151 int main(void)
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
152 {
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
153 #if DEBUG_STLINK_V2
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
154 initialise_monitor_handles();
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
155 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
156 //---- Check the linker puts the directory at the requested address ------
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
157 ASSERT( & Awe48 == (tFont*)0x81DFE00 );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
158 ASSERT( & FontT24 == (tFont*)0x81DFE0c );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
159 ASSERT( & FontT42 == (tFont*)0x81DFE18 );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
160 ASSERT( & FontT48 == (tFont*)0x81DFE24 );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
161 ASSERT( & FontT54 == (tFont*)0x81DFE30 );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
162 ASSERT( & FontT84 == (tFont*)0x81DFE3c );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
163 ASSERT( & FontT105 == (tFont*)0x81DFE48 );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
164 ASSERT( & FontT144 == (tFont*)0x81DFE54 );
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
165
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
166 //---- Check the linker puts the font data in the requested section ------
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
167 extern tChar __upper_font_data;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
168 extern tChar __upper_font_data_end;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
169 ASSERT( &__upper_font_data == (tChar*)0x08132040 );
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
170 ASSERT_RANGE( (int)&__upper_font_data_end, 0x08132040, 0x081E0000);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
171
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
172 //---- Walk through the directory data -----------------------------------
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
173 extern const tFont __font_directory;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
174 extern const tFont __font_directory_end;
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
175
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
176 ASSERT_RANGE(&ImgOSTC, (tImage*)&__upper_font_data, (tImage*)&__upper_font_data_end);
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
177
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
178 for(const tFont* font = & __font_directory; font < &__font_directory_end; ++font)
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
179 {
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 591
diff changeset
180 printf("Font: %x\n",(unsigned int)font);
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
181 // Check END-OF-DIRECTORY magic marker
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
182 if( font->length == (uint32_t)-1 )
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
183 {
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
184 ASSERT( font == &FontT144 + 1 );
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
185 break;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
186 }
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
187
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
188 // Check font descriptors are inside a safe range.
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
189 ASSERT_RANGE( font->length, 10, 150 ); /* old 103: some fonts meanwhile contain more charactes */
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
190 ASSERT_RANGE( font->spacesize, 0, 28 ); /* old 18 : Awe40 has some size 28 characters */
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
191 ASSERT_RANGE( font->spacesize2Monospaced, 13, 72 );
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
192 ASSERT_RANGE( font->height, 28, 108 );
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
193
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
194 //---- Walk through each char ----------------------------------------
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
195 for(int i = 0; i < font->length; ++i)
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
196 {
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
197 const tChar* c = &font->chars[i];
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
198
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
199 // Check char data is indeed stored in the actual data section
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
200 ASSERT_RANGE( c, &__upper_font_data, &__upper_font_data_end);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
201
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
202 // Check char data sanity
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
203 ASSERT_RANGE( c->code, 0x0000, 0xF143);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
204
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
205 // Check image sanity
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
206 const tImage* image = c->image;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
207 ASSERT_RANGE(image, (tImage*)&__upper_font_data, (tImage*)&__upper_font_data_end);
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
208 #if 0 /* common failure: root cause not clear */
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
209 ASSERT_RANGE(image->width, font->spacesize, font->spacesize2Monospaced);
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
210 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
211 ASSERT(image->height == font->height);
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
212 if(errorflag)
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
213 {
699
01f40cb1057e Cleanup warnings:
Ideenmodellierer
parents: 591
diff changeset
214 printf("image %x: h=%d fonth=%d\n",(unsigned int)image,image->height,font->height);
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
215 errorflag = 0;
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
216 }
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
217 // Uncompress image bytes
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
218 const uint8_t* byte = image->data;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
219 ASSERT_RANGE(byte, (uint8_t*)&__upper_font_data, (uint8_t*)&__upper_font_data_end);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
220
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
221 for(int w=0; w <image->width; ++w)
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
222 {
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
223 // Compression: special 0x01 byte at start of column means just skip it.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
224 if( *byte++ == 0x01 )
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
225 continue;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
226
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
227 int zeros = (byte[-1] == 0x00) ? 1 : 0;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
228 for(int h = 1; h < image->height; ++h)
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
229 {
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
230 if( *byte == 0x00 )
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
231 ++zeros;
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
232 #if 0 /* this rule is violated very often but does not seems to have an impact */
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
233 // Other bytes cannot have the 0x01 value...
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
234 ASSERT( *byte++ != 0x01 );
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
235 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
236 }
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
237 #if 0 /* just an information, not an error => activate if interested */
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
238 if( zeros == image->height )
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
239 printf("Font[%d] char[%d]: could skip column %d \n",
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
240 &__font_directory - font, i, w);
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
241 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
242 }
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
243
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
244 #if 0 /* byte usually pints to the next char ==> not sure what the check is about */
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
245 // Check the byte stream do not collide with the next char,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
246 // or with the first tImage struct of the font.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
247 if( (i+1) < font->length )
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
248 ASSERT( byte < font->chars[i+1].image->data );
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
249 else
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
250 ASSERT( byte < (uint8_t*)font->chars[0].image );
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
251
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
252 // TODO: check image bytes are contiguous between chars.
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
253 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
254 }
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
255 }
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
256
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
257 if( errors )
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
258 {
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
259 printf("Font Check: %d errors.\n", errors);
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
260 return -1;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
261 }
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
262
76
51e2734895a3 Update Fontpack code to support font moved to upper memory
Ideenmodellierer
parents: 36
diff changeset
263 printf("Font Check: no errors.\n");
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
264 return 0;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
265 }
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
266 /*#endif*/
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
267 #else
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
268 #define ASSERT(e) \
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
269 do { if( ! (e) ) { ++errors; errorflag = 1;} } while(0)
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
270
123
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
271 #define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max)
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
272
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
273 uint16_t errors = 1;
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
274 static uint8_t errorflag = 0;
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
275 uint16_t CheckFontPosition()
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
276 {
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
277 uint16_t retvalue;
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
278 ASSERT( & Awe48 == (tFont*)0x81DFE00 );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
279 ASSERT( & FontT24 == (tFont*)0x81DFE0c );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
280 ASSERT( & FontT42 == (tFont*)0x81DFE18 );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
281 ASSERT( & FontT48 == (tFont*)0x81DFE24 );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
282 ASSERT( & FontT54 == (tFont*)0x81DFE30 );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
283 ASSERT( & FontT84 == (tFont*)0x81DFE3c );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
284 ASSERT( & FontT105 == (tFont*)0x81DFE48 );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
285 ASSERT( & FontT144 == (tFont*)0x81DFE54 );
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
286 retvalue = errors;
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
287 return retvalue;
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
288 }
a984d87a1ec0 Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
Ideenmodellierer
parents: 76
diff changeset
289 #endif
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
290 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/