[Cryptech-Commits] [sw/stm32] 03/08: Add retro fmc_write_32/fmc_read_32 for the board-test projects that use them.

git at cryptech.is git at cryptech.is
Thu Oct 15 22:22:12 UTC 2020


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

commit 16b7a38bedbae0829e0b943c35f0896acb683025
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Thu Oct 15 13:53:53 2020 -0400

    Add retro fmc_write_32/fmc_read_32 for the board-test projects that use them.
---
 stm-fmc.h | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/stm-fmc.h b/stm-fmc.h
index c01d4ff..e9b5749 100644
--- a/stm-fmc.h
+++ b/stm-fmc.h
@@ -4,6 +4,8 @@
  * Functions to set up and use the FMC bus.
  *
  * Copyright (c) 2015, NORDUnet A/S All rights reserved.
+ * Copyright: 2020, The Commons Conservancy Cryptech Project
+ * SPDX-License-Identifier: BSD-3-Clause
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -15,9 +17,9 @@
  *   notice, this list of conditions and the following disclaimer in the
  *   documentation and/or other materials provided with the distribution.
  *
- * - Neither the name of the NORDUnet nor the names of its contributors may
- *   be used to endorse or promote products derived from this software
- *   without specific prior written permission.
+ * - Neither the name of the copyright holder nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -57,4 +59,14 @@ static inline void *fmc_fpga_addr(off_t addr)
     return (void *)(FMC_FPGA_BASE_ADDR + (addr & FMC_FPGA_ADDR_MASK));
 }
 
+static inline void fmc_write_32(uint32_t addr, uint32_t data)
+{
+    *(uint32_t *)fmc_fpga_addr(addr) = data;
+}
+
+static inline void fmc_read_32(uint32_t addr, uint32_t *data)
+{
+    *data = *(uint32_t *)fmc_fpga_addr(addr);
+}
+
 #endif /* __STM_FMC_H */



More information about the Commits mailing list