[GitHub] [mynewt-core] kasjer closed pull request #2267: I2S API for mynewt

2020-04-14 Thread GitBox
kasjer closed pull request #2267: I2S API for mynewt
URL: https://github.com/apache/mynewt-core/pull/2267
 
 
   


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] kasjer commented on issue #2267: I2S API for mynewt

2020-04-14 Thread GitBox
kasjer commented on issue #2267: I2S API for mynewt
URL: https://github.com/apache/mynewt-core/pull/2267#issuecomment-613832608
 
 
   Code was present in #2268 


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] kasjer merged pull request #2268: Add I2S driver for stm32f4

2020-04-14 Thread GitBox
kasjer merged pull request #2268: Add I2S driver for stm32f4
URL: https://github.com/apache/mynewt-core/pull/2268
 
 
   


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] 03/03: hw/drivers/i2s: Add I2S driver for STM32F4 family

2020-04-14 Thread jerzy
This is an automated email from the ASF dual-hosted git repository.

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

commit f54786e60885eba55a34c4a4dc7a971bf2323ab7
Author: Jerzy Kasenberg 
AuthorDate: Fri Mar 27 13:21:12 2020 +0100

hw/drivers/i2s: Add I2S driver for STM32F4 family

Code implements I2S driver for STM32F4xx MCUs that have it.
---
 .../i2s_stm32f4/include/i2s_stm32f4/i2s_stm32f4.h  | 274 +++
 .../include/i2s_stm32f4/stm32_pin_cfg.h|  41 +
 hw/drivers/i2s/i2s_stm32f4/pkg.yml |  29 +
 hw/drivers/i2s/i2s_stm32f4/src/i2s_stm32f4.c   | 855 +
 hw/drivers/i2s/i2s_stm32f4/syscfg.yml  |  19 +
 5 files changed, 1218 insertions(+)

