You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2021/02/17 00:03:20 UTC

[mynewt-core] 02/02: Enable HW HASH usage on frdm-k82f board

This is an automated email from the ASF dual-hosted git repository.

utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit cbf4886a57ed4fe546302cdf0675ebc37d0cab47
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Mon Feb 8 12:42:56 2021 -0300

    Enable HW HASH usage on frdm-k82f board
    
    Signed-off-by: Fabio Utzig <ut...@apache.org>
---
 hw/bsp/frdm-k82f/pkg.yml       |  3 +++
 hw/bsp/frdm-k82f/src/hal_bsp.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/hw/bsp/frdm-k82f/pkg.yml b/hw/bsp/frdm-k82f/pkg.yml
index 778b4c7..0389789 100644
--- a/hw/bsp/frdm-k82f/pkg.yml
+++ b/hw/bsp/frdm-k82f/pkg.yml
@@ -62,3 +62,6 @@ pkg.deps.UART_4:
 
 pkg.deps.ENC_FLASH_DEV:
     - "@apache-mynewt-core/hw/drivers/flash/enc_flash/ef_crypto"
+
+pkg.deps.HASH:
+    - "@apache-mynewt-core/hw/drivers/hash/hash_kinetis"
diff --git a/hw/bsp/frdm-k82f/src/hal_bsp.c b/hw/bsp/frdm-k82f/src/hal_bsp.c
index abf3af9..71162d2 100644
--- a/hw/bsp/frdm-k82f/src/hal_bsp.c
+++ b/hw/bsp/frdm-k82f/src/hal_bsp.c
@@ -31,6 +31,10 @@
 #if MYNEWT_VAL(ENC_FLASH_DEV)
 #include <ef_crypto/ef_crypto.h>
 #endif
+#if MYNEWT_VAL(HASH)
+#include "hash/hash.h"
+#include "hash_kinetis/hash_kinetis.h"
+#endif
 #if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1) || MYNEWT_VAL(UART_2) || \
     MYNEWT_VAL(UART_3) || MYNEWT_VAL(UART_4)
 #include "uart/uart.h"
@@ -98,6 +102,9 @@ static const struct nxp_hal_i2c_cfg hal_i2c3_cfg = {
 };
 #endif
 
+#if MYNEWT_VAL(HASH)
+static struct hash_dev os_bsp_hash;
+#endif
 
 /*
  * What memory to include in coredump.
@@ -222,6 +229,12 @@ hal_bsp_init(void)
     init_hardware();
     BOARD_BootClockRUN();
 
+#if MYNEWT_VAL(HASH)
+    rc = os_dev_create(&os_bsp_hash.dev, "hash", OS_DEV_INIT_KERNEL,
+                       OS_DEV_INIT_PRIO_DEFAULT, kinetis_hash_dev_init, NULL);
+    assert(rc == 0);
+#endif
+
 #if MYNEWT_VAL(UART_0)
     rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
                        OS_DEV_INIT_PRIMARY, 0, uart_hal_init, NULL);