Skip to content

Commit 218aa63

Browse files
raiden00plxiaoxiang781216
authored andcommitted
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.
1 parent f646664 commit 218aa63

File tree

12 files changed

+198
-24
lines changed

12 files changed

+198
-24
lines changed

boards/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4012,6 +4012,9 @@ endif
40124012
if ARCH_CHIP_NRF52
40134013
source "boards/arm/nrf52/common/Kconfig"
40144014
endif
4015+
if ARCH_CHIP_NRF53
4016+
source "boards/arm/nrf53/common/Kconfig"
4017+
endif
40154018
endif
40164019

40174020
config BOARD_CRASHDUMP

boards/arm/nrf53/common/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#
2+
# For a description of the syntax of this configuration file,
3+
# see the file kconfig-language.txt in the NuttX tools repository.
4+
#

boards/arm/nrf53/common/Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#############################################################################
2+
# boards/arm/nrf53/common/Makefile
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership. The
7+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance with the
9+
# License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
# License for the specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
#############################################################################
20+
21+
include $(TOPDIR)/Make.defs
22+
23+
include board/Make.defs
24+
include src/Make.defs
25+
26+
DEPPATH += --dep-path board
27+
DEPPATH += --dep-path src
28+
29+
include $(TOPDIR)/boards/Board.mk
30+
31+
ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
32+
BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
33+
CFLAGS += $(shell $(INCDIR) "$(CC)" $(BOARDDIR)$(DELIM)include)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/****************************************************************************
2+
* boards/arm/nrf53/common/include/nrf53_timer.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __BOARDS_ARM_NRF53_COMMON_INCLUDE_NRF53_TIMER_H
22+
#define __BOARDS_ARM_NRF53_COMMON_INCLUDE_NRF53_TIMER_H
23+
24+
/****************************************************************************
25+
* Included Files
26+
****************************************************************************/
27+
28+
#include <nuttx/config.h>
29+
30+
#include <nuttx/timers/timer.h>
31+
32+
/****************************************************************************
33+
* Public Functions Prototypes
34+
****************************************************************************/
35+
36+
/****************************************************************************
37+
* Name: nrf53_timer_driver_setup
38+
*
39+
* Description:
40+
* Configure the timer driver.
41+
*
42+
* Input Parameters:
43+
* devpath - The full path to the timer device. This should be of the
44+
* form /dev/timer0
45+
* timer - The timer's number.
46+
*
47+
* Returned Value:
48+
* Zero (OK) is returned on success; A negated errno value is returned
49+
* to indicate the nature of any failure.
50+
*
51+
****************************************************************************/
52+
53+
int nrf53_timer_driver_setup(const char *devpath, int timer);
54+
55+
#endif /* __BOARDS_ARM_NRF53_COMMON_INCLUDE_NRF53_TIMER_H */

boards/arm/nrf53/common/src/Make.defs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#############################################################################
2+
# boards/arm/nrf53/common/src/Make.defs
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership. The
7+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance with the
9+
# License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
# License for the specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
#############################################################################
20+
21+
ifeq ($(CONFIG_ARCH_BOARD_COMMON),y)
22+
23+
ifeq ($(CONFIG_NRF53_TIMER),y)
24+
CSRCS += nrf53_timer.c
25+
endif
26+
27+
DEPPATH += --dep-path src
28+
VPATH += :src
29+
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src)
30+
31+
endif
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/****************************************************************************
2+
* boards/arm/nrf53/common/src/nrf53_timer.c
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
/****************************************************************************
22+
* Included Files
23+
****************************************************************************/
24+
25+
#include <nuttx/config.h>
26+
27+
#include <nuttx/timers/timer.h>
28+
29+
#include "nrf53_tim_lowerhalf.h"
30+
31+
/****************************************************************************
32+
* Public Functions
33+
****************************************************************************/
34+
35+
/****************************************************************************
36+
* Name: nrf53_timer_driver_setup
37+
*
38+
* Description:
39+
* Configure the timer driver.
40+
*
41+
* Input Parameters:
42+
* devpath - The full path to the timer device. This should be of the
43+
* form /dev/timer0
44+
* timer - The timer's number.
45+
*
46+
* Returned Value:
47+
* Zero (OK) is returned on success; A negated errno value is returned
48+
* to indicate the nature of any failure.
49+
*
50+
****************************************************************************/
51+
52+
int nrf53_timer_driver_setup(const char *devpath, int timer)
53+
{
54+
return nrf53_timer_initialize(devpath, timer);
55+
}

boards/arm/nrf53/nrf5340-audio-dk/src/Makefile renamed to boards/arm/nrf53/nrf5340-audio-dk/src/Make.defs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
############################################################################
2-
# boards/arm/nrf53/nrf5340-audio-dk/src/Makefile
2+
# boards/arm/nrf53/nrf5340-audio-dk/src/Make.defs
33
#
44
# Licensed to the Apache Software Foundation (ASF) under one or more
55
# contributor license agreements. See the NOTICE file distributed with
@@ -32,4 +32,6 @@ else
3232
CSRCS += nrf53_userleds.c
3333
endif
3434

35-
include $(TOPDIR)/boards/Board.mk
35+
DEPPATH += --dep-path board
36+
VPATH += :board
37+
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

boards/arm/nrf53/nrf5340-dk/configs/timer_cpuapp/defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# CONFIG_STANDARD_SERIAL is not set
1111
CONFIG_ARCH="arm"
1212
CONFIG_ARCH_BOARD="nrf5340-dk"
13+
CONFIG_ARCH_BOARD_COMMON=y
1314
CONFIG_ARCH_BOARD_NRF5340_DK=y
1415
CONFIG_ARCH_CHIP="nrf53"
1516
CONFIG_ARCH_CHIP_NRF5340=y

boards/arm/nrf53/nrf5340-dk/src/Makefile renamed to boards/arm/nrf53/nrf5340-dk/src/Make.defs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
############################################################################
2-
# boards/arm/nrf53/nrf5340-dk/src/Makefile
2+
# boards/arm/nrf53/nrf5340-dk/src/Make.defs
33
#
44
# Licensed to the Apache Software Foundation (ASF) under one or more
55
# contributor license agreements. See the NOTICE file distributed with
@@ -40,12 +40,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
4040
CSRCS += nrf53_buttons.c
4141
endif
4242

43-
ifeq ($(CONFIG_TIMER),y)
44-
ifeq ($(CONFIG_NRF53_TIMER),y)
45-
CSRCS += nrf53_timer.c
46-
endif
47-
endif
48-
4943
ifeq ($(CONFIG_PWM),y)
5044
CSRCS += nrf53_pwm.c
5145
endif
@@ -54,4 +48,6 @@ ifeq ($(CONFIG_ADC),y)
5448
CSRCS += nrf53_adc.c
5549
endif
5650

57-
include $(TOPDIR)/boards/Board.mk
51+
DEPPATH += --dep-path board
52+
VPATH += :board
53+
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

boards/arm/nrf53/nrf5340-dk/src/nrf5340-dk.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,6 @@
9494

9595
int nrf53_bringup(void);
9696

97-
/****************************************************************************
98-
* Name: nrf53_timer_driver_setup
99-
*
100-
* Description:
101-
* Initialize TIMER driver.
102-
*
103-
****************************************************************************/
104-
105-
#ifdef CONFIG_TIMER
106-
int nrf53_timer_driver_setup(const char *devpath, int timer);
107-
#endif
108-
10997
/****************************************************************************
11098
* Name: nrf53_pwm_setup
11199
*

0 commit comments

Comments
 (0)