1 /***************************************************************************//** 2 * \file cyhal_i2s_impl.h 3 * 4 * Description: 5 * Provides a high level interface for interacting with the Infineon I2S. This is 6 * a wrapper around the lower level PDL API. 7 * 8 ******************************************************************************** 9 * \copyright 10 * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or 11 * an affiliate of Cypress Semiconductor Corporation 12 * 13 * SPDX-License-Identifier: Apache-2.0 14 * 15 * Licensed under the Apache License, Version 2.0 (the "License"); 16 * you may not use this file except in compliance with the License. 17 * You may obtain a copy of the License at 18 * 19 * http://www.apache.org/licenses/LICENSE-2.0 20 * 21 * Unless required by applicable law or agreed to in writing, software 22 * distributed under the License is distributed on an "AS IS" BASIS, 23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 * See the License for the specific language governing permissions and 25 * limitations under the License. 26 *******************************************************************************/ 27 28 #pragma once 29 30 #include "cyhal_audio_common.h" 31 32 #if (CYHAL_DRIVER_AVAILABLE_I2S) 33 34 #if defined(__cplusplus) 35 extern "C" { 36 #endif /* __cplusplus */ 37 38 #define cyhal_i2s_free(obj) (_cyhal_audioss_free((_cyhal_audioss_t *)(obj))) 39 40 #define cyhal_i2s_set_sample_rate(obj, sample_rate_hz) \ 41 _cyhal_audioss_set_sample_rate((_cyhal_audioss_t *)(obj), (sample_rate_hz)) 42 43 #define cyhal_i2s_enable_event(obj, event, intr_priority, enable) \ 44 _cyhal_audioss_enable_event((_cyhal_audioss_t *)(obj), (uint32_t)(event), (intr_priority), (enable)) 45 46 #define cyhal_i2s_start_tx(obj) _cyhal_audioss_start_tx((_cyhal_audioss_t *)(obj)) 47 #define cyhal_i2s_stop_tx(obj) _cyhal_audioss_stop_tx((_cyhal_audioss_t *)(obj)) 48 #define cyhal_i2s_clear_tx(obj) _cyhal_audioss_clear_tx((_cyhal_audioss_t *)(obj)) 49 50 #define cyhal_i2s_start_rx(obj) _cyhal_audioss_start_rx((_cyhal_audioss_t *)(obj)) 51 #define cyhal_i2s_stop_rx(obj) _cyhal_audioss_stop_rx((_cyhal_audioss_t *)(obj)) 52 #define cyhal_i2s_clear_rx(obj) _cyhal_audioss_clear_rx((_cyhal_audioss_t *)(obj)) 53 54 #define cyhal_i2s_read(obj, data, length) \ 55 _cyhal_audioss_read((_cyhal_audioss_t *)obj, data, length) 56 57 #define cyhal_i2s_write(obj, data, length) \ 58 _cyhal_audioss_write((_cyhal_audioss_t *)obj, data, length) 59 60 #define cyhal_i2s_is_tx_enabled(obj) _cyhal_audioss_is_tx_enabled((_cyhal_audioss_t *)(obj)) 61 #define cyhal_i2s_is_tx_busy(obj) _cyhal_audioss_is_tx_busy((_cyhal_audioss_t *)(obj)) 62 63 #define cyhal_i2s_is_rx_enabled(obj) _cyhal_audioss_is_rx_enabled((_cyhal_audioss_t *)(obj)) 64 #define cyhal_i2s_is_rx_busy(obj) _cyhal_audioss_is_rx_busy((_cyhal_audioss_t *)(obj)) 65 66 #define cyhal_i2s_read_async(obj, rx, rx_length) \ 67 _cyhal_audioss_read_async((_cyhal_audioss_t *)(obj), (rx), (rx_length)) 68 69 #define cyhal_i2s_write_async(obj, tx, tx_length) \ 70 _cyhal_audioss_write_async((_cyhal_audioss_t *)(obj), (tx), (tx_length)) 71 72 #define cyhal_i2s_set_async_mode(obj, mode, dma_priority) \ 73 _cyhal_audioss_set_async_mode((_cyhal_audioss_t *)(obj), (mode), (dma_priority)) 74 75 #define cyhal_i2s_is_read_pending(obj) _cyhal_audioss_is_read_pending((_cyhal_audioss_t *)(obj)) 76 #define cyhal_i2s_is_write_pending(obj) _cyhal_audioss_is_write_pending((_cyhal_audioss_t *)(obj)) 77 78 #define cyhal_i2s_abort_read_async(obj) _cyhal_audioss_abort_read_async((_cyhal_audioss_t *)(obj)) 79 #define cyhal_i2s_abort_write_async(obj) _cyhal_audioss_abort_write_async((_cyhal_audioss_t *)(obj)) 80 81 #if defined(__cplusplus) 82 } 83 #endif /* __cplusplus */ 84 85 #endif /* CYHAL_DRIVER_AVAILABLE_I2S */ 86