|
@@ -69,6 +69,19 @@ uint8_t lang_select(uint8_t lang)
|
|
|
}
|
|
|
}
|
|
|
#else
|
|
|
+ if (lang == LANG_ID_SEC)
|
|
|
+ {
|
|
|
+ uint16_t table = _SEC_LANG_TABLE;
|
|
|
+ if (pgm_read_dword(((uint32_t*)table)) == LANG_MAGIC)
|
|
|
+ {
|
|
|
+ if (lang_check(table))
|
|
|
+ if (pgm_read_dword(((uint32_t*)(table + 12))) == pgm_read_dword(((uint32_t*)(_PRI_LANG_SIGNATURE))))
|
|
|
+ {
|
|
|
+ lang_table = table;
|
|
|
+ lang_selected = lang;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
#endif
|
|
|
if (lang_selected == lang)
|
|
|
{
|
|
@@ -92,9 +105,9 @@ uint8_t lang_check(uint16_t addr)
|
|
|
|
|
|
uint8_t lang_get_count()
|
|
|
{
|
|
|
-#ifdef W25X20CL
|
|
|
if (pgm_read_dword(((uint32_t*)(_PRI_LANG_SIGNATURE))) == 0xffffffff)
|
|
|
return 1;
|
|
|
+#ifdef W25X20CL
|
|
|
W25X20CL_SPI_ENTER();
|
|
|
uint8_t count = 2;
|
|
|
uint32_t addr = 0x00000;
|
|
@@ -106,9 +119,16 @@ uint8_t lang_get_count()
|
|
|
addr += header.size;
|
|
|
count++;
|
|
|
}
|
|
|
- return count;
|
|
|
#else
|
|
|
+ uint16_t table = _SEC_LANG_TABLE;
|
|
|
+ uint8_t count = 1;
|
|
|
+ while (pgm_read_dword(((uint32_t*)table)) == LANG_MAGIC)
|
|
|
+ {
|
|
|
+ table += pgm_read_word((uint16_t*)(table + 4));
|
|
|
+ count++;
|
|
|
+ }
|
|
|
#endif
|
|
|
+ return count;
|
|
|
}
|
|
|
|
|
|
uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* offset)
|
|
@@ -135,6 +155,13 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off
|
|
|
}
|
|
|
return 0;
|
|
|
#else
|
|
|
+ if (lang == LANG_ID_SEC)
|
|
|
+ {
|
|
|
+ uint16_t ui = _SEC_LANG_TABLE;
|
|
|
+ memcpy_P(header, ui, sizeof(lang_table_header_t));
|
|
|
+ if (offset) *offset = ui;
|
|
|
+ return (header->magic == LANG_MAGIC)?1:0;
|
|
|
+ }
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -160,14 +187,13 @@ uint16_t lang_get_code(uint8_t lang)
|
|
|
addr += header.size;
|
|
|
}
|
|
|
#else
|
|
|
+ if (lang == LANG_ID_SEC)
|
|
|
+ {
|
|
|
+ uint16_t ui = _SEC_LANG_TABLE;
|
|
|
+ if (pgm_read_dword(((uint32_t*)(ui + 0))) == LANG_MAGIC)
|
|
|
+ return pgm_read_word(((uint16_t*)(ui + 10)));
|
|
|
+ }
|
|
|
#endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return LANG_CODE_XX;
|
|
|
}
|
|
|
|