You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/02/17 07:37:47 UTC

[GitHub] [mynewt-core] kasjer commented on a change in pull request #2482: Updates to k64f aka kinetis trng driver

kasjer commented on a change in pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#discussion_r577373281



##########
File path: hw/drivers/trng/trng_kinetis/src/trng_kinetis.c
##########
@@ -18,7 +18,23 @@
  */
 
 #include <string.h>
+#include "os/mynewt.h"
+
+#if MYNEWT_VAL(KINETIS_TRNG_USE_RNGA)
+#define USE_RNGA 1
 #include "fsl_rnga.h"
+#elif MYNEWT_VAL(KINETIS_TRNG_USE_TRNG)
+#define USE_TRNG 1
+#include "fsl_trng.h"
+#define TRNG_START(base) \

Review comment:
       maybe use do {} while (0) to prevent accidents with if (cond) TRNG_START();
   though I know mynewt style calls for {} in each if

##########
File path: hw/drivers/trng/trng_kinetis/src/trng_kinetis.c
##########
@@ -154,9 +186,16 @@ kinetis_trng_dev_open(struct os_dev *dev, uint32_t wait, void *arg)
         rng_cache_out = 0;
         rng_cache_in = 0;
 
+#if USE_RNGA
         RNGA_Init(RNG);
-
-        kinetis_rnga_start();
+#elif USE_TRNG
+        (void)TRNG_GetDefaultConfig(&default_config);
+        TRNG_Init(TRNG0, &default_config);
+#else
+        assert(0);

Review comment:
       this case was take care of in line 35
   ```c
   #error "Unsupported TRNG interface"
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org