Morse Micro IoT SDK  2.10.4
mmhal_os.h
1/*
2 * Copyright 2025 Morse Micro
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
19#pragma once
20
21#include <stdbool.h>
22#include <stddef.h>
23#include <stdint.h>
24
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
32
34void mmhal_init(void);
35
37void mmhal_reset(void);
38
41{
45};
46
55enum mmhal_sleep_state mmhal_sleep_prepare(uint32_t expected_idle_time_ms);
56
65uint32_t mmhal_sleep(enum mmhal_sleep_state sleep_state, uint32_t expected_idle_time_ms);
66
75void mmhal_sleep_abort(enum mmhal_sleep_state sleep_state);
76
81
84{
88};
89
97
106void mmhal_log_write(const uint8_t *data, size_t len);
107
114
115#ifdef __cplusplus
116}
117#endif
118
uint32_t mmhal_sleep(enum mmhal_sleep_state sleep_state, uint32_t expected_idle_time_ms)
Function to enter MCU sleep.
mmhal_sleep_state
Enumeration of MCU sleep state.
Definition: mmhal_os.h:41
mmhal_isr_state
Enumeration of ISR states (i.e., whether in ISR or not).
Definition: mmhal_os.h:84
void mmhal_sleep_abort(enum mmhal_sleep_state sleep_state)
Function to abort the MCU sleep state.
void mmhal_sleep_cleanup(void)
Function to cleanup on exit from the MCU sleep state.
void mmhal_log_write(const uint8_t *data, size_t len)
Write to the debug log.
void mmhal_log_flush(void)
Flush the debug log before returning.
void mmhal_early_init(void)
Initialization before RTOS scheduler starts.
enum mmhal_sleep_state mmhal_sleep_prepare(uint32_t expected_idle_time_ms)
Function to prepare MCU to enter sleep.
enum mmhal_isr_state mmhal_get_isr_state(void)
Get the current ISR state (i.e., whether in ISR or not).
void mmhal_reset(void)
Reset the microcontroller.
void mmhal_init(void)
Initialization after RTOS scheduler started.
@ MMHAL_SLEEP_DISABLED
Disable MCU sleep.
Definition: mmhal_os.h:42
@ MMHAL_SLEEP_SHALLOW
MCU to enter shallow sleep.
Definition: mmhal_os.h:43
@ MMHAL_SLEEP_DEEP
MCU can enter deep sleep.
Definition: mmhal_os.h:44
@ MMHAL_ISR_STATE_UNKNOWN
The HAL does not support checking ISR state.
Definition: mmhal_os.h:87
@ MMHAL_NOT_IN_ISR
The function was not executed from ISR context.
Definition: mmhal_os.h:85
@ MMHAL_IN_ISR
The function was executed from ISR context.
Definition: mmhal_os.h:86