FreeCalypso > hg > freecalypso-tools
view uptools/libcoding/gsm7_encode.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 | 061f8d75083d |
children | ec7e23d5151f |
line wrap: on
line source
/* * This library module implements the function for encoding from ISO 8859-1 * into the GSM 7-bit default alphabet (03.38 or 23.038). */ #include <sys/types.h> extern u_char gsm7_encode_table[256]; latin1_to_gsm7(inbuf, outbuf, outmax, outlenp) u_char *inbuf, *outbuf; unsigned outmax, *outlenp; { u_char *ip = inbuf, *op = outbuf; unsigned outcnt = 0, c, n; while (c = *ip++) { c = gsm7_encode_table[c]; if (c == 0xFF) return(-1); if (c & 0x80) n = 2; else n = 1; if (outcnt + n > outmax) return(-2); if (c & 0x80) { *op++ = 0x1B; *op++ = c & 0x7F; } else *op++ = c; outcnt += n; } *outlenp = outcnt; return(0); }