FreeCalypso > hg > freecalypso-tools
view uptools/libcoding/decode_helpers.c @ 505:7bf0d909c87e
fc-loadtool flash ID check: change of reset after the check logic
This change only affects those flash configurations that have ID checks
enabled. The logic for resetting the flash after the ID check has been
changed as follows:
1) If the check fails, we return without attempting to reset the flash.
2) If the check is successful, we reset the flash using the configured
method (could be AMD or Intel or Intel W30) instead of always doing an
AMD flash reset as the original code did.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Mon, 27 May 2019 19:58:01 +0000 |
| parents | 978571e23318 |
| children | 1c599681fd60 |
line wrap: on
line source
/* * This library module implements the is_decoded_char_ok() and emit_utf8_char() * functions used by gsm7_to_ascii_or_ext() and ucs2_to_ascii_or_ext(). */ #include <sys/types.h> is_decoded_char_ok(uni, ascii_ext) unsigned uni; { unsigned upper_limit; /* weed out control chars first */ if (uni < 0x20) return(0); if (uni >= 0x7F && uni <= 0x9F) return(0); /* see what range our output encoding allows */ switch (ascii_ext) { case 0: upper_limit = 0x7F; break; case 1: upper_limit = 0xFF; break; case 2: upper_limit = 0xFFFF; break; default: upper_limit = 0; } if (uni <= upper_limit) return(1); else return(0); } emit_utf8_char(uni, outp) unsigned uni; u_char *outp; { if (uni < 0x80) { *outp = uni; return(1); } if (uni < 0x800) { outp[0] = 0xC0 | (uni >> 6); outp[1] = 0x80 | (uni & 0x3F); return(2); } outp[0] = 0xE0 | (uni >> 12); outp[1] = 0x80 | ((uni >> 6) & 0x3F); outp[2] = 0x80 | (uni & 0x3F); return(3); }
