From 584f19dbe94ea1ad9585ce04c5f1d5b424ebaa09 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 8 Dec 2018 12:04:11 +0000 Subject: Updated TRNG. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12465 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/include/hal_spi.h | 62 +++++++++++++++++++++++------------------------ os/hal/include/hal_trng.h | 38 ++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 32 deletions(-) (limited to 'os/hal/include') diff --git a/os/hal/include/hal_spi.h b/os/hal/include/hal_spi.h index ab07811c0..4d2ebdefb 100644 --- a/os/hal/include/hal_spi.h +++ b/os/hal/include/hal_spi.h @@ -142,37 +142,6 @@ typedef void (*spicallback_t)(SPIDriver *spip); for completing types.*/ #include "hal_spi_lld.h" -/** - * @brief Structure representing an SPI driver. - */ -struct hal_spi_driver { - /** - * @brief Driver state. - */ - spistate_t state; - /** - * @brief Current configuration data. - */ - const SPIConfig *config; -#if SPI_USE_WAIT || defined(__DOXYGEN__) - /** - * @brief Waiting thread. - */ - thread_reference_t thread; -#endif /* SPI_USE_WAIT */ -#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) - /** - * @brief Mutex protecting the peripheral. - */ - mutex_t mutex; -#endif /* SPI_USE_MUTUAL_EXCLUSION */ -#if defined(SPI_DRIVER_EXT_FIELDS) - SPI_DRIVER_EXT_FIELDS -#endif - /* End of the mandatory fields.*/ - spi_lld_driver_fields; -}; - /** * @brief Driver configuration structure. */ @@ -217,6 +186,37 @@ struct hal_spi_config { spi_lld_config_fields; }; +/** + * @brief Structure representing an SPI driver. + */ +struct hal_spi_driver { + /** + * @brief Driver state. + */ + spistate_t state; + /** + * @brief Current configuration data. + */ + const SPIConfig *config; +#if SPI_USE_WAIT || defined(__DOXYGEN__) + /** + * @brief Waiting thread. + */ + thread_reference_t thread; +#endif /* SPI_USE_WAIT */ +#if SPI_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__) + /** + * @brief Mutex protecting the peripheral. + */ + mutex_t mutex; +#endif /* SPI_USE_MUTUAL_EXCLUSION */ +#if defined(SPI_DRIVER_EXT_FIELDS) + SPI_DRIVER_EXT_FIELDS +#endif + /* End of the mandatory fields.*/ + spi_lld_driver_fields; +}; + /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ diff --git a/os/hal/include/hal_trng.h b/os/hal/include/hal_trng.h index 48d95613e..a92f4f665 100644 --- a/os/hal/include/hal_trng.h +++ b/os/hal/include/hal_trng.h @@ -56,10 +56,46 @@ typedef enum { /** * @brief Type of a structure representing a TRNG driver. */ -typedef struct TRNGDriver TRNGDriver; +typedef struct hal_trng_driver TRNGDriver; +/** + * @brief Driver configuration structure. + * @note It could be empty on some architectures. + */ +typedef struct hal_trng_config TRNGConfig; + + +/* Including the low level driver header, it exports information required + for completing types.*/ #include "hal_trng_lld.h" +/** + * @brief Driver configuration structure. + */ +struct hal_trng_config { + /* End of the mandatory fields.*/ + trng_lld_config_fields; +}; + +/** + * @brief Structure representing a TRNG driver. + */ +struct hal_trng_driver { + /** + * @brief Driver state. + */ + trngstate_t state; + /** + * @brief Current configuration data. + */ + const TRNGConfig *config; +#if defined(TRNG_DRIVER_EXT_FIELDS) + TRNG_DRIVER_EXT_FIELDS +#endif + /* End of the mandatory fields.*/ + trng_lld_driver_fields; +}; + /*===========================================================================*/ /* Driver macros. */ /*===========================================================================*/ -- cgit v1.2.3