Classes | Macros | Typedefs | Enumerations | Functions
gr55xx_hal_i2s.h File Reference

Header file containing functions prototypes of I2S HAL library. More...

`#include "gr55xx_ll_i2s.h"`
`#include "gr55xx_hal_def.h"`
Include dependency graph for gr55xx_hal_i2s.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | _i2s_init
| I2S init Structure definition. More...
struct | _i2s_handle
| I2S handle Structure definition. More...
struct | _hal_i2s_callback
| HAL_I2S Callback function definition. More...

## Macros
#define | I2S_DIRECTION_FULL_DUPLEX LL_I2S_FULL_DUPLEX
| Full Duplex: Transmit & Receive More...
#define | I2S_DIRECTION_SIMPLEX_TX LL_I2S_SIMPLEX_TX
| Simplex TX: Transmit only More...
#define | I2S_DIRECTION_SIMPLEX_RX LL_I2S_SIMPLEX_RX
| Simplex RX: Receive only More...
#define | HAL_I2S_ERROR_NONE ((uint32_t)0x00000000)
| No error More...
#define | HAL_I2S_ERROR_TIMEOUT ((uint32_t)0x00000001)
| Timeout error More...
#define | HAL_I2S_ERROR_TRANSFER ((uint32_t)0x00000002)
| Transfer error More...
#define | HAL_I2S_ERROR_DMA ((uint32_t)0x00000004)
| DMA transfer error More...
#define | HAL_I2S_ERROR_INVALID_PARAM ((uint32_t)0x00000008)
| Invalid parameters error More...
#define | HAL_I2S_ERROR_TX_OVERFLOW ((uint32_t)0x00000010)
| Transmit overflow error More...
#define | HAL_I2S_ERROR_RX_OVERFLOW ((uint32_t)0x00000020)
| Receive overflow error More...
#define | I2S_DATASIZE_12BIT LL_I2S_DATASIZE_12BIT
| 12-bit serial data transfer More...
#define | I2S_DATASIZE_16BIT LL_I2S_DATASIZE_16BIT
| 16-bit serial data transfer More...
#define | I2S_DATASIZE_20BIT LL_I2S_DATASIZE_20BIT
| 20-bit serial data transfer More...
#define | I2S_DATASIZE_24BIT LL_I2S_DATASIZE_24BIT
| 24-bit serial data transfer More...
#define | I2S_DATASIZE_32BIT LL_I2S_DATASIZE_32BIT
| 32-bit serial data transfer More...
#define | I2S_CLOCK_SRC_96M LL_I2S_CLOCK_SRC_96M
| Inactive state of SCLK is low More...
#define | I2S_CLOCK_SRC_32M LL_I2S_CLOCK_SRC_32M
| Inactive state of SCLK is high. More...
#define | I2S_TX_FIFO_LEVEL_MAX 16
| I2S TX FIFO Level Max Value More...
#define | I2S_RX_FIFO_LEVEL_MAX 16
| I2S RX FIFO Level Max Value More...
#define | I2S_FLAG_TXFO LL_I2S_STATUS_TXFO
| TX FIFO write overflow flag More...
#define | I2S_FLAG_TXFE LL_I2S_STATUS_TXFE
| TX FIFO empty trigger flag More...
#define | I2S_FLAG_RXFO LL_I2S_STATUS_RXFO
| RX FIFO receive overflow flag More...
#define | I2S_FLAG_RXDA LL_I2S_STATUS_RXDA
| RX FIFO data available flag More...
#define | I2S_IT_TXFO LL_I2S_INT_TXFO
| TX FIFO write overflow interrupt More...
#define | I2S_IT_TXFE LL_I2S_INT_TXFE
| TX FIFO empty trigger interrupt More...
#define | I2S_IT_RXFO LL_I2S_INT_RXFO
| RX FIFO receive overflow interrupt. More...
#define | I2S_IT_RXDA LL_I2S_INT_RXDA
| RX FIFO data available interrupt More...
#define | HAL_I2S_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000)
| 5s More...
#define | __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_I2S_STATE_RESET)
| Reset I2S handle states. More...
#define | __HAL_I2S_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->ENABLE, I2S_ENABLE_EN)
| Enable the specified I2S peripheral. More...
#define | __HAL_I2S_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->ENABLE, I2S_ENABLE_EN)
| Disable the specified I2S peripheral. More...
#define | __HAL_I2S_ENABLE_CLOCK(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CLKEN, I2S_CLKEN_EN)
| Enable the specified I2S clock. More...
#define | __HAL_I2S_DISABLE_CLOCK(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CLKEN, I2S_CLKEN_EN)
| Disable the specified I2S clock. More...
#define | __HAL_I2S_ENABLE_TX_BLOCK(__HANDLE__) ll_i2s_enable_txblock((__HANDLE__)->p_instance)
| Enable the specified I2S transmitter block. More...
#define | __HAL_I2S_DISABLE_TX_BLOCK(__HANDLE__) ll_i2s_disable_txblock((__HANDLE__)->p_instance)
| Disable the specified I2S transmitter block. More...
#define | __HAL_I2S_ENABLE_RX_BLOCK(__HANDLE__) ll_i2s_enable_rxblock((__HANDLE__)->p_instance)
| Enable the specified I2S receiver block. More...
#define | __HAL_I2S_DISABLE_RX_BLOCK(__HANDLE__) ll_i2s_disable_rxblock((__HANDLE__)->p_instance)
| Disable the specified I2S receiver block. More...
#define | __HAL_I2S_ENABLE_TX_CHANNEL(__HANDLE__, __CH__) ll_i2s_enable_tx((__HANDLE__)->p_instance, (__CH__))
| Enable the specified I2S transmitter channel. More...
#define | __HAL_I2S_DISABLE_TX_CHANNEL(__HANDLE__, __CH__) ll_i2s_disable_tx((__HANDLE__)->p_instance, (__CH__))
| Disable the specified I2S transmitter channel. More...
#define | __HAL_I2S_ENABLE_RX_CHANNEL(__HANDLE__, __CH__) ll_i2s_enable_rx((__HANDLE__)->p_instance, (__CH__))
| Enable the specified I2S receiver channel. More...
#define | __HAL_I2S_DISABLE_RX_CHANNEL(__HANDLE__, __CH__) ll_i2s_disable_rx((__HANDLE__)->p_instance, (__CH__))
| Disable the specified I2S receiver channel. More...
#define | __HAL_I2S_FLUSH_TX_FIFO(__HANDLE__) ll_i2s_clr_txfifo_all((__HANDLE__)->p_instance)
| Flush the I2S transmitter FIFO. More...
#define | __HAL_I2S_FLUSH_RX_FIFO(__HANDLE__) ll_i2s_clr_rxfifo_all((__HANDLE__)->p_instance)
| Flush the I2S receiver FIFO. More...
#define | __HAL_I2S_ENABLE_DMA(__HANDLE__) ll_i2s_enable_dma(__HANDLE__->p_instance)
| Enable the I2S DMA Request. More...
#define | __HAL_I2S_DISABLE_DMA(__HANDLE__) ll_i2s_disable_dma(__HANDLE__->p_instance)
| Disable the I2S DMA Request. More...
#define | __HAL_I2S_RESET_TXDMA(__HANDLE__) WRITE_REG((__HANDLE__)->p_instance->TXDMA_RST, I2S_TXDMA_RST)
| Reset the I2S TX DMA request to the lowest enabled channel. More...
#define | __HAL_I2S_RESET_RXDMA(__HANDLE__) WRITE_REG((__HANDLE__)->p_instance->RXDMA_RST, I2S_RXDMA_RST)
| Reset the I2S RX DMA request to the lowest enabled channel. More...
#define | __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].INTMASK, (__INTERRUPT__))
| Enable the specified I2S interrupts. More...
#define | __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].INTMASK, (__INTERRUPT__))
| Disable the specified I2S interrupts. More...
#define | __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].INTSTAT, (__FLAG__)) != 0) ? SET : RESET)
| Check whether the specified I2S flag is set or not. More...
#define | __HAL_I2S_CLEAR_FLAG(__HANDLE__, __FLAG__)
| Clear the specified I2S flag. More...
#define | IS_I2S_DIRECTION(__MODE__)
| Check if I2S Direction Mode is valid. More...
#define | IS_I2S_DATASIZE(__DATASIZE__)
| Check if I2S Data Size is valid. More...
#define | IS_I2S_CPOL(__CPOL__)
| Check if I2S Clock Polarity is valid. More...
#define | IS_I2S_AUDIO_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) > 0) && ((__FREQUENCY__) <= 1500000))
| Check if I2S Audio Frequency is valid. More...
#define | IS_I2S_FIFO_THRESHOLD(__THR__) (((__THR__) >= 0) && ((__THR__) <= I2S_TX_FIFO_LEVEL_MAX))
| Check if I2S FIFO Threshold is valid. More...

