summaryrefslogtreecommitdiffstats
path: root/src/lib/util/jedparse.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
commitddb290d5f615019c33c42b8d94e5a5254cabcf33 (patch)
treea70f688b0df3acd19da7b1151e5902e3c6af3fa5 /src/lib/util/jedparse.cpp
parent333bff8de64dfaeb98134000412796b4fdef970b (diff)
NOTICE (TYPE NAME CONSOLIDATION)
Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
Diffstat (limited to 'src/lib/util/jedparse.cpp')
-rw-r--r--src/lib/util/jedparse.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/lib/util/jedparse.cpp b/src/lib/util/jedparse.cpp
index 9bed1164303..c2c9a139a6a 100644
--- a/src/lib/util/jedparse.cpp
+++ b/src/lib/util/jedparse.cpp
@@ -38,8 +38,8 @@
struct jed_parse_info
{
- UINT16 checksum; /* checksum value */
- UINT32 explicit_numfuses; /* explicitly specified number of fuses */
+ uint16_t checksum; /* checksum value */
+ uint32_t explicit_numfuses; /* explicitly specified number of fuses */
};
@@ -86,10 +86,10 @@ static int isdelim(char c)
character stream
-------------------------------------------------*/
-static UINT32 suck_number(const UINT8 **psrc)
+static uint32_t suck_number(const uint8_t **psrc)
{
- const UINT8 *src = *psrc;
- UINT32 value = 0;
+ const uint8_t *src = *psrc;
+ uint32_t value = 0;
/* skip delimiters */
while (isdelim(*src))
@@ -117,7 +117,7 @@ static UINT32 suck_number(const UINT8 **psrc)
process_field - process a single JEDEC field
-------------------------------------------------*/
-static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srcend, jed_parse_info *pinfo)
+static void process_field(jed_data *data, const uint8_t *cursrc, const uint8_t *srcend, jed_parse_info *pinfo)
{
/* switch off of the field type */
switch (*cursrc)
@@ -147,7 +147,7 @@ static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srce
/* fuse states */
case 'L':
{
- UINT32 curfuse;
+ uint32_t curfuse;
/* read the fuse number */
cursrc++;
@@ -189,11 +189,11 @@ static void process_field(jed_data *data, const UINT8 *cursrc, const UINT8 *srce
int jed_parse(const void *data, size_t length, jed_data *result)
{
- const UINT8 *cursrc = (const UINT8 *)data;
- const UINT8 *srcend = cursrc + length;
- const UINT8 *scan;
+ const uint8_t *cursrc = (const uint8_t *)data;
+ const uint8_t *srcend = cursrc + length;
+ const uint8_t *scan;
jed_parse_info pinfo;
- UINT16 checksum;
+ uint16_t checksum;
int i;
/* initialize the output and the intermediate info struct */
@@ -218,7 +218,7 @@ int jed_parse(const void *data, size_t length, jed_data *result)
checksum += *scan;
if (scan + 4 < srcend && ishex(scan[1]) && ishex(scan[2]) && ishex(scan[3]) && ishex(scan[4]))
{
- UINT16 dessum = (hexval(scan[1]) << 12) | (hexval(scan[2]) << 8) | (hexval(scan[3]) << 4) | hexval(scan[4] << 0);
+ uint16_t dessum = (hexval(scan[1]) << 12) | (hexval(scan[2]) << 8) | (hexval(scan[3]) << 4) | hexval(scan[4] << 0);
if (dessum != 0 && dessum != checksum)
return JEDERR_BAD_XMIT_SUM;
}
@@ -283,13 +283,13 @@ int jed_parse(const void *data, size_t length, jed_data *result)
size_t jed_output(const jed_data *data, void *result, size_t length)
{
- UINT8 *curdst = (UINT8 *)result;
- UINT8 *dstend = curdst + length;
+ uint8_t *curdst = (uint8_t *)result;
+ uint8_t *dstend = curdst + length;
int i, zeros, ones;
char tempbuf[256];
- UINT16 checksum;
- UINT8 defbyte;
- UINT8 *temp;
+ uint16_t checksum;
+ uint8_t defbyte;
+ uint8_t *temp;
/* always start the DST with a standard header and an STX */
tempbuf[0] = 0x02;
@@ -355,7 +355,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
/* now compute the transmission checksum */
checksum = 0;
- for (temp = (UINT8 *)result; temp < curdst && temp < dstend; temp++)
+ for (temp = (uint8_t *)result; temp < curdst && temp < dstend; temp++)
checksum += *temp & 0x7f;
checksum += 0x03;
@@ -367,7 +367,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
curdst += strlen(tempbuf);
/* return the final size */
- return curdst - (UINT8 *)result;
+ return curdst - (uint8_t *)result;
}
@@ -379,7 +379,7 @@ size_t jed_output(const jed_data *data, void *result, size_t length)
int jedbin_parse(const void *data, size_t length, jed_data *result)
{
- const UINT8 *cursrc = (const UINT8 *)data;
+ const uint8_t *cursrc = (const uint8_t *)data;
/* initialize the output */
memset(result, 0, sizeof(*result));
@@ -424,7 +424,7 @@ int jedbin_parse(const void *data, size_t length, jed_data *result)
size_t jedbin_output(const jed_data *data, void *result, size_t length)
{
- UINT8 *curdst = (UINT8 *)result;
+ uint8_t *curdst = (uint8_t *)result;
/* ensure we have enough room */
if (length >= 4 + (data->numfuses + 7) / 8)