git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14973 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2021-10-31 06:34:00 +00:00
parent 17e08c7939
commit e1732a23c0
7 changed files with 69 additions and 34 deletions

View File

@ -110,9 +110,9 @@ typedef uint8_t i2cflags_t;
typedef void (*i2c_delay_t)(void); typedef void (*i2c_delay_t)(void);
/** /**
* @brief Type of I2C driver configuration structure. * @brief I2C driver configuration structure.
*/ */
typedef struct { struct hal_i2c_config {
/** /**
* @brief 10 bits addressing switch. * @brief 10 bits addressing switch.
*/ */
@ -136,17 +136,22 @@ typedef struct {
*/ */
i2c_delay_t delay; i2c_delay_t delay;
#endif #endif
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */

View File

@ -99,19 +99,24 @@ typedef uint8_t i2cflags_t;
* @note Implementations may extend this structure to contain more, * @note Implementations may extend this structure to contain more,
* architecture dependent, fields. * architecture dependent, fields.
*/ */
typedef struct { struct hal_i2c_config {
/** /**
* @brief Specifies the I2C clock frequency. * @brief Specifies the I2C clock frequency.
*/ */
uint32_t clock_speed; uint32_t clock_speed;
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */
@ -171,7 +176,7 @@ struct I2CDriver {
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/*==========================================================================*/ /*==========================================================================*/
/* Driver macros. */ /* Driver macros. */

View File

@ -68,24 +68,29 @@ typedef uint16_t i2caddr_t;
typedef uint32_t i2cflags_t; typedef uint32_t i2cflags_t;
/** /**
* @brief Type of I2C driver configuration structure. * @brief I2C driver configuration structure.
* @note Implementations may extend this structure to contain more, * @note Implementations may extend this structure to contain more,
* architecture dependent, fields. * architecture dependent, fields.
*/ */
typedef struct { struct hal_i2c_config {
/* End of the mandatory fields.*/ /* End of the mandatory fields.*/
uint32_t dummy; uint32_t dummy;
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */

View File

@ -385,9 +385,9 @@ typedef enum {
} i2cdutycycle_t; } i2cdutycycle_t;
/** /**
* @brief Type of I2C driver configuration structure. * @brief I2C driver configuration structure.
*/ */
typedef struct { struct hal_i2c_config {
/* End of the mandatory fields.*/ /* End of the mandatory fields.*/
i2copmode_t op_mode; /**< @brief Specifies the I2C mode. */ i2copmode_t op_mode; /**< @brief Specifies the I2C mode. */
uint32_t clock_speed; /**< @brief Specifies the clock frequency. uint32_t clock_speed; /**< @brief Specifies the clock frequency.
@ -395,17 +395,22 @@ typedef struct {
than 400kHz. */ than 400kHz. */
i2cdutycycle_t duty_cycle; /**< @brief Specifies the I2C fast mode i2cdutycycle_t duty_cycle; /**< @brief Specifies the I2C fast mode
duty cycle. */ duty cycle. */
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */

View File

@ -355,9 +355,9 @@ typedef uint16_t i2caddr_t;
typedef uint32_t i2cflags_t; typedef uint32_t i2cflags_t;
/** /**
* @brief Type of I2C driver configuration structure. * @brief I2C driver configuration structure.
*/ */
typedef struct { struct hal_i2c_config {
/** /**
* @brief TIMINGR register initialization. * @brief TIMINGR register initialization.
* @note Refer to the STM32 reference manual, the values are affected * @note Refer to the STM32 reference manual, the values are affected
@ -374,17 +374,22 @@ typedef struct {
* @note Only the ADD10 bit can eventually be specified here. * @note Only the ADD10 bit can eventually be specified here.
*/ */
uint32_t cr2; uint32_t cr2;
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */

View File

@ -413,9 +413,9 @@ typedef uint16_t i2caddr_t;
typedef uint32_t i2cflags_t; typedef uint32_t i2cflags_t;
/** /**
* @brief Type of I2C driver configuration structure. * @brief I2C driver configuration structure.
*/ */
typedef struct { struct hal_i2c_config {
/** /**
* @brief TIMINGR register initialization. * @brief TIMINGR register initialization.
* @note Refer to the STM32 reference manual, the values are affected * @note Refer to the STM32 reference manual, the values are affected
@ -432,17 +432,22 @@ typedef struct {
* @note Only the ADD10 bit can eventually be specified here. * @note Only the ADD10 bit can eventually be specified here.
*/ */
uint32_t cr2; uint32_t cr2;
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */

View File

@ -68,24 +68,29 @@ typedef uint16_t i2caddr_t;
typedef uint32_t i2cflags_t; typedef uint32_t i2cflags_t;
/** /**
* @brief Type of I2C driver configuration structure. * @brief I2C driver configuration structure.
* @note Implementations may extend this structure to contain more, * @note Implementations may extend this structure to contain more,
* architecture dependent, fields. * architecture dependent, fields.
*/ */
typedef struct { struct hal_i2c_config {
/* End of the mandatory fields.*/ /* End of the mandatory fields.*/
uint32_t dummy; uint32_t dummy;
} I2CConfig; };
/**
* @brief Type of a structure representing an I2C configuration.
*/
typedef struct hal_i2c_config I2CConfig;
/** /**
* @brief Type of a structure representing an I2C driver. * @brief Type of a structure representing an I2C driver.
*/ */
typedef struct I2CDriver I2CDriver; typedef struct hal_i2c_driver I2CDriver;
/** /**
* @brief Structure representing an I2C driver. * @brief Structure representing an I2C driver.
*/ */
struct I2CDriver { struct hal_i2c_driver {
/** /**
* @brief Driver state. * @brief Driver state.
*/ */