diff --git a/hw/drivers/i2s/i2s_stm32f4/include/i2s_stm32f4/i2s_stm32f4.h 
b/hw/drivers/i2s/i2s_stm32f4/include/i2s_stm32f4/i2s_stm32f4.h
new file mode 100644
index 000..8e1fc87
--- /dev/null
+++ b/hw/drivers/i2s/i2s_stm32f4/include/i2s_stm32f4/i2s_stm32f4.h
@@ -0,0 +1,274 @@
+/*
+ * 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 _I2S_STM32_H
+#define _I2S_STM32_H
+
+#include 
+#include 
+
+struct i2s;
+struct i2s_cfg;
+struct stm32_spi_cfg;
+
+struct stm32_i2s_pins {
+stm32_pin_cfg_t ck_pin;
+stm32_pin_cfg_t ws_pin;
+stm32_pin_cfg_t sd_pin;
+stm32_pin_cfg_t ext_sd_pin;
+};
+
+#define I2S_PIN(n, port, pin) &(I2S ## n ## _P ## port ## pin)
+#define I2S_CK_PIN(n, port, pin) &(I2S ## n ## _CK_P ## port ## pin)
+#define I2S_WS_PIN(n, port, pin) &(I2S ## n ## _WS_P ## port ## pin)
+#define I2S_SD_PIN(n, port, pin) &(I2S ## n ## _SD_P ## port ## pin)
+
+struct stm32_dma_cfg {
+uint8_t dma_num;
+IRQn_Type dma_stream_irq;
+DMA_Stream_TypeDef *dma_stream;
+uint32_t dma_channel;
+};
+
+struct i2s_cfg {
+uint32_t mode;
+uint32_t standard;
+uint32_t data_format;
+uint32_t sample_rate;
+
+struct i2s_buffer_pool *pool;
+const struct stm32_spi_cfg *spi_cfg;
+const struct stm32_dma_cfg *dma_cfg;
+const struct stm32_dma_cfg *dma_i2sext_cfg;
+struct stm32_i2s_pins pins;
+};
+
+#define SPI_CFG(n) &(spi ## n ## _cfg)
+
+struct stm32_i2s {
+I2S_HandleTypeDef hi2s;
+DMA_HandleTypeDef *hdma_spi;
+DMA_HandleTypeDef *hdma_i2sext;
+
+struct i2s *i2s;
+struct i2s_sample_buffer *active_buffer;
+};
+
+#define DMA_CFG(dma, ch, st, name) &(name ## _stream ## st ## _channel ## ch)
+
+#define DMA_STREAM_DECLARE(dma, ch, st, name) \
+extern const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch
+
+DMA_STREAM_DECLARE(1, 0, 0, spi3_rx);
+DMA_STREAM_DECLARE(1, 0, 1, i2c1_tx);
+DMA_STREAM_DECLARE(1, 0, 2, spi3_rx);
+DMA_STREAM_DECLARE(1, 0, 3, spi2_rx);
+DMA_STREAM_DECLARE(1, 0, 4, spi2_tx);
+DMA_STREAM_DECLARE(1, 0, 5, spi3_tx);
+DMA_STREAM_DECLARE(1, 0, 7, spi3_tx);
+DMA_STREAM_DECLARE(1, 1, 0, i2c1_rx);
+DMA_STREAM_DECLARE(1, 1, 1, i2c3_rx);
+DMA_STREAM_DECLARE(1, 1, 2, tim7_up);
+DMA_STREAM_DECLARE(1, 1, 4, tim7_up);
+DMA_STREAM_DECLARE(1, 1, 5, i2c1_rx);
+DMA_STREAM_DECLARE(1, 1, 6, i2c1_tx);
+DMA_STREAM_DECLARE(1, 1, 7, i2c1_tx);
+DMA_STREAM_DECLARE(1, 2, 0, tim4_ch1);
+DMA_STREAM_DECLARE(1, 2, 2, i2s3_ext_rx);
+DMA_STREAM_DECLARE(1, 2, 3, tim4_ch2);
+DMA_STREAM_DECLARE(1, 2, 4, i2s2_ext_tx);
+DMA_STREAM_DECLARE(1, 2, 5, i2s3_ext_tx);
+DMA_STREAM_DECLARE(1, 2, 6, tim4_up);
+DMA_STREAM_DECLARE(1, 2, 7, tim4_ch3);
+DMA_STREAM_DECLARE(1, 3, 0, i2s3_ext_rx);
+DMA_STREAM_DECLARE(1, 3, 1, tim2_up);
+DMA_STREAM_DECLARE(1, 3, 1, tim2_ch3);
+DMA_STREAM_DECLARE(1, 3, 2, i2c3_rx);
+DMA_STREAM_DECLARE(1, 3, 3, i2s2_ext_rx);
+DMA_STREAM_DECLARE(1, 3, 4, i2c3_tx);
+DMA_STREAM_DECLARE(1, 3, 5, tim2_ch1);
+DMA_STREAM_DECLARE(1, 3, 6, tim2_ch2);
+DMA_STREAM_DECLARE(1, 3, 6, tim2_ch4);
+DMA_STREAM_DECLARE(1, 3, 7, tim2_up);
+DMA_STREAM_DECLARE(1, 3, 7, tim2_ch4);
+DMA_STREAM_DECLARE(1, 4, 0, uart5_rx);
+DMA_STREAM_DECLARE(1, 4, 1, usart3_rx);
+DMA_STREAM_DECLARE(1, 4, 2, uart4_rx);
+DMA_STREAM_DECLARE(1, 4, 3, usart3_tx);
+DMA_STREAM_DECLARE(1, 4, 4, uart4_tx);
+DMA_STREAM_DECLARE(1, 4, 5, usart2_rx);
+DMA_STREAM_DECLARE(1, 4, 6, usart2_tx);
+DMA_STREAM_DECLARE(1, 4, 7, uart5_tx);
+
+DMA_STREAM_DECLARE(2, 0, 0, 

[mynewt-core] 02/03: hw/drivers/i2s: Add I2S device implementation

2020-04-14 Thread jerzy
This is an automated email from the ASF dual-hosted git repository.

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

commit 6eac7e5002a49dcbfc695fba3471bee610a854f9
Author: Jerzy Kasenberg 
AuthorDate: Fri Mar 27 13:17:56 2020 +0100

hw/drivers/i2s: Add I2S device implementation

This adds common code for I2S device handling.
---
 hw/drivers/i2s/src/i2s.c | 378 +++
 1 file changed, 378 insertions(+)

diff --git a/hw/drivers/i2s/src/i2s.c b/hw/drivers/i2s/src/i2s.c
new file mode 100644
index 000..4d430bd
--- /dev/null
+++ b/hw/drivers/i2s/src/i2s.c
@@ -0,0 +1,378 @@
+/*
+ * 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.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+/* Function called from i2s_open/os_dev_open */
+static int
+i2s_open_handler(struct os_dev *dev, uint32_t timout, void *arg)
+{
+struct i2s *i2s;
+struct i2s_client *client = (struct i2s_client *)arg;
+struct i2s_sample_buffer *buffer;
+
+if (dev->od_flags & OS_DEV_F_STATUS_OPEN) {
+return OS_EBUSY;
+}
+
+i2s = (struct i2s *)dev;
+
+assert(client == NULL ||
+   (client->sample_buffer_ready_cb != NULL &&
+client->state_changed_cb != NULL));
+i2s->client = client;
+if (client && client->sample_rate) {
+i2s->sample_rate = client->sample_rate;
+}
+
+if (i2s->direction == I2S_IN) {
+while (NULL != (buffer = i2s_buffer_get(i2s, 0))) {
+i2s_buffer_put(i2s, buffer);
+}
+} else {
+i2s_start(i2s);
+}
+
+return OS_OK;
+}
+
+/* Function called from i2s_close/os_dev_close */
+static int
+i2s_close_handler(struct os_dev *dev)
+{
+struct i2s *i2s;
+
+i2s = (struct i2s *)dev;
+i2s_stop(i2s);
+i2s->client = NULL;
+
+return OS_OK;
+}
+
+static int
+i2s_suspend_handler(struct os_dev *dev, os_time_t timeout, int arg)
+{
+return i2s_driver_suspend((struct i2s *)dev, timeout, arg);
+}
+
+static int
+i2s_resume_handler(struct os_dev *dev)
+{
+return i2s_driver_resume((struct i2s *)dev);
+}
+
+static void
+i2s_add_to_user_queue(struct i2s *i2s, struct i2s_sample_buffer *buffer)
+{
+STAILQ_INSERT_TAIL(>user_queue, buffer, next_buffer);
+os_sem_release(>user_queue_buffer_count);
+}
+
+static void
+i2s_add_to_driver_queue(struct i2s *i2s, struct i2s_sample_buffer *buffer)
+{
+STAILQ_INSERT_TAIL(>driver_queue, buffer, next_buffer);
+if (i2s->state != I2S_STATE_STOPPED) {
+i2s_driver_buffer_queued(i2s);
+}
+}
+
+static void
+i2s_buffers_from_pool(struct i2s *i2s, struct i2s_buffer_pool *pool)
+{
+int i;
+int sr;
+struct i2s_sample_buffer *buffers;
+uintptr_t sample_data;
+uint32_t samples_per_buffer;
+
+if (i2s->direction != I2S_IN && pool != NULL) {
+os_sem_init(>user_queue_buffer_count, pool->buffer_count);
+} else {
+os_sem_init(>user_queue_buffer_count, 0);
+}
+
+i2s->buffer_pool = pool;
+if (pool == NULL) {
+return;
+}
+
+buffers = (struct i2s_sample_buffer *)pool->buffers;
+
+samples_per_buffer = pool->buffer_size / i2s->sample_size_in_bytes;
+sample_data = (uintptr_t)[pool->buffer_count];
+
+for (i = 0; i < pool->buffer_count; ++i) {
+buffers[i].capacity = samples_per_buffer;
+buffers[i].sample_data = (void *)sample_data;
+buffers[i].sample_count = 0;
+sample_data += pool->buffer_size;
+
+OS_ENTER_CRITICAL(sr);
+if (i2s->direction == I2S_IN) {
+i2s_add_to_driver_queue(i2s, [i]);
+} else {
+STAILQ_INSERT_TAIL(>user_queue, [i], next_buffer);
+}
+OS_EXIT_CRITICAL(sr);
+}
+}
+
+int
+i2s_init(struct i2s *i2s, struct i2s_buffer_pool *pool)
+{
+STAILQ_INIT(>driver_queue);
+STAILQ_INIT(>user_queue);
+
+i2s->state = I2S_STATE_STOPPED;
+
+i2s_buffers_from_pool(i2s, pool);
+
+i2s->dev.od_handlers.od_open = i2s_open_handler;
+i2s->dev.od_handlers.od_close = i2s_close_handler;
+i2s->dev.od_handlers.od_suspend = i2s_suspend_handler;
+i2s->dev.od_handlers.od_resume = i2s_resume_handler;
+
+return 

[mynewt-core] branch master updated (40fb2d6 -> f54786e)

2020-04-14 Thread jerzy
This is an automated email from the ASF dual-hosted git repository.

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


from 40fb2d6  stm32f4: Add I2SPLL configuration
 new bfe7d7f  hw/drivers/i2s: Add I2S API
 new 6eac7e5  hw/drivers/i2s: Add I2S device implementation
 new f54786e  hw/drivers/i2s: Add I2S driver for STM32F4 family

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 hw/drivers/i2s/README.md   | 224 ++
 .../i2s_stm32f4/include/i2s_stm32f4/i2s_stm32f4.h  | 274 +++
 .../include/i2s_stm32f4/stm32_pin_cfg.h}   |  16 +-
 .../{pwm/pwm_da1469x => i2s/i2s_stm32f4}/pkg.yml   |   8 +-
 hw/drivers/i2s/i2s_stm32f4/src/i2s_stm32f4.c   | 855 +
 .../drivers/i2s/i2s_stm32f4}/syscfg.yml|   2 +-
 hw/drivers/i2s/include/i2s/i2s.h   | 270 +++
 .../i2s/include/i2s/i2s_driver.h}  |  36 +-
 hw/drivers/{hash => i2s}/pkg.yml   |   7 +-
 hw/drivers/i2s/src/i2s.c   | 378 +
 10 files changed, 2037 insertions(+), 33 deletions(-)
 create mode 100644 hw/drivers/i2s/README.md
 create mode 100644 hw/drivers/i2s/i2s_stm32f4/include/i2s_stm32f4/i2s_stm32f4.h
 copy hw/{mcu/dialog/da1469x/src/da1469x_priv.h => 
drivers/i2s/i2s_stm32f4/include/i2s_stm32f4/stm32_pin_cfg.h} (79%)
 mode change 100755 => 100644
 copy hw/drivers/{pwm/pwm_da1469x => i2s/i2s_stm32f4}/pkg.yml (86%)
 create mode 100644 hw/drivers/i2s/i2s_stm32f4/src/i2s_stm32f4.c
 copy {compiler/arm-none-eabi-m3 => hw/drivers/i2s/i2s_stm32f4}/syscfg.yml (98%)
 create mode 100644 hw/drivers/i2s/include/i2s/i2s.h
 copy hw/{mcu/stm/stm32_common/include/stm32_common/stm32_hal.h => 
drivers/i2s/include/i2s/i2s_driver.h} (52%)
 copy hw/drivers/{hash => i2s}/pkg.yml (90%)
 create mode 100644 hw/drivers/i2s/src/i2s.c



