[GitHub] [mynewt-core] mkiiskila commented on a change in pull request #1674: sys/config: Add API for conf_load_one()

2019-03-05 Thread GitBox
mkiiskila commented on a change in pull request #1674: sys/config: Add API for 
conf_load_one()
URL: https://github.com/apache/mynewt-core/pull/1674#discussion_r262815690
 
 

 ##
 File path: sys/config/src/config_store.c
 ##
 @@ -67,7 +67,38 @@ conf_dst_register(struct conf_store *cs)
 static void
 conf_load_cb(char *name, char *val, void *cb_arg)
 {
-conf_set_value(name, val);
+if ((cb_arg && !strcmp((char*)cb_arg, name)) ||
 
 Review comment:
   if (!cb_arg || !strcmp(cb_arg, name)) {
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] mkiiskila commented on a change in pull request #1674: sys/config: Add API for conf_load_one()

2019-03-05 Thread GitBox
mkiiskila commented on a change in pull request #1674: sys/config: Add API for 
conf_load_one()
URL: https://github.com/apache/mynewt-core/pull/1674#discussion_r262816237
 
 

 ##
 File path: sys/config/include/config/config.h
 ##
 @@ -188,6 +188,15 @@ int conf_register(struct conf_handler *cf);
  */
 int conf_load(void);
 
+/**
+ * Load configuration from a specific registered persistence source.
+ * Handlers will be called for configuration subtrees for
+ * encountered values.
+ *
+ * @return 0 on success, non-zero on failure.
+ */
 
 Review comment:
   Comment copied from function above, should be updated to describe this 
function.
   
   Also, note the existence of conf_get_stored_value(), which also can be used 
in finding a value associated with a specific name.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: hw/mcu/nordic/nrf52xxx: Do not use END_START shortcut for SPIM

2019-03-05 Thread wes3
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 7c77377  hw/mcu/nordic/nrf52xxx: Do not use END_START shortcut for SPIM
 new 285d414  Merge pull request #1672 from wes3/nrf52_spim_no_shortcuts
7c77377 is described below

commit 7c77377ec91bf9bbd1a7d3cf5abf78b2b5bd6df0
Author: William San Filippo 
AuthorDate: Sat Mar 2 16:40:02 2019 -0800

hw/mcu/nordic/nrf52xxx: Do not use END_START shortcut for SPIM

Revert change that used END_START shortcut and EVENTS_STARTED
interrupt for SPIM interface. The reason behind reverting back
to the previous method is if interrupts are disabled/delayed too
long it is possible to transmit unexpected bytes on the SPI
interface. This method adds latency but insures a valid transfer.
See issue #1667.
---
 hw/mcu/nordic/nrf52xxx/src/hal_spi.c | 80 +---
 1 file changed, 28 insertions(+), 52 deletions(-)

diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_spi.c 
b/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
index a203b84..c0fd2d2 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_spi.c
@@ -70,6 +70,8 @@ struct nrf52_hal_spi
 uint8_t spi_xfr_flag;   /* Master only */
 uint8_t dummy_rx;   /* Master only */
 uint8_t slave_state;/* Slave only */
+uint16_t nhs_buflen;
+uint16_t nhs_bytes_txd;
 struct hal_spi_settings spi_cfg; /* Slave and master */
 
 /* Pointer to HW registers */
@@ -81,10 +83,9 @@ struct nrf52_hal_spi
 /* IRQ number */
 IRQn_Type irq_num;
 
-uint8_t *nhs_txbuf; /* Pointer to TX buffer */
-uint8_t *nhs_rxbuf; /* Pointer to RX buffer */
-uint16_t nhs_buflen;/* Length of buffer */
-uint16_t nhs_bytes_txq; /* Number of bytes queued for TX */
+/* Pointers to tx/rx buffers */
+uint8_t *nhs_txbuf;
+uint8_t *nhs_rxbuf;
 
 /* Callback and arguments */
 hal_spi_txrx_cb txrx_cb_func;
@@ -136,59 +137,41 @@ nrf52_irqm_handler(struct nrf52_hal_spi *spi)
 {
 NRF_SPIM_Type *spim;
 uint16_t xfr_bytes;
-uint16_t next_len;
+uint16_t len;
 
 spim = spi->nhs_spi.spim;
+if (spim->EVENTS_END) {
+spim->EVENTS_END = 0;
 
-/* Should not occur but if no transfer just leave  */
-if (spi->spi_xfr_flag == 0) {
-return;
-}
-
-if ((spim->EVENTS_STARTED) && (spim->INTENSET & 
SPIM_INTENSET_STARTED_Msk)) {
-spim->EVENTS_STARTED = 0;
-
-xfr_bytes = spim->TXD.MAXCNT;
-spi->nhs_bytes_txq += xfr_bytes;
+/* Should not occur but if no transfer just leave  */
+if (spi->spi_xfr_flag == 0) {
+return;
+}
 
-if (spi->nhs_bytes_txq < spi->nhs_buflen) {
+/* Are there more bytes to send? */
+xfr_bytes = spim->TXD.AMOUNT;
+spi->nhs_bytes_txd += xfr_bytes;
+if (spi->nhs_bytes_txd < spi->nhs_buflen) {
 spi->nhs_txbuf += xfr_bytes;
-
-next_len = min(SPIM_TXD_MAXCNT_MAX,
-   spi->nhs_buflen - spi->nhs_bytes_txq);
-
+len = spi->nhs_buflen - spi->nhs_bytes_txd;
+len = min(SPIM_TXD_MAXCNT_MAX, len);
 spim->TXD.PTR = (uint32_t)spi->nhs_txbuf;
-spim->TXD.MAXCNT = next_len;
+spim->TXD.MAXCNT = (uint8_t)len;
 
-/* If no RX buffer was provided, we already set it to dummy one */
+/* If no rxbuf, we need to set rxbuf and maxcnt to 1 */
 if (spi->nhs_rxbuf) {
 spi->nhs_rxbuf += xfr_bytes;
-spim->RXD.PTR = (uint32_t)spi->nhs_rxbuf;
-spim->RXD.MAXCNT = next_len;
+spim->RXD.PTR= (uint32_t)spi->nhs_rxbuf;
+spim->RXD.MAXCNT = (uint8_t)len;
 }
-
-spim->SHORTS |= SPIM_SHORTS_END_START_Msk;
-spim->INTENSET = SPIM_INTENSET_STARTED_Msk;
-spim->INTENCLR = SPIM_INTENSET_END_Msk;
+spim->TASKS_START = 1;
 } else {
-spim->SHORTS &= ~SPIM_SHORTS_END_START_Msk;
-spim->INTENSET = SPIM_INTENSET_END_Msk;
-spim->INTENCLR = SPIM_INTENSET_STARTED_Msk;
-}
-}
-
-if (spim->EVENTS_END) {
-spim->EVENTS_END = 0;
-
-if (spim->INTENSET & SPIM_INTENSET_END_Msk) {
 if (spi->txrx_cb_func) {
 spi->txrx_cb_func(spi->txrx_cb_arg, spi->nhs_buflen);
-}
 
+}
 spi->spi_xfr_flag = 0;
-
-spim->SHORTS &= ~SPIM_SHORTS_END_START_Msk;
-spim->INTENCLR = SPIM_INTENSET_STARTED_Msk | SPIM_INTENSET_END_Msk;
+spim->INTENCLR = SPIM_INTENSET_END_Msk;
 }
 }
 }
@@ -797,7 +780,7 @@ hal_spi_disable(int spi_num)
 spi->nhs_txbuf = NULL;
 spi->nhs_rxbuf = NULL;
 

[GitHub] [mynewt-core] wes3 merged pull request #1672: hw/mcu/nordic/nrf52xxx: Do not use END_START shortcut for SPIM

2019-03-05 Thread GitBox
wes3 merged pull request #1672: hw/mcu/nordic/nrf52xxx: Do not use END_START 
shortcut for SPIM
URL: https://github.com/apache/mynewt-core/pull/1672
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] vrahane merged pull request #1675: Add console_reinit(), console_deinit() and uart_console_deinit() APIs to disable console input/output at runtime

2019-03-05 Thread GitBox
vrahane merged pull request #1675: Add console_reinit(), console_deinit() and 
uart_console_deinit() APIs to disable console input/output at runtime
URL: https://github.com/apache/mynewt-core/pull/1675
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: Add console_reinit(), console_deinit() and uart_console_deinit() APIs to disable console input/output at runtime (#1675)

2019-03-05 Thread vipulrahane
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new b0faad3  Add console_reinit(), console_deinit() and 
uart_console_deinit() APIs to disable console input/output at runtime (#1675)
b0faad3 is described below

commit b0faad350148e04cabc9ff2654dcc055e645f857
Author: reshtitus <43156600+reshti...@users.noreply.github.com>
AuthorDate: Tue Mar 5 18:01:19 2019 -0800

Add console_reinit(), console_deinit() and uart_console_deinit() APIs to 
disable console input/output at runtime (#1675)

- Added functions for de-initializing/re-initializing the uart console
- Added functions to console stub
---
 sys/console/full/include/console/console.h | 26 ++
 sys/console/full/src/console.c | 20 
 sys/console/full/src/console_priv.h|  1 +
 sys/console/full/src/uart_console.c| 15 +++
 sys/console/stub/include/console/console.h | 15 +++
 5 files changed, 77 insertions(+)

diff --git a/sys/console/full/include/console/console.h 
b/sys/console/full/include/console/console.h
index cd02260..b375ecf 100644
--- a/sys/console/full/include/console/console.h
+++ b/sys/console/full/include/console/console.h
@@ -45,6 +45,14 @@ typedef void (*console_rx_cb)(void);
 typedef int (*console_append_char_cb)(char *line, uint8_t byte);
 typedef void (*completion_cb)(char *str, console_append_char_cb cb);
 
+/**
+ * De initializes the UART console.
+ */
+void console_deinit(void);
+/**
+ * Re Initializes the UART console.
+ */
+void console_reinit(void);
 int console_init(console_rx_cb rx_cb);
 int console_is_init(void);
 void console_write(const char *str, int cnt);
@@ -69,6 +77,11 @@ void console_line_event_put(struct os_event *ev);
  * Global indicating whether console is silent or not
  */
 extern bool g_silence_console;
+/**
+ * Global indicating whether console input is disabled or not
+ */
+extern bool g_console_input_ignore;
+
 
 /**
  * Silences console output, input is still active
@@ -82,6 +95,19 @@ console_silence(bool silent)
 g_silence_console = silent;
 }
 
+
+/**
+ * Ignores console input, output is still active
+ *
+ * @param ignore Lets console know if input should be disabled,
+ *true for ignore input, false otherwise
+ */
+static void inline
+console_input_ignore(bool ignore)
+{
+g_console_input_ignore = ignore;
+}
+
 extern int console_is_midline;
 extern int console_out(int character);
 extern void console_rx_restart(void);
diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index 93d8a50..c7048a4 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -84,6 +84,7 @@ static struct os_eventq avail_queue;
 static struct os_eventq *lines_queue;
 static completion_cb completion;
 bool g_silence_console;
+bool g_console_input_ignore;
 static struct os_mutex console_write_lock;
 
 /*
@@ -670,6 +671,9 @@ console_handle_char(uint8_t byte)
 #if !MYNEWT_VAL(CONSOLE_INPUT)
 return 0;
 #endif
+if (g_console_input_ignore) {
+return 0;
+}
 
 static struct os_event *ev;
 static struct console_input *input;
@@ -853,6 +857,22 @@ console_set_completion_cb(completion_cb cb)
 completion = cb;
 }
 
+void
+console_deinit(void)
+{
+#if MYNEWT_VAL(CONSOLE_UART)
+uart_console_deinit();
+#endif
+}
+
+void
+console_reinit(void)
+{
+#if MYNEWT_VAL(CONSOLE_UART)
+ uart_console_init();
+#endif
+}
+
 #if MYNEWT_VAL(CONSOLE_COMPAT)
 int
 console_init(console_rx_cb rx_cb)
diff --git a/sys/console/full/src/console_priv.h 
b/sys/console/full/src/console_priv.h
index ff41cae..136080c 100644
--- a/sys/console/full/src/console_priv.h
+++ b/sys/console/full/src/console_priv.h
@@ -25,6 +25,7 @@ extern "C" {
 #endif
 
 int uart_console_is_init(void);
+int uart_console_deinit(void);
 int uart_console_init(void);
 void uart_console_blocking_mode(void);
 void uart_console_non_blocking_mode(void);
diff --git a/sys/console/full/src/uart_console.c 
b/sys/console/full/src/uart_console.c
index 8255701..176106a 100644
--- a/sys/console/full/src/uart_console.c
+++ b/sys/console/full/src/uart_console.c
@@ -272,6 +272,21 @@ uart_console_is_init(void)
 }
 
 int
+uart_console_deinit(void)
+{
+struct os_dev *dev;
+dev = os_dev_lookup(MYNEWT_VAL(CONSOLE_UART_DEV));
+if (dev) {
+/* Force close now */
+os_dev_close(dev);
+uart_dev = NULL;
+} else {
+return SYS_ENODEV;
+}
+return 0;
+}
+
+int
 uart_console_init(void)
 {
 struct uart_conf uc = {
diff --git a/sys/console/stub/include/console/console.h 
b/sys/console/stub/include/console/console.h
index 0543fa6..ff6c6b3 100644
--- a/sys/console/stub/include/console/console.h
+++ b/sys/console/stub/include/console/console.h
@@ -43,6 +43,16 @@ 

[GitHub] [mynewt-core] reshtitus opened a new pull request #1675: [DO NOT MERGE] FWBB 667 cli enable disable

2019-03-05 Thread GitBox
reshtitus opened a new pull request #1675: [DO NOT MERGE] FWBB 667 cli enable 
disable
URL: https://github.com/apache/mynewt-core/pull/1675
 
 
   Added functions to reinitialize/de inititalize  UART console.
   Added an API to keep UART output enabled while ignoring the input.
   These functions are used in the CDD ticket in juul-platform.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] vrahane opened a new pull request #1674: sys/config: Add API for conf_load_one()

2019-03-05 Thread GitBox
vrahane opened a new pull request #1674: sys/config: Add API for conf_load_one()
URL: https://github.com/apache/mynewt-core/pull/1674
 
 
   - Earlier we would load all configuration values together, this API gives us 
a way to load just one value.
   - conf_load() still loads everything the way it used to.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch master updated: mcu/nordic Added missing baud rate values for nRF51 and nRF52.

2019-03-05 Thread mlaz
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new 2b73bed  mcu/nordic Added missing baud rate values for nRF51 and nRF52.
 new 0c16e38  Merge pull request #1671 from mlaz/add_missig_baud
2b73bed is described below

commit 2b73beda4eaf50078ad4c253a71d5818e886b63d
Author: Miguel Azevedo 
AuthorDate: Fri Mar 1 18:50:17 2019 +

mcu/nordic Added missing baud rate values for nRF51 and nRF52.
---
 hw/mcu/nordic/nrf51xxx/src/hal_uart.c | 18 ++
 hw/mcu/nordic/nrf52xxx/src/hal_uart.c |  8 
 2 files changed, 26 insertions(+)

diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_uart.c 
b/hw/mcu/nordic/nrf51xxx/src/hal_uart.c
index 636d49e..53ca337 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_uart.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_uart.c
@@ -194,18 +194,36 @@ static uint32_t
 hal_uart_baudrate(int baudrate)
 {
 switch (baudrate) {
+case 1200:
+return UART_BAUDRATE_BAUDRATE_Baud1200;
+case 2400:
+return UART_BAUDRATE_BAUDRATE_Baud2400;
+case 4800:
+return UART_BAUDRATE_BAUDRATE_Baud4800;
 case 9600:
 return UART_BAUDRATE_BAUDRATE_Baud9600;
+case 14400:
+return UART_BAUDRATE_BAUDRATE_Baud14400;
 case 19200:
 return UART_BAUDRATE_BAUDRATE_Baud19200;
+case 28800:
+return UART_BAUDRATE_BAUDRATE_Baud28800;
+case 31250:
+return UART_BAUDRATE_BAUDRATE_Baud31250;
 case 38400:
 return UART_BAUDRATE_BAUDRATE_Baud38400;
+case 56000:
+return UART_BAUDRATE_BAUDRATE_Baud56000;
 case 57600:
 return UART_BAUDRATE_BAUDRATE_Baud57600;
+case 76800:
+return UART_BAUDRATE_BAUDRATE_Baud76800;
 case 115200:
 return UART_BAUDRATE_BAUDRATE_Baud115200;
 case 230400:
 return UART_BAUDRATE_BAUDRATE_Baud230400;
+case 25:
+return UART_BAUDRATE_BAUDRATE_Baud25;
 case 460800:
 return UART_BAUDRATE_BAUDRATE_Baud460800;
 case 921600:
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_uart.c 
b/hw/mcu/nordic/nrf52xxx/src/hal_uart.c
index 33fb30e..5dc5907 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_uart.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_uart.c
@@ -291,10 +291,16 @@ hal_uart_baudrate(int baudrate)
 return UARTE_BAUDRATE_BAUDRATE_Baud4800;
 case 9600:
 return UARTE_BAUDRATE_BAUDRATE_Baud9600;
+case 14400:
+return UARTE_BAUDRATE_BAUDRATE_Baud14400;
 case 19200:
 return UARTE_BAUDRATE_BAUDRATE_Baud19200;
+case 28800:
+return UARTE_BAUDRATE_BAUDRATE_Baud28800;
 case 38400:
 return UARTE_BAUDRATE_BAUDRATE_Baud38400;
+case 56000:
+return UARTE_BAUDRATE_BAUDRATE_Baud56000;
 case 57600:
 return UARTE_BAUDRATE_BAUDRATE_Baud57600;
 case 76800:
@@ -303,6 +309,8 @@ hal_uart_baudrate(int baudrate)
 return UARTE_BAUDRATE_BAUDRATE_Baud115200;
 case 230400:
 return UARTE_BAUDRATE_BAUDRATE_Baud230400;
+case 25:
+return UARTE_BAUDRATE_BAUDRATE_Baud25;
 case 460800:
 return UARTE_BAUDRATE_BAUDRATE_Baud460800;
 case 921600:



[GitHub] [mynewt-core] mlaz merged pull request #1671: mcu/nordic: Add missig baud rates

2019-03-05 Thread GitBox
mlaz merged pull request #1671: mcu/nordic: Add missig baud rates
URL: https://github.com/apache/mynewt-core/pull/1671
 
 
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] andrzej-kaczmarek opened a new pull request #1673: Use new BLE_CONTROLLER syscfg where applicable

2019-03-05 Thread GitBox
andrzej-kaczmarek opened a new pull request #1673: Use new BLE_CONTROLLER 
syscfg where applicable
URL: https://github.com/apache/mynewt-core/pull/1673
 
 
   This requires https://github.com/apache/mynewt-nimble/pull/362 to be merged 
first.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] mkiiskila commented on a change in pull request #1649: [WIP] [RFC] Add initial crypto driver framework

2019-03-05 Thread GitBox
mkiiskila commented on a change in pull request #1649: [WIP] [RFC] Add initial 
crypto driver framework
URL: https://github.com/apache/mynewt-core/pull/1649#discussion_r262516883
 
 

 ##
 File path: hw/drivers/crypto/include/crypto/crypto.h
 ##
 @@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __CRYPTO_H__
+#define __CRYPTO_H__
+
+#include 
+#include 
+#include "os/mynewt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AES definitions
+ */
+#define AES_BLOCK_LEN 16
+
+#define AES_128_KEY_LEN   16
+#define AES_192_KEY_LEN   24
+#define AES_256_KEY_LEN   32
+#define AES_MAX_KEY_LEN   AES_256_KEY_LEN
+
+#define CRYPTO_VALID_AES_KEYLEN(x) \
+(((x) == 128) || ((x) == 192) || ((x) == 256))
+
+/*
+ * Driver capabilities
+ */
+#define CRYPTO_OP_ENCRYPT  0x01
+#define CRYPTO_OP_DECRYPT  0x02
+#define CRYPTO_VALID_OP(x) \
+(((x) == CRYPTO_OP_ENCRYPT) || ((x) == CRYPTO_OP_DECRYPT))
+
+#define CRYPTO_ALGO_AES0x0001
+#define CRYPTO_ALGO_DES0x0002
+#define CRYPTO_ALGO_3DES   0x0004
+#define CRYPTO_ALGO_RSA0x0010
+
+#define CRYPTO_MODE_ECB0x0001
+#define CRYPTO_MODE_CBC0x0002
+#define CRYPTO_MODE_CTR0x0004
+#define CRYPTO_MODE_CCM0x0008
+#define CRYPTO_MODE_GCM0x0010
+
+/*
+ * TODO: this driver need a global lock, only one thread can do
+ * encrypt/decrypt at any time...
+ */
+
+struct crypto_dev;
+
+typedef uint32_t (* crypto_op_func_t)(struct crypto_dev *crypto, uint16_t algo,
+uint16_t mode, const uint8_t *key, uint16_t keylen, uint8_t *iv,
+const uint8_t *inbuf, uint8_t *outbuf, uint32_t len);
+typedef bool (* crypto_support_func_t)(struct crypto_dev *crypto, uint8_t op,
+uint16_t algo, uint16_t mode, uint16_t keylen);
+
+/**
+ * @struct crypto_interface
+ * @brief Provides the interface into a HW crypto driver
+ *
+ * @var crypto_interface::encrypt
+ * encrypt is a crypto_op_func_t pointer to the encryption routine
+ *
+ * @var crypto_interface::decrypt
+ * decrypt is a crypto_op_func_t pointer to the decryption routine
+ *
+ * @var crypto_interface::has_algomode
+ * caps exports the capabilities of the HW driver. see TODO
+ */
+struct crypto_interface {
+crypto_op_func_t encrypt;
+crypto_op_func_t decrypt;
 
 Review comment:
   Thanks! I'd leave it up to you whether to define your own, or reuse the 
struct from other package. I probably would have a separate one, so there's no 
dependency to those packages :)


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-nimble] andrzej-kaczmarek opened a new pull request #362: nimble: Replace BLE_DEVICE with BLE_CONTROLLER

2019-03-05 Thread GitBox
andrzej-kaczmarek opened a new pull request #362: nimble: Replace BLE_DEVICE 
with BLE_CONTROLLER
URL: https://github.com/apache/mynewt-nimble/pull/362
 
 
   BLE_CONTROLLER is a better name for its purpose.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-newt] utzig commented on issue #274: Remember which packages satisfy API requirements

2019-03-05 Thread GitBox
utzig commented on issue #274: Remember which packages satisfy API requirements
URL: https://github.com/apache/mynewt-newt/pull/274#issuecomment-469675980
 
 
   This look OK to me, I re-started the CI to check if it passes 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] utzig commented on a change in pull request #1649: [WIP] [RFC] Add initial crypto driver framework

2019-03-05 Thread GitBox
utzig commented on a change in pull request #1649: [WIP] [RFC] Add initial 
crypto driver framework
URL: https://github.com/apache/mynewt-core/pull/1649#discussion_r262484726
 
 

 ##
 File path: hw/drivers/crypto/include/crypto/crypto.h
 ##
 @@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __CRYPTO_H__
+#define __CRYPTO_H__
+
+#include 
+#include 
+#include "os/mynewt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AES definitions
+ */
+#define AES_BLOCK_LEN 16
+
+#define AES_128_KEY_LEN   16
+#define AES_192_KEY_LEN   24
+#define AES_256_KEY_LEN   32
+#define AES_MAX_KEY_LEN   AES_256_KEY_LEN
+
+#define CRYPTO_VALID_AES_KEYLEN(x) \
+(((x) == 128) || ((x) == 192) || ((x) == 256))
+
+/*
+ * Driver capabilities
+ */
+#define CRYPTO_OP_ENCRYPT  0x01
+#define CRYPTO_OP_DECRYPT  0x02
+#define CRYPTO_VALID_OP(x) \
+(((x) == CRYPTO_OP_ENCRYPT) || ((x) == CRYPTO_OP_DECRYPT))
+
+#define CRYPTO_ALGO_AES0x0001
+#define CRYPTO_ALGO_DES0x0002
+#define CRYPTO_ALGO_3DES   0x0004
+#define CRYPTO_ALGO_RSA0x0010
+
+#define CRYPTO_MODE_ECB0x0001
+#define CRYPTO_MODE_CBC0x0002
+#define CRYPTO_MODE_CTR0x0004
+#define CRYPTO_MODE_CCM0x0008
+#define CRYPTO_MODE_GCM0x0010
+
+/*
+ * TODO: this driver need a global lock, only one thread can do
+ * encrypt/decrypt at any time...
+ */
+
+struct crypto_dev;
+
+typedef uint32_t (* crypto_op_func_t)(struct crypto_dev *crypto, uint16_t algo,
+uint16_t mode, const uint8_t *key, uint16_t keylen, uint8_t *iv,
+const uint8_t *inbuf, uint8_t *outbuf, uint32_t len);
+typedef bool (* crypto_support_func_t)(struct crypto_dev *crypto, uint8_t op,
+uint16_t algo, uint16_t mode, uint16_t keylen);
+
+/**
+ * @struct crypto_interface
+ * @brief Provides the interface into a HW crypto driver
+ *
+ * @var crypto_interface::encrypt
+ * encrypt is a crypto_op_func_t pointer to the encryption routine
+ *
+ * @var crypto_interface::decrypt
+ * decrypt is a crypto_op_func_t pointer to the decryption routine
+ *
+ * @var crypto_interface::has_algomode
+ * caps exports the capabilities of the HW driver. see TODO
+ */
+struct crypto_interface {
+crypto_op_func_t encrypt;
+crypto_op_func_t decrypt;
 
 Review comment:
   > I want to be able decrypt/encrypt data in-place. I don't want to spend 
cycles copying data from temporary buffers, when doing crypto. I can see some 
of the drivers appear to be able to do it, but I did not go through all of them.
   
   You mean doing `encrypt_aes_ecb(buf, buf, len)`? The only mode that was not 
working was CTR, but I fixed it yesterday. Documentation might still mention it 
need separate buffers though.
   
   > I want to be able to use discontiguous buffers. Specifically, I want to be 
able to add routines which decrypt/encrypt data within mbuf chain without 
having to move data to a temporary buffer for encryption/decryption, and then 
having to copy it back. I'd be ok with the interface being even iovec[], 
although state structure would've been best. The former allows for datagrams 
carried in mbuf chains, while the latter would allow me to use this with byte 
streams, like TCP.
   
   Good idea, I will add functions like `crypto_algo+mode_(en|de)cryptv(xxx)` 
that accept `iovec` instead of `inbuf/outbuf`. The tree seems to have cbor and 
lwip `iovec` definitions; should be using one of those or should I add a new 
definition? (`crypto_iovec`?, but being similarly defined will accept the 
others as well...)


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:
us...@infra.apache.org


With regards,
Apache Git Services


[mynewt-core] branch kasjer/flashspi-bus-support deleted (was 4626933)

2019-03-05 Thread jerzy
This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a change to branch kasjer/flashspi-bus-support
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.


 was 4626933  hw/drivers: Add bus driver support ot spiflash

This change permanently discards the following revisions:

 discard 4626933  hw/drivers: Add bus driver support ot spiflash



[GitHub] [mynewt-newt] andrewleech commented on issue #151: Error: Error updating when running newt install

2019-03-05 Thread GitBox
andrewleech commented on issue #151: Error: Error updating when running newt 
install
URL: https://github.com/apache/mynewt-newt/issues/151#issuecomment-469626669
 
 
   I just had the same problem trying to install my first project, also in 
Windows WSL.
   The git filemode fix above didn't work for me however, after that and 
retrying install I got a long list of errors like
   ```
   * Warning: Parsing pkg @apache-mynewt-nimble/nimble/transport/uart config: 
strconv.ParseInt: parsing "MYNEWT_VAL(BLE_TRANS_UART_SYSINIT_STAGE)": invalid 
syntax; ignoring package.
   ```
   I was trying to install into one of the mounted windows folder, eg 
`/mnt/c/Users/...` 
   Starting again in one of the wsl linux native folders like `~/` fixed the 
problem for me.


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:
us...@infra.apache.org


With regards,
Apache Git Services