FreeCalypso > hg > fc-usbser-tools
view cp2102/decode_baudtab.c @ 105:1e820ed0904e
Installed-binaries: list of binaries installed by this package
I am establishing a new convention for all FreeCalypso tools, across
different packages and source repositories: each FC tools package
will have a file name Installed-binaries listing all user-invokable
binaries that package installs in /opt/freecalypso/bin. These files
are to serve as an aid to users and distro package maintainers who
prefer to not add /opt/freecalypso/bin to their PATH. The alternative
to adding this directory to PATH is to create a symlink for every
installed binary in some standard location such as /usr/bin or
/usr/local/bin, pointing to the actual binary in /opt/freecalypso/bin;
having a list of all FC-installed binaries in a standardized format
will allow this process to be automated.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 29 Sep 2023 19:42:53 +0000 |
| parents | 672c7adc8bc9 |
| children |
line wrap: on
line source
/* * The function implemented in this module decodes the baud rate table * contained in the captured CP2102 EEPROM image. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include "cp210x_defs.h" extern u_char eeprom[SIZE_EEPROM]; void decode_baud_table(outf) FILE *outf; { unsigned entry; u_char *dp; unsigned baudrate, baudgen, timegen, prescaler, sparebyte; unsigned baud_div, calc_baud, time_us; dp = eeprom; for (entry = 0; entry < SIZE_BAUDRATES; entry++) { baudgen = (dp[0] << 8) | dp[1]; timegen = (dp[2] << 8) | dp[3]; prescaler = dp[4]; sparebyte = dp[5]; baudrate = dp[6] | (dp[7] << 8) | (dp[8] << 16) | (dp[9] << 24); dp += SIZE_BAUDRATE_CFG; fprintf(outf, "baud-entry %2u: %7u = %04X, %04X, %u, %u", entry, baudrate, baudgen, timegen, prescaler, sparebyte); if (prescaler) { baud_div = (0x10000 - baudgen) * prescaler; calc_baud = 24000000 / baud_div; fprintf(outf, "\t# %u baud, ", calc_baud); time_us = (0x10000 - timegen) * 2; if (time_us >= 1000) fprintf(outf, "%u.%03u ms", time_us / 1000, time_us % 1000); else fprintf(outf, "%u us", time_us); } putc('\n', outf); } }
