blob: 273399a19d5e7010f155add381bcdf5b98c58f4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#![cfg(feature = "wba")]
#![allow(non_snake_case)]
//
// /* USER CODE BEGIN Header */
// /**
// ******************************************************************************
// * @file mac_sys_if.c
// * @author MCD Application Team
// * @brief Source file for using MAC Layer with a RTOS
// ******************************************************************************
// * @attention
// *
// * Copyright (c) 2025 STMicroelectronics.
// * All rights reserved.
// *
// * This software is licensed under terms that can be found in the LICENSE file
// * in the root directory of this software component.
// * If no LICENSE file comes with this software, it is provided AS-IS.
// *
// ******************************************************************************
// */
// /* USER CODE END Header */
//
// #include "main.h"
// #include "app_common.h"
// #include "app_conf.h"
// #include "log_module.h"
// #include "stm32_rtos.h"
// #include "st_mac_802_15_4_sys.h"
//
// extern void mac_baremetal_run(void);
//
// /* Private defines -----------------------------------------------------------*/
// /* USER CODE BEGIN PD */
//
// /* USER CODE END PD */
//
// /* Private macros ------------------------------------------------------------*/
// /* USER CODE BEGIN PM */
//
// /* USER CODE END PM */
//
// /* Private variables ---------------------------------------------------------*/
// /* USER CODE BEGIN PV */
//
// /* USER CODE END PV */
//
// /* Global variables ----------------------------------------------------------*/
// /* USER CODE BEGIN GV */
//
// /* USER CODE END GV */
//
// /* Functions Definition ------------------------------------------------------*/
//
// /**
// * @brief Mac Layer Initialisation
// * @param None
// * @retval None
// */
// void MacSys_Init(void)
// {
// /* Register tasks */
// UTIL_SEQ_RegTask( TASK_MAC_LAYER, UTIL_SEQ_RFU, mac_baremetal_run);
// }
//
// /**
// * @brief Mac Layer Resume
// * @param None
// * @retval None
// */
// void MacSys_Resume(void)
// {
// UTIL_SEQ_ResumeTask( TASK_MAC_LAYER );
// }
//
// /**
// * @brief MAC Layer set Task.
// * @param None
// * @retval None
// */
// void MacSys_SemaphoreSet(void)
// {
// UTIL_SEQ_SetTask( TASK_MAC_LAYER, TASK_PRIO_MAC_LAYER );
// }
//
// /**
// * @brief MAC Layer Task wait.
// * @param None
// * @retval None
// */
// void MacSys_SemaphoreWait( void )
// {
// /* Not used */
// }
//
// /**
// * @brief MAC Layer set Event.
// * @param None
// * @retval None
// */
// void MacSys_EventSet( void )
// {
// UTIL_SEQ_SetEvt( EVENT_MAC_LAYER );
// }
//
// /**
// * @brief MAC Layer wait Event.
// * @param None
// * @retval None
// */
// void MacSys_EventWait( void )
// {
// UTIL_SEQ_WaitEvt( EVENT_MAC_LAYER );
// }
//
use super::util_seq;
use crate::bindings::mac;
/// Placeholder value used by the original ST middleware when registering tasks.
const UTIL_SEQ_RFU: u32 = 0;
/// Bit mask identifying the MAC layer task within the sequencer.
const TASK_MAC_LAYER_MASK: u32 = 1 << mac::CFG_TASK_ID_T_CFG_TASK_MAC_LAYER;
/// Sequencer priority assigned to the MAC layer task.
const TASK_PRIO_MAC_LAYER: u32 = mac::CFG_SEQ_PRIO_ID_T_CFG_SEQ_PRIO_0 as u32;
/// Event flag consumed by the MAC task while waiting on notifications.
const EVENT_MAC_LAYER_MASK: u32 = 1 << 0;
/// Registers the MAC bare-metal runner with the lightweight sequencer.
///
/// Mirrors the behaviour of the reference implementation:
/// `UTIL_SEQ_RegTask(TASK_MAC_LAYER, UTIL_SEQ_RFU, mac_baremetal_run);`
#[unsafe(no_mangle)]
pub unsafe extern "C" fn MacSys_Init() {
util_seq::UTIL_SEQ_RegTask(TASK_MAC_LAYER_MASK, UTIL_SEQ_RFU, Some(mac::mac_baremetal_run));
}
/**
* @brief Mac Layer Resume
* @param None
* @retval None
*/
#[unsafe(no_mangle)]
pub unsafe extern "C" fn MacSys_Resume() {
util_seq::UTIL_SEQ_ResumeTask(TASK_MAC_LAYER_MASK);
}
/**
* @brief MAC Layer set Task.
* @param None
* @retval None
*/
#[unsafe(no_mangle)]
pub unsafe extern "C" fn MacSys_SemaphoreSet() {
util_seq::UTIL_SEQ_SetTask(TASK_MAC_LAYER_MASK, TASK_PRIO_MAC_LAYER);
}
/**
* @brief MAC Layer Task wait.
* @param None
* @retval None
*/
#[unsafe(no_mangle)]
pub unsafe extern "C" fn MacSys_SemaphoreWait() {}
/**
* @brief MAC Layer set Event.
* @param None
* @retval None
*/
#[unsafe(no_mangle)]
pub unsafe extern "C" fn MacSys_EventSet() {
util_seq::UTIL_SEQ_SetEvt(EVENT_MAC_LAYER_MASK);
}
/**
* @brief MAC Layer wait Event.
* @param None
* @retval None
*/
#[unsafe(no_mangle)]
pub unsafe extern "C" fn MacSys_EventWait() {
util_seq::UTIL_SEQ_WaitEvt(EVENT_MAC_LAYER_MASK);
}
|