2 * HAL (Hardware Abstract Layer) Common API
4 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
26 #include "hal-radio-interface.h"
28 hal_radio_error_t hal_radio_get_backend(void **hal_radio_handle);
30 hal_radio_error_t hal_radio_put_backend(void *hal_radio_handle);
33 * @brief Initializes new handle of radio HAL.
35 * @param[out] hal_radio_handle A newly returned the radio HAL handle
36 * @return @c 0 on success, otherwise a negative error value
37 * @retval #HAL_RADIO_ERROR_NONE Successful
38 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
39 * @retval #HAL_RADIO_ERROR_OUT_OF_MEMORY Out of memory
40 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
43 hal_radio_error_t hal_radio_init(void *hal_radio_handle);
46 * @brief Deinitializes handle of radio HAL.
48 * @param[in] hal_radio_handle The radio HAL handle
49 * @return @c 0 on success, otherwise a negative error value
50 * @retval #HAL_RADIO_ERROR_NONE Successful
51 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
54 hal_radio_error_t hal_radio_deinit(void *hal_radio_handle);
57 * @brief Prepare the device of radio.
59 * @param[in] hal_radio_handle The radio HAL handle
60 * @return @c 0 on success, otherwise a negative error value
61 * @retval #HAL_RADIO_ERROR_NONE Successful
62 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
63 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
64 * @see radio_unprepare()
66 hal_radio_error_t hal_radio_prepare(void *hal_radio_handle);
69 * @brief Unprepare the device of radio.
71 * @param[in] hal_radio_handle The radio HAL handle
72 * @return @c 0 on success, otherwise a negative error value
73 * @retval #HAL_RADIO_ERROR_NONE Successful
74 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
75 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
76 * @see radio_prepare()
78 hal_radio_error_t hal_radio_unprepare(void *hal_radio_handle);
81 * @brief Opens the device of radio.
83 * @param[in] hal_radio_handle The radio HAL handle
84 * @return @c 0 on success, otherwise a negative error value
85 * @retval #HAL_RADIO_ERROR_NONE Successful
86 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
87 * @retval #HAL_RADIO_ERROR_DEVICE_NOT_FOUND Failed to find radio device
88 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
89 * @retval #HAL_HAL_RADIO_ERROR_PERMISSION_DENIED The access to the resources can not be granted.
90 * @retval #HAL_RADIO_ERROR_DEVICE_NOT_PREPARED Not prepared the radio device
93 hal_radio_error_t hal_radio_open(void *hal_radio_handle);
96 * @brief Closes the device of radio.
98 * @param[in] hal_radio_handle The radio HAL handle
99 * @return @c 0 on success, otherwise a negative error value
100 * @retval #HAL_RADIO_ERROR_NONE Successful
101 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
102 * @retval #HAL_RADIO_ERROR_DEVICE_NOT_OPENED The radio device is not opened.
103 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
106 hal_radio_error_t hal_radio_close(void *hal_radio_handle);
109 * @brief Starts the device of radio.
111 * @param[in] hal_radio_handle The radio HAL handle
112 * @return @c 0 on success, otherwise a negative error value
113 * @retval #HAL_RADIO_ERROR_NONE Successful
114 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
115 * @retval #HAL_RADIO_ERROR_DEVICE_NOT_OPENED The radio device is not opened.
118 hal_radio_error_t hal_radio_start(void *hal_radio_handle);
121 * @brief Stops the device of radio.
123 * @param[in] hal_radio_handle The radio HAL handle
124 * @return @c 0 on success, otherwise a negative error value
125 * @retval #HAL_RADIO_ERROR_NONE Successful
126 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
127 * @retval #HAL_RADIO_ERROR_DEVICE_NOT_OPENED The radio device is not opened.
130 hal_radio_error_t hal_radio_stop(void *hal_radio_handle);
133 * @brief Seeks (up or down) the effective frequency of the radio.
135 * @param[in] hal_radio_handle The radio HAL handle
136 * @param[in] direction The seek direction type (up or down)
137 * @return @c 0 on success, otherwise a negative error value
138 * @retval #HAL_RADIO_ERROR_NONE Successful
139 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
140 * @retval #HAL_RADIO_ERROR_DEVICE_NOT_OPENED The radio device is not opened
141 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
143 hal_radio_error_t hal_radio_seek(void *hal_radio_handle, hal_radio_seek_direction_type_t direction);
146 * @brief Gets the radio frequency.
148 * @param[in] hal_radio_handle The radio HAL handle
149 * @param[out] frequency The current frequency (khz)
150 * @return @c 0 on success, otherwise a negative error value
151 * @retval #HAL_RADIO_ERROR_NONE Successful
152 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
153 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
155 hal_radio_error_t hal_radio_get_frequency(void *hal_radio_handle, uint32_t *frequency);
158 * @brief Sets the radio frequency.
160 * @param[in] hal_radio_handle The radio HAL handle
161 * @param[in] frequency The frequency to set (khz)
162 * @return @c 0 on success, otherwise a negative error value
163 * @retval #HAL_RADIO_ERROR_NONE Successful
164 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
165 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
167 hal_radio_error_t hal_radio_set_frequency(void *hal_radio_handle, uint32_t frequency);
170 * @brief Gets the current signal strength of the radio
172 * @param[in] hal_radio_handle The radio HAL handle
173 * @param[out] strength The current signal strength (dBm)
174 * @return @c 0 on success, otherwise a negative error value
175 * @retval #HAL_RADIO_ERROR_NONE Successful
176 * @retval #HAL_RADIO_ERROR_INVALID_PARAMETER Invalid parameter
177 * @retval #HAL_RADIO_ERROR_INVALID_OPERATION Invalid operation
179 hal_radio_error_t hal_radio_get_signal_strength(void *hal_radio_handle, int32_t *strength);
184 #endif /* __HAL_RADIO__ */