Vybhav Kadaba
/
EV-PRO-MW1001_Development_v11570
Mbed FW update
Revision 61:0f16a2e3b58b, committed 2020-03-31
- Comitter:
- Vkadaba
- Date:
- Tue Mar 31 04:50:37 2020 +0000
- Parent:
- 60:363fffe5bd22
- Commit message:
- removed crc support for LUT
Changed in this revision
--- a/inc/admw1001/admw1001_config.h Mon Mar 16 09:54:36 2020 +0000 +++ b/inc/admw1001/admw1001_config.h Tue Mar 31 04:50:37 2020 +0000 @@ -271,12 +271,10 @@ { ADMW1001_ADC_REFERENCE_VOLTAGE_INTERNAL = 0, /*!< Internal VRef - 1.2V */ - ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_1, + ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_1 = 1, /*!< External reference voltage #1 */ - ADMW1001_ADC_REFERENCE_VOLTAGE_EXTERNAL_2, - /*!< External reference voltage #2 */ - ADMW1001_ADC_REFERENCE_VOLTAGE_AVDD, - /*!< Analag Supply Voltage AVDD reference (typically 3.3V) is selected */ + ADMW1001_ADC_REFERENCE_VOLTAGE_AVDD = 3, + /*!< Analog Supply Voltage AVDD reference (typically 3.3V) is selected */ } ADMW1001_ADC_REFERENCE_TYPE;
--- a/inc/admw1001/admw1001_lut_data.h Mon Mar 16 09:54:36 2020 +0000 +++ b/inc/admw1001/admw1001_lut_data.h Tue Mar 31 04:50:37 2020 +0000 @@ -273,9 +273,7 @@ uint16_t dataType : 4; /**< ADMW1001_LUT_DATA_TYPE */ uint16_t length; /**< Length (bytes) of table data section (excl. this header) */ - uint16_t crc16; /**< CRC-16-CCITT of the data */ }; - uint64_t value64; } ADMW1001_LUT_DESCRIPTOR; /*! Look-Up Table geometry-specific data structures */
--- a/lut_data.c Mon Mar 16 09:54:36 2020 +0000 +++ b/lut_data.c Tue Mar 31 04:50:37 2020 +0000 @@ -16,7 +16,6 @@ .sensor = ADMW1001_ADC_SENSOR_BRIDGE_4WIRE, .dataType = ADMW1001_LUT_DATA_TYPE_FLOAT32, .length = 0, /* Filled by admw_1001_AssembleLutData() */ - .crc16 = 0 /* Filled by admw_1001_AssembleLutData() */ }; ADMW1001_LUT_1D_NES bridge_4wire_1_range1_data = { .nElements = 2,
--- a/main.cpp Mon Mar 16 09:54:36 2020 +0000 +++ b/main.cpp Tue Mar 31 04:50:37 2020 +0000 @@ -65,7 +65,7 @@ extern ADMW_CONFIG measureware_config; /* Change the following pointer to load or change the configurations */ -static ADMW_CONFIG *pSelectedConfig = &multichannel_continuous_config; +static ADMW_CONFIG *pSelectedConfig = &thermocouple_typeK_cjc0_config; /* use the following to load LUT */ extern ADMW1001_LUT_DESCRIPTOR *lut_desc_list[];
--- a/src/admw_1001.c Mon Mar 16 09:54:36 2020 +0000 +++ b/src/admw_1001.c Tue Mar 31 04:50:37 2020 +0000 @@ -2355,7 +2355,8 @@ ADMW1001_LUT_HEADER *pHdr = &pLutBuffer->header; uint8_t *pLutTableData = (uint8_t *)pLutBuffer + sizeof(*pHdr); - if (sizeof(*pHdr) > nLutBufferSize) { + if (sizeof(*pHdr) > nLutBufferSize) + { ADMW_LOG_ERROR("Insufficient LUT buffer size provided"); return ADMW_INVALID_PARAM; } @@ -2371,7 +2372,8 @@ * Walk through the list of table pointers provided, appending the table * descriptor+data from each one to the provided LUT buffer */ - for (unsigned i = 0; i < nNumTables; i++) { + for (unsigned i = 0; i < nNumTables; i++) + { ADMW1001_LUT_DESCRIPTOR * const pDesc = ppDesc[i]; ADMW1001_LUT_TABLE_DATA * const pData = ppData[i]; ADMW_RESULT res; @@ -2384,9 +2386,9 @@ /* Fill in the table descriptor length and CRC fields */ pDesc->length = dataLength; - pDesc->crc16 = admw_crc16_ccitt(pData, dataLength); - if ((sizeof(*pHdr) + pHdr->totalLength + sizeof(*pDesc) + dataLength) > nLutBufferSize) { + if ((sizeof(*pHdr) + pHdr->totalLength + sizeof(*pDesc) + dataLength) > nLutBufferSize) + { ADMW_LOG_ERROR("Insufficient LUT buffer size provided"); return ADMW_INVALID_PARAM; } @@ -2406,66 +2408,64 @@ ADMW_DEVICE_HANDLE const hDevice, ADMW1001_LUT * const pLutData) { +#pragma diag_suppress=Pa039 ADMW1001_LUT_HEADER *pLutHeader = &pLutData->header; ADMW1001_LUT_TABLE *pLutTable = pLutData->tables; unsigned actualLength = 0; - if (pLutData->header.signature != ADMW_LUT_SIGNATURE) { + if (pLutData->header.signature != ADMW_LUT_SIGNATURE) + { ADMW_LOG_ERROR("LUT signature incorrect (expected 0x%X, actual 0x%X)", - ADMW_LUT_SIGNATURE, pLutHeader->signature); + ADMW_LUT_SIGNATURE, pLutHeader->signature); return ADMW_INVALID_SIGNATURE; } if ((pLutData->tables->descriptor.geometry!= ADMW1001_LUT_GEOMETRY_NES_1D) && - (pLutData->tables->data.lut1dNes.nElements > MAX_LUT_NUM_ENTRIES)) { + (pLutData->tables->data.lut1dNes.nElements > MAX_LUT_NUM_ENTRIES)) + { return ADMW_INVALID_PARAM; } - - for (unsigned i = 0; i < pLutHeader->numTables; i++) { + for (unsigned i = 0; i < pLutHeader->numTables; i++) + { ADMW1001_LUT_DESCRIPTOR *pDesc = &pLutTable->descriptor; - ADMW1001_LUT_TABLE_DATA *pData = &pLutTable->data; - unsigned short calculatedCrc; - switch (pDesc->geometry) { - case ADMW1001_LUT_GEOMETRY_COEFFS: - switch (pDesc->equation) { - case ADMW1001_LUT_EQUATION_POLYN: - case ADMW1001_LUT_EQUATION_POLYNEXP: - case ADMW1001_LUT_EQUATION_QUADRATIC: - case ADMW1001_LUT_EQUATION_STEINHART: - case ADMW1001_LUT_EQUATION_LOGARITHMIC: - case ADMW1001_LUT_EQUATION_BIVARIATE_POLYN: - break; - default: - ADMW_LOG_ERROR("Invalid equation %u specified for LUT table %u", - pDesc->equation, i); - return ADMW_INVALID_PARAM; + switch (pDesc->geometry) + { + case ADMW1001_LUT_GEOMETRY_COEFFS: + switch (pDesc->equation) + { + case ADMW1001_LUT_EQUATION_POLYN: + case ADMW1001_LUT_EQUATION_POLYNEXP: + case ADMW1001_LUT_EQUATION_QUADRATIC: + case ADMW1001_LUT_EQUATION_STEINHART: + case ADMW1001_LUT_EQUATION_LOGARITHMIC: + case ADMW1001_LUT_EQUATION_BIVARIATE_POLYN: + break; + default: + ADMW_LOG_ERROR("Invalid equation %u specified for LUT table %u", + pDesc->equation, i); + return ADMW_INVALID_PARAM; } - break; - case ADMW1001_LUT_GEOMETRY_NES_1D: - break; - default: - ADMW_LOG_ERROR("Invalid geometry %u specified for LUT table %u", - pDesc->geometry, i); - return ADMW_INVALID_PARAM; + break; + case ADMW1001_LUT_GEOMETRY_NES_1D: + break; + default: + ADMW_LOG_ERROR("Invalid geometry %u specified for LUT table %u", + pDesc->geometry, i); + return ADMW_INVALID_PARAM; } - switch (pDesc->dataType) { - case ADMW1001_LUT_DATA_TYPE_FLOAT32: - case ADMW1001_LUT_DATA_TYPE_FLOAT64: - break; - default: - ADMW_LOG_ERROR("Invalid vector format %u specified for LUT table %u", - pDesc->dataType, i); - return ADMW_INVALID_PARAM; + switch (pDesc->dataType) + { + case ADMW1001_LUT_DATA_TYPE_FLOAT32: + case ADMW1001_LUT_DATA_TYPE_FLOAT64: + break; + default: + ADMW_LOG_ERROR("Invalid vector format %u specified for LUT table %u", + pDesc->dataType, i); + return ADMW_INVALID_PARAM; } - calculatedCrc = admw_crc16_ccitt(pData, pDesc->length); - if (calculatedCrc != pDesc->crc16) { - ADMW_LOG_ERROR("CRC validation failed on LUT table %u (expected 0x%04X, actual 0x%04X)", - i, pDesc->crc16, calculatedCrc); - return ADMW_CRC_ERROR; - } actualLength += sizeof(*pDesc) + pDesc->length; @@ -2473,15 +2473,17 @@ pLutTable = (ADMW1001_LUT_TABLE *)((uint8_t *)pLutTable + sizeof(*pDesc) + pDesc->length); } - if (actualLength != pLutHeader->totalLength) { + if (actualLength != pLutHeader->totalLength) + { ADMW_LOG_ERROR("LUT table length mismatch (expected %u, actual %u)", - pLutHeader->totalLength, actualLength); + pLutHeader->totalLength, actualLength); return ADMW_WRONG_SIZE; } - if (sizeof(*pLutHeader) + pLutHeader->totalLength > ADMW_LUT_MAX_SIZE) { + if (sizeof(*pLutHeader) + pLutHeader->totalLength > ADMW_LUT_MAX_SIZE) + { ADMW_LOG_ERROR("Maximum LUT table length (%u bytes) exceeded", - ADMW_LUT_MAX_SIZE); + ADMW_LUT_MAX_SIZE); return ADMW_WRONG_SIZE; }