app_i2s_dma.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file app_i2s_dma.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of I2S app library.
7  *
8  ****************************************************************************************
9  * @attention
10  #####Copyright (c) 2019 GOODIX
11  All rights reserved.
12 
13  Redistribution and use in source and binary forms, with or without
14  modification, are permitted provided that the following conditions are met:
15  * Redistributions of source code must retain the above copyright
16  notice, this list of conditions and the following disclaimer.
17  * Redistributions in binary form must reproduce the above copyright
18  notice, this list of conditions and the following disclaimer in the
19  documentation and/or other materials provided with the distribution.
20  * Neither the name of GOODIX nor the names of its contributors may be used
21  to endorse or promote products derived from this software without
22  specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35  ****************************************************************************************
36  */
37 
38 /** @addtogroup PERIPHERAL Peripheral Driver
39  * @{
40  */
41 
42 /** @addtogroup APP_DRIVER APP DRIVER
43  * @{
44  */
45 
46 /** @defgroup APP_I2S I2S
47  * @brief I2S APP module driver.
48  * @{
49  */
50 
51 
52 #ifndef _APP_I2S_DMA_PUB_H_
53 #define _APP_I2S_DMA_PUB_H_
54 
55 #include "grx_hal.h"
56 #include "app_io.h"
57 #include "app_i2s.h"
58 #include "app_drv_error.h"
59 #include "app_drv_config.h"
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 #ifdef HAL_I2S_MODULE_ENABLED
66 
67 /* Exported functions --------------------------------------------------------*/
68 /** @addtogroup HAL_APP_I2S_DRIVER_FUNCTIONS Functions
69  * @{
70  */
71 
72 /**
73  ****************************************************************************************
74  * @brief Initialize the APP I2S DRIVER according to the specified parameters
75  * in the app_i2s_params_t and app_i2s_evt_handler_t.
76  * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode
77  * is set, you can't use interrupt mode.
78  *
79  * @param[in] p_params: Pointer to app_i2s_params_t parameter which contains the
80  * configuration information for the specified I2S module.
81  *
82  * @return Result of initialization.
83  ****************************************************************************************
84  */
85 uint16_t app_i2s_dma_init(app_i2s_params_t *p_params);
86 
87 /**
88  ****************************************************************************************
89  * @brief De-initialize the APP I2S DRIVER peripheral.
90  *
91  * @param[in] id: De-initialize for a specific ID.
92  *
93  * @return Result of De-initialization.
94  ****************************************************************************************
95  */
97 
98 /**
99  ****************************************************************************************
100  * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt
101  *
102  * @param[in] id: which I2S module want to receive.
103  * @param[in] p_data: Pointer to data buffer
104  * @param[in] size: Amount of data to be sent
105  *
106  * @return Result of operation.
107  ****************************************************************************************
108  */
109 uint16_t app_i2s_dma_receive_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size);
110 
111 /**
112  ****************************************************************************************
113  * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt
114  *
115  * @param[in] id: which I2S module want to transmit.
116  * @param[in] p_data: Pointer to data buffer
117  * @param[in] size: Amount of data to be sent
118  *
119  * @return Result of operation.
120  ****************************************************************************************
121  */
122 uint16_t app_i2s_dma_transmit_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size);
123 
124 /**
125  ****************************************************************************************
126  * @brief Transmit and Receive an amount of data in non-blocking mode with Interrupt.
127  * @param[in] id: I2S ID
128  * @param[in] p_tx_data: Pointer to transmission data buffer
129  * @param[out] p_rx_data: Pointer to reception data buffer
130  * @param[in] length: Amount of data to be sent and received in bytes
131  * @retval ::APP_DRV_SUCCESS: Operation is OK.
132  * @retval ::HAL_ERROR: Parameter error or operation not supported.
133  * @retval ::HAL_BUSY: Driver is busy.
134  * @retval ::HAL_TIMEOUT: Timeout occurred.
135  * @retval ::APP_DRV_ERR_INVALID_PARAM: Parameter error.
136  * @retval ::APP_DRV_ERR_BUSY: Driver is busy.
137  ****************************************************************************************
138  */
140  uint16_t *p_tx_data,
141  uint16_t *p_rx_data,
142  uint32_t length);
143 
144 /** @} */
145 
146 #endif
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif
153 /** @} */
154 /** @} */
155 /** @} */
156 
157 
app_i2s.h
Header file containing functions prototypes of I2S app library.
app_i2s_params_t
I2S parameters structure definition.
Definition: app_i2s.h:189
app_i2s_dma_init
uint16_t app_i2s_dma_init(app_i2s_params_t *p_params)
Initialize the APP I2S DRIVER according to the specified parameters in the app_i2s_params_t and app_i...
app_i2s_dma_transmit_async
uint16_t app_i2s_dma_transmit_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size)
Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt.
app_i2s_dma_deinit
uint16_t app_i2s_dma_deinit(app_i2s_id_t id)
De-initialize the APP I2S DRIVER peripheral.
app_io.h
Header file containing functions prototypes of GPIO app library.
app_i2s_id_t
app_i2s_id_t
I2S module Enumerations definition.
Definition: app_i2s.h:76
grx_hal.h
This file contains all the functions prototypes for the HAL module driver.
app_i2s_dma_receive_async
uint16_t app_i2s_dma_receive_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size)
Receive in master or slave mode an amount of data in non-blocking mode with Interrupt.
app_i2s_dma_transmit_receive_async
uint16_t app_i2s_dma_transmit_receive_async(app_i2s_id_t id, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length)
Transmit and Receive an amount of data in non-blocking mode with Interrupt.
app_drv_error.h
Header file of app driver error code.
app_drv_config.h
Header file of app driver config code.