Hi,
Historically in ChibiOS/HAL low level drivers contained the type definitions for both the HLD and the LLD parts. This impacted drivers in several ways:
- Code duplicated in each LLD.
- Changes in HLD always mandated changes in LLDs.
- Alignment problems between the various ports.
- Added effort in creating LLDs.
Now things are going to change:
- Type definitions will be moved in HLD, this will make sure that LLDs are not necessarily impacted by changes.
- LLDs will just export two structures: xxx_lld_driver_fields and xxx_lld_config_fields containing the fields to be added to XXXDriver and XXXConfig.
So far only ADC, DAC, I2S, RTC, SPI, TRNG, WSPI drivers have been updated to the new model, please make sure that your ports are aligned to the new model in trunk. I will inform in this thread when more drivers will be updated.
Changes in STM32 drivers took few minutes, I will gladly assist you in adapting your drivers if required.
Sorry for the forced change but the project has to evolve in order to go ahead, overall codebase will greatly benefit from this.
Giovanni
[MAINTAINERS] Low Level Driver organization changes
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: [MAINTAINERS] Low Level Driver organization changes
Giovanni wrote:Sorry for the forced change but the project has to evolve in order to go ahead, overall codebase will greatly benefit from this.
The code base is already a gem and well respected in the relevant communities as very high quality. This is a good change for the future of ChibiOS/HAL.
- tfAteba
- Posts: 547
- Joined: Fri Oct 16, 2015 11:03 pm
- Location: Strasbourg, France
- Has thanked: 91 times
- Been thanked: 48 times
Re: [MAINTAINERS] Low Level Driver organization changes
Hello Giovanni,
I will start the migration as soon has possible , but before I need to See the changes that you have made.
I will start the migration as soon has possible , but before I need to See the changes that you have made.
regards,
Theo.
Theo.
Re: [MAINTAINERS] Low Level Driver organization changes
Changed driver struct names in the upper layer driver. For example, in hal_dac.h:
Lowercase hal_<peripheral>_driver, hal_<peripheral>_config, and so on. Just curious, why the change ?
Code: Select all
/**
* @brief Type of a structure representing an DAC driver.
*/
typedef struct hal_dac_driver DACDriver;
/**
* @brief Type of a structure representing an DAC driver configuration.
*/
typedef struct hal_dac_config DACConfig;
/**
* @brief Type of a DAC conversion group.
*/
typedef struct hal_dac_conversion_group DACConversionGroup;
Lowercase hal_<peripheral>_driver, hal_<peripheral>_config, and so on. Just curious, why the change ?
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: [MAINTAINERS] Low Level Driver organization changes
xFaisal,
The change is not just that, now the xxxConfig and xxxDriver structures are defined in the upper layer, the LLD extra fields are exported by the LLD into a macro. This way, when there is a change affecting just the HLD, there is no need to rework all LLDs.
xTheo,
Look at the files under os/hal/templates, the change is more clearly visible looking at templates rather than STM32 implementations.
Giovanni
The change is not just that, now the xxxConfig and xxxDriver structures are defined in the upper layer, the LLD extra fields are exported by the LLD into a macro. This way, when there is a change affecting just the HLD, there is no need to rework all LLDs.
xTheo,
Look at the files under os/hal/templates, the change is more clearly visible looking at templates rather than STM32 implementations.
Giovanni
Re: [MAINTAINERS] Low Level Driver organization changes
Giovanni wrote:xFaisal,
The change is not just that, now the xxxConfig and xxxDriver structures are defined in the upper layer, the LLD extra fields are exported by the LLD into a macro. This way, when there is a change affecting just the HLD, there is no need to rework all LLDs.
xTheo,
Look at the files under os/hal/templates, the change is more clearly visible looking at templates rather than STM32 implementations.
Giovanni
Oh, I understood that part of it.
I was just wondering about the new naming convention. Previously, user applications would use the xxxConfig and xxxDriver structures in their top level application. Is the correct convention to now use hal_<peripheral>_driver and hal_<peripheral>_config?
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: [MAINTAINERS] Low Level Driver organization changes
Hi,
That is the structure name, not the type name, I decided to not have conflicting names, ss non-API it is right to not use camel case. Driver and config are still xxxDriver and xxxConfig, from the application pov nothing changed.
Giovanni
That is the structure name, not the type name, I decided to not have conflicting names, ss non-API it is right to not use camel case. Driver and config are still xxxDriver and xxxConfig, from the application pov nothing changed.
Giovanni
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 10 guests