[mynewt-core] 01/03: hw/drivers/i2s: Add I2S API

2020-04-14 Thread jerzy
This is an automated email from the ASF dual-hosted git repository.

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

commit bfe7d7f7527e656d9f4b448f15c14d71051fbc7f
Author: Jerzy Kasenberg 
AuthorDate: Fri Mar 27 10:24:53 2020 +0100

hw/drivers/i2s: Add I2S API

This adds API that can be used to stream
data through I2S interface.
---
 hw/drivers/i2s/README.md| 224 ++
 hw/drivers/i2s/include/i2s/i2s.h| 270 
 hw/drivers/i2s/include/i2s/i2s_driver.h |  43 +
 hw/drivers/i2s/pkg.yml  |  27 
 4 files changed, 564 insertions(+)

diff --git a/hw/drivers/i2s/README.md b/hw/drivers/i2s/README.md
new file mode 100644
index 000..492234e
--- /dev/null
+++ b/hw/drivers/i2s/README.md
@@ -0,0 +1,224 @@
+
+
+# I2S interface (Inter-IC Sound)
+
+# Overview
+
+Inter-IC Sound is interface for sending digital audio data.
+
+Data send to and received from I2S device is grouped in sample buffers.
+When user code wants to send audio data to I2S device (speaker), it first
+request buffer from I2S device, fills it with samples and send it back to the
+device. When data is transmitted out of the system to external IC, buffer
+become available to the user core and can be obtained again.
+
+For input devices like digital microphone, correctly configured i2s device has
+several buffers that are filled with incoming data.
+User code requests sample buffer and gets buffers filled with data, user code
+can process this data and must return buffer back to the i2s device.
+
+General flow is to get buffers from i2s device fill them for outgoing 
transmission
+(or interpret samples for incoming transmission) and send buffer back to the 
device. 
+
+# API
+
+ Device creation
+
+```i2s_create(i2s, "name", cfg)```
+
+Function creates I2S device with specified name and configuration.
+Note that cfg argument is not defined in **api.h** but by driver package that 
must be present in build.
+ Device access
+
+`i2s_open("dev_name", timout, client)`
+
+Opens I2S interface. It can be input (microphone) or output (speaker) 
interface.
+
+`i2s_close()`
+
+Closes I2S interface, opened with `i2s_open()`
+
+ Start/stop device operation
+
+`i2s_start()`
+
+Starts I2S device operation, for input, device starts collecting samples to 
internal buffers.
+For output, samples are streamed out of device if they are already sent to 
device with `i2s_buffer_put()`.
+* NOTE: this function must be called explicitly for input i2s device.
+
+`i2s_stop()`
+
+Stops sending or receiving samples. 
+
+ High level read and write
+It is possible to use simple blocking functions to read from I2S input device 
or write to I2S output device.
+
+`i2s_write(i2s, data, size)`
+
+This function write user provided data to the output I2S device. It returns 
number of bytes written.
+Return value will in most cases will be less then requested since data is 
written in internal buffer size chunks.
+
+`i2s_read(i2s, data_buffer, size)`
+Read data from microphone to user provided buffer. Function returns actual 
number of bytes read. Return value
+may be less then size because it will most likely be truncated to internal 
buffer size. 
+
+ Sample buffers
+
+I2S software device needs at least 2 buffers for seamless sample streaming.
+
+`i2s_buffer_get()`
+
+Returns a buffer with samples taken from the I2S input device.
+For output device it will return a buffer that should be filled with samples 
by user code and then passed back to the device.
+
+`i2s_buffer_put()`
+
+Sends sample to output I2S device. For input device it simply returns buffer 
so it can be reused for next
+incoming samples.
+
+- For output device user code gets a buffers from the i2s device with 
`i2s_buffer_get()`, then fills the buffer with
+new samples, then sends the buffer with samples back to the device using 
`i2s_buffer_put()`.
+- For input device after user code starts sampling operation calling 
`i2s_start()` it must wait for collected samples.
+Simplest way to wait is to call `i2s_buffer_get(i2s, OS_WAIT_FOREVER)` that 
will block till samples are available
+and returns buffer full of data.
+Once application does something with the samples it should immediately call 
`i2s_buffer_put()` to return buffer back
+to the driver so next samples can be collected.
+- It is possible to have I2S created without internal buffers. In that case 
user code can create buffers and pass
+them to the driver using `i2s_buffer_put()`. Such buffers would then be 
available when processed by the driver and
+could be taken back with `i2s_buffer_get()`. If user provided callback 
function `sample_buffer_ready_cb` is called
+from interrupt context and return value other then 0, buffer will not be put 
in internal queue and can not be obtained
+with `i2s_buffer_get()`.
+
+Buffer pool can be created by `I2S_BUFFER_POOL_DEF()` macro
+
+

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2268: Add I2S driver for stm32f4

