• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  * Description: Provides hal sio \n
16  *
17  * History: \n
18  * 2023-01-15, Create file. \n
19  */
20 #ifndef HAL_SIO_H
21 #define HAL_SIO_H
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 #include "common_def.h"
26 #include "errcode.h"
27 #include "sio_porting.h"
28 
29 #ifdef __cplusplus
30 #if __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33 #endif /* __cplusplus */
34 
35 /**
36  * @defgroup drivers_hal_sio_api SIO
37  * @ingroup  drivers_hal_sio
38  * @{
39  */
40 
41 /**
42  * @if Eng
43  * @brief  SIO divice modes.
44  * @else
45  * @brief  SIO设备模式。
46  * @endif
47  */
48 typedef enum hal_sio_driver_mode {
49     SLAVE,                                      /*!< @if Eng SLAVE.
50                                                      @else   从模式。 @endif */
51     MASTER                                      /*!< @if Eng MASTER.
52                                                      @else   主模式。 @endif */
53 } hal_sio_driver_mode_t;
54 
55 /**
56  * @if Eng
57  * @brief  SIO modes.
58  * @else
59  * @brief  SIO 模式。
60  * @endif
61  */
62 typedef enum hal_sio_mode {
63     I2S_MODE = 0,                                   /*!< @if Eng I2S mode.
64                                                      @else   I2S 模式。 @endif */
65     PCM_MODE,                                       /*!< @if Eng PCM mode.
66                                                      @else   PCM 模式。 @endif */
67     NONE_SIO_MODE
68 } hal_sio_mode_t;
69 
70 /**
71  * @if Eng
72  * @brief  SIO interrupts.
73  * @else
74  * @brief  SIO 中断类型。
75  * @endif
76  */
77 typedef enum hal_sio_interrupt {
78     RX_INTR = 0,                                /*!< @if Eng RX FIFO higher than threshold interrupt.
79                                                      @else   接收fifo高于阈值中断。 @endif */
80     TX_INTR,                                    /*!< @if Eng TX FIFO higher than threshold interrupt.
81                                                      @else   发送fifo高于阈值中断。 @endif */
82     RX_RIGHT_FIFO_OVER,                         /*!< @if Eng RX RIGHT FIFO Overflow interrupt.
83                                                      @else   右声道接收fifo上溢中断。 @endif */
84     RX_LEFT_FIFO_OVER,                          /*!< @if Eng RX LEFT FIFO Overflow interrupt.
85                                                      @else   左声道接收fifo上溢中断。 @endif */
86     TX_RIGHT_FIFO_UNDER,                        /*!< @if Eng TX RIGHT FIFO Overflow interrupt.
87                                                      @else   右声道发送fifo上溢中断。 @endif */
88     TX_LEFT_FIFO_UNDER                          /*!< @if Eng TX LEFT FIFO Overflow interrupt.
89                                                      @else   左声道发送fifo上溢中断。 @endif */
90 } hal_sio_interrupt_t;
91 
92 /**
93  * @if Eng
94  * @brief  SIO timing mode.
95  * @else
96  * @brief  SIO时序模式。
97  * @endif
98  */
99 typedef enum hal_sio_iming_mode {
100     PCM_STD_MODE = 0,                           /*!< @if Eng PCM standard timing mode.
101                                                      @else   PCM标准时序模式。 @endif */
102     PCM_UD_MODE,                                /*!< @if Eng PCM user-defined timing mode.
103                                                      @else   PCM自定义时序模式。 @endif */
104     NONE_TIMING_MODE
105 } hal_sio_timing_mode_t;
106 
107 /**
108  * @if Eng
109  * @brief  SIO transmission path modes.
110  * @else
111  * @brief  SIO 传输路径模式。
112  * @endif
113  */
114 typedef enum {
115     STD_MODE = 0,                               /*!< @if Eng Standard mode.
116                                                      @else   标准模式。 @endif */
117     MULTICHANNEL_MODE                           /*!< @if Eng Multichannel mode.
118                                                      @else   多路模式。 @endif */
119 } hal_sio_transfer_mode_t;
120 
121 /**
122  * @if Eng
123  * @brief  SIO clk edge.
124  * @else
125  * @brief  SIO 时钟边沿。
126  * @endif
127  */
128 typedef enum hal_sio_clk_edge {
129     FALLING_EDGE = 0,                           /*!< @if Eng Falling edge.
130                                                      @else   下降沿。 @endif */
131     RISING_EDGE,                                /*!< @if Eng Rising edge
132                                                      @else   上升沿。 @endif */
133     NONE_EDGE
134 } hal_sio_clk_edge_t;
135 
136 /**
137  * @if Eng
138  * @brief  SIO voice_channel.
139  * @else
140  * @brief  SIO 声道。
141  * @endif
142  */
143 typedef enum hal_sio_voice_channel {
144     SIO_LEFT = 0,                               /*!< @if Eng SIO left voice channel.
145                                                      @else   SIO 左声道。 @endif */
146     SIO_RIGHT,                                  /*!< @if Eng SIO right voice channel.
147                                                      @else   SIO 右声道。 @endif */
148     NONE_MODE
149 } hal_sio_voice_channel_t;
150 
151 /**
152  * @if Eng
153  * @brief  SIO data width.
154  * @else
155  * @brief  SIO 数据位宽。
156  * @endif
157  */
158 typedef enum hal_sio_data_width {
159     RESERVED,                                   /*!< @if Eng RESERVED.
160                                                      @else   保留。 @endif */
161     SIXTEEN_BIT,                                /*!< @if Eng 16 BITS.
162                                                      @else   16位。 @endif */
163     EIGHTEEN_BIT,                               /*!< @if Eng 18 BITS.
164                                                      @else   18位。 @endif */
165     TWENTY_BIT,                                 /*!< @if Eng 20 BITS.
166                                                      @else   20位。 @endif */
167     TWENTY_FOUR_BIT,                            /*!< @if Eng 24 BITS.
168                                                      @else   24位。 @endif */
169     THIRTY_TWO_BIT                              /*!< @if Eng 32 BITS.
170                                                      @else   32位。 @endif */
171 } hal_sio_data_width_t;
172 
173 /**
174  * @if Eng
175  * @brief  SIO transmission Channels number.
176  * @else
177  * @brief  SIO 传输通道数。
178  * @endif
179  */
180 typedef enum hal_sio_channel_number {
181     TWO_CH,                                     /*!< @if Eng 2 Channels.
182                                                      @else   2通道。 @endif */
183     FOUR_CH,                                    /*!< @if Eng 4 Channels.
184                                                      @else   4通道。 @endif */
185     EIGHT_CH,                                   /*!< @if Eng 8 Channels.
186                                                      @else   8通道。 @endif */
187     SIXTEEN_CH                                  /*!< @if Eng 16 Channels.
188                                                      @else   16通道。 @endif */
189 } hal_sio_channel_number_t;
190 
191 /**
192  * @if Eng
193  * @brief  SIO tx data structure.
194  * @else
195  * @brief  SIO tx传输结构体。
196  * @endif
197  */
198 typedef struct hal_sio_tx_data {
199     uint32_t *left_buff;                        /*!< @if Eng Data send through tx left fifo.
200                                                      @else   通过tx 左fifo发送的数据。 @endif */
201     uint32_t *right_buff;                       /*!< @if Eng Data send through tx right fifo.
202                                                      @else   通过tx 右fifo发送的数据。 @endif */
203     uint32_t length;                            /*!< @if Eng Bytes of data need to send
204                                                      @else   发送数据的个数 @endif */
205 } hal_sio_tx_data_t;
206 
207 /**
208  * @if Eng
209  * @brief  SIO received data.
210  * @else
211  * @brief  SIO 接收数据。
212  * @endif
213  */
214 typedef struct hal_sio_received_data {
215     uint32_t left_buff[CONFIG_DATA_LEN_MAX];    /*!< @if Eng Left data.
216                                                      @else   左声道数据。 @endif */
217     uint32_t right_buff[CONFIG_DATA_LEN_MAX];   /*!< @if Eng Right data.
218                                                      @else   右声道数据。 @endif */
219     uint32_t length;                            /*!< @if Eng Data length.
220                                                      @else   数据长度。 @endif */
221 } hal_sio_rx_data_t;
222 
223 /**
224  * @if Eng
225  * @brief  Definition of SIO attributes.
226  * @else
227  * @brief  SIO配置参数定义。
228  * @endif
229  */
230 typedef struct hal_sio_config {
231     hal_sio_driver_mode_t drive_mode;           /*!< @if Eng SIO divice modes.
232                                                      @else   SIO 设备模式。 @endif */
233     hal_sio_transfer_mode_t transfer_mode;      /*!< @if Eng SIO transmission path modes.
234                                                      @else   SIO 传输路径模式。 @endif */
235     hal_sio_data_width_t data_width;            /*!< @if Eng SIO data width.
236                                                      @else   SIO 数据宽度。 @endif */
237     hal_sio_channel_number_t channels_num;      /*!< @if Eng Number of SIO transmission Channels.
238                                                      @else   SIO 传输通道数。 @endif */
239     hal_sio_timing_mode_t timing;               /*!< @if Eng SIO timing mode.
240                                                      @else   SIO 时序模式。 @endif */
241     hal_sio_clk_edge_t clk_edge;                /*!< @if Eng PCM clock edge mode.
242                                                      @else   PCM 时钟边沿模式。 @endif */
243     uint8_t div_number;                         /*!< @if Eng Div number, see @ref hal_sio_config.data_width.
244                                                      @else   分频系数,见 @ref hal_sio_config.data_width 成员 @endif */
245     uint8_t number_of_channels;                 /*!< @if Eng Number of channels, see @ref hal_sio_config.channels_num.
246                                                      @else   通道数,见 @ref hal_sio_config.channels_num 成员。 @endif */
247 } hal_sio_config_t;
248 
249 #if defined(CONFIG_I2S_SUPPORT_DMA)
250 
251 /**
252  * @if Eng
253  * @brief  Definition of I2S DMA attributes.
254  * @else
255  * @brief  I2S DMA配置参数定义
256  * @endif
257  */
258 typedef struct hal_i2s_dma_attr {
259     bool tx_dma_enable;                     /*!< @if Eng false: tx not use dma @ref uapi_i2s_write_data can be used. \n
260                                                      true:  tx use dma @ref uapi_i2s_merge_write_by_dma can be used.
261                                              @else   false: TX没有使用DMA,使用 @ref uapi_i2s_write_data 发送数据 \n
262                                                      true:  TX使用DMA,使用 @ref uapi_i2s_merge_write_by_dma 发送数据 @endif */
263     uint8_t tx_int_threshold;               /*!< @if Eng i2s tx fifo level to trigger interrupt.
264                                              @else 触发中断的txfifo水线 @endif */
265     bool rx_dma_enable;                     /*!< @if Eng false: rx not use dma @ref uapi_i2s_write_data can be used. \n
266                                                      true:  rx use dma @ref uapi_i2s_merge_write_by_dma can be used.
267                                              @else   false: RX没有使用DMA,使用 @ref uapi_i2s_write_data 发送数据 \n
268                                                      true:  RX使用DMA,使用 @ref uapi_i2s_merge_write_by_dma 发送数据 @endif */
269     uint8_t rx_int_threshold;               /*!< @if Eng i2s rx fifo level to trigger interrupt.
270                                              @else 触发中断的rxfifo水线 @endif */
271 } hal_i2s_dma_attr_t;
272 
273 /**
274  * @if Eng
275  * @brief  Configuring DMA Transmission interface for hal sio.
276  * @param  [in]  bus The device pointer to manager the hal sio.
277  * @param  [in]  attr dma configuration of sio.
278  * @else
279  * @brief  HAL层配置DMA传输接口
280  * @param  [in]  bus sio号, 参考 @ref sio_bus_t
281  * @param  [in]  attr SIO的高级配置参数。
282  * @endif
283  */
284 typedef void (*hal_sio_dma_cfg_t)(sio_bus_t bus, const uintptr_t attr);
285 #endif
286 
287 /**
288  * @if Eng
289  * @brief  Definition of sio callback type.
290  * @else
291  * @brief  HAL层SIO回调函数。
292  * @endif
293  */
294 typedef void (*hal_sio_callback_t)(uint32_t *left_buff, uint32_t *right_buff, uint32_t length);
295 
296 /**
297  * @if Eng
298  * @brief  Initialize device for hal sio.
299  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
300  * @retval ERRCODE_SUCC Success.
301  * @retval Other        Failure. For details, see @ref errcode_t
302  * @else
303  * @brief  HAL层SIO的初始化接口。
304  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
305  * @retval ERRCODE_SUCC 成功。
306  * @retval Other        失败,参考 @ref errcode_t
307  * @endif
308  */
309 typedef errcode_t (*hal_sio_init_t)(sio_bus_t bus);
310 
311 /**
312  * @if Eng
313  * @brief  Deinitialize device for hal sio.
314  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
315  * @else
316  * @brief  HAL层SIO的去初始化接口。
317  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
318  * @endif
319  */
320 typedef void (*hal_sio_deinit_t)(sio_bus_t bus);
321 
322 /**
323  * @if Eng
324  * @brief  Config device interface for hal sio.
325  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
326  * @param  [in]  config The SIO config. For details, see @ref hal_sio_config_t
327  * @else
328  * @brief  HAL层SIO配置接口。
329  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
330  * @param  [in]  config SIO配置参数。参考 @ref hal_sio_config_t
331  * @endif
332  */
333 typedef void (*hal_sio_set_config_t)(sio_bus_t bus, const hal_sio_config_t *config);
334 
335 /**
336  * @if Eng
337  * @brief  Get config of device interface for hal sio.
338  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
339  * @param  [in]  config The SIO config. For details, see @ref hal_sio_config_t
340  * @else
341  * @brief  HAL层SIO获取配置接口。
342  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
343  * @param  [in]  config SIO配置参数。参考 @ref hal_sio_config_t
344  * @endif
345  */
346 typedef errcode_t (*hal_sio_get_config_t)(sio_bus_t bus, hal_sio_config_t *config);
347 
348 /**
349  * @if Eng
350  * @brief  RX enable interface for hal sio.
351  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
352  * @param  [in]  en Enable rx or not.
353  * @else
354  * @brief  HAL层SIO rx使能接口。
355  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
356  * @param  [in]  en 是否开启rx。
357  * @endif
358  */
359 typedef void (*hal_sio_rx_enable_t)(sio_bus_t bus, bool en);
360 
361 /**
362  * @if Eng
363  * @brief  Write data interface for hal sio.
364  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
365  * @param  [in]  data The SIO data. For details, see @ref hal_sio_tx_data_t
366  * @param  [in]  mode The SIO mode. For details, see @ref hal_sio_mode_t
367  * @else
368  * @brief  HAL层SIO的写接口。
369  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
370  * @param  [in]  data SIO数据。参考 @ref hal_sio_tx_data_t
371  * @param  [in]  mode SIO模式。参考 @ref hal_sio_mode_t
372  * @endif
373  */
374 typedef void (*hal_sio_write_t)(sio_bus_t bus, hal_sio_tx_data_t *data, hal_sio_mode_t mode);
375 
376 /**
377  * @if Eng
378  * @brief  Get data interface for hal sio.
379  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t.
380  * @param  [out]  data data of the sio read. For details, see @ref hal_sio_rx_data_t.
381  * @else
382  * @brief  HAL层SIO获取数据接口。
383  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
384  * @param  [out]  data SIO读取的数据。参考 @ref hal_sio_rx_data_t
385  * @endif
386  */
387 typedef void (*hal_sio_get_data_t)(sio_bus_t bus, hal_sio_rx_data_t *data);
388 
389 /**
390  * @if Eng
391  * @brief  Register callback func for hal sio.
392  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
393  * @param  [in]  callback The SIO callback. For details, see @ref hal_sio_tx_data_t
394  * @else
395  * @brief  HAL层SIO注册回调函数接口。
396  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
397  * @param  [in]  callback SIO回调函数。参考 @ref hal_sio_callback_t
398  * @endif
399  */
400 typedef void (*hal_sio_register_t)(sio_bus_t bus, hal_sio_callback_t callback);
401 
402 /**
403  * @if Eng
404  * @brief  Unregister callback func for hal sio.
405  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
406  * @else
407  * @brief  HAL层SIO去注册回调函数接口。
408  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
409  * @endif
410  */
411 typedef void (*hal_sio_unregister_t)(sio_bus_t bus);
412 
413 /**
414  * @if Eng
415  * @brief  Loop mode interface for hal sio.
416  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
417  * @param  [in]  en Enable loop back mode or not.
418  * @retval ERRCODE_SUCC   Success.
419  * @retval Other        Failure. For details, see @ref errcode_t
420  * @else
421  * @brief  HAL层SIO自测模式接口。
422  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
423  * @param  [in]  en 是否开启回环模式。
424  * @retval ERRCODE_SUCC 成功。
425  * @retval Other        失败,参考 @ref errcode_t
426  * @endif
427  */
428 typedef void (*hal_sio_loop_t)(sio_bus_t bus, bool en);
429 
430 /**
431  * @if Eng
432  * @brief  SIO loop test for hal sio.
433  * @param  [in]  bus The SIO bus. For details, see @ref sio_bus_t
434  * @param  [in]  data The SIO data. For details, see @ref hal_sio_tx_data_t
435  * @param  [in]  mode The SIO mode. For details, see @ref hal_sio_mode_t
436  * @else
437  * @brief  HAL层SIO自测接口。
438  * @param  [in]  bus SIO端口号。参考 @ref sio_bus_t
439  * @param  [in]  data SIO的数据。参考 @ref hal_sio_rx_data_t
440  * @param  [in]  mode SIO的模式。 参考 @ref hal_sio_mode_t
441  * @endif
442  */
443 typedef void (*hal_sio_loop_trans_t)(sio_bus_t bus, hal_sio_tx_data_t *data, hal_sio_mode_t mode);
444 
445 /**
446  * @if Eng
447  * @brief  Interface between sio driver and sio hal.
448  * @else
449  * @brief  Driver层SIO和HAL层SIO的接口。
450  * @endif
451  */
452 typedef struct hal_sio_funcs {
453     hal_sio_init_t              init;                       /*!< @if Eng Init device interface.
454                                                                  @else   HAL层SIO的初始化接口。 @endif */
455     hal_sio_deinit_t            deinit;                     /*!< @if Eng Deinit device interface.
456                                                                  @else   HAL层SIO去初始化接口。 @endif */
457     hal_sio_set_config_t        set_config;                 /*!< @if Eng Config device interface.
458                                                                  @else   HAL层SIO配置接口。 @endif */
459     hal_sio_get_config_t        get_config;                 /*!< @if Eng Get_config device interface.
460                                                                  @else   HAL层SIO获取配置接口。 @endif */
461     hal_sio_rx_enable_t         rx_enable;                       /*!< @if Eng RX enable interface.
462                                                                  @else   HAL层SIO rx使能接口。 @endif */
463     hal_sio_write_t             write;                      /*!< @if Eng Write data interface.
464                                                                  @else   HAL层SIO发送数据接口。 @endif */
465     hal_sio_get_data_t          get_data;                   /*!< @if Eng Get data interface.
466                                                                  @else   HAL层SIO获取数据接口 @endif */
467     hal_sio_register_t          registerfunc;               /*!< @if Eng Register callback func interface.
468                                                                  @else   HAL层SIO注册回调函数接口。 @endif */
469     hal_sio_unregister_t        unregisterfunc;             /*!< @if Eng Unregister callback func interface.
470                                                                  @else   HAL层SIO去注册回调函数接口。 @endif */
471     hal_sio_loop_t              loop;                       /*!< @if Eng Loop mode interface.
472                                                                  @else   HAL层SIO自测模式接口。 @endif */
473     hal_sio_loop_trans_t        loop_trans;                 /*!< @if Eng SIO loop test interface
474                                                                  @else   HAL层SIO回路自测函数接口。 @endif */
475 #if defined(CONFIG_I2S_SUPPORT_DMA)
476     hal_sio_dma_cfg_t           dma_cfg;                    /*!< @if Eng SIO dma config interface
477                                                                  @else   HAL层SIO DMA配置接口 @endif */
478 #endif
479 } hal_sio_funcs_t;
480 
481 /**
482  * @if Eng
483  * @brief  Init the registers of SIO IPs.
484  * @retval ERRCODE_SUCC Success.
485  * @retval Other        Failure. For details, see @ref errcode_t
486  * @else
487  * @brief  初始化寄存器基地址列表。
488  * @retval ERRCODE_SUCC 成功。
489  * @retval Other        失败,参考 @ref errcode_t
490  * @endif
491  */
492 errcode_t hal_sio_regs_init(sio_bus_t bus);
493 
494 /**
495  * @if Eng
496  * @brief  Deinit the registers of SIO IPs.
497  * @else
498  * @brief  去初始化寄存器基地址列表。
499  * @endif
500  */
501 void hal_sio_regs_deinit(sio_bus_t bus);
502 
503 /**
504  * @if Eng
505  * @brief  Register @ref hal_sio_funcs_t into the g_hal_sios_funcs.
506  * @param  [in]  bus The sio bus. see @ref sio_bus_t
507  * @param  [in]  funcs Interface between sio driver and sio hal.
508  * @retval ERRCODE_SUCC   Success.
509  * @retval Other        Failure. For details, see @ref errcode_t
510  * @else
511  * @brief  注册 @ref hal_sio_funcs_t 到 g_hal_sios_funcs。
512  * @param  [in]  bus 串口号。参考 @ref sio_bus_t
513  * @param  [in]  funcs Driver层sio和HAL层sio的接口实例。
514  * @retval ERRCODE_SUCC 成功。
515  * @retval Other        失败,参考 @ref errcode_t
516  * @endif
517  */
518 errcode_t hal_sio_register_funcs(sio_bus_t bus, hal_sio_funcs_t *funcs);
519 
520 /**
521  * @if Eng
522  * @brief  Unregister @ref hal_sio_funcs_t from the g_hal_sios_funcs.
523  * @param  [in]  bus The sio bus. see @ref sio_bus_t
524  * @return ERRCODE_SUCC   Success.
525  * @retval Other        Failure. For details, see @ref errcode_t
526  * @else
527  * @brief  从g_hal_sios_funcs注销 @ref hal_sio_funcs_t 。
528  * @param  [in]  bus 串口号。参考 @ref sio_bus_t
529  * @return ERRCODE_SUCC 成功。
530  * @retval Other        失败,参考 @ref errcode_t
531  * @endif
532  */
533 errcode_t hal_sio_unregister_funcs(sio_bus_t bus);
534 
535 /**
536  * @if Eng
537  * @brief  Get interface between sio driver and sio hal, see @ref hal_sio_funcs_t
538  * @param  [in]  bus The sio bus. see @ref sio_bus_t
539  * @return Interface between sio driver and sio hal, see @ref hal_sio_funcs_t
540  * @else
541  * @brief  获取Driver层sio和HAL层sio的接口实例。参考 @ref hal_sio_funcs_t
542  * @param  [in]  bus 串口号。 参考 @ref sio_bus_t
543  * @return Driver层sio和HAL层sio的接口实例。参考 @ref hal_sio_funcs_t
544  * @endif
545  */
546 hal_sio_funcs_t *hal_sio_get_funcs(sio_bus_t bus);
547 
548 #if defined(CONFIG_I2S_SUPPORT_DMA)
549 /**
550  * @if Eng
551  * @brief  sio crg clock enable.
552  * @param  [in]  bus The sio bus. see @ref sio_bus_t.
553  * @param  [in]  enable true or false.
554  * @else
555  * @brief  sio crg clock 使能。
556  * @param  [in]  bus 串口号, 参考 @ref sio_bus_t.
557  * @param  [in]  enable true 或者 false.
558  * @endif
559  */
560 void hal_sio_set_crg_clock_enable(sio_bus_t bus, bool enable);
561 
562 /**
563  * @if Eng
564  * @brief  sio tx enable.
565  * @param  [in]  bus The sio bus. see @ref sio_bus_t.
566  * @param  [in]  val 0 or 1.
567  * @else
568  * @brief  sio tx 使能。
569  * @param  [in]  bus 串口号, 参考 @ref sio_bus_t.
570  * @param  [in]  val 0 或者 1.
571  * @endif
572  */
573 void hal_sio_set_tx_enable(sio_bus_t bus, uint32_t val);
574 
575 /**
576  * @if Eng
577  * @brief  sio rx enable.
578  * @param  [in]  bus The sio bus. see @ref sio_bus_t.
579  * @param  [in]  val 0 or 1.
580  * @else
581  * @brief  sio rx 使能。
582  * @param  [in]  bus 串口号, 参考 @ref sio_bus_t.
583  * @param  [in]  val 0 或者 1.
584  * @endif
585  */
586 void hal_sio_set_rx_enable(sio_bus_t bus, uint32_t val);
587 #endif
588 /**
589  * @}
590  */
591 
592 #ifdef __cplusplus
593 #if __cplusplus
594 }
595 #endif /* __cplusplus */
596 #endif /* __cplusplus */
597 
598 #endif