Add media top-level directory for storage medium access components
Introduces the top-level media directory for components concerned
with accessing storage media using well-known formats. Reuses
external source code from TF-A where possible.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I5fa2cb24aa33f019df5108e80ccd78f0170e4c0b
diff --git a/components/common/crc32/crc32.h b/components/common/crc32/crc32.h
new file mode 100644
index 0000000..a04e380
--- /dev/null
+++ b/components/common/crc32/crc32.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef COMMON_CRC32_H
+#define COMMON_CRC32_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Calculate a CRC32 over the provided data
+ *
+ * \param[in] crc The starting CRC for previous data
+ * \param[in] buf The buffer to calculate the CRC over
+ * \param[in] size Number of bytes in the buffer
+ *
+ * \return The calculated CRC32
+ */
+uint32_t crc32(uint32_t crc, const unsigned char *buf, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COMMON_CRC32_H */