boards/nrf52: introduce common folder

This is an initial step towards moving common logic for NRF52 boards into one place.
At this point, only initialization of the TIMER has been moved.
This commit is contained in:
raiden00pl 2023-05-22 14:02:04 +02:00 committed by Xiang Xiao
parent d9ea87443e
commit f646664cfb
16 changed files with 214 additions and 32 deletions

View file

@ -4009,6 +4009,9 @@ endif
if ARCH_CHIP_RP2040
source "boards/arm/rp2040/common/Kconfig"
endif
if ARCH_CHIP_NRF52
source "boards/arm/nrf52/common/Kconfig"
endif
endif
config BOARD_CRASHDUMP

View 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.
#

View file

@ -0,0 +1,33 @@
#############################################################################
# boards/arm/nrf52/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)

View file

@ -0,0 +1,55 @@
/****************************************************************************
* boards/arm/nrf52/common/include/nrf52_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_ARM_NRF52_COMMON_INCLUDE_NRF52_TIMER_H
#define __BOARDS_ARM_NRF52_COMMON_INCLUDE_NRF52_TIMER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/timers/timer.h>
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
/****************************************************************************
* Name: nrf52_timer_driver_setup
*
* Description:
* Configure the timer driver.
*
* Input Parameters:
* devpath - The full path to the timer device. This should be of the
* form /dev/timer0
* 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 nrf52_timer_driver_setup(const char *devpath, int timer);
#endif /* __BOARDS_ARM_NRF52_COMMON_INCLUDE_NRF52_TIMER_H */

View file

@ -0,0 +1,31 @@
#############################################################################
# boards/arm/nrf52/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_ARCH_BOARD_COMMON),y)
ifeq ($(CONFIG_NRF52_TIMER),y)
CSRCS += nrf52_timer.c
endif
DEPPATH += --dep-path src
VPATH += :src
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src)
endif

View file

@ -0,0 +1,55 @@
/****************************************************************************
* boards/arm/nrf52/common/src/nrf52_timer.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/timers/timer.h>
#include "nrf52_tim_lowerhalf.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nrf52_timer_driver_setup
*
* Description:
* Configure the timer driver.
*
* Input Parameters:
* devpath - The full path to the timer device. This should be of the
* form /dev/timer0
* 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 nrf52_timer_driver_setup(const char *devpath, int timer)
{
return nrf52_timer_initialize(devpath, timer);
}

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/nrf52-feather/src/Makefile
# boards/arm/nrf52/nrf52-feather/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -36,4 +36,6 @@ ifeq ($(CONFIG_I2C),y)
CSRCS += nrf52_i2c.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/nrf52832-dk/src/Makefile
# boards/arm/nrf52/nrf52832-dk/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -36,4 +36,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += nrf52_buttons.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/nrf52832-mdk/src/Makefile
# boards/arm/nrf52/nrf52832-mdk/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -30,4 +30,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += nrf52_autoleds.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/nrf52832-sparkfun/src/Makefile
# boards/arm/nrf52/nrf52832-sparkfun/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -30,4 +30,6 @@ ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += nrf52_autoleds.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -10,6 +10,7 @@
# CONFIG_NSH_DISABLE_PS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nrf52840-dk"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_NRF52840_DK=y
CONFIG_ARCH_CHIP="nrf52"
CONFIG_ARCH_CHIP_NRF52840=y

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/nrf52840-dk/src/Makefile
# boards/arm/nrf52/nrf52840-dk/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -60,12 +60,6 @@ ifeq ($(CONFIG_NRF52840DK_HIGHPRI),y)
CSRCS += nrf52_highpri.c
endif
ifeq ($(CONFIG_TIMER),y)
ifeq ($(CONFIG_NRF52_TIMER),y)
CSRCS += nrf52_timer.c
endif
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += nrf52_pwm.c
endif
@ -86,4 +80,6 @@ ifeq ($(CONFIG_NRF52_QSPI),y)
CSRCS += nrf52_mx25.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -165,18 +165,6 @@ int nrf52_hts221_initialize(char *devpath);
int nrf52_lpwaninitialize(void);
#endif
/****************************************************************************
* Name: nrf52_timer_driver_setup
*
* Description:
* Initialize TIMER driver.
*
****************************************************************************/
#ifdef CONFIG_TIMER
int nrf52_timer_driver_setup(const char *devpath, int timer);
#endif
/****************************************************************************
* Name: nrf52_pwm_setup
*

View file

@ -45,6 +45,10 @@
# include <nuttx/usb/rndis.h>
#endif
#ifdef CONFIG_TIMER
# include "nrf52_timer.h"
#endif
#ifdef CONFIG_NRF52_SOFTDEVICE_CONTROLLER
# include "nrf52_sdc.h"
#endif

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/nrf52840-dongle/src/Makefile
# boards/arm/nrf52/nrf52840-dongle/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -32,4 +32,6 @@ else
CSRCS += nrf52_userleds.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View file

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf52/thingy52/src/Makefile
# boards/arm/nrf52/thingy52/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -30,4 +30,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += nrf52_buttons.c
endif
include $(TOPDIR)/boards/Board.mk
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)