Добавить идентификацию прошивки и чтение EEPROM Бальзам-167

This commit is contained in:
2026-10-05 17:48:23 +03:00
parent 0e3d89e1ee
commit 90046de7fd
28 changed files with 924 additions and 22 deletions
+5
View File
@@ -12,6 +12,11 @@ unsigned ump_validate(unsigned fn, uint16_t a, uint16_t n, int can)
{
if (fn == 6) return a >= UMP_BASE && a <= UMP_BASE+3 ? 0 : 2;
if (fn != 3) return 1;
/* CAN reads the whole immutable block (six fragments); RTU may read slices.
* Check subtraction only after the lower bound, avoiding uint16 wraparound. */
if (a >= UMP_FIRMWARE_INFO && a < UMP_FIRMWARE_INFO + UMP_FIRMWARE_INFO_WORDS)
return can ? ((a == UMP_FIRMWARE_INFO && n == UMP_FIRMWARE_INFO_WORDS) ? 0 : 2)
: ((n && n <= UMP_FIRMWARE_INFO + UMP_FIRMWARE_INFO_WORDS - a) ? 0 : 2);
if (can) return ((a == UMP_BASE && n == 16) ||
(a == UMP_DATA && (n == 40 || n == 80 || n == 120 || n == 42 || n == 84)) ||
(a == UMP_LIVE && n == 124)) ? 0 : 2;