2018-03-26 10:37:32 -06:00
|
|
|
/****************************************************************************
|
2021-03-08 18:39:04 -03:00
|
|
|
* boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c
|
2018-03-26 10:37:32 -06:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* 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
|
2018-03-26 10:37:32 -06:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-03-26 10:37:32 -06:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* 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.
|
2018-03-26 10:37:32 -06:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2018-04-20 07:23:57 -06:00
|
|
|
|
2018-03-26 10:37:32 -06:00
|
|
|
#include <sys/types.h>
|
2018-04-20 07:23:57 -06:00
|
|
|
#include <syslog.h>
|
2018-03-26 10:37:32 -06:00
|
|
|
|
2018-11-18 07:51:24 -06:00
|
|
|
#ifdef CONFIG_NRF52_WDT
|
2020-10-28 14:40:35 -03:00
|
|
|
# include "nrf52_wdt_lowerhalf.h"
|
2018-11-18 07:51:24 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_USERLED
|
|
|
|
# include <nuttx/leds/userled.h>
|
|
|
|
#endif
|
2018-04-30 16:30:13 -06:00
|
|
|
|
2018-03-26 10:37:32 -06:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nrf52_bringup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Perform architecture-specific initialization
|
|
|
|
*
|
2019-02-18 15:32:00 -06:00
|
|
|
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
|
|
|
* Called from board_late_initialize().
|
2018-03-26 10:37:32 -06:00
|
|
|
*
|
2021-08-01 15:00:54 +08:00
|
|
|
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
|
2018-03-26 10:37:32 -06:00
|
|
|
* Called from the NSH library
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nrf52_bringup(void)
|
|
|
|
{
|
2018-04-20 07:23:57 -06:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
#ifdef CONFIG_NRF52_WDT
|
|
|
|
/* Start Watchdog timer */
|
|
|
|
|
|
|
|
ret = nrf52_wdt_initialize(CONFIG_WATCHDOG_DEVPATH, 1, 1);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: nrf52_wdt_initialize failed: %d\n", ret);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-11-18 07:51:24 -06:00
|
|
|
#ifdef CONFIG_USERLED
|
|
|
|
/* Register the LED driver */
|
|
|
|
|
|
|
|
ret = userled_lower_initialize(CONFIG_EXAMPLES_LEDS_DEVPATH);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-04-20 07:23:57 -06:00
|
|
|
UNUSED(ret);
|
2018-03-26 10:37:32 -06:00
|
|
|
return OK;
|
|
|
|
}
|