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/16 22:49:12 UTC

[GitHub] [mynewt-core] utzig opened a new pull request #2482: Updates to k64f aka kinetis trng driver

utzig opened a new pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482


   * trng: k64f: rename to trng_kinetis - This makes it less specific, since the driver should also work on other Kinetis families.
   
   * trng: kinetis: update driver for newer families - Older Kinetis families used the RNGA HW module for random number generation, newer models have a slightly different HW module called TRNG; this commit adds TRNG API usage compatibility, and adds syscfg to allow BSPs to choose from one of the HW modules.
   
   * hw: bsp: frdm-k82f: enable TRNG usage
   
   * trng: kinetis: remove delay in poller - This delay was causing a race condition on trng_test during console_printf, and can be safely removed.
   
   * trng: kinetis: seed RNGA with SIM->UIDL - This follows the recommendation from NXP SDK.


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
utzig commented on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780474767


   Fix for CI was submitted here: https://github.com/apache/mynewt-mcumgr/pull/113


----------------------------------------------------------------
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780437274


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/bsp/frdm-k82f/src/hal_bsp.c
   <details>
   
   ```diff
   @@ -124,7 +124,8 @@
        }
    };
    
   -static void init_hardware(void)
   +static void
   +init_hardware(void)
    {
        uint32_t tmp;
    
   ```
   
   </details>


----------------------------------------------------------------
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780444281


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780437274


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/bsp/frdm-k82f/src/hal_bsp.c
   <details>
   
   ```diff
   @@ -124,7 +124,8 @@
        }
    };
    
   -static void init_hardware(void)
   +static void
   +init_hardware(void)
    {
        uint32_t tmp;
    
   ```
   
   </details>


----------------------------------------------------------------
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780199210


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780168681


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
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



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780168681


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
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



[GitHub] [mynewt-core] utzig merged pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
utzig merged pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482


   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#discussion_r577468765



##########
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:
       Done.




----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
utzig commented on a change in pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#discussion_r577468890



##########
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:
       I removed it.




----------------------------------------------------------------
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



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2482: Updates to k64f aka kinetis trng driver

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2482:
URL: https://github.com/apache/mynewt-core/pull/2482#issuecomment-780199210


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


----------------------------------------------------------------
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