Skip to content

Commit 8f173db

Browse files
committed
Update HAL CRC API
* Change "is supported" check to be a macro, so it can be done at compile-time. * Eliminate weird shift on 7-bit CRCs. * Add support for 32-bit CRCs and reversals to TMPM3HQ.
1 parent b0751bf commit 8f173db

File tree

19 files changed

+110
-208
lines changed

19 files changed

+110
-208
lines changed

TESTS/mbed_hal/crc/main.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void crc_is_supported_test()
5454
uint32_t num_of_supported_polynomials = 0;
5555

5656
for (unsigned int i = 0; i < (test_cases_size / sizeof(TEST_CASE)); i++) {
57-
if (hal_crc_is_supported(&test_cases[i].config_data) == true) {
57+
if (HAL_CRC_IS_SUPPORTED(test_cases[i].config_data.polynomial, test_cases[i].config_data.width)) {
5858

5959
num_of_supported_polynomials++;
6060
}
@@ -68,7 +68,7 @@ void crc_is_supported_test()
6868
void crc_calc_single_test()
6969
{
7070
for (unsigned int i = 0; i < (test_cases_size / sizeof(TEST_CASE)); i++) {
71-
if (hal_crc_is_supported(&test_cases[i].config_data) == true) {
71+
if (HAL_CRC_IS_SUPPORTED(test_cases[i].config_data.polynomial, test_cases[i].config_data.width)) {
7272

7373
hal_crc_compute_partial_start(&test_cases[i].config_data);
7474
hal_crc_compute_partial((uint8_t *) input_data, strlen((const char *) input_data));
@@ -84,7 +84,7 @@ void crc_calc_single_test()
8484
void crc_calc_multi_test()
8585
{
8686
for (unsigned int i = 0; i < (test_cases_size / sizeof(TEST_CASE)); i++) {
87-
if (hal_crc_is_supported(&test_cases[i].config_data) == true) {
87+
if (HAL_CRC_IS_SUPPORTED(test_cases[i].config_data.polynomial, test_cases[i].config_data.width)) {
8888

8989
const uint32_t first_part_bytes = 3;
9090
const uint32_t second_part_bytes = 1;
@@ -117,7 +117,7 @@ void crc_reconfigure_test()
117117
for (unsigned int i = 0; i < (test_cases_size / sizeof(TEST_CASE)); i++) {
118118

119119
/* Find two supported polynomials if possible. */
120-
if (hal_crc_is_supported(&test_cases[i].config_data) == true) {
120+
if (HAL_CRC_IS_SUPPORTED(test_cases[i].config_data.polynomial, test_cases[i].config_data.width)) {
121121
if (pol_cnt == 0) {
122122
pol_idx[pol_cnt] = i;
123123
pol_cnt++;
@@ -159,7 +159,7 @@ void crc_compute_partial_invalid_param_test()
159159

160160
/* At least one polynomial must be supported. */
161161
for (unsigned int i = 0; i < (test_cases_size / sizeof(TEST_CASE)); i++) {
162-
if (hal_crc_is_supported(&test_cases[i].config_data) == true) {
162+
if (HAL_CRC_IS_SUPPORTED(test_cases[i].config_data.polynomial, test_cases[i].config_data.width)) {
163163

164164
hal_crc_compute_partial_start(&test_cases[i].config_data);
165165

@@ -180,19 +180,12 @@ void crc_compute_partial_invalid_param_test()
180180
}
181181
}
182182

183-
/* Test that hal_crc_is_supported() returns false if pointer to the config structure is undefined. */
184-
void crc_is_supported_invalid_param_test()
185-
{
186-
TEST_ASSERT_EQUAL(false, hal_crc_is_supported(NULL));
187-
}
188-
189183
Case cases[] = {
190184
Case("test: supported polynomials.", crc_is_supported_test),
191185
Case("test: CRC calculation - single input.", crc_calc_single_test),
192186
Case("test: CRC calculation - multi input.", crc_calc_multi_test),
193187
Case("test: re-configure without getting the result.", crc_reconfigure_test),
194188
Case("test: hal_crc_compute_partial() - invalid parameters.", crc_compute_partial_invalid_param_test),
195-
Case("test: hal_crc_is_supported() - invalid parameter.", crc_is_supported_invalid_param_test),
196189
};
197190

198191
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
@@ -208,12 +201,12 @@ int main()
208201
// *INDENT-OFF*
209202
TEST_CASE local_test_cases[] = {
210203
/* Predefined polynomials. */
211-
/* 00 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x00000000, false, false}, 0xEA },
212-
/* 01 */{ {POLY_7BIT_SD , 7, 0x0000007F, 0x00000000, false, false}, 0xA0 },
213-
/* 02 */{ {POLY_7BIT_SD , 7, 0x0000002B, 0x00000000, false, false}, 0x74 },
214-
/* 03 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x0000007F, false, false}, 0x95 },
215-
/* 04 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x0000002B, false, false}, 0xC1 },
216-
/* 05 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x00000000, true , false}, 0xA4 },
204+
/* 00 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x00000000, false, false}, 0x75 },
205+
/* 01 */{ {POLY_7BIT_SD , 7, 0x0000007F, 0x00000000, false, false}, 0x50 },
206+
/* 02 */{ {POLY_7BIT_SD , 7, 0x0000002B, 0x00000000, false, false}, 0x3A },
207+
/* 03 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x0000007F, false, false}, 0x0A },
208+
/* 04 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x0000002B, false, false}, 0x5E },
209+
/* 05 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x00000000, true , false}, 0x52 },
217210
/* 06 */{ {POLY_7BIT_SD , 7, 0x00000000, 0x00000000, false, true }, 0x57 },
218211

219212
/* 07 */{ {POLY_8BIT_CCITT , 8, 0x00000000, 0x00000000, false, false}, 0xF4 },

UNITTESTS/empty_baseline/unittest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ set(unittest-test-sources
4848
empty_baseline/empty_baseline.cpp
4949
)
5050

51-
set(DEVICE_FLAGS "-DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP")
51+
set(DEVICE_FLAGS "-DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP")
5252
set(CONF_FLAGS "-DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DMBED_CONF_DATAFLASH_SPI_FREQ=1 -DMBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS=0 -DMBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE=0 -DMBED_CONF_QSPIF_QSPI_FREQ=1 -DMBED_CONF_QSPIF_QSPI_MIN_READ_SIZE=1 -DMBED_CONF_QSPIF_QSPI_MIN_PROG_SIZE=1 -DMBED_LFS_READ_SIZE=64 -DMBED_LFS_PROG_SIZE=64 -DMBED_LFS_BLOCK_SIZE=512 -DMBED_LFS_LOOKAHEAD=512 -DFLASHIAP_APP_ROM_END_ADDR=0x80000 -DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE=1024 -DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS=0x80000 -DMBED_CONF_STORAGE_STORAGE_TYPE=default")
5353
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEVICE_FLAGS} ${CONF_FLAGS}")
5454
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DEVICE_FLAGS} ${CONF_FLAGS}")

hal/crc_api.h

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,15 @@
2828
* Different polynomial values supported
2929
*/
3030
typedef enum crc_polynomial {
31-
POLY_OTHER = 0, ///< Custom polynomial
31+
POLY_7BIT_SD = 0x09, ///< x7+x3+1
3232
POLY_8BIT_CCITT = 0x07, ///< x8+x2+x+1
33-
POLY_7BIT_SD = 0x9, ///< x7+x3+1
3433
POLY_16BIT_CCITT = 0x1021, ///< x16+x12+x5+1
3534
POLY_16BIT_IBM = 0x8005, ///< x16+x15+x2+1
36-
POLY_32BIT_ANSI = 0x04C11DB7, ///< x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1
37-
POLY_32BIT_REV_ANSI = 0xEDB88320 ///< x31+x30+x29+x27+x26+x24+x23+x21+x20+x19+x15+x9+x8+x5
35+
POLY_32BIT_ANSI = 0x04C11DB7 ///< x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1
3836
} crc_polynomial_t;
3937

4038
typedef struct crc_mbed_config {
41-
/** CRC Polynomial. Example polynomial: 0x21 = 0010_0011 = x^5+x+1 */
39+
/** CRC Polynomial. Example polynomial: x^8+x^5+x+1 -> width = 8, polynomial = 0010_0011 = 0x21 */
4240
uint32_t polynomial;
4341
/** CRC Bit Width */
4442
uint32_t width;
@@ -66,14 +64,12 @@ extern "C" {
6664
*
6765
* # Defined behaviour
6866
*
69-
* * Function hal_crc_is_supported() returns true if platform supports hardware
67+
* * Macro HAL_CRC_IS_SUPPORTED() evaluates true if platform supports hardware
7068
* CRC for the given polynomial/width - verified by test ::crc_is_supported_test.
71-
* * Function hal_crc_is_supported() returns false if platform does not support hardware
69+
* * Macro HAL_CRC_IS_SUPPORTED() evaluates false if platform does not support hardware
7270
* CRC for the given polynomial/width - verified by test ::crc_is_supported_test.
73-
* * Function hal_crc_is_supported() returns false if given pointer to configuration
74-
* structure is undefined (NULL) - verified by test ::crc_is_supported_invalid_param_test.
75-
* * If CRC module does not support one of the following settings: initial_xor, final_xor
76-
* reflect_in, reflect_out, then these operations should be handled by the driver
71+
* * If CRC module does not support any of the following settings: initial_xor, final_xor
72+
* reflect_in, reflect_out, then these operations must be handled by the driver
7773
* - Verified by test ::crc_calc_single_test.
7874
* * Platform which supports hardware CRC must be able to handle at least one of the predefined
7975
* polynomial/width configurations that can be constructed in the MbedCRC class: POLY_8BIT_CCITT,
@@ -109,6 +105,24 @@ extern "C" {
109105
*
110106
* # Potential bugs
111107
*
108+
* # Macros
109+
*
110+
* Platform support for particular CRC polynomials is indicated by the
111+
* macro HAL_CRC_IS_SUPPORTED(polynomial, width), which must be defined
112+
* in device.h, or a file included from there.
113+
*
114+
* The macro must evaluate to a constant boolean expression when given
115+
* constant parameters.
116+
*
117+
* The current platform must support the given polynomial with all possible
118+
* other config parameters if the macro evaluates to true. These are:
119+
* reflect in, reflect out, initial xor and final xor. If any of these settings
120+
* of these settings cannot be configured, the polynomial is not supported.
121+
*
122+
* Example:
123+
*
124+
* #define HAL_CRC_IS_SUPPORTED(polynomial, width) \
125+
* ((width) == 16 || ((width) == 32 && (polynomial) == POLY_32BIT_ANSI)
112126
* @{
113127
*/
114128

@@ -122,33 +136,6 @@ extern "C" {
122136
*
123137
*/
124138

125-
/** Determine if the current platform supports hardware CRC for given polynomial
126-
*
127-
* The purpose of this function is to inform the CRC Platform API whether the
128-
* current platform has a hardware CRC module and that it can support the
129-
* requested polynomial.
130-
*
131-
* Supported polynomials are restricted to the named polynomials that can be
132-
* constructed in the MbedCRC class, POLY_8BIT_CCITT, POLY_7BIT_SD,
133-
* POLY_16BIT_CCITT, POLY_16BIT_IBM and POLY_32BIT_ANSI.
134-
*
135-
* The current platform must support the given polynomials default parameters
136-
* in order to return a true response. These include: reflect in, reflect out,
137-
* initial xor and final xor. For example, POLY_32BIT_ANSI requires an initial
138-
* and final xor of 0xFFFFFFFF, and reflection of both input and output. If any
139-
* of these settings cannot be configured, the polynomial is not supported.
140-
*
141-
* This function is thread safe; it safe to call from multiple contexts if
142-
* required.
143-
*
144-
* \param config Contains CRC configuration parameters for initializing the
145-
* hardware CRC module. For example, polynomial and initial seed
146-
* values.
147-
*
148-
* \return True if running if the polynomial is supported, false if not.
149-
*/
150-
bool hal_crc_is_supported(const crc_mbed_config_t *config);
151-
152139
/** Initialize the hardware CRC module with the given polynomial
153140
*
154141
* After calling this function, the CRC HAL module is ready to receive data
@@ -163,7 +150,7 @@ bool hal_crc_is_supported(const crc_mbed_config_t *config);
163150
*
164151
* This function must be called with a valid polynomial supported by the
165152
* platform. The polynomial must be checked for support using the
166-
* hal_crc_is_supported() function.
153+
* HAL_CRC_IS_SUPPORTED() macro.
167154
*
168155
* Calling hal_crc_compute_partial_start() multiple times without finalizing the
169156
* CRC calculation with hal_crc_get_result() overrides the current

targets/TARGET_Cypress/TARGET_PSOC6/cy_crc_api.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "mbed_assert.h"
2020
#include "mbed_error.h"
2121
#include "cyhal_crc.h"
22+
#include "objects.h"
2223

2324
#if DEVICE_CRC
2425

@@ -30,11 +31,6 @@ static cyhal_crc_t cy_crc;
3031
static crc_algorithm_t cy_crc_cfg;
3132
static bool cy_crc_initialized = false;
3233

33-
bool hal_crc_is_supported(const crc_mbed_config_t *config)
34-
{
35-
return config->width <= 32;
36-
}
37-
3834
void hal_crc_compute_partial_start(const crc_mbed_config_t *config)
3935
{
4036
if (!cy_crc_initialized) {
@@ -43,7 +39,7 @@ void hal_crc_compute_partial_start(const crc_mbed_config_t *config)
4339
}
4440
cy_crc_initialized = true;
4541
}
46-
if (!hal_crc_is_supported(config)) {
42+
if (!HAL_CRC_IS_SUPPORTED(config->polynomial, config->width)) {
4743
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_UNSUPPORTED), "unsupported CRC width");
4844
}
4945
cy_crc_cfg.width = config->width;
@@ -77,12 +73,6 @@ uint32_t hal_crc_get_result(void)
7773
}
7874
cyhal_crc_free(&cy_crc);
7975
cy_crc_initialized = false;
80-
// mbed expects result to be aligned unusually in this case
81-
if (0 != (cy_crc_cfg.width % 8) && 0 == cy_crc_cfg.remReverse) {
82-
value ^= cy_crc_cfg.remXor; // Undo result XOR
83-
value <<= 8 - (cy_crc_cfg.width % 8); // Left align to nearest byte
84-
value ^= cy_crc_cfg.remXor; // Redo result XOR
85-
}
8676
return value;
8777
}
8878

targets/TARGET_Cypress/TARGET_PSOC6/objects.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ struct qspi_s {
121121
};
122122
#endif
123123

124+
#if DEVICE_CRC
125+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) <= 32)
126+
#endif
127+
124128
#ifdef __cplusplus
125129
}
126130
#endif

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/mbed_crc_api.c

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@
2323
static crc_bits_t width;
2424
static uint32_t final_xor;
2525

26-
bool hal_crc_is_supported(const crc_mbed_config_t* config)
27-
{
28-
if (config == NULL) {
29-
return false;
30-
}
31-
32-
if ((config->width != 32) && (config->width != 16)) {
33-
return false;
34-
}
35-
36-
return true;
37-
}
38-
3926
void hal_crc_compute_partial_start(const crc_mbed_config_t* config)
4027
{
4128
if (config == NULL) {
@@ -50,12 +37,7 @@ void hal_crc_compute_partial_start(const crc_mbed_config_t* config)
5037
platform_config.seed = config->initial_xor;
5138
platform_config.reflectIn = config->reflect_in;
5239
platform_config.reflectOut = config->reflect_out;
53-
if ((width == kCrcBits16 && config->final_xor == 0xFFFFU) ||
54-
(width == kCrcBits32 && config->final_xor == 0xFFFFFFFFU)) {
55-
platform_config.complementChecksum = true;
56-
} else {
57-
platform_config.complementChecksum = false;
58-
}
40+
platform_config.complementChecksum = false;
5941
platform_config.crcBits = width;
6042
platform_config.crcResult = kCrcFinalChecksum;
6143

@@ -79,24 +61,15 @@ uint32_t hal_crc_get_result(void)
7961
{
8062
uint32_t result;
8163

82-
const bool manual_final_xor = ((final_xor != 0x00000000U) &&
83-
((final_xor != 0xFFFFFFFFU && width == kCrcBits32) ||
84-
(final_xor != 0xFFFFU && width == kCrcBits16)));
85-
8664
switch (width)
8765
{
8866
case kCrcBits16:
8967
result = CRC_Get16bitResult(CRC0);
90-
if (manual_final_xor) {
91-
result ^= final_xor;
92-
result &= 0xFFFF;
93-
}
68+
result ^= final_xor;
9469
return result;
9570
case kCrcBits32:
9671
result = CRC_Get32bitResult(CRC0);
97-
if (manual_final_xor) {
98-
result ^= final_xor;
99-
}
72+
result ^= final_xor;
10073
return result;
10174
default:
10275
MBED_ASSERT("Unhandled switch case");

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/objects.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ struct qspi_s {
105105

106106
#include "us_ticker_defines.h"
107107

108+
#if DEVICE_CRC
109+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 16 || (width) == 32)
110+
#endif
111+
108112
#ifdef __cplusplus
109113
}
110114
#endif

targets/TARGET_STM/TARGET_STM32F0/common_objects.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "PinNames.h"
3737
#include "stm32f0xx_ll_usart.h"
3838
#include "stm32f0xx_ll_tim.h"
39+
#include "stm32f0xx_ll_crc.h"
3940

4041
#ifdef __cplusplus
4142
extern "C" {
@@ -119,6 +120,13 @@ struct analogin_s {
119120
uint8_t channel;
120121
};
121122

123+
124+
#ifdef CRC_PROG_POLYNOMIAL_SUPPORT
125+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
126+
#else
127+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 32 && (polynomial) == 0x04C11DB7)
128+
#endif
129+
122130
#include "gpio_object.h"
123131

124132
#if DEVICE_ANALOGOUT

targets/TARGET_STM/TARGET_STM32F3/common_objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ struct flash_s {
141141
};
142142
#endif
143143

144+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
145+
144146
#include "gpio_object.h"
145147

146148
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32F7/common_objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ struct qspi_s {
161161
};
162162
#endif
163163

164+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
165+
164166
#ifdef __cplusplus
165167
}
166168
#endif

targets/TARGET_STM/TARGET_STM32H7/objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ struct can_s {
193193
};
194194
#endif
195195

196+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
197+
196198
/* rtc_api.c */
197199
#define __HAL_RCC_PWR_CLK_ENABLE()
198200

targets/TARGET_STM/TARGET_STM32L0/common_objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ struct dac_s {
135135
};
136136
#endif
137137

138+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
139+
138140
#ifdef __cplusplus
139141
}
140142
#endif

targets/TARGET_STM/TARGET_STM32L4/common_objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,6 @@ struct qspi_s {
165165
};
166166
#endif
167167

168+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
169+
168170
#endif

targets/TARGET_STM/TARGET_STM32WB/common_objects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ struct analogin_s {
126126
uint8_t channel;
127127
};
128128

129+
#define HAL_CRC_IS_SUPPORTED(polynomial, width) ((width) == 7 || (width) == 8 || (width) == 16 || (width) == 32)
130+
129131
#include "gpio_object.h"
130132

131133
#ifdef __cplusplus

0 commit comments

Comments
 (0)