You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/05 11:22:14 UTC
[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6781: Multiple improvements for stm32wl5 board nucleo-stm32wl5jc
pkarashchenko commented on code in PR #6781:
URL: https://github.com/apache/incubator-nuttx/pull/6781#discussion_r938715331
##########
arch/arm/src/stm32wl5/stm32wl5_ipcc.c:
##########
@@ -381,11 +390,13 @@ static ssize_t stm32wl5_ipcc_write(struct ipcc_lower_s *ipcc,
static int stm32wl5_ipcc_rx_isr(int irq, void *context, void *arg)
{
int chan;
- ssize_t nread;
uint32_t mr;
uint32_t sr;
uint32_t status;
struct stm32wl5_ipcc_s *priv;
+#ifdef CONFIG_IPCC_BUFFERED
+ ssize_t nread;
+#endif
(void)context;
Review Comment:
Good to use `UNUSED` macro
##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_ipcc.c:
##########
@@ -0,0 +1,183 @@
+/****************************************************************************
+ * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_ipcc.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/ipcc.h>
+#include <debug.h>
+
+#include <stm32wl5_ipcc.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Define default values for macros if they are not define in config */
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN1_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN1_RXBUF 0
Review Comment:
```suggestion
# define CONFIG_ARCH_BOARD_IPCC_CHAN1_RXBUF 0
```
here and similar places
##########
boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_ipcc.c:
##########
@@ -0,0 +1,183 @@
+/****************************************************************************
+ * boards/arm/stm32wl5/nucleo-wl55jc/src/stm32_ipcc.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/ipcc.h>
+#include <debug.h>
+
+#include <stm32wl5_ipcc.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Define default values for macros if they are not define in config */
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN1_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN1_RXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN1_TXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN1_TXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN2_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN2_RXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN2_TXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN2_TXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN3_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN3_RXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN3_TXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN3_TXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN4_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN4_RXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN4_TXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN4_TXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN5_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN5_RXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN5_TXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN5_TXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN6_RXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN6_RXBUF 0
+#endif
+
+#ifndef CONFIG_ARCH_BOARD_IPCC_CHAN6_TXBUF
+#define CONFIG_ARCH_BOARD_IPCC_CHAN6_TXBUF 0
+#endif
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int init_ipcc(int chan, size_t rxbuflen, size_t txbuflen);
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: init_ipcc
+ *
+ * Description:
+ * Initializes IPCC channel with tx and rx buffer sizes. If ipcc is
+ * unbuffered, rxbuflen and txbuflen are ignored.
+ *
+ * Input Parameters:
+ * chan - channel number, indexed from 0
+ * rxbuflen - size of rxbuffer for buffered transactions
+ * txbuflen - size of txbuffer for buffered transactions
+ *
+ * Returned Value:
+ * 0 on success or -1 on errors.
+ *
+ ****************************************************************************/
+
+static int init_ipcc(int chan, size_t rxbuflen, size_t txbuflen)
+{
+ struct ipcc_lower_s *ipcc;
+ int ret;
+
+#ifndef CONFIG_IPCC_BUFFERED
+ UNUSED(rxbuflen);
+ UNUSED(txbuflen);
Review Comment:
Optional: can be placed together with `ret = ipcc_register(ipcc);` in the same `ifdef` block.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org