2020-04-14 Thread GitBox
apache-mynewt-bot commented on issue #2268: Add I2S driver for stm32f4
URL: https://github.com/apache/mynewt-core/pull/2268#issuecomment-613667726
 
 
   
   
   
   ## 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2267: I2S API for mynewt

2020-04-14 Thread GitBox
apache-mynewt-bot commented on issue #2267: I2S API for mynewt
URL: https://github.com/apache/mynewt-core/pull/2267#issuecomment-613661926
 
 
   
   
   
   ## 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] kasjer opened a new pull request #2268: Add I2S driver for stm32f4

2020-04-14 Thread GitBox
kasjer opened a new pull request #2268: Add I2S driver for stm32f4
URL: https://github.com/apache/mynewt-core/pull/2268
 
 
   This PR adds I2S driver for STM32F4 MCU.
   First 2 commits are part of #2267.


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] kasjer opened a new pull request #2267: I2S API for mynewt

2020-04-14 Thread GitBox
kasjer opened a new pull request #2267: I2S API for mynewt
URL: https://github.com/apache/mynewt-core/pull/2267
 
 
   This introduces API for accessing I2S devices.
   API handles input, output and duplex mode.
   Further PRs with drivers for different MCU will follow.


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-mcumgr] de-nordic commented on issue #77: zephyr: Convert k_timer calls to new API

