min-protocol / min

The MIN protocol specification and reference implementation
257 stars 88 forks source link

Ability to calculate CRC in HW #34

Open oswinrodrigues opened 3 years ago

oswinrodrigues commented 3 years ago

The two MCUs I am working with - and most modern processors today, I believe - have built-in CRC computation units / modules / engines. As such, I'm curious if there is the possibility to feed in my own CRC, rather that MIN computing on its end?

I understand that the design intent is to be HW-agnostic. Perhaps some hook defined where the application can, on its end, invoke the CRC driver and return accordingly?

To be clear, more than requesting this be added to the library, I'm inquiring if it is possible in the current state and, if not, how easy it would be to do this in a fork of my own?

kentindell commented 3 years ago

Would be a good idea to use a hook to a hardware driver. It would be possible to replace the CRC function with a call out to a hardware-specific function.

The way to do it is to move the CRC function into its own source code file, then in the main application code include the hardware-specific function with the same name/parameters. The linker will choose the hardware-specific function and leave the generic one in the library.