## Typedefs
typedef struct _i2s_init | i2s_init_t
| I2S init Structure definition. More...
typedef struct _i2s_handle | i2s_handle_t
| I2S handle Structure definition. More...
typedef struct _hal_i2s_callback | hal_i2s_callback_t
| HAL_I2S Callback function definition. More...

## Enumerations
enum | hal_i2s_state_t { HAL_I2S_STATE_RESET = 0x00, HAL_I2S_STATE_READY = 0x01, HAL_I2S_STATE_BUSY = 0x02, HAL_I2S_STATE_BUSY_TX = 0x12, HAL_I2S_STATE_BUSY_RX = 0x22, HAL_I2S_STATE_BUSY_TX_RX = 0x32, HAL_I2S_STATE_ABORT = 0x08, HAL_I2S_STATE_ERROR = 0x04 }
| HAL I2S State Enumerations definition. More...

## Functions
hal_status_t | hal_i2s_init (i2s_handle_t *p_i2s)
| Initialize the I2S according to the specified parameters in the i2s_init_t and initialize the associated handle. More...
hal_status_t | hal_i2s_deinit (i2s_handle_t *p_i2s)
| De-initialize the I2S peripheral. More...
void | hal_i2s_msp_init (i2s_handle_t *p_i2s)
| Initialize the I2S MSP. More...
void | hal_i2s_msp_deinit (i2s_handle_t *p_i2s)
| De-initialize the I2S MSP. More...
hal_status_t | hal_i2s_transmit (i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length, uint32_t timeout)
| Transmit an amount of data in blocking mode. More...
hal_status_t | hal_i2s_receive (i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length, uint32_t timeout)
| Receive an amount of data in blocking mode. More...
hal_status_t | hal_i2s_transmit_receive (i2s_handle_t *p_i2s, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length, uint32_t timeout)
| Transmit and Receive an amount of data in blocking mode. More...
hal_status_t | hal_i2s_transmit_it (i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length)
| Transmit an amount of data in non-blocking mode with Interrupt. More...
hal_status_t | hal_i2s_receive_it (i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length)
| Receive an amount of data in non-blocking mode with Interrupt. More...
hal_status_t | hal_i2s_transmit_receive_it (i2s_handle_t *p_i2s, 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. More...
hal_status_t | hal_i2s_transmit_dma (i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length)
| Transmit an amount of data in non-blocking mode with DMA. More...
hal_status_t | hal_i2s_receive_dma (i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length)
| Receive an amount of data in non-blocking mode with DMA. More...
hal_status_t | hal_i2s_transmit_receive_dma (i2s_handle_t *p_i2s, 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 DMA. More...
hal_status_t | hal_i2s_start_clock (i2s_handle_t *p_i2s)
| Start the I2S master clock. More...
hal_status_t | hal_i2s_stop_clock (i2s_handle_t *p_i2s)
| Stop the I2S master clock. More...
hal_status_t | hal_i2s_abort (i2s_handle_t *p_i2s)
| Abort ongoing transfer (blocking mode). More...
void | hal_i2s_irq_handler (i2s_handle_t *p_i2s)
| Handle I2S interrupt request. More...
void | hal_i2s_tx_cplt_callback (i2s_handle_t *p_i2s)
| TX Transfer completed callback. More...
void | hal_i2s_rx_cplt_callback (i2s_handle_t *p_i2s)
| RX Transfer completed callback. More...
void | hal_i2s_tx_rx_cplt_callback (i2s_handle_t *p_i2s)
| TX/RX Transfer completed callback. More...
void | hal_i2s_error_callback (i2s_handle_t *p_i2s)
| I2S error callback. More...
hal_i2s_state_t | hal_i2s_get_state (i2s_handle_t *p_i2s)
| Return the I2S handle state. More...
uint32_t | hal_i2s_get_error (i2s_handle_t *p_i2s)
| Return the I2S error code. More...
hal_status_t | hal_i2s_set_tx_fifo_threshold (i2s_handle_t *p_i2s, uint32_t threshold)
| Set the TX FIFO threshold. More...
hal_status_t | hal_i2s_set_rx_fifo_threshold (i2s_handle_t *p_i2s, uint32_t threshold)
| Set the RX FIFO threshold. More...
uint32_t | hal_i2s_get_tx_fifo_threshold (i2s_handle_t *p_i2s)
| Get the TX FIFO threshold. More...
uint32_t | hal_i2s_get_rx_fifo_threshold (i2s_handle_t *p_i2s)
| Get the RX FIFO threshold. More...
hal_status_t | hal_i2s_suspend_reg (i2s_handle_t *p_i2s)
| Suspend some registers related to I2S configuration before sleep. More...
hal_status_t | hal_i2s_resume_reg (i2s_handle_t *p_i2s)
| Restore some registers related to I2S configuration after sleep. More...

## Detailed Description

Header file containing functions prototypes of I2S HAL library.

Author
  BLE Driver Team

Attention

  ##### Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_hal_i2s.h.