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 2021/09/21 13:27:12 UTC

[GitHub] [incubator-nuttx] saramonteiro opened a new pull request #4587: xtensa/esp32-s2: Adds freerun timer wrapper

saramonteiro opened a new pull request #4587:
URL: https://github.com/apache/incubator-nuttx/pull/4587


   ## Summary
   
   This PR adds the freerun timer wrapper.
   
   ## Impact
   
   From now on freerun API can be used in the board logic of ESP32-S2 for the initialization of some external peripheral drivers like DHTxx, for example.
   
   ## Test
   
   Local test.
   


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



[GitHub] [incubator-nuttx] gustavonihei commented on pull request #4587: xtensa/esp32-s2: Adds freerun timer wrapper

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on pull request #4587:
URL: https://github.com/apache/incubator-nuttx/pull/4587#issuecomment-924890363


   CI already passed successfully and the only change was related https://github.com/apache/incubator-nuttx/pull/4587#discussion_r713888594.
   Let's merge it before CI starts.


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



[GitHub] [incubator-nuttx] saramonteiro commented on a change in pull request #4587: xtensa/esp32-s2: Adds freerun timer wrapper

Posted by GitBox <gi...@apache.org>.
saramonteiro commented on a change in pull request #4587:
URL: https://github.com/apache/incubator-nuttx/pull/4587#discussion_r713896146



##########
File path: arch/xtensa/src/esp32s2/esp32s2_freerun.c
##########
@@ -0,0 +1,354 @@
+/****************************************************************************
+ * arch/xtensa/src/esp32s2/esp32s2_freerun.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 <sys/types.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <assert.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/clock.h>
+
+#include "esp32s2_freerun.h"
+#include "esp32s2_clockconfig.h"
+#include "esp32s2_gpio.h"
+
+#ifdef CONFIG_ESP32S2_FREERUN
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define MAX_TIMERS 4
+#define MAX_US_RESOLUTION 819 /* MAX_US = (PREmax * USEC_PER_SEC) / CLKmin */ 
+#define TIMER_WIDTH 64
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32s2_freerun_handler
+ *
+ * Description:
+ *   Timer interrupt callback.  When the freerun timer counter overflows,
+ *   this interrupt will occur.  It will just increment an overflow counter.
+ *
+ * Input Parameters:
+ *   irq              - IRQ associated to that interrupt.
+ *   arg              - An opaque argument provided when the interrupt
+ *                      was registered.
+ *
+ * Returned Value:
+ *   OK
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_CLOCK_TIMEKEEPING
+static int esp32s2_freerun_handler(int irq, void *context, void *arg)
+{
+  struct esp32s2_freerun_s *freerun =
+    (struct esp32s2_freerun_s *) arg;

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei merged pull request #4587: xtensa/esp32-s2: Adds freerun timer wrapper

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #4587:
URL: https://github.com/apache/incubator-nuttx/pull/4587


   


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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #4587: xtensa/esp32-s2: Adds freerun timer wrapper

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #4587:
URL: https://github.com/apache/incubator-nuttx/pull/4587#discussion_r713888594



##########
File path: arch/xtensa/src/esp32s2/esp32s2_freerun.c
##########
@@ -0,0 +1,354 @@
+/****************************************************************************
+ * arch/xtensa/src/esp32s2/esp32s2_freerun.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 <sys/types.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <assert.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/clock.h>
+
+#include "esp32s2_freerun.h"
+#include "esp32s2_clockconfig.h"
+#include "esp32s2_gpio.h"
+
+#ifdef CONFIG_ESP32S2_FREERUN
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define MAX_TIMERS 4
+#define MAX_US_RESOLUTION 819 /* MAX_US = (PREmax * USEC_PER_SEC) / CLKmin */ 
+#define TIMER_WIDTH 64
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: esp32s2_freerun_handler
+ *
+ * Description:
+ *   Timer interrupt callback.  When the freerun timer counter overflows,
+ *   this interrupt will occur.  It will just increment an overflow counter.
+ *
+ * Input Parameters:
+ *   irq              - IRQ associated to that interrupt.
+ *   arg              - An opaque argument provided when the interrupt
+ *                      was registered.
+ *
+ * Returned Value:
+ *   OK
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_CLOCK_TIMEKEEPING
+static int esp32s2_freerun_handler(int irq, void *context, void *arg)
+{
+  struct esp32s2_freerun_s *freerun =
+    (struct esp32s2_freerun_s *) arg;

Review comment:
       ```suggestion
     struct esp32s2_freerun_s *freerun = (struct esp32s2_freerun_s *) arg;
   ```
   nit: These two lines may be merged into a single one.




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