boards/xtensa/esp32: A bit of re-organisation in the ESP32 boards.
Move the common files into the common directory. Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
parent
648ec7bee4
commit
3ba5018b37
@ -47,7 +47,7 @@ config ESP32_TIMER
|
||||
bool
|
||||
default n
|
||||
|
||||
config ESP32_WTD
|
||||
config ESP32_WDT
|
||||
bool
|
||||
default n
|
||||
|
||||
@ -211,7 +211,7 @@ config ESP32_TIMER3
|
||||
config ESP32_MWDT0
|
||||
bool "Main System Watchdog Timer (Group 0)"
|
||||
default n
|
||||
select ESP32_WTD
|
||||
select ESP32_WDT
|
||||
---help---
|
||||
Includes MWDT0. This watchdog timer is part of the Group 0
|
||||
timer submodule.
|
||||
@ -219,7 +219,7 @@ config ESP32_MWDT0
|
||||
config ESP32_MWDT1
|
||||
bool "Main System Watchdog Timer (Group 1)"
|
||||
default n
|
||||
select ESP32_WTD
|
||||
select ESP32_WDT
|
||||
---help---
|
||||
Includes MWDT1. This watchdog timer is part of the Group 0
|
||||
timer submodule.
|
||||
|
@ -164,7 +164,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_WATCHDOG),y)
|
||||
CHIP_CSRCS += esp32_wtd_lowerhalf.c
|
||||
ifeq ($(CONFIG_ESP32_WTD),y)
|
||||
ifeq ($(CONFIG_ESP32_WDT),y)
|
||||
CHIP_CSRCS += esp32_wtd.c
|
||||
endif
|
||||
endif
|
||||
|
4
boards/xtensa/esp32/common/Kconfig
Normal file
4
boards/xtensa/esp32/common/Kconfig
Normal file
@ -0,0 +1,4 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
33
boards/xtensa/esp32/common/Makefile
Normal file
33
boards/xtensa/esp32/common/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
#############################################################################
|
||||
# boards/xtensa/esp32/common/Makefile
|
||||
#
|
||||
# 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 $(TOPDIR)/Make.defs
|
||||
|
||||
include board/Make.defs
|
||||
include src/Make.defs
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
DEPPATH += --dep-path src
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
||||
ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
|
||||
BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
|
||||
CFLAGS += $(shell $(INCDIR) "$(CC)" $(BOARDDIR)$(DELIM)include)
|
78
boards/xtensa/esp32/common/include/esp32_timer.h
Normal file
78
boards/xtensa/esp32/common/include/esp32_timer.h
Normal file
@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32/common/include/esp32_timer.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 __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_TIMER_H
|
||||
#define __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_TIMER_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_timer_init
|
||||
*
|
||||
* Description:
|
||||
* Configure the timer driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the timer device. This should be of the
|
||||
* form /dev/timerX
|
||||
* timer - The timer's number.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned
|
||||
* to indicate the nature of any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_timer_init(void);
|
||||
|
||||
#endif /* CONFIG_TIMER */
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_TIMER_H */
|
78
boards/xtensa/esp32/common/include/esp32_wdt.h
Normal file
78
boards/xtensa/esp32/common/include/esp32_wdt.h
Normal file
@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32/common/include/esp32_wdt.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 __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_WDT_H
|
||||
#define __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_WDT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_wdt_init
|
||||
*
|
||||
* Description:
|
||||
* Configure the timer driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the timer device. This should be of the
|
||||
* form /dev/watchdogX
|
||||
* wdt timer - The wdt timer's number.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned
|
||||
* to indicate the nature of any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_wdt_init(void);
|
||||
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_XTENSA_ESP32_COMMON_INCLUDE_WDT_H */
|
32
boards/xtensa/esp32/common/src/Make.defs
Normal file
32
boards/xtensa/esp32/common/src/Make.defs
Normal file
@ -0,0 +1,32 @@
|
||||
#############################################################################
|
||||
# boards/xtensa/esp32/common/src/Make.defs
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
ifeq ($(CONFIG_TIMER),y)
|
||||
CSRCS += esp32_timer.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WDT),y)
|
||||
CSRCS += esp32_wdt.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32/esp32-core/src/esp32_timer.c
|
||||
* boards/xtensa/esp32/common/src/esp32_timer.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -23,30 +23,31 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/timers/timer.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include "esp32_tim_lowerhalf.h"
|
||||
#include "esp32-core.h"
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/timers/timer.h>
|
||||
|
||||
#include "esp32_tim_lowerhalf.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_TIMER0
|
||||
#define ESP32_TIMER0 (0)
|
||||
# define ESP32_TIMER0 (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_TIMER1
|
||||
#define ESP32_TIMER1 (1)
|
||||
# define ESP32_TIMER1 (1)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_TIMER2
|
||||
#define ESP32_TIMER2 (2)
|
||||
# define ESP32_TIMER2 (2)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_TIMER3
|
||||
#define ESP32_TIMER3 (3)
|
||||
# define ESP32_TIMER3 (3)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -54,7 +55,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_timer_driver_setup
|
||||
* Name: board_timer_init
|
||||
*
|
||||
* Description:
|
||||
* Configure the timer driver.
|
||||
@ -70,10 +71,11 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_timer_driver_init(void)
|
||||
int board_timer_init(void)
|
||||
{
|
||||
int ret = OK;
|
||||
#ifdef CONFIG_ESP32_TIMER0
|
||||
|
||||
#ifdef CONFIG_ESP32_TIMER0
|
||||
ret = esp32_timer_initialize("/dev/timer0", ESP32_TIMER0);
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -120,3 +122,4 @@ int esp32_timer_driver_init(void)
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* boards/xtensa/esp32/esp32-core/src/esp32_wtd.c
|
||||
* boards/xtensa/esp32/common/src/esp32_wtd.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@ -23,25 +23,26 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <debug.h>
|
||||
#include "esp32_wtd_lowerhalf.h"
|
||||
#include "esp32-core.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "esp32_wtd_lowerhalf.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_MWDT0
|
||||
#define ESP32_MWDT0 (0)
|
||||
# define ESP32_MWDT0 (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_MWDT1
|
||||
#define ESP32_MWDT1 (1)
|
||||
# define ESP32_MWDT1 (1)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_RWDT
|
||||
#define ESP32_RWDT (2)
|
||||
# define ESP32_RWDT (2)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -49,7 +50,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_wtd_driver_init
|
||||
* Name: board_wdt_init
|
||||
*
|
||||
* Description:
|
||||
* Configure the timer driver.
|
||||
@ -65,7 +66,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_wtd_driver_init(void)
|
||||
int board_wdt_init(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
@ -78,7 +79,6 @@ int esp32_wtd_driver_init(void)
|
||||
ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_MWDT1
|
||||
@ -90,7 +90,6 @@ int esp32_wtd_driver_init(void)
|
||||
ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_RWDT
|
||||
@ -102,9 +101,9 @@ int esp32_wtd_driver_init(void)
|
||||
ret);
|
||||
goto errout;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
4
boards/xtensa/esp32/drivers/Kconfig
Normal file
4
boards/xtensa/esp32/drivers/Kconfig
Normal file
@ -0,0 +1,4 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
@ -60,29 +60,15 @@ ifeq ($(CONFIG_ESP32_SPIFLASH),y)
|
||||
CSRCS += esp32_spiflash.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TIMER),y)
|
||||
ifeq ($(CONFIG_ESP32_TIMER),y)
|
||||
CSRCS += esp32_timer.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USERLED),y)
|
||||
CSRCS += esp32_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WATCHDOG),y)
|
||||
ifeq ($(CONFIG_ESP32_WTD),y)
|
||||
CSRCS += esp32_wtd.c
|
||||
endif
|
||||
endif
|
||||
|
||||
SCRIPTIN = $(SCRIPTDIR)$(DELIM)esp32.template.ld
|
||||
SCRIPTOUT = $(SCRIPTDIR)$(DELIM)esp32_out.ld
|
||||
|
||||
.PHONY = context distclean
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
||||
$(SCRIPTOUT): $(SCRIPTIN) $(CONFIGFILE)
|
||||
$(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(SCRIPTIN) -o $@
|
||||
|
||||
@ -91,3 +77,7 @@ context:: $(SCRIPTOUT)
|
||||
distclean::
|
||||
$(call DELFILE, $(SCRIPTOUT))
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
|
||||
|
@ -95,28 +95,6 @@ int esp32_mmcsd_initialize(int minor);
|
||||
****************************************************************************/
|
||||
|
||||
int esp32_spiflash_init(void);
|
||||
/****************************************************************************
|
||||
* Name: esp32_timer_driver_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize TIMER driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
int esp32_timer_driver_init(void);
|
||||
#endif
|
||||
/****************************************************************************
|
||||
* Name: esp32_wdt_driver_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize WATCHDOG driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
int esp32_wtd_driver_init(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp32_spiflash_encrypt_test
|
||||
@ -133,9 +111,7 @@ int esp32_wtd_driver_init(void);
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ESP32_SPIFLASH_ENCRYPTION_TEST
|
||||
|
||||
void esp32_spiflash_encrypt_test(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
@ -51,25 +51,30 @@
|
||||
#include <debug.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
# include <nuttx/timers/timer.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include <syslog.h>
|
||||
#include <sys/errno.h>
|
||||
#include <nuttx/himem/himem.h>
|
||||
|
||||
#include "esp32_procfs_imm.h"
|
||||
#include "esp32-core.h"
|
||||
|
||||
#include "esp32_wlan.h"
|
||||
#include "esp32_spiflash.h"
|
||||
#include "esp32_partition.h"
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_TIMER
|
||||
# include "esp32_timer.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESP32_WDT
|
||||
# include "esp32_wdt.h"
|
||||
#endif
|
||||
|
||||
#include "esp32-core.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -218,16 +223,15 @@ int esp32_bringup(void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
/* Configure TIMER driver */
|
||||
/* Configure timer driver */
|
||||
|
||||
ret = esp32_timer_driver_init();
|
||||
ret = board_timer_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to initialize timer drivers: %d\n",
|
||||
ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
@ -241,16 +245,15 @@ int esp32_bringup(void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
/* Configure WATCHDOG driver */
|
||||
/* Configure watchdog timer */
|
||||
|
||||
ret = esp32_wtd_driver_init();
|
||||
ret = board_wdt_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to initialize watchdog drivers: %d\n",
|
||||
ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* If we got here then perhaps not all initialization was successful, but
|
||||
|
Loading…
Reference in New Issue
Block a user