1 /* 2 * Copyright 2017-2018, NXP 3 * All rights reserved. 4 * 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef __SRTM_I2C_CODEC_ADAPTER_H__ 10 #define __SRTM_I2C_CODEC_ADAPTER_H__ 11 12 #include "srtm_audio_service.h" 13 #include "fsl_codec_common.h" 14 #include "fsl_codec_i2c.h" 15 /*! 16 * @addtogroup srtm_service 17 * @{ 18 */ 19 20 /******************************************************************************* 21 * Definitions 22 ******************************************************************************/ 23 typedef status_t (*srtm_i2c_read_reg_map_t)(void *handle, uint32_t reg, uint32_t *val); 24 typedef status_t (*srtm_i2c_write_reg_map_t)(void *handle, uint32_t reg, uint32_t val); 25 26 typedef struct _srtm_i2c_codec_config 27 { 28 uint32_t mclk; 29 uint8_t slaveAddr; 30 codec_reg_addr_t addrType; 31 codec_reg_width_t regWidth; 32 srtm_i2c_read_reg_map_t readRegMap; 33 srtm_i2c_write_reg_map_t writeRegMap; 34 void *i2cHandle; 35 } srtm_i2c_codec_config_t; 36 37 /******************************************************************************* 38 * API 39 ******************************************************************************/ 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /*! 45 * @brief Create I2C Codec adapter. 46 * 47 * @param driver Codec driver handle. 48 * @param config Codec driver configuration. 49 * @return SRTM Codec adapter on success or NULL on failure. 50 */ 51 srtm_codec_adapter_t SRTM_I2CCodecAdapter_Create(codec_handle_t *driver, srtm_i2c_codec_config_t *config); 52 53 /*! 54 * @brief Destroy I2C Codec adapter. 55 * 56 * @param adapter Codec adapter to destroy. 57 */ 58 void SRTM_I2CCodecAdapter_Destroy(srtm_codec_adapter_t adapter); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 64 /*! @} */ 65 66 #endif /* __SRTM_I2C_CODEC_ADAPTER_H__ */ 67