boards/nrf53: introduce common folder

This is an initial step towards moving common logic for NRF53 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:19 +02:00 committed by Xiang Xiao
parent f646664cfb
commit 218aa63af3
12 changed files with 198 additions and 24 deletions

View File

@ -4012,6 +4012,9 @@ endif
if ARCH_CHIP_NRF52
source "boards/arm/nrf52/common/Kconfig"
endif
if ARCH_CHIP_NRF53
source "boards/arm/nrf53/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/nrf53/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/nrf53/common/include/nrf53_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_NRF53_COMMON_INCLUDE_NRF53_TIMER_H
#define __BOARDS_ARM_NRF53_COMMON_INCLUDE_NRF53_TIMER_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/timers/timer.h>
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
/****************************************************************************
* Name: nrf53_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 nrf53_timer_driver_setup(const char *devpath, int timer);
#endif /* __BOARDS_ARM_NRF53_COMMON_INCLUDE_NRF53_TIMER_H */

View File

@ -0,0 +1,31 @@
#############################################################################
# boards/arm/nrf53/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_NRF53_TIMER),y)
CSRCS += nrf53_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/nrf53/common/src/nrf53_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 "nrf53_tim_lowerhalf.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nrf53_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 nrf53_timer_driver_setup(const char *devpath, int timer)
{
return nrf53_timer_initialize(devpath, timer);
}

View File

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf53/nrf5340-audio-dk/src/Makefile
# boards/arm/nrf53/nrf5340-audio-dk/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 += nrf53_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

@ -10,6 +10,7 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nrf5340-dk"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_NRF5340_DK=y
CONFIG_ARCH_CHIP="nrf53"
CONFIG_ARCH_CHIP_NRF5340=y

View File

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf53/nrf5340-dk/src/Makefile
# boards/arm/nrf53/nrf5340-dk/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -40,12 +40,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += nrf53_buttons.c
endif
ifeq ($(CONFIG_TIMER),y)
ifeq ($(CONFIG_NRF53_TIMER),y)
CSRCS += nrf53_timer.c
endif
endif
ifeq ($(CONFIG_PWM),y)
CSRCS += nrf53_pwm.c
endif
@ -54,4 +48,6 @@ ifeq ($(CONFIG_ADC),y)
CSRCS += nrf53_adc.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

@ -94,18 +94,6 @@
int nrf53_bringup(void);
/****************************************************************************
* Name: nrf53_timer_driver_setup
*
* Description:
* Initialize TIMER driver.
*
****************************************************************************/
#ifdef CONFIG_TIMER
int nrf53_timer_driver_setup(const char *devpath, int timer);
#endif
/****************************************************************************
* Name: nrf53_pwm_setup
*

View File

@ -56,6 +56,10 @@
# include "nrf53_rptun.h"
#endif
#ifdef CONFIG_TIMER
# include "nrf53_timer.h"
#endif
#include "nrf5340-dk.h"
/****************************************************************************

View File

@ -1,5 +1,5 @@
############################################################################
# boards/arm/nrf53/thingy53/src/Makefile
# boards/arm/nrf53/thingy53/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -34,4 +34,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
CSRCS += nrf53_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)