-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(PeriphDrivers): Add PinMux tool supporting functions #997
Conversation
/clang-format-run |
@@ -109,6 +109,11 @@ int MXC_GPIO_Config(const mxc_gpio_cfg_t *cfg) | |||
|
|||
MXC_GPIO_Init(1 << port); | |||
|
|||
if (MXC_GPIO_GetConfigLock() == MXC_GPIO_CONFIG_LOCKED) { | |||
// Configuration is locked. Ignore any attempts to change it. | |||
return E_NO_ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lorne-maxim what do you think about returning E_BAD_STATE
instead of no error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had considered it, but the problem is our PeriphInit functions check the return value of this function. So someone that has used the PinMux tool will have their configuration locked. They will then have no way of calling the PeriphInit function that won't return an error.
Is PinInit the correct name? We're hoping to extend the configuration tools to do clock configuration, and then later we'll do peripheral initialization. I think the ideal would be to have all this done by a single entry-point hook (and break down into functions underneath in the generated code) in which case a more generic name will be required. We were using "soc_init" until now, but you might have other preferences, especially if you want to use CamelCase. |
@perkinsmg As we extend the functionality of the pin config tool we can continue to add calls into |
The current call stack on reset is:
Therefore, I agree with @Jake-Carter here. We can add additional functions to this list as needed. We could also replace PinInit with a more generic function like @perkinsmg suggests, but I'm struggling to find an appropriate name. soc_init, feels wrong since we already have SystemInit. The name should suggest this is where all the configuration that was selected by an external tool is actually applied: |
Co-authored-by: lorne-maxim <[email protected]>
Co-authored-by: lorne-maxim <[email protected]>
Add PinMux Tool Support
Description
Tools like a PinMux Configuration tool need a single entry point or function for configuring all the necessary pins. The current paradigm in the peripheral drivers is to initialize any pins associated with a particular peripheral at the time the peripheral's initialization function is called. This could override any settings previously set by the PinMux tool. This PR addresses this problem in the following way:
Advantages
Disadvantages