-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add RCC module to abstract clock enable and reset #177
Conversation
|
||
# FIXME: Move to modm:platform:core! | ||
env.outbasepath = "modm/src/modm/platform/core" | ||
env.template("peripherals.hpp.in") |
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.
modm-devices need to become smarter, right now it's just dumping the raw XML out it's API, so a lot of things need to be computed in modm that should be provided by modm-devices. Here, to compute the true set of addressable peripherals requires quite a bit of computation, which I don't want to duplicate in :platform:core
module.
@@ -37,6 +38,8 @@ public: | |||
static inline void | |||
enable() | |||
{ | |||
Rcc::enable<Peripheral::Rng>(); | |||
Rcc::reset<Peripheral::Rng>(); |
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.
Yeah, remember how the RNG never worked? HAVE YOU TRIED TURNING IT OFF AND ON AGAIN???
# filter out MPU and/or FPU if required | ||
peripherals = filter(lambda p: p[0] not in core_features or core_features[p[0]], peripherals) | ||
peripherals = sorted(peripherals, key=lambda p: p[0]) | ||
# print("\n".join([s+" -> "+hex(a) for (s,k,a) in peripherals])) | ||
|
||
# Find all RCC enable and reset definitions | ||
match = re.findall(r"RCC_([A-Z0-9]+?)_([A-Z0-9]+?)_(EN|RST) ", content) |
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.
Evil or genius? Why not both?
e8a0cbc
to
4a82a94
Compare
This adds a
modm::platform::Rcc
class withRcc::enable<Peripheral>()
Rcc::disable<Peripheral>()
Rcc::reset<Peripheral>()
methods, which are implemented by parsing the CMSIS header files to extract the peripheral name, register name and bit masks. This information be moved to modm-devices in the future, but for now this "hack" significantly improves modm by moving the
A{H,P}B{1,2}
decisions from all peripherals into a common module.cc @rleh @chris-durand