aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKarl Palsson2012-06-18 18:57:45 +0000
committerPiotr Esden-Tempski2012-06-29 02:08:53 -0700
commit450c3e00a16c3d8bf1a9282d2ca4b45e8b4d9045 (patch)
treeda45045396bf1b6ef19bce1b8d1c95984bf4dab4 /include
parent98174e4a0c6acfe5e427c58fdccbe0f8652d9214 (diff)
Basic helper routines for CRC
Note, the CRC block is pretty useless for interoperability. It only operates on 32bit chunks, and in a different bit order. No attempt to make full helpers for compatibility with other implementations has been done. https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FCRC%20computation&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2006
Diffstat (limited to 'include')
-rw-r--r--include/libopencm3/stm32/crc.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/libopencm3/stm32/crc.h b/include/libopencm3/stm32/crc.h
index 6ae4085..7d80259 100644
--- a/include/libopencm3/stm32/crc.h
+++ b/include/libopencm3/stm32/crc.h
@@ -55,4 +55,24 @@
/* TODO */
+/**
+ * Reset the CRC calculator to initial values.
+ */
+void crc_reset(void);
+
+/**
+ * Add a word to the crc calculator and return the result.
+ * @param data new word to add to the crc calculator
+ * @return final crc calculator value
+ */
+u32 crc_calculate(u32 data);
+
+/**
+ * Add a block of data to the CRC calculator and return the final result
+ * @param datap pointer to the start of a block of 32bit data words
+ * @param size length of data, in 32bit increments
+ * @return final CRC calculator value
+ */
+u32 crc_calculate_block(u32 *datap, int size);
+
#endif