risc-v/espressif: Add support for Oneshot Timer

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei
2023-04-05 16:51:34 -03:00
committed by Alan Carvalho de Assis
parent 31d68f2dd3
commit 7aecd751f0
9 changed files with 686 additions and 0 deletions
+4
View File
@@ -50,6 +50,10 @@ ifeq ($(CONFIG_TIMER),y)
CHIP_CSRCS += esp_timer.c
endif
ifeq ($(CONFIG_ONESHOT),y)
CHIP_CSRCS += esp_oneshot.c
endif
ifeq ($(CONFIG_ESPRESSIF_HR_TIMER),y)
CHIP_CSRCS += esp_hr_timer.c
endif
File diff suppressed because it is too large Load Diff
+51
View File
@@ -0,0 +1,51 @@
/****************************************************************************
* arch/risc-v/src/espressif/esp_oneshot.h
*
* 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 __ARCH_RISCV_SRC_ESPRESSIF_ESP_ONESHOT_H
#define __ARCH_RISCV_SRC_ESPRESSIF_ESP_ONESHOT_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: esp_oneshot_initialize
*
* Description:
* Initialize a oneshot timer device.
*
* Input Parameters:
* None.
*
* Returned Values:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure.
*
****************************************************************************/
int esp_oneshot_initialize(void);
#endif /* __ARCH_RISCV_SRC_ESPRESSIF_ESP_ONESHOT_H */
@@ -19,6 +19,7 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_EXAMPLES_ONESHOT=y
CONFIG_EXAMPLES_TIMER=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -32,6 +33,7 @@ CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
@@ -42,6 +42,10 @@
# include "esp_timer.h"
#endif
#ifdef CONFIG_ONESHOT
# include "esp_oneshot.h"
#endif
#ifdef CONFIG_ESPRESSIF_HR_TIMER
# include "esp_hr_timer.h"
#endif
@@ -116,12 +120,22 @@ int esp_bringup(void)
_err("Failed to initialize Timer 0: %d\n", ret);
}
#ifndef CONFIG_ONESHOT
ret = esp_timer_initialize(1);
if (ret < 0)
{
_err("Failed to initialize Timer 1: %d\n", ret);
}
#endif
#endif
#ifdef CONFIG_ONESHOT
ret = esp_oneshot_initialize();
if (ret < 0)
{
_err("Failed to initialize Oneshot Timer: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_HR_TIMER
ret = esp_hr_timer_init();
@@ -20,6 +20,7 @@ CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_ESPRESSIF_ESP32C6=y
CONFIG_EXAMPLES_ONESHOT=y
CONFIG_EXAMPLES_TIMER=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -33,6 +34,7 @@ CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
@@ -42,6 +42,10 @@
# include "esp_timer.h"
#endif
#ifdef CONFIG_ONESHOT
# include "esp_oneshot.h"
#endif
#ifdef CONFIG_ESPRESSIF_HR_TIMER
# include "esp_hr_timer.h"
#endif
@@ -116,12 +120,22 @@ int esp_bringup(void)
_err("Failed to initialize Timer 0: %d\n", ret);
}
#ifndef CONFIG_ONESHOT
ret = esp_timer_initialize(1);
if (ret < 0)
{
_err("Failed to initialize Timer 1: %d\n", ret);
}
#endif
#endif
#ifdef CONFIG_ONESHOT
ret = esp_oneshot_initialize();
if (ret < 0)
{
_err("Failed to initialize Oneshot Timer: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_HR_TIMER
ret = esp_hr_timer_init();
@@ -20,6 +20,7 @@ CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_DEV_ZERO=y
CONFIG_ESPRESSIF_ESP32H2=y
CONFIG_EXAMPLES_ONESHOT=y
CONFIG_EXAMPLES_TIMER=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@@ -33,6 +34,7 @@ CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
@@ -42,6 +42,10 @@
# include "esp_timer.h"
#endif
#ifdef CONFIG_ONESHOT
# include "esp_oneshot.h"
#endif
#ifdef CONFIG_ESPRESSIF_HR_TIMER
# include "esp_hr_timer.h"
#endif
@@ -116,12 +120,22 @@ int esp_bringup(void)
_err("Failed to initialize Timer 0: %d\n", ret);
}
#ifndef CONFIG_ONESHOT
ret = esp_timer_initialize(1);
if (ret < 0)
{
_err("Failed to initialize Timer 1: %d\n", ret);
}
#endif
#endif
#ifdef CONFIG_ONESHOT
ret = esp_oneshot_initialize();
if (ret < 0)
{
_err("Failed to initialize Oneshot Timer: %d\n", ret);
}
#endif
#ifdef CONFIG_ESPRESSIF_HR_TIMER
ret = esp_hr_timer_init();