Skip to content
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

Configure hardware clock and hardware based timestamping automatically when available by default #549

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rnijveld
Copy link
Member

Note that this requires a new release of timestamped-socket first.

Comment on lines +313 to +345
macro_rules! add_hw {
($idx:expr) => {{
let idx = $idx;
let mut clock = LinuxClock::open_idx(idx).expect("Unable to open clock");
if let Some(id) = clock_name_map.get(&idx) {
clock_port_map.push(Some(*id));
} else {
clock.init().expect("Unable to initialize clock");
let id = internal_sync_senders.len();
clock_port_map.push(Some(id));
clock_name_map.insert(idx, id);
internal_sync_senders
.push(start_clock_task(clock.clone(), system_clock.clone()));
}
(
Some(idx),
Box::new(clock) as BoxedClock,
InterfaceTimestampMode::HardwarePTPAll,
)
}};
}

macro_rules! add_sw {
() => {{
clock_port_map.push(None);
(
None,
system_clock.clone_boxed(),
InterfaceTimestampMode::SoftwareAll,
)
}};
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit uncomfortable with these being macros. What is stopping us from making these just outright functions (and exposing all the dependencies on names in the surrounding code)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants