STM32H7: Support the RNG Peripheral
The random number generator on the STM32H7 is identical to the v1 RNG already present in the library. So use that, and make sure that the RCC knows about the peripheral. Originally filed at: https://github.com/libopencm3/libopencm3/pull/1244 Reviewed-by: Karl Palsson <karlp@tweak.net.au> * whitespace changes from review
This commit is contained in:
committed by
Karl Palsson
parent
b47d769369
commit
1c54d58c81
@@ -394,6 +394,7 @@ LGPL License Terms @ref lgpl_license
|
||||
#define RCC_D2CCIP2R_CECSEL_SHIFT 22
|
||||
#define RCC_D2CCIP2R_USBSEL_SHIFT 20
|
||||
#define RCC_D2CCIP2R_I2C123SEL_SHIFT 12
|
||||
#define RCC_D2CCIP2R_RNGSEL_MASK 0x3
|
||||
#define RCC_D2CCIP2R_RNGSEL_SHIFT 8
|
||||
#define RCC_D2CCIP2R_USART16SEL_SHIFT 3
|
||||
#define RCC_D2CCIP2R_USART234578SEL_SHIFT 0
|
||||
@@ -402,6 +403,10 @@ LGPL License Terms @ref lgpl_license
|
||||
/** @defgroup rcc_d2ccip2r_values RCC_D2CCIP2R Values
|
||||
* @ingroup rcc_registers
|
||||
* @{*/
|
||||
#define RCC_D2CCIP2R_RNGSEL_HSI48 0
|
||||
#define RCC_D2CCIP2R_RNGSEL_PLL1Q 1
|
||||
#define RCC_D2CCIP2R_RNGSEL_LSE 2
|
||||
#define RCC_D2CCIP2R_RNGSEL_LSI 3
|
||||
#define RCC_D2CCIP2R_USART16SEL_PCLK2 0
|
||||
#define RCC_D2CCIP2R_USART234578SEL_PCLK1 0
|
||||
#define RCC_D2CCIP2R_USARTSEL_PLL2Q 1
|
||||
@@ -774,6 +779,12 @@ void rcc_set_spi123_clksel(uint8_t clksel);
|
||||
*/
|
||||
void rcc_set_spi45_clksel(uint8_t clksel);
|
||||
|
||||
/**
|
||||
* Set the clock select for the RNG device.
|
||||
* @param[in] clksel Clock source to configure for. @ref rcc_d2ccip2r_values
|
||||
* @sa rcc_set_peripheral_clk_sel for equivalent generic functionality
|
||||
*/
|
||||
void rcc_set_rng_clksel(uint8_t clksel);
|
||||
|
||||
END_DECLS
|
||||
/**@}*/
|
||||
|
||||
23
include/libopencm3/stm32/h7/rng.h
Normal file
23
include/libopencm3/stm32/h7/rng.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of the libopencm3 project.
|
||||
*
|
||||
* 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_RNG_H
|
||||
#define LIBOPENCM3_RNG_H
|
||||
|
||||
#include <libopencm3/stm32/common/rng_common_v1.h>
|
||||
|
||||
#endif
|
||||
@@ -26,6 +26,8 @@
|
||||
# include <libopencm3/stm32/f4/rng.h>
|
||||
#elif defined(STM32F7)
|
||||
# include <libopencm3/stm32/f7/rng.h>
|
||||
#elif defined(STM32H7)
|
||||
# include <libopencm3/stm32/h7/rng.h>
|
||||
#elif defined(STM32L0)
|
||||
# include <libopencm3/stm32/l0/rng.h>
|
||||
#elif defined(STM32L4)
|
||||
|
||||
Reference in New Issue
Block a user