summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/file_internal.c3
-rw-r--r--firmware/common/unicode.c28
2 files changed, 25 insertions, 6 deletions
diff --git a/firmware/common/file_internal.c b/firmware/common/file_internal.c
index ebe77f0c9f..e5b43cd19d 100644
--- a/firmware/common/file_internal.c
+++ b/firmware/common/file_internal.c
@@ -36,7 +36,8 @@
36 36
37/* for internal functions' scanning use to save quite a bit of stack space - 37/* for internal functions' scanning use to save quite a bit of stack space -
38 access must be serialized by the writer lock */ 38 access must be serialized by the writer lock */
39#if defined(CPU_SH) || defined(IAUDIO_M5) 39#if defined(CPU_SH) || defined(IAUDIO_M5) \
40 || CONFIG_CPU == IMX233
40/* otherwise, out of IRAM */ 41/* otherwise, out of IRAM */
41struct fat_direntry dir_fatent; 42struct fat_direntry dir_fatent;
42#else 43#else
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index 954ad47e1d..8988686b70 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -54,6 +54,7 @@
54#else /* APPLICATION */ 54#else /* APPLICATION */
55#ifdef __PCTOOL__ 55#ifdef __PCTOOL__
56#define yield() 56#define yield()
57#define DEFAULT_CP_STATIC_ALLOC
57#endif 58#endif
58#define open_noiso_internal open 59#define open_noiso_internal open
59#endif /* !APPLICATION */ 60#endif /* !APPLICATION */
@@ -182,6 +183,23 @@ const char *get_current_codepage_name_linux(void)
182} 183}
183#endif /* defined(APPLICATION) && defined(__linux__) */ 184#endif /* defined(APPLICATION) && defined(__linux__) */
184 185
186#ifdef DEFAULT_CP_STATIC_ALLOC
187static unsigned short default_cp_table_buf[MAX_CP_TABLE_SIZE+1];
188#define cp_table_get_data(handle) \
189 default_cp_table_buf
190#define cp_table_free(handle) \
191 do {} while (0)
192#define cp_table_alloc(filename, size, opsp) \
193 ({ (void)(opsp); 1; })
194#else
195#define cp_table_alloc(filename, size, opsp) \
196 core_alloc_ex((filename), (size), (opsp))
197#define cp_table_free(handle) \
198 core_free(handle)
199#define cp_table_get_data(handle) \
200 core_get_data(handle)
201#endif
202
185static const unsigned char utf8comp[6] = 203static const unsigned char utf8comp[6] =
186{ 204{
187 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC 205 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
@@ -233,9 +251,9 @@ static int alloc_and_load_cp_table(int cp, void *buf)
233 !(size % (off_t)sizeof (uint16_t))) { 251 !(size % (off_t)sizeof (uint16_t))) {
234 252
235 /* if the buffer is provided, use that but don't alloc */ 253 /* if the buffer is provided, use that but don't alloc */
236 int handle = buf ? 0 : core_alloc_ex(filename, size, &ops); 254 int handle = buf ? 0 : cp_table_alloc(filename, size, &ops);
237 if (handle > 0) 255 if (handle > 0)
238 buf = core_get_data(handle); 256 buf = cp_table_get_data(handle);
239 257
240 if (buf && read(fd, buf, size) == size) { 258 if (buf && read(fd, buf, size) == size) {
241 close(fd); 259 close(fd);
@@ -244,7 +262,7 @@ static int alloc_and_load_cp_table(int cp, void *buf)
244 } 262 }
245 263
246 if (handle > 0) 264 if (handle > 0)
247 core_free(handle); 265 cp_table_free(handle);
248 } 266 }
249 267
250 close(fd); 268 close(fd);
@@ -284,7 +302,7 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8,
284 if (tid == default_cp_tid) { 302 if (tid == default_cp_tid) {
285 /* use default table */ 303 /* use default table */
286 if (default_cp_handle > 0) { 304 if (default_cp_handle > 0) {
287 table = core_get_data(default_cp_handle); 305 table = cp_table_get_data(default_cp_handle);
288 default_cp_table_ref++; 306 default_cp_table_ref++;
289 } 307 }
290 308
@@ -564,7 +582,7 @@ void set_codepage(int cp)
564 cp_lock_leave(); 582 cp_lock_leave();
565 583
566 if (handle > 0) 584 if (handle > 0)
567 core_free(handle); 585 cp_table_free(handle);
568} 586}
569 587
570int get_codepage(void) 588int get_codepage(void)