diff options
-rw-r--r-- | chip/stm32/build.mk | 1 | ||||
-rw-r--r-- | chip/stm32/crc_hw.h (renamed from chip/stm32/crc.h) | 20 | ||||
-rw-r--r-- | common/build.mk | 1 | ||||
-rw-r--r-- | common/crc.c (renamed from chip/stm32/crc.c) | 0 | ||||
-rw-r--r-- | include/crc.h | 27 |
5 files changed, 32 insertions, 17 deletions
diff --git a/chip/stm32/build.mk b/chip/stm32/build.mk index d141fa2f60..65fdb58876 100644 --- a/chip/stm32/build.mk +++ b/chip/stm32/build.mk @@ -27,7 +27,6 @@ chip-y=dma.o system.o chip-y+=jtag-$(CHIP_FAMILY).o clock-$(CHIP_FAMILY).o chip-$(CONFIG_SPI)+=spi.o chip-$(CONFIG_SPI_MASTER_PORT)+=spi_master.o -chip-$(CONFIG_SW_CRC)+=crc.o chip-$(CONFIG_COMMON_GPIO)+=gpio.o gpio-$(CHIP_FAMILY).o chip-$(CONFIG_COMMON_TIMER)+=hwtimer$(TIMER_TYPE).o chip-$(CONFIG_I2C)+=i2c-$(CHIP_FAMILY).o diff --git a/chip/stm32/crc.h b/chip/stm32/crc_hw.h index df98c35d3b..c1a97da842 100644 --- a/chip/stm32/crc.h +++ b/chip/stm32/crc_hw.h @@ -3,13 +3,9 @@ * found in the LICENSE file. */ -#ifndef _CRC_H -#define _CRC_H -/* CRC-32 implementation with USB constants */ - -/* Note: it's a stateful CRC-32 to match the hardware block interface */ - -#ifdef CONFIG_HW_CRC +#ifndef _CRC_HW_H +#define _CRC_HW_H +/* CRC-32 hardware implementation with USB constants */ #include "registers.h" @@ -39,12 +35,4 @@ static inline uint32_t crc32_result(void) return STM32_CRC_DR ^ 0xFFFFFFFF; } -#else /* !CONFIG_HW_CRC */ -/* Use software implementation */ -void crc32_init(void); -void crc32_hash32(uint32_t val); -void crc32_hash16(uint16_t val); -uint32_t crc32_result(void); -#endif /* CONFIG_HW_CRC */ - -#endif /* _CRC_H */ +#endif /* _CRC_HW_H */ diff --git a/common/build.mk b/common/build.mk index 6b2dd5dbfb..4401c570aa 100644 --- a/common/build.mk +++ b/common/build.mk @@ -62,6 +62,7 @@ common-$(CONFIG_SHA1)+=sha1.o common-$(CONFIG_SOFTWARE_CLZ)+=clz.o common-$(CONFIG_SPI_FLASH)+=spi_flash.o common-$(CONFIG_SWITCH)+=switch.o +common-$(CONFIG_SW_CRC)+=crc.o common-$(CONFIG_TEMP_SENSOR)+=temp_sensor.o thermal.o common-$(CONFIG_USB_PORT_POWER_DUMB)+=usb_port_power_dumb.o common-$(CONFIG_USB_PORT_POWER_SMART)+=usb_port_power_smart.o diff --git a/chip/stm32/crc.c b/common/crc.c index 31054ad732..31054ad732 100644 --- a/chip/stm32/crc.c +++ b/common/crc.c diff --git a/include/crc.h b/include/crc.h new file mode 100644 index 0000000000..73289ae213 --- /dev/null +++ b/include/crc.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef _CRC_H +#define _CRC_H +/* CRC-32 implementation with USB constants */ +/* Note: it's a stateful CRC-32 to match the hardware block interface */ + +#ifdef CONFIG_HW_CRC +#include "crc_hw.h" +#else + +/* Use software implementation */ + +void crc32_init(void); + +void crc32_hash32(uint32_t val); + +void crc32_hash16(uint16_t val); + +uint32_t crc32_result(void); + +#endif /* CONFIG_HW_CRC */ + +#endif /* _CRC_H */ |