Brian Viele 53302439df stm32h7: Initial introduction into libopencm3.
Updates to a base set of includes to map to the h7 include files which are
mainly based on the f7 versions for simple devices (e.g. SPI, USART, GPIO).

Custom files that have been implemented from the datasheet/ref manual include
the memory map, RCC, PWR definitions, and irq.json file for generation of
nvic files for interrupt mapping.

Additional functionality, especially PLL and tweaks for non-F7 compatible
implementations coming in future commits.

Added documentation tree configuration.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Changed dmaX_streamX to dmaX_strX in a few places for consistency
2019-11-28 22:15:24 +00:00

80 lines
2.4 KiB
C

/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2019 Brian Viele <vielster@allocor.tech>
*
* 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/>.
*/
#ifndef LIBOPENCM3_PWR_H
#define LIBOPENCM3_PWR_H
/**@{*/
/** @defgroup pwr_registers PWR Registers
* @ingroup STM32H_pwr_defines
@{*/
/** Power control register. */
#define PWR_CR1 MMIO32(POWER_CONTROL_BASE + 0x00)
/** Power control/status register. */
#define PWR_CSR1 MMIO32(POWER_CONTROL_BASE + 0x04)
/** Power control register 2. */
#define PWR_CR2 MMIO32(POWER_CONTROL_BASE + 0x08)
/** Power control register 3. */
#define PWR_CR3 MMIO32(POWER_CONTROL_BASE + 0x0C)
/** CPU Power control register 3. */
#define PWR_CPUCR MMIO32(POWER_CONTROL_BASE + 0x10)
/** D3 Domain Power Control register. */
#define PWR_D3CR MMIO32(POWER_CONTROL_BASE + 0x18)
/** Wakeup Domain Power Control register. */
#define PWR_WKUPCR MMIO32(POWER_CONTROL_BASE + 0x20)
/*@}*/
/** VOS[15:14]: Regulator voltage scaling output selection */
#define PWR_CR1_SVOS_SHIFT 14
#define PWR_CR1_SVOS_SCALE_3 (0x3)
#define PWR_CR1_SVOS_SCALE_4 (0x2)
#define PWR_CR1_SVOS_SCALE_5 (0x1)
#define PWR_CR1_SVOS_MASK (0x3)
/** DBP[8]: Disable backup domain write protection. */
#define PWR_CR1_DBP (1 << 8)
/** PVDO: PVD output */
#define PWR_CSR1_PVDO (1 << 4)
/* --- Function prototypes ------------------------------------------------- */
enum pwr_svos_scale {
PWR_SCALE3 = PWR_CR1_SVOS_SCALE_3 << PWR_CR1_SVOS_SHIFT,
PWR_SCALE4 = PWR_CR1_SVOS_SCALE_4 << PWR_CR1_SVOS_SHIFT,
PWR_SCALE5 = PWR_CR1_SVOS_SCALE_5 << PWR_CR1_SVOS_SHIFT,
};
BEGIN_DECLS
void pwr_set_svos_scale(enum pwr_svos_scale scale);
END_DECLS
/**@}*/
#endif