boards/nrf5340-dk: add TIMER configuration

This commit is contained in:
raiden00pl 2023-03-13 14:16:48 +01:00 committed by Alan Carvalho de Assis
parent 8d2451da0c
commit a5aa7886ba
5 changed files with 144 additions and 0 deletions

View File

@ -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

View File

@ -36,4 +36,10 @@ else
CSRCS += nrf53_userleds.c CSRCS += nrf53_userleds.c
endif endif
ifeq ($(CONFIG_TIMER),y)
ifeq ($(CONFIG_NRF53_TIMER),y)
CSRCS += nrf53_timer.c
endif
endif
include $(TOPDIR)/boards/Board.mk include $(TOPDIR)/boards/Board.mk

View File

@ -82,5 +82,17 @@
int nrf53_bringup(void); 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 /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_NRF53_NRF5340_DK_SRC_NRF53_NRF5340_DK_H */ #endif /* __BOARDS_ARM_NRF53_NRF5340_DK_SRC_NRF53_NRF5340_DK_H */

View File

@ -39,6 +39,14 @@
# include "nrf53_rptun.h" # include "nrf53_rptun.h"
#endif #endif
#include "nrf5340-dk.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define NRF53_TIMER (0)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -79,6 +87,18 @@ int nrf53_bringup(void)
#endif #endif
#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 #ifdef CONFIG_NRF53_SOFTDEVICE_CONTROLLER
ret = nrf53_sdc_initialize(); ret = nrf53_sdc_initialize();

View File

@ -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 <nuttx/config.h>
#include <nuttx/timers/timer.h>
#include <debug.h>
#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);
}