stm32: centralize additionnal iwdg window register definition into iwdg-v2.

stm32f0, l3, l4 are currently sharing the same duplicated header, and
stm32l0 uses the same peripheral. Stop copy-pasting stuff and centralize
definitions into a iwdg_common_v2.h header.
This commit is contained in:
Guillaume Revaillot 2018-03-28 13:34:51 +02:00 committed by Karl Palsson
parent f63090d9b6
commit 207eb07d4c
4 changed files with 85 additions and 65 deletions

View File

@ -0,0 +1,82 @@
/** @addtogroup iwdg_defines
@author @htmlonly &copy; @endhtmlonly 2018 Guillame Revaillot <revaillot@archos.com>
*/
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2018 Guillaume Revaillot <revaillot@archos.com>
* Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA IWDG.H
The order of header inclusion is important. iwdg.h includes the device
specific memorymap.h header before including this header file.*/
/** @cond */
#ifdef LIBOPENCM3_IWDG_H
/** @endcond */
#pragma once
/**@{*/
#include <libopencm3/stm32/common/iwdg_common_all.h>
/*****************************************************************************/
/* Module definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Register definitions */
/*****************************************************************************/
/* Key Register (IWDG_WINR) */
#define IWDG_WINR MMIO32(IWDG_BASE + 0x10)
/*****************************************************************************/
/* Register values */
/*****************************************************************************/
/** @{*/
/* --- IWDG_SR values ------------------------------------------------------ */
/* WVU: Watchdog counter window value update */
#define IWDG_SR_WVU (1 << 2)
/**@}*/
/*****************************************************************************/
/* API definitions */
/*****************************************************************************/
/*****************************************************************************/
/* API Functions */
/*****************************************************************************/
BEGIN_DECLS
END_DECLS
/**@}*/
/** @cond */
#else
#warning "iwdg_common_v2.h should not be included explicitly, only via iwdg.h"
#endif
/** @endcond */

View File

@ -33,38 +33,6 @@
#ifndef LIBOPENCM3_IWDG_H
#define LIBOPENCM3_IWDG_H
#include <libopencm3/stm32/common/iwdg_common_all.h>
/*****************************************************************************/
/* Module definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Register definitions */
/*****************************************************************************/
/* Key Register (IWDG_WINR) */
#define IWDG_WINR MMIO32(IWDG_BASE + 0x10)
/*****************************************************************************/
/* Register values */
/*****************************************************************************/
/* --- IWDG_SR values ------------------------------------------------------ */
/* WVU: Watchdog counter window value update */
#define IWDG_SR_WVU (1 << 2)
/*****************************************************************************/
/* API definitions */
/*****************************************************************************/
/*****************************************************************************/
/* API Functions */
/*****************************************************************************/
BEGIN_DECLS
END_DECLS
#include <libopencm3/stm32/common/iwdg_common_v2.h>
#endif

View File

@ -33,21 +33,6 @@
#ifndef LIBOPENCM3_IWDG_H
#define LIBOPENCM3_IWDG_H
#include <libopencm3/stm32/common/iwdg_common_all.h>
/* --- IWDG registers ------------------------------------------------------ */
/* Window register (IWDG_WINR) */
#define IWDG_WINR MMIO32(IWDG_BASE + 0x10)
/* --- IWDG_SR values ------------------------------------------------------ */
/* WVU: Watchdog counter window value update */
#define IWDG_SR_WVU (1 << 2)
/* --- IWDG_WIN values ----------------------------------------------------- */
/* Bits 11:0 WIN[11:0]: Watchdog counter window value */
#include <libopencm3/stm32/common/iwdg_common_v2.h>
#endif

View File

@ -32,21 +32,6 @@
#ifndef LIBOPENCM3_IWDG_H
#define LIBOPENCM3_IWDG_H
#include <libopencm3/stm32/common/iwdg_common_all.h>
/* --- IWDG registers ------------------------------------------------------ */
/* Window register (IWDG_WINR) */
#define IWDG_WINR MMIO32(IWDG_BASE + 0x10)
/* --- IWDG_SR values ------------------------------------------------------ */
/* WVU: Watchdog counter window value update */
#define IWDG_SR_WVU (1 << 2)
/* --- IWDG_WIN values ----------------------------------------------------- */
/* Bits 11:0 WIN[11:0]: Watchdog counter window value */
#include <libopencm3/stm32/common/iwdg_common_v2.h>
#endif