osal_rs/freertos/
config.rs

1/***************************************************************************
2 *
3 * osal-rs
4 * Copyright (C) 2023/2026 Antonio Salsi <passy.linux@zresa.it>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 *
18 ***************************************************************************/
19
20use crate::os::types::StackType;
21
22pub mod ffi {
23    use crate::freertos::types::{TickType, StackType};
24
25    unsafe extern "C" {
26        pub fn osal_rs_config_cpu_clock_hz() -> u64;
27        pub fn osal_rs_config_tick_rate_hz() -> TickType;
28        pub fn osal_rs_config_max_priorities() -> u32;
29        pub fn osal_rs_config_minimal_stack_size() -> StackType;
30        pub fn osal_rs_config_max_task_name_len() -> u32;
31    }
32}
33
34#[macro_export]
35macro_rules! tick_period_ms {
36    () => {
37        // CHECK (1000 / $crate::freertos::config::TICK_RATE_HZ)
38        (unsafe { $crate::os::config::ffi::osal_rs_config_tick_rate_hz() })
39    };
40}
41
42#[macro_export]
43macro_rules! tick_rate_hz {
44    () => {
45        (unsafe { $crate::os::config::ffi::osal_rs_config_tick_rate_hz() })
46    };
47}
48
49
50#[macro_export]
51macro_rules! cpu_clock_hz {
52    () => {
53        (unsafe { $crate::os::config::ffi::osal_rs_config_cpu_clock_hz() })
54    };
55}
56
57#[macro_export]
58macro_rules! max_priorities {
59    () => {
60        (unsafe { $crate::os::config::ffi::osal_rs_config_max_priorities() })
61    };
62}
63
64#[macro_export]
65macro_rules! minimal_stack_size {
66    () => {
67        ( unsafe { $crate::os::config::ffi::osal_rs_config_minimal_stack_size() })
68    };
69}   
70
71#[macro_export]
72macro_rules! max_task_name_len {
73    () => {
74        (unsafe { $crate::os::config::ffi::osal_rs_config_max_task_name_len() })
75    };
76}