Updated TRNG.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12465 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
Giovanni Di Sirio 2018-12-08 12:04:11 +00:00
parent 358fdba16d
commit 584f19dbe9
5 changed files with 95 additions and 97 deletions

View File

@ -142,37 +142,6 @@ typedef void (*spicallback_t)(SPIDriver *spip);
for completing types.*/ for completing types.*/
#include "hal_spi_lld.h" #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. * @brief Driver configuration structure.
*/ */
@ -217,6 +186,37 @@ struct hal_spi_config {
spi_lld_config_fields; 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. */ /* Driver macros. */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -56,10 +56,46 @@ typedef enum {
/** /**
* @brief Type of a structure representing a TRNG driver. * @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" #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. */ /* Driver macros. */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -93,44 +93,24 @@
/* Driver data structures and types. */ /* Driver data structures and types. */
/*===========================================================================*/ /*===========================================================================*/
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/
typedef struct {
/* End of the mandatory fields.*/
/**
* @brief Dummy configuration, it is not needed.
*/
uint32_t dummy;
} TRNGConfig;
/**
* @brief Structure representing a TRNG driver.
*/
struct TRNGDriver {
/**
* @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.*/
/**
* @brief Pointer to the RNG registers block.
*/
RNG_TypeDef *rng;
};
/*===========================================================================*/ /*===========================================================================*/
/* Driver macros. */ /* Driver macros. */
/*===========================================================================*/ /*===========================================================================*/
/**
* @brief Low level fields of the TRNG configuration structure.
*/
#define trng_lld_config_fields \
/* Dummy configuration, it is not needed.*/ \
uint32_t dummy
/**
* @brief Low level fields of the TRNG driver structure.
*/
#define trng_lld_driver_fields \
/* Pointer to the RNG registers block.*/ \
RNG_TypeDef *rng
/*===========================================================================*/ /*===========================================================================*/
/* External declarations. */ /* External declarations. */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -57,40 +57,22 @@
/* Driver data structures and types. */ /* Driver data structures and types. */
/*===========================================================================*/ /*===========================================================================*/
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/
typedef struct {
/* End of the mandatory fields.*/
/**
* @brief Dummy configuration, it is not needed..
*/
uint32_t dummy;
} TRNGConfig;
/**
* @brief Structure representing a TRNG driver.
*/
struct TRNGDriver {
/**
* @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.*/
};
/*===========================================================================*/ /*===========================================================================*/
/* Driver macros. */ /* Driver macros. */
/*===========================================================================*/ /*===========================================================================*/
/**
* @brief Low level fields of the TRNG configuration structure.
*/
#define trng_lld_config_fields \
/* Dummy configuration, it is not needed.*/ \
uint32_t dummy
/**
* @brief Low level fields of the TRNG driver structure.
*/
#define trng_lld_driver_fields
/*===========================================================================*/ /*===========================================================================*/
/* External declarations. */ /* External declarations. */
/*===========================================================================*/ /*===========================================================================*/

View File

@ -78,7 +78,7 @@
- NEW: Low level drivers simplification. There is a new template of LLD, now - NEW: Low level drivers simplification. There is a new template of LLD, now
driver and configuration types are defined in the HLD, LLD just exports driver and configuration types are defined in the HLD, LLD just exports
macros with the fields to be added to the structures. macros with the fields to be added to the structures.
So far the drivers updated are: RTC, SPI. So far the drivers updated are: RTC, SPI, TRNG.
- NEW: Added UART7/8 support to STM32 UART USARTv1 driver. - NEW: Added UART7/8 support to STM32 UART USARTv1 driver.
- NEW: Added persistent storage interface to the STM32 RTCv2 driver. - NEW: Added persistent storage interface to the STM32 RTCv2 driver.
- NEW: STM32 RTCv2 driver now supports callbacks on events. - NEW: STM32 RTCv2 driver now supports callbacks on events.