2020-04-14 Thread GitBox
de-nordic commented on issue #77: zephyr: Convert k_timer calls to new API
URL: https://github.com/apache/mynewt-mcumgr/pull/77#issuecomment-613455448
 
 
   Thanks for reviews and merge.


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-mcumgr] vrahane commented on issue #53: Get rid of LOG_VERSION 2 based on a recent discussion

2020-04-14 Thread GitBox
vrahane commented on issue #53: Get rid of LOG_VERSION 2 based on a recent 
discussion
URL: https://github.com/apache/mynewt-mcumgr/issues/53#issuecomment-613412409
 
 
   Fixed as part of https://github.com/apache/mynewt-mcumgr/pull/55


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-mcumgr] vrahane closed issue #53: Get rid of LOG_VERSION 2 based on a recent discussion

2020-04-14 Thread GitBox
vrahane closed issue #53: Get rid of LOG_VERSION 2 based on a recent discussion
URL: https://github.com/apache/mynewt-mcumgr/issues/53
 
 
   


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] rymanluk commented on a change in pull request #790: nimble/store: Fix nimble store behavior when CCCDs exceed static defined limit

2020-04-14 Thread GitBox
rymanluk commented on a change in pull request #790: nimble/store: Fix nimble 
store behavior when CCCDs exceed static defined limit
URL: https://github.com/apache/mynewt-nimble/pull/790#discussion_r407949256
 
 

 ##
 File path: nimble/host/src/ble_store_util.c
 ##
 @@ -230,16 +372,24 @@ ble_store_util_delete_oldest_peer(void)
 int
 ble_store_util_status_rr(struct ble_store_status_event *event, void *arg)
 {
+int rc = BLE_HS_EUNKNOWN;
 switch (event->event_code) {
 case BLE_STORE_EVENT_OVERFLOW:
 switch (event->overflow.obj_type) {
-case BLE_STORE_OBJ_TYPE_OUR_SEC:
-case BLE_STORE_OBJ_TYPE_PEER_SEC:
-case BLE_STORE_OBJ_TYPE_CCCD:
-return ble_gap_unpair_oldest_peer();
-
-default:
-return BLE_HS_EUNKNOWN;
+case BLE_STORE_OBJ_TYPE_OUR_SEC:
+case BLE_STORE_OBJ_TYPE_PEER_SEC:
+return ble_gap_unpair_oldest_peer();
+case BLE_STORE_OBJ_TYPE_CCCD:
+/* Try to remove unbonded CCCDs first */
+if ((rc = ble_store_clean_old_cccds((void *) 
>overflow.value->cccd.peer_addr)) == BLE_HS_ENOENT) {
 
 Review comment:
   @h2zero actually CCCD's do get stored when devices are bonded.  That happens 
after pairing is completed and both devices have set bonding flag.
   
   If you do see an issue that CCCDs are stored but device is not actually 
bonded, please report it as an issue.


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-mcumgr] branch master updated: zephyr: Convert k_timer calls to new API (#77)

2020-04-14 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-mcumgr.git


The following commit(s) were added to refs/heads/master by this push:
 new 40341ab  zephyr: Convert k_timer calls to new API (#77)
40341ab is described below

commit 40341abeeac9c93b4aa59c20ee183376c7920d7e
Author: de-nordic <56024351+de-nor...@users.noreply.github.com>
AuthorDate: Tue Apr 14 14:22:41 2020 +0200

zephyr: Convert k_timer calls to new API (#77)

The new API does not accept integer types for timeouts, instead it uses
k_timeout_t structure.

Signed-off-by: Dominik Ermel 
---
 cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c 
b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
index b650259..e6ac44d 100644
--- a/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
+++ b/cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
@@ -91,6 +91,6 @@ zephyr_os_mgmt_reset_cb(struct k_timer *timer)
 int
 os_mgmt_impl_reset(unsigned int delay_ms)
 {
-k_timer_start(_os_mgmt_reset_timer, K_MSEC(delay_ms), 0);
+k_timer_start(_os_mgmt_reset_timer, K_MSEC(delay_ms), K_NO_WAIT);
 return 0;
 }



[GitHub] [mynewt-mcumgr] vrahane merged pull request #77: zephyr: Convert k_timer calls to new API

2020-04-14 Thread GitBox
vrahane merged pull request #77: zephyr: Convert k_timer calls to new API
URL: https://github.com/apache/mynewt-mcumgr/pull/77
 
 
   


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-mcumgr] de-nordic commented on a change in pull request #77: zephyr: Convert k_timer calls to new API

2020-04-14 Thread GitBox
de-nordic commented on a change in pull request #77: zephyr: Convert k_timer 
calls to new API
URL: https://github.com/apache/mynewt-mcumgr/pull/77#discussion_r408059921
 
 

 ##
 File path: cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
 ##
 @@ -34,6 +34,8 @@ static K_TIMER_DEFINE(zephyr_os_mgmt_reset_timer,
 
 K_WORK_DEFINE(zephyr_os_mgmt_reset_work, zephyr_os_mgmt_reset_work_handler);
 
+
 
 Review comment:
   I do not know where that came from  :(


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-mcumgr] nvlsianpu commented on a change in pull request #77: zephyr: Convert k_timer calls to new API

2020-04-14 Thread GitBox
nvlsianpu commented on a change in pull request #77: zephyr: Convert k_timer 
calls to new API
URL: https://github.com/apache/mynewt-mcumgr/pull/77#discussion_r408056661
 
 

 ##
 File path: cmd/os_mgmt/port/zephyr/src/zephyr_os_mgmt.c
 ##
 @@ -34,6 +34,8 @@ static K_TIMER_DEFINE(zephyr_os_mgmt_reset_timer,
 
 K_WORK_DEFINE(zephyr_os_mgmt_reset_work, zephyr_os_mgmt_reset_work_handler);
 
+
 
 Review comment:
   accidental new lines?


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 commented on issue #783: Make ble_gap_rx_l2cap_update_req() behave like ble_gap_rx_param_req()

2020-04-14 Thread GitBox
andrzej-kaczmarek commented on issue #783: Make ble_gap_rx_l2cap_update_req() 
behave like ble_gap_rx_param_req()
URL: https://github.com/apache/mynewt-nimble/pull/783#issuecomment-613356581
 
 
   if we are going to allow adjusting min/max interval by application, we also 
need to make sure that selected range is within original range, otherwise we 
violate spec as @rymanluk said before. adding this extra check would both 
resolve original issue and would not make our host accept parameters that 
violate spec.


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] rymanluk commented on issue #783: Make ble_gap_rx_l2cap_update_req() behave like ble_gap_rx_param_req()

2020-04-14 Thread GitBox
rymanluk commented on issue #783: Make ble_gap_rx_l2cap_update_req() behave 
like ble_gap_rx_param_req()
URL: https://github.com/apache/mynewt-nimble/pull/783#issuecomment-613311714
 
 
   @zacwbond Actually on the second thought, why not to allow application to 
fine tune that parameters. It is up to application to behave correctly here.
   
   If there will be no voices against that I will merge it. Thanks


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] rymanluk commented on a change in pull request #790: nimble/store: Fix nimble store behavior when CCCDs exceed static defined limit

2020-04-14 Thread GitBox
rymanluk commented on a change in pull request #790: nimble/store: Fix nimble 
store behavior when CCCDs exceed static defined limit
URL: https://github.com/apache/mynewt-nimble/pull/790#discussion_r407949256
 
 

 ##
 File path: nimble/host/src/ble_store_util.c
 ##
 @@ -230,16 +372,24 @@ ble_store_util_delete_oldest_peer(void)
 int
 ble_store_util_status_rr(struct ble_store_status_event *event, void *arg)
 {
+int rc = BLE_HS_EUNKNOWN;
 switch (event->event_code) {
 case BLE_STORE_EVENT_OVERFLOW:
 switch (event->overflow.obj_type) {
-case BLE_STORE_OBJ_TYPE_OUR_SEC:
-case BLE_STORE_OBJ_TYPE_PEER_SEC:
-case BLE_STORE_OBJ_TYPE_CCCD:
-return ble_gap_unpair_oldest_peer();
-
-default:
-return BLE_HS_EUNKNOWN;
+case BLE_STORE_OBJ_TYPE_OUR_SEC:
+case BLE_STORE_OBJ_TYPE_PEER_SEC:
+return ble_gap_unpair_oldest_peer();
+case BLE_STORE_OBJ_TYPE_CCCD:
+/* Try to remove unbonded CCCDs first */
+if ((rc = ble_store_clean_old_cccds((void *) 
>overflow.value->cccd.peer_addr)) == BLE_HS_ENOENT) {
 
 Review comment:
   @h2zero actually CCCD's do get stored when devices are bonded.  That happens 
after pairing is completed and both devices have bonding flag in set. 
   
   If you do see an issue that CCCDs are stored but device is not actually 
bonded, please report it as an issue.


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] kasjer merged pull request #2265: stm32f4: Add I2SPLL configuration

2020-04-14 Thread GitBox
kasjer merged pull request #2265: stm32f4: Add I2SPLL configuration
URL: https://github.com/apache/mynewt-core/pull/2265
 
 
   


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: stm32f4: Add I2SPLL configuration

2020-04-14 Thread jerzy
This is an automated email from the ASF dual-hosted git repository.

jerzy 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 40fb2d6  stm32f4: Add I2SPLL configuration
40fb2d6 is described below

commit 40fb2d65dc5ce38f1d8da9e06aab8a58c1e54b43
Author: Jerzy Kasenberg 
AuthorDate: Fri Apr 10 15:36:03 2020 +0200

stm32f4: Add I2SPLL configuration

I2SPLL clock configuration was missing so I2S peripheral
would not work without user code initialization.
Now I2SPLL configuration is added to syscfg, and PLL will be
configured when those values are set in BSP.
---
 hw/mcu/stm/stm32f4xx/src/clock_stm32f4xx.c | 21 +
 hw/mcu/stm/stm32f4xx/syscfg.yml| 12 
 2 files changed, 33 insertions(+)

diff --git a/hw/mcu/stm/stm32f4xx/src/clock_stm32f4xx.c 
b/hw/mcu/stm/stm32f4xx/src/clock_stm32f4xx.c
index 7efc507..e3602cf 100644
--- a/hw/mcu/stm/stm32f4xx/src/clock_stm32f4xx.c
+++ b/hw/mcu/stm/stm32f4xx/src/clock_stm32f4xx.c
@@ -42,6 +42,23 @@
 #error "At least one of HSE or HSI clock source must be enabled"
 #endif
 
+#if MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLM) && MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLN) 
&& MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLR)
+static void
+config_i2s_pll(void)
+{
+RCC_PeriphCLKInitTypeDef i2s_clock_init;
+
+i2s_clock_init.PeriphClockSelection = RCC_PERIPHCLK_PLLI2S;
+i2s_clock_init.PLLI2S.PLLI2SM = MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLM);
+i2s_clock_init.PLLI2S.PLLI2SN = MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLN);
+i2s_clock_init.PLLI2S.PLLI2SR = MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLR);
+i2s_clock_init.TIMPresSelection = 0;
+i2s_clock_init.RTCClockSelection = 0;
+
+HAL_RCCEx_PeriphCLKConfig(_clock_init);
+}
+#endif
+
 void
 SystemClock_Config(void)
 {
@@ -251,6 +268,10 @@ SystemClock_Config(void)
 }
 #endif
 
+#if MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLM) && MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLN) 
&& MYNEWT_VAL(STM32_CLOCK_PLLI2S_PLLR)
+config_i2s_pll();
+#endif
+
 #if PREFETCH_ENABLE
 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || \
 defined(STM32F417xx)
diff --git a/hw/mcu/stm/stm32f4xx/syscfg.yml b/hw/mcu/stm/stm32f4xx/syscfg.yml
index 48ab9a3..e6d1367 100644
--- a/hw/mcu/stm/stm32f4xx/syscfg.yml
+++ b/hw/mcu/stm/stm32f4xx/syscfg.yml
@@ -79,6 +79,18 @@ syscfg.defs:
 description: PLL config R parameter
 value: 0
 
+STM32_CLOCK_PLLI2S_PLLM:
+description: I2SPLL config M parameter
+value: 0
+
+STM32_CLOCK_PLLI2S_PLLN:
+description: I2SPLL config N parameter
+value: 0
+
+STM32_CLOCK_PLLI2S_PLLR:
+description: I2SPLL config R parameter
+value: 0
+
 STM32_CLOCK_ENABLE_OVERDRIVE:
 description: Turn on over-drive mode (reach higher clock rates)
 value: 0



[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2266: - Added a feature comparison table for supported BSPs

2020-04-14 Thread GitBox
apache-mynewt-bot commented on issue #2266: - Added a feature comparison table 
for supported BSPs
URL: https://github.com/apache/mynewt-core/pull/2266#issuecomment-613249010
 
 
   
   
   
   ## 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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [mynewt-core] chrisdutz opened a new pull request #2266: - Added a feature comparison table for supported BSPs

2020-04-14 Thread GitBox
chrisdutz opened a new pull request #2266: - Added a feature comparison table 
for supported BSPs
URL: https://github.com/apache/mynewt-core/pull/2266
 
 
   


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