2018-03-26 10:37:32 -06:00
|
|
|
/****************************************************************************
|
2019-12-16 18:35:45 +00:00
|
|
|
* boards/arm/nrf52/nrf52832-dk/src/nrf53_bringup.c
|
2018-03-26 10:37:32 -06:00
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* 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
|
|
|
|
# include "nrf52_wdt.h"
|
|
|
|
#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
|
|
|
*
|
2019-02-18 15:32:00 -06:00
|
|
|
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_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;
|
|
|
|
}
|