![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/drivers/fsl_flexio_i2s.h@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
kadonotakashi | 0:8fdf9a60065b | 3 | * All rights reserved. |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
kadonotakashi | 0:8fdf9a60065b | 6 | * are permitted provided that the following conditions are met: |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
kadonotakashi | 0:8fdf9a60065b | 9 | * of conditions and the following disclaimer. |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
kadonotakashi | 0:8fdf9a60065b | 12 | * list of conditions and the following disclaimer in the documentation and/or |
kadonotakashi | 0:8fdf9a60065b | 13 | * other materials provided with the distribution. |
kadonotakashi | 0:8fdf9a60065b | 14 | * |
kadonotakashi | 0:8fdf9a60065b | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
kadonotakashi | 0:8fdf9a60065b | 16 | * contributors may be used to endorse or promote products derived from this |
kadonotakashi | 0:8fdf9a60065b | 17 | * software without specific prior written permission. |
kadonotakashi | 0:8fdf9a60065b | 18 | * |
kadonotakashi | 0:8fdf9a60065b | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
kadonotakashi | 0:8fdf9a60065b | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
kadonotakashi | 0:8fdf9a60065b | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
kadonotakashi | 0:8fdf9a60065b | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
kadonotakashi | 0:8fdf9a60065b | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
kadonotakashi | 0:8fdf9a60065b | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
kadonotakashi | 0:8fdf9a60065b | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
kadonotakashi | 0:8fdf9a60065b | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
kadonotakashi | 0:8fdf9a60065b | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
kadonotakashi | 0:8fdf9a60065b | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
kadonotakashi | 0:8fdf9a60065b | 29 | */ |
kadonotakashi | 0:8fdf9a60065b | 30 | #ifndef _FSL_FLEXIO_I2S_H_ |
kadonotakashi | 0:8fdf9a60065b | 31 | #define _FSL_FLEXIO_I2S_H_ |
kadonotakashi | 0:8fdf9a60065b | 32 | |
kadonotakashi | 0:8fdf9a60065b | 33 | #include "fsl_common.h" |
kadonotakashi | 0:8fdf9a60065b | 34 | #include "fsl_flexio.h" |
kadonotakashi | 0:8fdf9a60065b | 35 | |
kadonotakashi | 0:8fdf9a60065b | 36 | /*! |
kadonotakashi | 0:8fdf9a60065b | 37 | * @addtogroup flexio_i2s |
kadonotakashi | 0:8fdf9a60065b | 38 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 39 | */ |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 43 | * Definitions |
kadonotakashi | 0:8fdf9a60065b | 44 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 45 | |
kadonotakashi | 0:8fdf9a60065b | 46 | /*! @name Driver version */ |
kadonotakashi | 0:8fdf9a60065b | 47 | /*@{*/ |
kadonotakashi | 0:8fdf9a60065b | 48 | /*! @brief FlexIO I2S driver version 2.1.0. */ |
kadonotakashi | 0:8fdf9a60065b | 49 | #define FSL_FLEXIO_I2S_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) |
kadonotakashi | 0:8fdf9a60065b | 50 | /*@}*/ |
kadonotakashi | 0:8fdf9a60065b | 51 | |
kadonotakashi | 0:8fdf9a60065b | 52 | /*! @brief FlexIO I2S transfer status */ |
kadonotakashi | 0:8fdf9a60065b | 53 | enum _flexio_i2s_status |
kadonotakashi | 0:8fdf9a60065b | 54 | { |
kadonotakashi | 0:8fdf9a60065b | 55 | kStatus_FLEXIO_I2S_Idle = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 0), /*!< FlexIO I2S is in idle state */ |
kadonotakashi | 0:8fdf9a60065b | 56 | kStatus_FLEXIO_I2S_TxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 1), /*!< FlexIO I2S Tx is busy */ |
kadonotakashi | 0:8fdf9a60065b | 57 | kStatus_FLEXIO_I2S_RxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 2), /*!< FlexIO I2S Tx is busy */ |
kadonotakashi | 0:8fdf9a60065b | 58 | kStatus_FLEXIO_I2S_Error = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 3), /*!< FlexIO I2S error occurred */ |
kadonotakashi | 0:8fdf9a60065b | 59 | kStatus_FLEXIO_I2S_QueueFull = MAKE_STATUS(kStatusGroup_FLEXIO_I2S, 4), /*!< FlexIO I2S transfer queue is full. */ |
kadonotakashi | 0:8fdf9a60065b | 60 | }; |
kadonotakashi | 0:8fdf9a60065b | 61 | |
kadonotakashi | 0:8fdf9a60065b | 62 | /*! @brief Define FlexIO I2S access structure typedef */ |
kadonotakashi | 0:8fdf9a60065b | 63 | typedef struct _flexio_i2s_type |
kadonotakashi | 0:8fdf9a60065b | 64 | { |
kadonotakashi | 0:8fdf9a60065b | 65 | FLEXIO_Type *flexioBase; /*!< FlexIO base pointer */ |
kadonotakashi | 0:8fdf9a60065b | 66 | uint8_t txPinIndex; /*!< Tx data pin index in FlexIO pins */ |
kadonotakashi | 0:8fdf9a60065b | 67 | uint8_t rxPinIndex; /*!< Rx data pin index */ |
kadonotakashi | 0:8fdf9a60065b | 68 | uint8_t bclkPinIndex; /*!< Bit clock pin index */ |
kadonotakashi | 0:8fdf9a60065b | 69 | uint8_t fsPinIndex; /*!< Frame sync pin index */ |
kadonotakashi | 0:8fdf9a60065b | 70 | uint8_t txShifterIndex; /*!< Tx data shifter index */ |
kadonotakashi | 0:8fdf9a60065b | 71 | uint8_t rxShifterIndex; /*!< Rx data shifter index */ |
kadonotakashi | 0:8fdf9a60065b | 72 | uint8_t bclkTimerIndex; /*!< Bit clock timer index */ |
kadonotakashi | 0:8fdf9a60065b | 73 | uint8_t fsTimerIndex; /*!< Frame sync timer index */ |
kadonotakashi | 0:8fdf9a60065b | 74 | } FLEXIO_I2S_Type; |
kadonotakashi | 0:8fdf9a60065b | 75 | |
kadonotakashi | 0:8fdf9a60065b | 76 | /*! @brief Master or slave mode */ |
kadonotakashi | 0:8fdf9a60065b | 77 | typedef enum _flexio_i2s_master_slave |
kadonotakashi | 0:8fdf9a60065b | 78 | { |
kadonotakashi | 0:8fdf9a60065b | 79 | kFLEXIO_I2S_Master = 0x0U, /*!< Master mode */ |
kadonotakashi | 0:8fdf9a60065b | 80 | kFLEXIO_I2S_Slave = 0x1U /*!< Slave mode */ |
kadonotakashi | 0:8fdf9a60065b | 81 | } flexio_i2s_master_slave_t; |
kadonotakashi | 0:8fdf9a60065b | 82 | |
kadonotakashi | 0:8fdf9a60065b | 83 | /*! @brief Define FlexIO FlexIO I2S interrupt mask. */ |
kadonotakashi | 0:8fdf9a60065b | 84 | enum _flexio_i2s_interrupt_enable |
kadonotakashi | 0:8fdf9a60065b | 85 | { |
kadonotakashi | 0:8fdf9a60065b | 86 | kFLEXIO_I2S_TxDataRegEmptyInterruptEnable = 0x1U, /*!< Transmit buffer empty interrupt enable. */ |
kadonotakashi | 0:8fdf9a60065b | 87 | kFLEXIO_I2S_RxDataRegFullInterruptEnable = 0x2U, /*!< Receive buffer full interrupt enable. */ |
kadonotakashi | 0:8fdf9a60065b | 88 | }; |
kadonotakashi | 0:8fdf9a60065b | 89 | |
kadonotakashi | 0:8fdf9a60065b | 90 | /*! @brief Define FlexIO FlexIO I2S status mask. */ |
kadonotakashi | 0:8fdf9a60065b | 91 | enum _flexio_i2s_status_flags |
kadonotakashi | 0:8fdf9a60065b | 92 | { |
kadonotakashi | 0:8fdf9a60065b | 93 | kFLEXIO_I2S_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */ |
kadonotakashi | 0:8fdf9a60065b | 94 | kFLEXIO_I2S_RxDataRegFullFlag = 0x2U, /*!< Receive buffer full flag. */ |
kadonotakashi | 0:8fdf9a60065b | 95 | }; |
kadonotakashi | 0:8fdf9a60065b | 96 | |
kadonotakashi | 0:8fdf9a60065b | 97 | /*! @brief FlexIO I2S configure structure */ |
kadonotakashi | 0:8fdf9a60065b | 98 | typedef struct _flexio_i2s_config |
kadonotakashi | 0:8fdf9a60065b | 99 | { |
kadonotakashi | 0:8fdf9a60065b | 100 | bool enableI2S; /*!< Enable FlexIO I2S */ |
kadonotakashi | 0:8fdf9a60065b | 101 | flexio_i2s_master_slave_t masterSlave; /*!< Master or slave */ |
kadonotakashi | 0:8fdf9a60065b | 102 | } flexio_i2s_config_t; |
kadonotakashi | 0:8fdf9a60065b | 103 | |
kadonotakashi | 0:8fdf9a60065b | 104 | /*! @brief FlexIO I2S audio format, FlexIO I2S only support the same format in Tx and Rx */ |
kadonotakashi | 0:8fdf9a60065b | 105 | typedef struct _flexio_i2s_format |
kadonotakashi | 0:8fdf9a60065b | 106 | { |
kadonotakashi | 0:8fdf9a60065b | 107 | uint8_t bitWidth; /*!< Bit width of audio data, always 8/16/24/32 bits */ |
kadonotakashi | 0:8fdf9a60065b | 108 | uint32_t sampleRate_Hz; /*!< Sample rate of the audio data */ |
kadonotakashi | 0:8fdf9a60065b | 109 | } flexio_i2s_format_t; |
kadonotakashi | 0:8fdf9a60065b | 110 | |
kadonotakashi | 0:8fdf9a60065b | 111 | /*!@brief FlexIO I2S transfer queue size, user can refine it according to use case. */ |
kadonotakashi | 0:8fdf9a60065b | 112 | #define FLEXIO_I2S_XFER_QUEUE_SIZE (4) |
kadonotakashi | 0:8fdf9a60065b | 113 | |
kadonotakashi | 0:8fdf9a60065b | 114 | /*! @brief Audio sample rate */ |
kadonotakashi | 0:8fdf9a60065b | 115 | typedef enum _flexio_i2s_sample_rate |
kadonotakashi | 0:8fdf9a60065b | 116 | { |
kadonotakashi | 0:8fdf9a60065b | 117 | kFLEXIO_I2S_SampleRate8KHz = 8000U, /*!< Sample rate 8000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 118 | kFLEXIO_I2S_SampleRate11025Hz = 11025U, /*!< Sample rate 11025Hz */ |
kadonotakashi | 0:8fdf9a60065b | 119 | kFLEXIO_I2S_SampleRate12KHz = 12000U, /*!< Sample rate 12000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 120 | kFLEXIO_I2S_SampleRate16KHz = 16000U, /*!< Sample rate 16000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 121 | kFLEXIO_I2S_SampleRate22050Hz = 22050U, /*!< Sample rate 22050Hz */ |
kadonotakashi | 0:8fdf9a60065b | 122 | kFLEXIO_I2S_SampleRate24KHz = 24000U, /*!< Sample rate 24000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 123 | kFLEXIO_I2S_SampleRate32KHz = 32000U, /*!< Sample rate 32000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 124 | kFLEXIO_I2S_SampleRate44100Hz = 44100U, /*!< Sample rate 44100Hz */ |
kadonotakashi | 0:8fdf9a60065b | 125 | kFLEXIO_I2S_SampleRate48KHz = 48000U, /*!< Sample rate 48000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 126 | kFLEXIO_I2S_SampleRate96KHz = 96000U /*!< Sample rate 96000Hz */ |
kadonotakashi | 0:8fdf9a60065b | 127 | } flexio_i2s_sample_rate_t; |
kadonotakashi | 0:8fdf9a60065b | 128 | |
kadonotakashi | 0:8fdf9a60065b | 129 | /*! @brief Audio word width */ |
kadonotakashi | 0:8fdf9a60065b | 130 | typedef enum _flexio_i2s_word_width |
kadonotakashi | 0:8fdf9a60065b | 131 | { |
kadonotakashi | 0:8fdf9a60065b | 132 | kFLEXIO_I2S_WordWidth8bits = 8U, /*!< Audio data width 8 bits */ |
kadonotakashi | 0:8fdf9a60065b | 133 | kFLEXIO_I2S_WordWidth16bits = 16U, /*!< Audio data width 16 bits */ |
kadonotakashi | 0:8fdf9a60065b | 134 | kFLEXIO_I2S_WordWidth24bits = 24U, /*!< Audio data width 24 bits */ |
kadonotakashi | 0:8fdf9a60065b | 135 | kFLEXIO_I2S_WordWidth32bits = 32U /*!< Audio data width 32 bits */ |
kadonotakashi | 0:8fdf9a60065b | 136 | } flexio_i2s_word_width_t; |
kadonotakashi | 0:8fdf9a60065b | 137 | |
kadonotakashi | 0:8fdf9a60065b | 138 | /*! @brief Define FlexIO I2S transfer structure. */ |
kadonotakashi | 0:8fdf9a60065b | 139 | typedef struct _flexio_i2s_transfer |
kadonotakashi | 0:8fdf9a60065b | 140 | { |
kadonotakashi | 0:8fdf9a60065b | 141 | uint8_t *data; /*!< Data buffer start pointer */ |
kadonotakashi | 0:8fdf9a60065b | 142 | size_t dataSize; /*!< Bytes to be transferred. */ |
kadonotakashi | 0:8fdf9a60065b | 143 | } flexio_i2s_transfer_t; |
kadonotakashi | 0:8fdf9a60065b | 144 | |
kadonotakashi | 0:8fdf9a60065b | 145 | typedef struct _flexio_i2s_handle flexio_i2s_handle_t; |
kadonotakashi | 0:8fdf9a60065b | 146 | |
kadonotakashi | 0:8fdf9a60065b | 147 | /*! @brief FlexIO I2S xfer callback prototype */ |
kadonotakashi | 0:8fdf9a60065b | 148 | typedef void (*flexio_i2s_callback_t)(FLEXIO_I2S_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 149 | flexio_i2s_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 150 | status_t status, |
kadonotakashi | 0:8fdf9a60065b | 151 | void *userData); |
kadonotakashi | 0:8fdf9a60065b | 152 | |
kadonotakashi | 0:8fdf9a60065b | 153 | /*! @brief Define FlexIO I2S handle structure. */ |
kadonotakashi | 0:8fdf9a60065b | 154 | struct _flexio_i2s_handle |
kadonotakashi | 0:8fdf9a60065b | 155 | { |
kadonotakashi | 0:8fdf9a60065b | 156 | uint32_t state; /*!< Internal state */ |
kadonotakashi | 0:8fdf9a60065b | 157 | flexio_i2s_callback_t callback; /*!< Callback function called at transfer event*/ |
kadonotakashi | 0:8fdf9a60065b | 158 | void *userData; /*!< Callback parameter passed to callback function*/ |
kadonotakashi | 0:8fdf9a60065b | 159 | uint8_t bitWidth; /*!< Bit width for transfer, 8/16/24/32bits */ |
kadonotakashi | 0:8fdf9a60065b | 160 | flexio_i2s_transfer_t queue[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Transfer queue storing queued transfer */ |
kadonotakashi | 0:8fdf9a60065b | 161 | size_t transferSize[FLEXIO_I2S_XFER_QUEUE_SIZE]; /*!< Data bytes need to transfer */ |
kadonotakashi | 0:8fdf9a60065b | 162 | volatile uint8_t queueUser; /*!< Index for user to queue transfer */ |
kadonotakashi | 0:8fdf9a60065b | 163 | volatile uint8_t queueDriver; /*!< Index for driver to get the transfer data and size */ |
kadonotakashi | 0:8fdf9a60065b | 164 | }; |
kadonotakashi | 0:8fdf9a60065b | 165 | |
kadonotakashi | 0:8fdf9a60065b | 166 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 167 | * API |
kadonotakashi | 0:8fdf9a60065b | 168 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 169 | |
kadonotakashi | 0:8fdf9a60065b | 170 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 171 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 172 | #endif /*_cplusplus*/ |
kadonotakashi | 0:8fdf9a60065b | 173 | |
kadonotakashi | 0:8fdf9a60065b | 174 | /*! |
kadonotakashi | 0:8fdf9a60065b | 175 | * @name Initialization and deinitialization |
kadonotakashi | 0:8fdf9a60065b | 176 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 177 | */ |
kadonotakashi | 0:8fdf9a60065b | 178 | |
kadonotakashi | 0:8fdf9a60065b | 179 | /*! |
kadonotakashi | 0:8fdf9a60065b | 180 | * @brief Initializes the FlexIO I2S. |
kadonotakashi | 0:8fdf9a60065b | 181 | * |
kadonotakashi | 0:8fdf9a60065b | 182 | * This API configures FlexIO pins and shifter to I2S and configures the FlexIO I2S with a configuration structure. |
kadonotakashi | 0:8fdf9a60065b | 183 | * The configuration structure can be filled by the user, or be set with default values by |
kadonotakashi | 0:8fdf9a60065b | 184 | * FLEXIO_I2S_GetDefaultConfig(). |
kadonotakashi | 0:8fdf9a60065b | 185 | * |
kadonotakashi | 0:8fdf9a60065b | 186 | * @note This API should be called at the beginning of the application to use |
kadonotakashi | 0:8fdf9a60065b | 187 | * the FlexIO I2S driver. Otherwise, any access to the FlexIO I2S module can cause hard fault |
kadonotakashi | 0:8fdf9a60065b | 188 | * because the clock is not enabled. |
kadonotakashi | 0:8fdf9a60065b | 189 | * |
kadonotakashi | 0:8fdf9a60065b | 190 | * @param base FlexIO I2S base pointer |
kadonotakashi | 0:8fdf9a60065b | 191 | * @param config FlexIO I2S configure structure. |
kadonotakashi | 0:8fdf9a60065b | 192 | */ |
kadonotakashi | 0:8fdf9a60065b | 193 | void FLEXIO_I2S_Init(FLEXIO_I2S_Type *base, const flexio_i2s_config_t *config); |
kadonotakashi | 0:8fdf9a60065b | 194 | |
kadonotakashi | 0:8fdf9a60065b | 195 | /*! |
kadonotakashi | 0:8fdf9a60065b | 196 | * @brief Sets the FlexIO I2S configuration structure to default values. |
kadonotakashi | 0:8fdf9a60065b | 197 | * |
kadonotakashi | 0:8fdf9a60065b | 198 | * The purpose of this API is to get the configuration structure initialized for use in FLEXIO_I2S_Init(). |
kadonotakashi | 0:8fdf9a60065b | 199 | * Users may use the initialized structure unchanged in FLEXIO_I2S_Init() or modify |
kadonotakashi | 0:8fdf9a60065b | 200 | * some fields of the structure before calling FLEXIO_I2S_Init(). |
kadonotakashi | 0:8fdf9a60065b | 201 | * |
kadonotakashi | 0:8fdf9a60065b | 202 | * @param config pointer to master configuration structure |
kadonotakashi | 0:8fdf9a60065b | 203 | */ |
kadonotakashi | 0:8fdf9a60065b | 204 | void FLEXIO_I2S_GetDefaultConfig(flexio_i2s_config_t *config); |
kadonotakashi | 0:8fdf9a60065b | 205 | |
kadonotakashi | 0:8fdf9a60065b | 206 | /*! |
kadonotakashi | 0:8fdf9a60065b | 207 | * @brief De-initializes the FlexIO I2S. |
kadonotakashi | 0:8fdf9a60065b | 208 | * |
kadonotakashi | 0:8fdf9a60065b | 209 | * Calling this API gates the FlexIO i2s clock. After calling this API, call the FLEXO_I2S_Init to use the |
kadonotakashi | 0:8fdf9a60065b | 210 | * FlexIO I2S module. |
kadonotakashi | 0:8fdf9a60065b | 211 | * |
kadonotakashi | 0:8fdf9a60065b | 212 | * @param base FlexIO I2S base pointer |
kadonotakashi | 0:8fdf9a60065b | 213 | */ |
kadonotakashi | 0:8fdf9a60065b | 214 | void FLEXIO_I2S_Deinit(FLEXIO_I2S_Type *base); |
kadonotakashi | 0:8fdf9a60065b | 215 | |
kadonotakashi | 0:8fdf9a60065b | 216 | /*! |
kadonotakashi | 0:8fdf9a60065b | 217 | * @brief Enables/disables the FlexIO I2S module operation. |
kadonotakashi | 0:8fdf9a60065b | 218 | * |
kadonotakashi | 0:8fdf9a60065b | 219 | * @param base Pointer to FLEXIO_I2S_Type |
kadonotakashi | 0:8fdf9a60065b | 220 | * @param enable True to enable, false to disable. |
kadonotakashi | 0:8fdf9a60065b | 221 | */ |
kadonotakashi | 0:8fdf9a60065b | 222 | static inline void FLEXIO_I2S_Enable(FLEXIO_I2S_Type *base, bool enable) |
kadonotakashi | 0:8fdf9a60065b | 223 | { |
kadonotakashi | 0:8fdf9a60065b | 224 | if (enable) |
kadonotakashi | 0:8fdf9a60065b | 225 | { |
kadonotakashi | 0:8fdf9a60065b | 226 | base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK; |
kadonotakashi | 0:8fdf9a60065b | 227 | } |
kadonotakashi | 0:8fdf9a60065b | 228 | else |
kadonotakashi | 0:8fdf9a60065b | 229 | { |
kadonotakashi | 0:8fdf9a60065b | 230 | base->flexioBase->CTRL &= ~FLEXIO_CTRL_FLEXEN_MASK; |
kadonotakashi | 0:8fdf9a60065b | 231 | } |
kadonotakashi | 0:8fdf9a60065b | 232 | } |
kadonotakashi | 0:8fdf9a60065b | 233 | |
kadonotakashi | 0:8fdf9a60065b | 234 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 235 | |
kadonotakashi | 0:8fdf9a60065b | 236 | /*! |
kadonotakashi | 0:8fdf9a60065b | 237 | * @name Status |
kadonotakashi | 0:8fdf9a60065b | 238 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 239 | */ |
kadonotakashi | 0:8fdf9a60065b | 240 | |
kadonotakashi | 0:8fdf9a60065b | 241 | /*! |
kadonotakashi | 0:8fdf9a60065b | 242 | * @brief Gets the FlexIO I2S status flags. |
kadonotakashi | 0:8fdf9a60065b | 243 | * |
kadonotakashi | 0:8fdf9a60065b | 244 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 245 | * @return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags. |
kadonotakashi | 0:8fdf9a60065b | 246 | */ |
kadonotakashi | 0:8fdf9a60065b | 247 | uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base); |
kadonotakashi | 0:8fdf9a60065b | 248 | |
kadonotakashi | 0:8fdf9a60065b | 249 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 250 | |
kadonotakashi | 0:8fdf9a60065b | 251 | /*! |
kadonotakashi | 0:8fdf9a60065b | 252 | * @name Interrupts |
kadonotakashi | 0:8fdf9a60065b | 253 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 254 | */ |
kadonotakashi | 0:8fdf9a60065b | 255 | |
kadonotakashi | 0:8fdf9a60065b | 256 | /*! |
kadonotakashi | 0:8fdf9a60065b | 257 | * @brief Enables the FlexIO I2S interrupt. |
kadonotakashi | 0:8fdf9a60065b | 258 | * |
kadonotakashi | 0:8fdf9a60065b | 259 | * This function enables the FlexIO UART interrupt. |
kadonotakashi | 0:8fdf9a60065b | 260 | * |
kadonotakashi | 0:8fdf9a60065b | 261 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 262 | * @param mask interrupt source |
kadonotakashi | 0:8fdf9a60065b | 263 | */ |
kadonotakashi | 0:8fdf9a60065b | 264 | void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask); |
kadonotakashi | 0:8fdf9a60065b | 265 | |
kadonotakashi | 0:8fdf9a60065b | 266 | /*! |
kadonotakashi | 0:8fdf9a60065b | 267 | * @brief Disables the FlexIO I2S interrupt. |
kadonotakashi | 0:8fdf9a60065b | 268 | * |
kadonotakashi | 0:8fdf9a60065b | 269 | * This function enables the FlexIO UART interrupt. |
kadonotakashi | 0:8fdf9a60065b | 270 | * |
kadonotakashi | 0:8fdf9a60065b | 271 | * @param base pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 272 | * @param mask interrupt source |
kadonotakashi | 0:8fdf9a60065b | 273 | */ |
kadonotakashi | 0:8fdf9a60065b | 274 | void FLEXIO_I2S_DisableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask); |
kadonotakashi | 0:8fdf9a60065b | 275 | |
kadonotakashi | 0:8fdf9a60065b | 276 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 277 | |
kadonotakashi | 0:8fdf9a60065b | 278 | /*! |
kadonotakashi | 0:8fdf9a60065b | 279 | * @name DMA Control |
kadonotakashi | 0:8fdf9a60065b | 280 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 281 | */ |
kadonotakashi | 0:8fdf9a60065b | 282 | |
kadonotakashi | 0:8fdf9a60065b | 283 | /*! |
kadonotakashi | 0:8fdf9a60065b | 284 | * @brief Enables/disables the FlexIO I2S Tx DMA requests. |
kadonotakashi | 0:8fdf9a60065b | 285 | * |
kadonotakashi | 0:8fdf9a60065b | 286 | * @param base FlexIO I2S base pointer |
kadonotakashi | 0:8fdf9a60065b | 287 | * @param enable True means enable DMA, false means disable DMA. |
kadonotakashi | 0:8fdf9a60065b | 288 | */ |
kadonotakashi | 0:8fdf9a60065b | 289 | static inline void FLEXIO_I2S_TxEnableDMA(FLEXIO_I2S_Type *base, bool enable) |
kadonotakashi | 0:8fdf9a60065b | 290 | { |
kadonotakashi | 0:8fdf9a60065b | 291 | FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1 << base->txShifterIndex, enable); |
kadonotakashi | 0:8fdf9a60065b | 292 | } |
kadonotakashi | 0:8fdf9a60065b | 293 | |
kadonotakashi | 0:8fdf9a60065b | 294 | /*! |
kadonotakashi | 0:8fdf9a60065b | 295 | * @brief Enables/disables the FlexIO I2S Rx DMA requests. |
kadonotakashi | 0:8fdf9a60065b | 296 | * |
kadonotakashi | 0:8fdf9a60065b | 297 | * @param base FlexIO I2S base pointer |
kadonotakashi | 0:8fdf9a60065b | 298 | * @param enable True means enable DMA, false means disable DMA. |
kadonotakashi | 0:8fdf9a60065b | 299 | */ |
kadonotakashi | 0:8fdf9a60065b | 300 | static inline void FLEXIO_I2S_RxEnableDMA(FLEXIO_I2S_Type *base, bool enable) |
kadonotakashi | 0:8fdf9a60065b | 301 | { |
kadonotakashi | 0:8fdf9a60065b | 302 | FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1 << base->rxShifterIndex, enable); |
kadonotakashi | 0:8fdf9a60065b | 303 | } |
kadonotakashi | 0:8fdf9a60065b | 304 | |
kadonotakashi | 0:8fdf9a60065b | 305 | /*! |
kadonotakashi | 0:8fdf9a60065b | 306 | * @brief Gets the FlexIO I2S send data register address. |
kadonotakashi | 0:8fdf9a60065b | 307 | * |
kadonotakashi | 0:8fdf9a60065b | 308 | * This function returns the I2S data register address, mainly used by DMA/eDMA. |
kadonotakashi | 0:8fdf9a60065b | 309 | * |
kadonotakashi | 0:8fdf9a60065b | 310 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 311 | * @return FlexIO i2s send data register address. |
kadonotakashi | 0:8fdf9a60065b | 312 | */ |
kadonotakashi | 0:8fdf9a60065b | 313 | static inline uint32_t FLEXIO_I2S_TxGetDataRegisterAddress(FLEXIO_I2S_Type *base) |
kadonotakashi | 0:8fdf9a60065b | 314 | { |
kadonotakashi | 0:8fdf9a60065b | 315 | return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->txShifterIndex); |
kadonotakashi | 0:8fdf9a60065b | 316 | } |
kadonotakashi | 0:8fdf9a60065b | 317 | |
kadonotakashi | 0:8fdf9a60065b | 318 | /*! |
kadonotakashi | 0:8fdf9a60065b | 319 | * @brief Gets the FlexIO I2S receive data register address. |
kadonotakashi | 0:8fdf9a60065b | 320 | * |
kadonotakashi | 0:8fdf9a60065b | 321 | * This function returns the I2S data register address, mainly used by DMA/eDMA. |
kadonotakashi | 0:8fdf9a60065b | 322 | * |
kadonotakashi | 0:8fdf9a60065b | 323 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 324 | * @return FlexIO i2s receive data register address. |
kadonotakashi | 0:8fdf9a60065b | 325 | */ |
kadonotakashi | 0:8fdf9a60065b | 326 | static inline uint32_t FLEXIO_I2S_RxGetDataRegisterAddress(FLEXIO_I2S_Type *base) |
kadonotakashi | 0:8fdf9a60065b | 327 | { |
kadonotakashi | 0:8fdf9a60065b | 328 | return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferBitSwapped, base->rxShifterIndex); |
kadonotakashi | 0:8fdf9a60065b | 329 | } |
kadonotakashi | 0:8fdf9a60065b | 330 | |
kadonotakashi | 0:8fdf9a60065b | 331 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 332 | |
kadonotakashi | 0:8fdf9a60065b | 333 | /*! |
kadonotakashi | 0:8fdf9a60065b | 334 | * @name Bus Operations |
kadonotakashi | 0:8fdf9a60065b | 335 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 336 | */ |
kadonotakashi | 0:8fdf9a60065b | 337 | |
kadonotakashi | 0:8fdf9a60065b | 338 | /*! |
kadonotakashi | 0:8fdf9a60065b | 339 | * @brief Configures the FlexIO I2S audio format in master mode. |
kadonotakashi | 0:8fdf9a60065b | 340 | * |
kadonotakashi | 0:8fdf9a60065b | 341 | * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data |
kadonotakashi | 0:8fdf9a60065b | 342 | * format to be transferred. |
kadonotakashi | 0:8fdf9a60065b | 343 | * |
kadonotakashi | 0:8fdf9a60065b | 344 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 345 | * @param format Pointer to FlexIO I2S audio data format structure. |
kadonotakashi | 0:8fdf9a60065b | 346 | * @param srcClock_Hz I2S master clock source frequency in Hz. |
kadonotakashi | 0:8fdf9a60065b | 347 | */ |
kadonotakashi | 0:8fdf9a60065b | 348 | void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz); |
kadonotakashi | 0:8fdf9a60065b | 349 | |
kadonotakashi | 0:8fdf9a60065b | 350 | /*! |
kadonotakashi | 0:8fdf9a60065b | 351 | * @brief Configures the FlexIO I2S audio format in slave mode. |
kadonotakashi | 0:8fdf9a60065b | 352 | * |
kadonotakashi | 0:8fdf9a60065b | 353 | * Audio format can be changed in run-time of FlexIO I2S. This function configures the sample rate and audio data |
kadonotakashi | 0:8fdf9a60065b | 354 | * format to be transferred. |
kadonotakashi | 0:8fdf9a60065b | 355 | * |
kadonotakashi | 0:8fdf9a60065b | 356 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 357 | * @param format Pointer to FlexIO I2S audio data format structure. |
kadonotakashi | 0:8fdf9a60065b | 358 | */ |
kadonotakashi | 0:8fdf9a60065b | 359 | void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format); |
kadonotakashi | 0:8fdf9a60065b | 360 | |
kadonotakashi | 0:8fdf9a60065b | 361 | /*! |
kadonotakashi | 0:8fdf9a60065b | 362 | * @brief Sends data using a blocking method. |
kadonotakashi | 0:8fdf9a60065b | 363 | * |
kadonotakashi | 0:8fdf9a60065b | 364 | * @note This function blocks via polling until data is ready to be sent. |
kadonotakashi | 0:8fdf9a60065b | 365 | * |
kadonotakashi | 0:8fdf9a60065b | 366 | * @param base FlexIO I2S base pointer. |
kadonotakashi | 0:8fdf9a60065b | 367 | * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits. |
kadonotakashi | 0:8fdf9a60065b | 368 | * @param txData Pointer to the data to be written. |
kadonotakashi | 0:8fdf9a60065b | 369 | * @param size Bytes to be written. |
kadonotakashi | 0:8fdf9a60065b | 370 | */ |
kadonotakashi | 0:8fdf9a60065b | 371 | void FLEXIO_I2S_WriteBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *txData, size_t size); |
kadonotakashi | 0:8fdf9a60065b | 372 | |
kadonotakashi | 0:8fdf9a60065b | 373 | /*! |
kadonotakashi | 0:8fdf9a60065b | 374 | * @brief Writes data into a data register. |
kadonotakashi | 0:8fdf9a60065b | 375 | * |
kadonotakashi | 0:8fdf9a60065b | 376 | * @param base FlexIO I2S base pointer. |
kadonotakashi | 0:8fdf9a60065b | 377 | * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits. |
kadonotakashi | 0:8fdf9a60065b | 378 | * @param data Data to be written. |
kadonotakashi | 0:8fdf9a60065b | 379 | */ |
kadonotakashi | 0:8fdf9a60065b | 380 | static inline void FLEXIO_I2S_WriteData(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint32_t data) |
kadonotakashi | 0:8fdf9a60065b | 381 | { |
kadonotakashi | 0:8fdf9a60065b | 382 | base->flexioBase->SHIFTBUFBIS[base->txShifterIndex] = (data << (32U - bitWidth)); |
kadonotakashi | 0:8fdf9a60065b | 383 | } |
kadonotakashi | 0:8fdf9a60065b | 384 | |
kadonotakashi | 0:8fdf9a60065b | 385 | /*! |
kadonotakashi | 0:8fdf9a60065b | 386 | * @brief Receives a piece of data using a blocking method. |
kadonotakashi | 0:8fdf9a60065b | 387 | * |
kadonotakashi | 0:8fdf9a60065b | 388 | * @note This function blocks via polling until data is ready to be sent. |
kadonotakashi | 0:8fdf9a60065b | 389 | * |
kadonotakashi | 0:8fdf9a60065b | 390 | * @param base FlexIO I2S base pointer |
kadonotakashi | 0:8fdf9a60065b | 391 | * @param bitWidth How many bits in a audio word, usually 8/16/24/32 bits. |
kadonotakashi | 0:8fdf9a60065b | 392 | * @param rxData Pointer to the data to be read. |
kadonotakashi | 0:8fdf9a60065b | 393 | * @param size Bytes to be read. |
kadonotakashi | 0:8fdf9a60065b | 394 | */ |
kadonotakashi | 0:8fdf9a60065b | 395 | void FLEXIO_I2S_ReadBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size); |
kadonotakashi | 0:8fdf9a60065b | 396 | |
kadonotakashi | 0:8fdf9a60065b | 397 | /*! |
kadonotakashi | 0:8fdf9a60065b | 398 | * @brief Reads a data from the data register. |
kadonotakashi | 0:8fdf9a60065b | 399 | * |
kadonotakashi | 0:8fdf9a60065b | 400 | * @param base FlexIO I2S base pointer |
kadonotakashi | 0:8fdf9a60065b | 401 | * @return Data read from data register. |
kadonotakashi | 0:8fdf9a60065b | 402 | */ |
kadonotakashi | 0:8fdf9a60065b | 403 | static inline uint32_t FLEXIO_I2S_ReadData(FLEXIO_I2S_Type *base) |
kadonotakashi | 0:8fdf9a60065b | 404 | { |
kadonotakashi | 0:8fdf9a60065b | 405 | return base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex]; |
kadonotakashi | 0:8fdf9a60065b | 406 | } |
kadonotakashi | 0:8fdf9a60065b | 407 | |
kadonotakashi | 0:8fdf9a60065b | 408 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 409 | |
kadonotakashi | 0:8fdf9a60065b | 410 | /*! |
kadonotakashi | 0:8fdf9a60065b | 411 | * @name Transactional |
kadonotakashi | 0:8fdf9a60065b | 412 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 413 | */ |
kadonotakashi | 0:8fdf9a60065b | 414 | |
kadonotakashi | 0:8fdf9a60065b | 415 | /*! |
kadonotakashi | 0:8fdf9a60065b | 416 | * @brief Initializes the FlexIO I2S handle. |
kadonotakashi | 0:8fdf9a60065b | 417 | * |
kadonotakashi | 0:8fdf9a60065b | 418 | * This function initializes the FlexIO I2S handle which can be used for other |
kadonotakashi | 0:8fdf9a60065b | 419 | * FlexIO I2S transactional APIs. Call this API once to get the |
kadonotakashi | 0:8fdf9a60065b | 420 | * initialized handle. |
kadonotakashi | 0:8fdf9a60065b | 421 | * |
kadonotakashi | 0:8fdf9a60065b | 422 | * @param base Pointer to FLEXIO_I2S_Type structure |
kadonotakashi | 0:8fdf9a60065b | 423 | * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. |
kadonotakashi | 0:8fdf9a60065b | 424 | * @param callback FlexIO I2S callback function, which is called while finished a block. |
kadonotakashi | 0:8fdf9a60065b | 425 | * @param userData User parameter for the FlexIO I2S callback. |
kadonotakashi | 0:8fdf9a60065b | 426 | */ |
kadonotakashi | 0:8fdf9a60065b | 427 | void FLEXIO_I2S_TransferTxCreateHandle(FLEXIO_I2S_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 428 | flexio_i2s_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 429 | flexio_i2s_callback_t callback, |
kadonotakashi | 0:8fdf9a60065b | 430 | void *userData); |
kadonotakashi | 0:8fdf9a60065b | 431 | |
kadonotakashi | 0:8fdf9a60065b | 432 | /*! |
kadonotakashi | 0:8fdf9a60065b | 433 | * @brief Configures the FlexIO I2S audio format. |
kadonotakashi | 0:8fdf9a60065b | 434 | * |
kadonotakashi | 0:8fdf9a60065b | 435 | * Audio format can be changed at run-time of FlexIO I2S. This function configures the sample rate and audio data |
kadonotakashi | 0:8fdf9a60065b | 436 | * format to be transferred. |
kadonotakashi | 0:8fdf9a60065b | 437 | * |
kadonotakashi | 0:8fdf9a60065b | 438 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 439 | * @param handle FlexIO I2S handle pointer. |
kadonotakashi | 0:8fdf9a60065b | 440 | * @param format Pointer to audio data format structure. |
kadonotakashi | 0:8fdf9a60065b | 441 | * @param srcClock_Hz FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode. |
kadonotakashi | 0:8fdf9a60065b | 442 | */ |
kadonotakashi | 0:8fdf9a60065b | 443 | void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 444 | flexio_i2s_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 445 | flexio_i2s_format_t *format, |
kadonotakashi | 0:8fdf9a60065b | 446 | uint32_t srcClock_Hz); |
kadonotakashi | 0:8fdf9a60065b | 447 | |
kadonotakashi | 0:8fdf9a60065b | 448 | /*! |
kadonotakashi | 0:8fdf9a60065b | 449 | * @brief Initializes the FlexIO I2S receive handle. |
kadonotakashi | 0:8fdf9a60065b | 450 | * |
kadonotakashi | 0:8fdf9a60065b | 451 | * This function initializes the FlexIO I2S handle which can be used for other |
kadonotakashi | 0:8fdf9a60065b | 452 | * FlexIO I2S transactional APIs. Call this API once to get the |
kadonotakashi | 0:8fdf9a60065b | 453 | * initialized handle. |
kadonotakashi | 0:8fdf9a60065b | 454 | * |
kadonotakashi | 0:8fdf9a60065b | 455 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 456 | * @param handle Pointer to flexio_i2s_handle_t structure to store the transfer state. |
kadonotakashi | 0:8fdf9a60065b | 457 | * @param callback FlexIO I2S callback function, which is called while finished a block. |
kadonotakashi | 0:8fdf9a60065b | 458 | * @param userData User parameter for the FlexIO I2S callback. |
kadonotakashi | 0:8fdf9a60065b | 459 | */ |
kadonotakashi | 0:8fdf9a60065b | 460 | void FLEXIO_I2S_TransferRxCreateHandle(FLEXIO_I2S_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 461 | flexio_i2s_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 462 | flexio_i2s_callback_t callback, |
kadonotakashi | 0:8fdf9a60065b | 463 | void *userData); |
kadonotakashi | 0:8fdf9a60065b | 464 | |
kadonotakashi | 0:8fdf9a60065b | 465 | /*! |
kadonotakashi | 0:8fdf9a60065b | 466 | * @brief Performs an interrupt non-blocking send transfer on FlexIO I2S. |
kadonotakashi | 0:8fdf9a60065b | 467 | * |
kadonotakashi | 0:8fdf9a60065b | 468 | * @note The API returns immediately after transfer initiates. |
kadonotakashi | 0:8fdf9a60065b | 469 | * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status and check whether |
kadonotakashi | 0:8fdf9a60065b | 470 | * the transfer is finished. If the return status is 0, the transfer is finished. |
kadonotakashi | 0:8fdf9a60065b | 471 | * |
kadonotakashi | 0:8fdf9a60065b | 472 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 473 | * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state |
kadonotakashi | 0:8fdf9a60065b | 474 | * @param xfer Pointer to flexio_i2s_transfer_t structure |
kadonotakashi | 0:8fdf9a60065b | 475 | * @retval kStatus_Success Successfully start the data transmission. |
kadonotakashi | 0:8fdf9a60065b | 476 | * @retval kStatus_FLEXIO_I2S_TxBusy Previous transmission still not finished, data not all written to TX register yet. |
kadonotakashi | 0:8fdf9a60065b | 477 | * @retval kStatus_InvalidArgument The input parameter is invalid. |
kadonotakashi | 0:8fdf9a60065b | 478 | */ |
kadonotakashi | 0:8fdf9a60065b | 479 | status_t FLEXIO_I2S_TransferSendNonBlocking(FLEXIO_I2S_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 480 | flexio_i2s_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 481 | flexio_i2s_transfer_t *xfer); |
kadonotakashi | 0:8fdf9a60065b | 482 | |
kadonotakashi | 0:8fdf9a60065b | 483 | /*! |
kadonotakashi | 0:8fdf9a60065b | 484 | * @brief Performs an interrupt non-blocking receive transfer on FlexIO I2S. |
kadonotakashi | 0:8fdf9a60065b | 485 | * |
kadonotakashi | 0:8fdf9a60065b | 486 | * @note The API returns immediately after transfer initiates. |
kadonotakashi | 0:8fdf9a60065b | 487 | * Call FLEXIO_I2S_GetRemainingBytes to poll the transfer status to check whether |
kadonotakashi | 0:8fdf9a60065b | 488 | * the transfer is finished. If the return status is 0, the transfer is finished. |
kadonotakashi | 0:8fdf9a60065b | 489 | * |
kadonotakashi | 0:8fdf9a60065b | 490 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 491 | * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state |
kadonotakashi | 0:8fdf9a60065b | 492 | * @param xfer Pointer to flexio_i2s_transfer_t structure |
kadonotakashi | 0:8fdf9a60065b | 493 | * @retval kStatus_Success Successfully start the data receive. |
kadonotakashi | 0:8fdf9a60065b | 494 | * @retval kStatus_FLEXIO_I2S_RxBusy Previous receive still not finished. |
kadonotakashi | 0:8fdf9a60065b | 495 | * @retval kStatus_InvalidArgument The input parameter is invalid. |
kadonotakashi | 0:8fdf9a60065b | 496 | */ |
kadonotakashi | 0:8fdf9a60065b | 497 | status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 498 | flexio_i2s_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 499 | flexio_i2s_transfer_t *xfer); |
kadonotakashi | 0:8fdf9a60065b | 500 | |
kadonotakashi | 0:8fdf9a60065b | 501 | /*! |
kadonotakashi | 0:8fdf9a60065b | 502 | * @brief Aborts the current send. |
kadonotakashi | 0:8fdf9a60065b | 503 | * |
kadonotakashi | 0:8fdf9a60065b | 504 | * @note This API can be called at any time when interrupt non-blocking transfer initiates |
kadonotakashi | 0:8fdf9a60065b | 505 | * to abort the transfer in a early time. |
kadonotakashi | 0:8fdf9a60065b | 506 | * |
kadonotakashi | 0:8fdf9a60065b | 507 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 508 | * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state |
kadonotakashi | 0:8fdf9a60065b | 509 | */ |
kadonotakashi | 0:8fdf9a60065b | 510 | void FLEXIO_I2S_TransferAbortSend(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle); |
kadonotakashi | 0:8fdf9a60065b | 511 | |
kadonotakashi | 0:8fdf9a60065b | 512 | /*! |
kadonotakashi | 0:8fdf9a60065b | 513 | * @brief Aborts the current receive. |
kadonotakashi | 0:8fdf9a60065b | 514 | * |
kadonotakashi | 0:8fdf9a60065b | 515 | * @note This API can be called at any time when interrupt non-blocking transfer initiates |
kadonotakashi | 0:8fdf9a60065b | 516 | * to abort the transfer in a early time. |
kadonotakashi | 0:8fdf9a60065b | 517 | * |
kadonotakashi | 0:8fdf9a60065b | 518 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 519 | * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state |
kadonotakashi | 0:8fdf9a60065b | 520 | */ |
kadonotakashi | 0:8fdf9a60065b | 521 | void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle); |
kadonotakashi | 0:8fdf9a60065b | 522 | |
kadonotakashi | 0:8fdf9a60065b | 523 | /*! |
kadonotakashi | 0:8fdf9a60065b | 524 | * @brief Gets the remaining bytes to be sent. |
kadonotakashi | 0:8fdf9a60065b | 525 | * |
kadonotakashi | 0:8fdf9a60065b | 526 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 527 | * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state |
kadonotakashi | 0:8fdf9a60065b | 528 | * @param count Bytes sent. |
kadonotakashi | 0:8fdf9a60065b | 529 | * @retval kStatus_Success Succeed get the transfer count. |
kadonotakashi | 0:8fdf9a60065b | 530 | * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. |
kadonotakashi | 0:8fdf9a60065b | 531 | */ |
kadonotakashi | 0:8fdf9a60065b | 532 | status_t FLEXIO_I2S_TransferGetSendCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count); |
kadonotakashi | 0:8fdf9a60065b | 533 | |
kadonotakashi | 0:8fdf9a60065b | 534 | /*! |
kadonotakashi | 0:8fdf9a60065b | 535 | * @brief Gets the remaining bytes to be received. |
kadonotakashi | 0:8fdf9a60065b | 536 | * |
kadonotakashi | 0:8fdf9a60065b | 537 | * @param base Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 538 | * @param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state |
kadonotakashi | 0:8fdf9a60065b | 539 | * @return count Bytes received. |
kadonotakashi | 0:8fdf9a60065b | 540 | * @retval kStatus_Success Succeed get the transfer count. |
kadonotakashi | 0:8fdf9a60065b | 541 | * @retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. |
kadonotakashi | 0:8fdf9a60065b | 542 | */ |
kadonotakashi | 0:8fdf9a60065b | 543 | status_t FLEXIO_I2S_TransferGetReceiveCount(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, size_t *count); |
kadonotakashi | 0:8fdf9a60065b | 544 | |
kadonotakashi | 0:8fdf9a60065b | 545 | /*! |
kadonotakashi | 0:8fdf9a60065b | 546 | * @brief Tx interrupt handler. |
kadonotakashi | 0:8fdf9a60065b | 547 | * |
kadonotakashi | 0:8fdf9a60065b | 548 | * @param i2sBase Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 549 | * @param i2sHandle Pointer to flexio_i2s_handle_t structure |
kadonotakashi | 0:8fdf9a60065b | 550 | */ |
kadonotakashi | 0:8fdf9a60065b | 551 | void FLEXIO_I2S_TransferTxHandleIRQ(void *i2sBase, void *i2sHandle); |
kadonotakashi | 0:8fdf9a60065b | 552 | |
kadonotakashi | 0:8fdf9a60065b | 553 | /*! |
kadonotakashi | 0:8fdf9a60065b | 554 | * @brief Rx interrupt handler. |
kadonotakashi | 0:8fdf9a60065b | 555 | * |
kadonotakashi | 0:8fdf9a60065b | 556 | * @param i2sBase Pointer to FLEXIO_I2S_Type structure. |
kadonotakashi | 0:8fdf9a60065b | 557 | * @param i2sHandle Pointer to flexio_i2s_handle_t structure. |
kadonotakashi | 0:8fdf9a60065b | 558 | */ |
kadonotakashi | 0:8fdf9a60065b | 559 | void FLEXIO_I2S_TransferRxHandleIRQ(void *i2sBase, void *i2sHandle); |
kadonotakashi | 0:8fdf9a60065b | 560 | |
kadonotakashi | 0:8fdf9a60065b | 561 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 562 | |
kadonotakashi | 0:8fdf9a60065b | 563 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 564 | } |
kadonotakashi | 0:8fdf9a60065b | 565 | #endif /*_cplusplus*/ |
kadonotakashi | 0:8fdf9a60065b | 566 | |
kadonotakashi | 0:8fdf9a60065b | 567 | /*! @} */ |
kadonotakashi | 0:8fdf9a60065b | 568 | |
kadonotakashi | 0:8fdf9a60065b | 569 | #endif /* _FSL_FLEXIO_I2S_H_ */ |