diff --git a/boards/arm/nrf53/nrf5340-dk/configs/timer_cpuapp/defconfig b/boards/arm/nrf53/nrf5340-dk/configs/timer_cpuapp/defconfig new file mode 100644 index 00000000000..08e45c141b0 --- /dev/null +++ b/boards/arm/nrf53/nrf5340-dk/configs/timer_cpuapp/defconfig @@ -0,0 +1,48 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="nrf5340-dk" +CONFIG_ARCH_BOARD_NRF5340_DK=y +CONFIG_ARCH_CHIP="nrf53" +CONFIG_ARCH_CHIP_NRF5340=y +CONFIG_ARCH_CHIP_NRF5340_CPUAPP=y +CONFIG_ARCH_CHIP_NRF53=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_STDARG_H=y +CONFIG_BOARD_LOOPSPERMSEC=5500 +CONFIG_BUILTIN=y +CONFIG_EXAMPLES_TIMER=y +CONFIG_EXPERIMENTAL=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_MM_REGIONS=2 +CONFIG_NRF53_TIMER0=y +CONFIG_NRF53_UART0=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=524288 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=26 +CONFIG_START_MONTH=3 +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=0 +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/arm/nrf53/nrf5340-dk/src/Makefile b/boards/arm/nrf53/nrf5340-dk/src/Makefile index 3351a9d8313..8e7fc5c975c 100644 --- a/boards/arm/nrf53/nrf5340-dk/src/Makefile +++ b/boards/arm/nrf53/nrf5340-dk/src/Makefile @@ -36,4 +36,10 @@ else CSRCS += nrf53_userleds.c endif +ifeq ($(CONFIG_TIMER),y) +ifeq ($(CONFIG_NRF53_TIMER),y) +CSRCS += nrf53_timer.c +endif +endif + include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm/nrf53/nrf5340-dk/src/nrf5340-dk.h b/boards/arm/nrf53/nrf5340-dk/src/nrf5340-dk.h index 1332f9d4a7d..7548def7f18 100644 --- a/boards/arm/nrf53/nrf5340-dk/src/nrf5340-dk.h +++ b/boards/arm/nrf53/nrf5340-dk/src/nrf5340-dk.h @@ -82,5 +82,17 @@ 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 + #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_ARM_NRF53_NRF5340_DK_SRC_NRF53_NRF5340_DK_H */ diff --git a/boards/arm/nrf53/nrf5340-dk/src/nrf53_bringup.c b/boards/arm/nrf53/nrf5340-dk/src/nrf53_bringup.c index a7db7f5cf33..27b1061feee 100644 --- a/boards/arm/nrf53/nrf5340-dk/src/nrf53_bringup.c +++ b/boards/arm/nrf53/nrf5340-dk/src/nrf53_bringup.c @@ -39,6 +39,14 @@ # include "nrf53_rptun.h" #endif +#include "nrf5340-dk.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define NRF53_TIMER (0) + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -79,6 +87,18 @@ int nrf53_bringup(void) #endif #endif +#if defined(CONFIG_TIMER) && defined(CONFIG_NRF53_TIMER) + /* Configure TIMER driver */ + + ret = nrf53_timer_driver_setup("/dev/timer0", NRF53_TIMER); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to initialize timer driver: %d\n", + ret); + } +#endif + #ifdef CONFIG_NRF53_SOFTDEVICE_CONTROLLER ret = nrf53_sdc_initialize(); diff --git a/boards/arm/nrf53/nrf5340-dk/src/nrf53_timer.c b/boards/arm/nrf53/nrf5340-dk/src/nrf53_timer.c new file mode 100644 index 00000000000..c47c0b74c04 --- /dev/null +++ b/boards/arm/nrf53/nrf5340-dk/src/nrf53_timer.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * boards/arm/nrf53/nrf5340-dk/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 +#include + +#include + +#include "nrf53_tim_lowerhalf.h" + +#include "nrf5340-dk.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); +}