arch: samd5e5 : Add watchdog timer drivers.

boards: metro-m4  Add support for starting the watchdog timer on the metro-m4.

Testing:
- Build check only

Signed-off-by: Leomar Mateus Radke  <leomar@falker.com.br>
This commit is contained in:
leomarradke
2020-08-03 20:41:10 -03:00
committed by Alan Carvalho de Assis
parent f618de9c97
commit e7073df8d6
4 changed files with 620 additions and 1 deletions
+1 -1
View File
@@ -92,7 +92,7 @@
# define WDT_CONFIG_PER_1K (7 << WDT_CONFIG_PER_SHIFT) /* 1024 clock cycles */
# define WDT_CONFIG_PER_2K (8 << WDT_CONFIG_PER_SHIFT) /* 2048 clock cycles */
# define WDT_CONFIG_PER_4K (9 << WDT_CONFIG_PER_SHIFT) /* 4096 clock cycles */
# define WDT_CONFIG_PER_8k (10 << WDT_CONFIG_PER_SHIFT) /* 8192 clock cycles */
# define WDT_CONFIG_PER_8K (10 << WDT_CONFIG_PER_SHIFT) /* 8192 clock cycles */
# define WDT_CONFIG_PER_16K (11 << WDT_CONFIG_PER_SHIFT) /* 16384 clock cycles */
#define WDT_CONFIG_WINDOW_SHIFT (4) /* Bits 4-7: Window Mode Time-Out Period */
#define WDT_CONFIG_WINDOW_MASK (15 << WDT_CONFIG_WINDOW_SHIFT)
File diff suppressed because it is too large Load Diff
+97
View File
@@ -0,0 +1,97 @@
/****************************************************************************
* arch/arm/src/sama5/sam_wdt.h
*
* Copyright (C) 2020 Falker Automacao Agricola LTDA.
* Author: Leomar Mateus Radke <leomar@falker.com.br>
* Author: Ricardo Wartchow <wartchow@gmail.com>
*
* 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_SAMD5E5_SAM_WDT_H
#define __ARCH_ARM_SRC_SAMD5E5_SAM_WDT_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#include "hardware/sam_wdt.h"
#ifdef CONFIG_SAMD5E5_WDT
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: sam_wdt_initialize()
*
* Description:
* Perform architecture-specific initialization of the Watchdog hardware.
* This interface should be provided by all configurations using
* to avoid exposed platform-dependent logic.
*
* At a minimum, this function should call watchdog_register().
*
* Input Parameters:
* None
*
* Returned Value:
* Zero on success; a negated errno value on failure.
*
****************************************************************************/
void sam_wdt_initialize(FAR const char *devpath);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_SAMD5E5_WDT */
#endif /* __ARCH_ARM_SRC_SAMD5E5_SAM_WDT_H */
@@ -47,6 +47,10 @@
#include "metro-m4.h"
#if defined(CONFIG_SAMD5E5_WDT) && defined(CONFIG_WATCHDOG)
#include "sam_wdt.h"
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -86,6 +90,10 @@ int sam_bringup(void)
}
#endif
#if defined(CONFIG_SAMD5E5_WDT) && defined(CONFIG_WATCHDOG)
(void)sam_wdt_initialize(CONFIG_WATCHDOG_DEVPATH);
#endif
UNUSED(ret);
return OK;
}