openthread_fuchsia/backing/
reset.rs1use super::*;
6use std::sync::atomic::Ordering;
7
8#[derive(thiserror::Error, Debug, Hash)]
10#[error("PlatformResetRequested")]
11pub struct PlatformResetRequested {}
12
13impl PlatformBacking {
14 fn on_plat_reset(&self, instance: Option<&ot::Instance>) {
15 #[no_mangle]
16 unsafe extern "C" fn otPlatReset(instance: *mut otsys::otInstance) {
17 PlatformBacking::on_plat_reset(
18 PlatformBacking::as_ref(),
20 ot::Instance::ref_from_ot_ptr(instance),
23 )
24 }
25
26 if let Some(instance) = instance {
27 instance.thread_set_enabled(false).unwrap();
28 instance.ip6_set_enabled(false).unwrap();
29 }
30 self.is_platform_reset_requested.store(true, Ordering::SeqCst);
32 info!("on_plat_reset for {:?}", instance);
33 }
34}