This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Description
The [libuart] and [libadc] use only volatile protocol_callback* var in their callback instances which restricts the interrupt-safety to the actual instance of the callback and not the instance address and its members, so by changing it to volatile protocol_callback *volatile var and declaring the struct protocol_callback members to volatile, the interrupt-safety will include also asynchronous changes to the addresses and member states.
- The
volatile protocol_callback* would add this feature:
volatile protocol_callback* internal_protocol_callback = ...;
protocol_callback finalize_callback = ...;
ISR(_xxx__vector) {
//Adjusts the callback instance
*internal_protocol_callback = finalize_callback;
}
- The
protocol_callback *volatile would add this functionality:
protocol_callback *volatile internal_protocol_callback = ...;
protocol_callback *volatile finalize_callback = ...;
ISR(_xxx__vector) {
//Adjusts the callback instance address to another one
internal_protocol_callback = finalize_callback;
}
- The
typedef struct { void (*volatile on_command)(vector); } protcol_callback; would add this functionality:
volatile protocol_callback *volatile internal_protocol_callback = ...;
volatile protocol_callback *volatile finalize_callback = ...;
ISR(_xxx__vector) {
//Adjusts the callback instance address to another one
internal_protocol_callback->on_command = finalize_callback->on_command;
}