-
Notifications
You must be signed in to change notification settings - Fork 5
Use tock-registers rather than volatile-register and clean up API #6
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
base: main
Are you sure you want to change the base?
Conversation
|
Oh right, and |
5f0211b to
78e5165
Compare
|
Wow, this seems very reasonable and it is a breaking change. I’m not familiar with |
|
Fair, I'll try to split out the other changes into a separate PR so we can get that in in the meantime. |
Make fields private where possible.
Clients should not need to access registers directly; if they need functionality which is not currently exposed then it should be added to this crate. Also removed register access methods, as they didn't really add anything.
This PR does quite a few things.
tock-registersrather thanvolatile-register.tock-registersis used by thecortex-acrate, so it makes sense for users on Cortex A at least to have fewer dependencies.tock-registersitself has no dependencies, so we're trading three dependencies (bitflags,volatile-registerandvcell) for one. It also makes for nicer and somewhat more typesafe code, astock-registershas macros to generate types (including enums) for bit fields.MmioUart8250struct which were providing direct access to registers. If clients need functionality not provided by the wrapper methods then that functionality should be added to this crate, rather than having clients directly access registers.MmioUart8250::newas unsafe. The caller needs to make sure that the address being passed in really is the base address of appropriate MMIO registers, and not an unmapped address, or the address of some other memory. Otherwise it would let safe code read and write arbitrary memory, which is unsound.