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 2020/03/27 13:57:01 UTC
[GitHub] [mynewt-core] kasjer opened a new pull request #2252: [RFC] I2S API
and driver for STM32 MCUs
kasjer opened a new pull request #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252
I2S interface is present on several supported boards.
This introduces API for I2S input and output devices.
Driver for STM32 MCU is also included.
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2252:
[RFC] I2S API and driver for STM32 and NRF52 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2252: [RFC] I2S API and driver for STM32 and NRF52 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-610248314
<!-- 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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-610248314
<!-- 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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 and NRF52 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 and NRF52 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-612095994
<!-- 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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-606714969
<!-- 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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605041342
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/i2s_stm32/include/i2s_stm32/i2s_stm32.h
<details>
```diff
@@ -14,10 +14,10 @@
stm32_pin_cfg_t 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)
+#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;
@@ -38,7 +38,7 @@
struct stm32_i2s_pins pins;
};
-#define SPI_CFG(n) &(spi##n##_cfg)
+#define SPI_CFG(n) &(spi ## n ## _cfg)
struct stm32_i2s {
I2S_HandleTypeDef hi2s;
@@ -48,10 +48,10 @@
struct i2s_sample_buffer *active_buffer;
};
-#define DMA_CFG(dma, ch, st, name) &(name##_stream##st##_channel##ch)
+#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
+ 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);
@@ -159,7 +159,7 @@
DMA_STREAM_DECLARE(2, 7, 7, tim8_com);
#define SPI_CFG_DECLARE(n) \
-extern struct stm32_spi_cfg spi##n##_cfg;
+ extern struct stm32_spi_cfg spi ## n ## _cfg;
SPI_CFG_DECLARE(1);
SPI_CFG_DECLARE(2);
@@ -168,13 +168,13 @@
SPI_CFG_DECLARE(5);
#define I2S_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _P ## port ## pin;
#define I2S_CK_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_CK_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _CK_P ## port ## pin;
#define I2S_WS_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_WS_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _WS_P ## port ## pin;
#define I2S_SD_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_SD_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _SD_P ## port ## pin;
/* I2S1 Possible CK pins */
I2S_CK_PIN_DECLARE(1, A, 5)
```
</details>
#### hw/drivers/i2s/i2s_stm32/src/i2s_stm32.c
<details>
```diff
@@ -403,52 +403,52 @@
}
#define I2S_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
#define I2S_CK_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_CK_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _CK_P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
#define I2S_WS_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_WS_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _WS_P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
#define I2S_SD_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_SD_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _SD_P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
/* I2S1 Possible CK pins */
I2S_CK_PIN_DEFINE(1, A, 5, GPIO_AF5_SPI1);
@@ -540,12 +540,12 @@
I2S_SD_PIN_DEFINE(5, E, 14, GPIO_AF6_SPI5);
#define DMA_STREAM_DEFINE(dma, ch, st, name) \
-const struct stm32_dma_cfg name##_stream##st##_channel##ch = { \
- dma, \
- DMA##dma##_Stream##st##_IRQn, \
- DMA##dma##_Stream##st, \
- DMA_CHANNEL_##ch, \
-}
+ const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch = { \
+ dma, \
+ DMA ## dma ## _Stream ## st ## _IRQn, \
+ DMA ## dma ## _Stream ## st, \
+ DMA_CHANNEL_ ## ch, \
+ }
DMA_STREAM_DEFINE(1, 0, 0, spi3_rx);
DMA_STREAM_DEFINE(1, 0, 1, i2c1_tx);
@@ -664,15 +664,15 @@
DMA_STREAM_DEFINE(2, 7, 7, tim8_com);
#define SPI_CFG_DEFINE(n) \
-struct stm32_spi_cfg spi##n##_cfg = { \
- .spi_num = n, \
- .spi = SPI##n, \
- .i2s_irq = SPI##n##_IRQn, \
- .driver_data = &stm32_i2s##n, \
- .irq_handler = i2s##n##_irq_handler, \
- .dma_handler = i2s##n##_dma_stream_irq_handler, \
- .enable_clock = i2s##n##_clock_enable, \
-};
+ struct stm32_spi_cfg spi ## n ## _cfg = { \
+ .spi_num = n, \
+ .spi = SPI ## n, \
+ .i2s_irq = SPI ## n ## _IRQn, \
+ .driver_data = &stm32_i2s ## n, \
+ .irq_handler = i2s ## n ## _irq_handler, \
+ .dma_handler = i2s ## n ## _dma_stream_irq_handler, \
+ .enable_clock = i2s ## n ## _clock_enable, \
+ };
#ifdef SPI1
SPI_CFG_DEFINE(1);
```
</details>
#### hw/drivers/i2s/include/i2s/i2s.h
<details>
```diff
@@ -64,12 +64,13 @@
* @param size single buffer size in bytes
*/
#define I2S_BUFFER_POOL_DEF(name, count, size) \
-static uint8_t _Alignas(struct i2s_buffer_pool) name##_buffers[(sizeof(struct i2s_sample_buffer[count])) + size * count]; \
-struct i2s_buffer_pool name = { \
- .buffer_size = size, \
- .buffer_count = count, \
- .buffers = (struct i2s_sample_buffer *)name##_buffers \
-};
+ static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer [count])) + \
+ size * count]; \
+ struct i2s_buffer_pool name = { \
+ .buffer_size = size, \
+ .buffer_count = count, \
+ .buffers = (struct i2s_sample_buffer *)name ## _buffers \
+ };
#define I2S_BUFFER_POOL(name) ((struct i2s_buffer_pool *)(&name))
enum i2s_state {
```
</details>
#### hw/drivers/i2s/src/i2s.c
<details>
```diff
@@ -154,7 +154,8 @@
}
int
-i2s_close(struct i2s *i2s) {
+i2s_close(struct i2s *i2s)
+{
return os_dev_close(&i2s->dev);
}
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605041018
<!-- license-bot -->
## RAT Report (2020-03-27 14:48:17)
## New files with unknown licenses
* <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/include/i2s_stm32/i2s_stm32.h">hw/drivers/i2s/i2s_stm32/include/i2s_stm32/i2s_stm32.h</a>
* <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/include/i2s_stm32/stm32_pin_cfg.h">hw/drivers/i2s/i2s_stm32/include/i2s_stm32/stm32_pin_cfg.h</a>
## 11 new files were excluded from check (.rat-excludes)
<details>
<summary>Detailed analysis</summary>
## New files in this PR
| License | File |
|---------|------|
| AL | <a href="https://github.com/apache/mynewt-core/blob/943194cddf2cb0b8a87540de4b667a3b2399f1c4/hw/drivers/i2s/pkg.yml">hw/drivers/i2s/pkg.yml</a> |
| AL | <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/pkg.yml">hw/drivers/i2s/i2s_stm32/pkg.yml</a> |
| AL | <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/syscfg.yml">hw/drivers/i2s/i2s_stm32/syscfg.yml</a> |
| ????? | <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/include/i2s_stm32/i2s_stm32.h">hw/drivers/i2s/i2s_stm32/include/i2s_stm32/i2s_stm32.h</a> |
| ????? | <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/include/i2s_stm32/stm32_pin_cfg.h">hw/drivers/i2s/i2s_stm32/include/i2s_stm32/stm32_pin_cfg.h</a> |
| AL | <a href="https://github.com/apache/mynewt-core/blob/199b4fdb8e1baa5188e2207c6189a9d3156e64af/hw/drivers/i2s/i2s_stm32/src/i2s_stm32.c">hw/drivers/i2s/i2s_stm32/src/i2s_stm32.c</a> |
| AL | <a href="https://github.com/apache/mynewt-core/blob/943194cddf2cb0b8a87540de4b667a3b2399f1c4/hw/drivers/i2s/include/i2s/i2s.h">hw/drivers/i2s/include/i2s/i2s.h</a> |
| AL | <a href="https://github.com/apache/mynewt-core/blob/943194cddf2cb0b8a87540de4b667a3b2399f1c4/hw/drivers/i2s/include/i2s/i2s_driver.h">hw/drivers/i2s/include/i2s/i2s_driver.h</a> |
| AL | <a href="https://github.com/apache/mynewt-core/blob/4d9d4436fe2d9ff5f9987bf0b36ca8fd51717096/hw/drivers/i2s/src/i2s.c">hw/drivers/i2s/src/i2s.c</a> |
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2252:
[RFC] I2S API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605108684
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/include/i2s/i2s.h
<details>
```diff
@@ -64,7 +64,7 @@
* @param size single buffer size in bytes
*/
#define I2S_BUFFER_POOL_DEF(name, count, size) \
- static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer[count])) + \
+ static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer [count])) + \
size * count]; \
struct i2s_buffer_pool name = { \
.buffer_size = size, \
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-609856939
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/i2s_stm32f4/src/i2s_stm32f4.c
<details>
```diff
@@ -469,7 +469,7 @@
}
}
#endif
- /* Fallthrough */
+ /* Fallthrough */
case HAL_I2S_STATE_READY:
assert(i2s_data->active_buffer == NULL);
i2s_data->active_buffer = i2s_driver_buffer_get(i2s);
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2252:
[RFC] I2S API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-606714969
<!-- 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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605072004
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/i2s_stm32/src/i2s_stm32.c
<details>
```diff
@@ -540,12 +540,12 @@
I2S_SD_PIN_DEFINE(5, E, 14, GPIO_AF6_SPI5);
#define DMA_STREAM_DEFINE(dma, ch, st, name) \
-const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch = { \
- dma, \
- DMA ## dma ## _Stream ## st ## _IRQn, \
- DMA ## dma ## _Stream ## st, \
- DMA_CHANNEL_ ## ch, \
-}
+ const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch = { \
+ dma, \
+ DMA ## dma ## _Stream ## st ## _IRQn, \
+ DMA ## dma ## _Stream ## st, \
+ DMA_CHANNEL_ ## ch, \
+ }
DMA_STREAM_DEFINE(1, 0, 0, spi3_rx);
DMA_STREAM_DEFINE(1, 0, 1, i2c1_tx);
```
</details>
#### hw/drivers/i2s/include/i2s/i2s.h
<details>
```diff
@@ -64,7 +64,8 @@
* @param size single buffer size in bytes
*/
#define I2S_BUFFER_POOL_DEF(name, count, size) \
- static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer[count])) + size * count]; \
+ static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer [count])) + \
+ size * count]; \
struct i2s_buffer_pool name = { \
.buffer_size = size, \
.buffer_count = count, \
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] kasjer commented on issue #2252: [RFC] I2S API and
driver for STM32 and NRF52 MCUs
Posted by GitBox <gi...@apache.org>.
kasjer commented on issue #2252: [RFC] I2S API and driver for STM32 and NRF52 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-613919209
PR split into few smaller ones
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2252:
[RFC] I2S API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605041342
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/i2s_stm32/include/i2s_stm32/i2s_stm32.h
<details>
```diff
@@ -14,10 +14,10 @@
stm32_pin_cfg_t 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)
+#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;
@@ -38,7 +38,7 @@
struct stm32_i2s_pins pins;
};
-#define SPI_CFG(n) &(spi##n##_cfg)
+#define SPI_CFG(n) &(spi ## n ## _cfg)
struct stm32_i2s {
I2S_HandleTypeDef hi2s;
@@ -48,10 +48,10 @@
struct i2s_sample_buffer *active_buffer;
};
-#define DMA_CFG(dma, ch, st, name) &(name##_stream##st##_channel##ch)
+#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
+ 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);
@@ -159,7 +159,7 @@
DMA_STREAM_DECLARE(2, 7, 7, tim8_com);
#define SPI_CFG_DECLARE(n) \
-extern struct stm32_spi_cfg spi##n##_cfg;
+ extern struct stm32_spi_cfg spi ## n ## _cfg;
SPI_CFG_DECLARE(1);
SPI_CFG_DECLARE(2);
@@ -168,13 +168,13 @@
SPI_CFG_DECLARE(5);
#define I2S_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _P ## port ## pin;
#define I2S_CK_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_CK_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _CK_P ## port ## pin;
#define I2S_WS_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_WS_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _WS_P ## port ## pin;
#define I2S_SD_PIN_DECLARE(n, port, pin) \
-extern const struct stm32_pin_cfg I2S##n##_SD_P##port##pin;
+ extern const struct stm32_pin_cfg I2S ## n ## _SD_P ## port ## pin;
/* I2S1 Possible CK pins */
I2S_CK_PIN_DECLARE(1, A, 5)
```
</details>
#### hw/drivers/i2s/i2s_stm32/src/i2s_stm32.c
<details>
```diff
@@ -403,52 +403,52 @@
}
#define I2S_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
#define I2S_CK_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_CK_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _CK_P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
#define I2S_WS_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_WS_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _WS_P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
#define I2S_SD_PIN_DEFINE(n, po, pi, af) \
-const struct stm32_pin_cfg I2S##n##_SD_P##po##pi = { \
- .pin = MCU_GPIO_PORT##po(pi), \
- .hal_init = { \
- .Pin = GPIO_PIN_##pi, \
- .Mode = GPIO_MODE_AF_PP, \
- .Pull = GPIO_NOPULL, \
- .Speed = GPIO_SPEED_FREQ_LOW, \
- .Alternate = af, \
- } \
-}
+ const struct stm32_pin_cfg I2S ## n ## _SD_P ## po ## pi = { \
+ .pin = MCU_GPIO_PORT ## po(pi), \
+ .hal_init = { \
+ .Pin = GPIO_PIN_ ## pi, \
+ .Mode = GPIO_MODE_AF_PP, \
+ .Pull = GPIO_NOPULL, \
+ .Speed = GPIO_SPEED_FREQ_LOW, \
+ .Alternate = af, \
+ } \
+ }
/* I2S1 Possible CK pins */
I2S_CK_PIN_DEFINE(1, A, 5, GPIO_AF5_SPI1);
@@ -540,12 +540,12 @@
I2S_SD_PIN_DEFINE(5, E, 14, GPIO_AF6_SPI5);
#define DMA_STREAM_DEFINE(dma, ch, st, name) \
-const struct stm32_dma_cfg name##_stream##st##_channel##ch = { \
- dma, \
- DMA##dma##_Stream##st##_IRQn, \
- DMA##dma##_Stream##st, \
- DMA_CHANNEL_##ch, \
-}
+ const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch = { \
+ dma, \
+ DMA ## dma ## _Stream ## st ## _IRQn, \
+ DMA ## dma ## _Stream ## st, \
+ DMA_CHANNEL_ ## ch, \
+ }
DMA_STREAM_DEFINE(1, 0, 0, spi3_rx);
DMA_STREAM_DEFINE(1, 0, 1, i2c1_tx);
@@ -664,15 +664,15 @@
DMA_STREAM_DEFINE(2, 7, 7, tim8_com);
#define SPI_CFG_DEFINE(n) \
-struct stm32_spi_cfg spi##n##_cfg = { \
- .spi_num = n, \
- .spi = SPI##n, \
- .i2s_irq = SPI##n##_IRQn, \
- .driver_data = &stm32_i2s##n, \
- .irq_handler = i2s##n##_irq_handler, \
- .dma_handler = i2s##n##_dma_stream_irq_handler, \
- .enable_clock = i2s##n##_clock_enable, \
-};
+ struct stm32_spi_cfg spi ## n ## _cfg = { \
+ .spi_num = n, \
+ .spi = SPI ## n, \
+ .i2s_irq = SPI ## n ## _IRQn, \
+ .driver_data = &stm32_i2s ## n, \
+ .irq_handler = i2s ## n ## _irq_handler, \
+ .dma_handler = i2s ## n ## _dma_stream_irq_handler, \
+ .enable_clock = i2s ## n ## _clock_enable, \
+ };
#ifdef SPI1
SPI_CFG_DEFINE(1);
```
</details>
#### hw/drivers/i2s/include/i2s/i2s.h
<details>
```diff
@@ -64,12 +64,13 @@
* @param size single buffer size in bytes
*/
#define I2S_BUFFER_POOL_DEF(name, count, size) \
-static uint8_t _Alignas(struct i2s_buffer_pool) name##_buffers[(sizeof(struct i2s_sample_buffer[count])) + size * count]; \
-struct i2s_buffer_pool name = { \
- .buffer_size = size, \
- .buffer_count = count, \
- .buffers = (struct i2s_sample_buffer *)name##_buffers \
-};
+ static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer [count])) + \
+ size * count]; \
+ struct i2s_buffer_pool name = { \
+ .buffer_size = size, \
+ .buffer_count = count, \
+ .buffers = (struct i2s_sample_buffer *)name ## _buffers \
+ };
#define I2S_BUFFER_POOL(name) ((struct i2s_buffer_pool *)(&name))
enum i2s_state {
```
</details>
#### hw/drivers/i2s/src/i2s.c
<details>
```diff
@@ -154,7 +154,8 @@
}
int
-i2s_close(struct i2s *i2s) {
+i2s_close(struct i2s *i2s)
+{
return os_dev_close(&i2s->dev);
}
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2252: [RFC] I2S
API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605108684
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/include/i2s/i2s.h
<details>
```diff
@@ -64,7 +64,7 @@
* @param size single buffer size in bytes
*/
#define I2S_BUFFER_POOL_DEF(name, count, size) \
- static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer[count])) + \
+ static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer [count])) + \
size * count]; \
struct i2s_buffer_pool name = { \
.buffer_size = size, \
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2252:
[RFC] I2S API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-609856939
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/i2s_stm32f4/src/i2s_stm32f4.c
<details>
```diff
@@ -469,7 +469,7 @@
}
}
#endif
- /* Fallthrough */
+ /* Fallthrough */
case HAL_I2S_STATE_READY:
assert(i2s_data->active_buffer == NULL);
i2s_data->active_buffer = i2s_driver_buffer_get(i2s);
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2252:
[RFC] I2S API and driver for STM32 MCUs
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2252: [RFC] I2S API and driver for STM32 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252#issuecomment-605072004
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### hw/drivers/i2s/i2s_stm32/src/i2s_stm32.c
<details>
```diff
@@ -540,12 +540,12 @@
I2S_SD_PIN_DEFINE(5, E, 14, GPIO_AF6_SPI5);
#define DMA_STREAM_DEFINE(dma, ch, st, name) \
-const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch = { \
- dma, \
- DMA ## dma ## _Stream ## st ## _IRQn, \
- DMA ## dma ## _Stream ## st, \
- DMA_CHANNEL_ ## ch, \
-}
+ const struct stm32_dma_cfg name ## _stream ## st ## _channel ## ch = { \
+ dma, \
+ DMA ## dma ## _Stream ## st ## _IRQn, \
+ DMA ## dma ## _Stream ## st, \
+ DMA_CHANNEL_ ## ch, \
+ }
DMA_STREAM_DEFINE(1, 0, 0, spi3_rx);
DMA_STREAM_DEFINE(1, 0, 1, i2c1_tx);
```
</details>
#### hw/drivers/i2s/include/i2s/i2s.h
<details>
```diff
@@ -64,7 +64,8 @@
* @param size single buffer size in bytes
*/
#define I2S_BUFFER_POOL_DEF(name, count, size) \
- static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer[count])) + size * count]; \
+ static uint8_t _Alignas(struct i2s_buffer_pool) name ## _buffers[(sizeof(struct i2s_sample_buffer [count])) + \
+ size * count]; \
struct i2s_buffer_pool name = { \
.buffer_size = size, \
.buffer_count = count, \
```
</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
With regards,
Apache Git Services
[GitHub] [mynewt-core] kasjer closed pull request #2252: [RFC] I2S API and
driver for STM32 and NRF52 MCUs
Posted by GitBox <gi...@apache.org>.
kasjer closed pull request #2252: [RFC] I2S API and driver for STM32 and NRF52 MCUs
URL: https://github.com/apache/mynewt-core/pull/2252
----------------------------------------------------------------
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
With regards,
Apache Git Services