113 lines
4.0 KiB
C
113 lines
4.0 KiB
C
/****************************************************************************
|
|
* arch/arm/src/nrf52/nrf52_wdt.h
|
|
*
|
|
* 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.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __ARCH_ARM_SRC_NRF52_NRF52_WDT_H
|
|
#define __ARCH_ARM_SRC_NRF52_NRF52_WDT_H
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#ifdef CONFIG_WATCHDOG
|
|
|
|
/****************************************************************************
|
|
* Pre-processor Definitions
|
|
****************************************************************************/
|
|
|
|
#define NRF_WDT_RR_VALUE 0x6E524635UL /* Fixed value, don't modify it */
|
|
#define NRF_WDT_TASK_SET 1
|
|
#define WDT_CONFIG_HALT_POS 3
|
|
#define WDT_CONFIG_SLEEP_POS 0
|
|
#define NRF_WDT_INT_TIMEOUT_MASK 1
|
|
|
|
/****************************************************************************
|
|
* Public Types
|
|
****************************************************************************/
|
|
|
|
#undef EXTERN
|
|
#if defined(__cplusplus)
|
|
#define EXTERN extern "C"
|
|
extern "C"
|
|
{
|
|
#else
|
|
#define EXTERN extern
|
|
#endif
|
|
|
|
enum wdt_behaviour_e
|
|
{
|
|
WDG_PAUSE = 0,
|
|
WDG_RUN = 1
|
|
};
|
|
|
|
/****************************************************************************
|
|
* Public Functions
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: nrf52_wdt_initialize
|
|
*
|
|
* Description:
|
|
* Initialize the WDT watchdog time. The watchdog timer is initialized and
|
|
* registers as 'devpath. The initial state of the watchdog time is
|
|
* disabled.
|
|
*
|
|
* Input Parameters:
|
|
* devpath - The full path to the watchdog. This should be of the form
|
|
* /dev/watchdog0
|
|
* mode_sleep - The behaviour of watchdog when CPU enter sleep mode
|
|
* mode_halt - The behaviour of watchdog when CPU was HALT by
|
|
* debugger
|
|
*
|
|
* Returned Values:
|
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
|
* any failure.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifdef CONFIG_NRF52_WDT
|
|
int nrf52_wdt_initialize(FAR const char *devpath, int16_t mode_sleep,
|
|
int16_t mode_halt);
|
|
#endif
|
|
|
|
#undef EXTERN
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif /* CONFIG_WATCHDOG */
|
|
#endif /* __ARCH_ARM_SRC_NRF52_NRF52_WDT_H */
|