1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef __APP_DEMO_I2S_H__ 17 #define __APP_DEMO_I2S_H__ 18 19 #include <hi_types_base.h> 20 #include <hi_errno.h> 21 #include <hi_mem.h> 22 #include <hi_event.h> 23 #include <hi_time.h> 24 #include <hi_task.h> 25 #include <hi_early_debug.h> 26 #include <hi_config.h> 27 #include <hi_stdlib.h> 28 #include <hi_i2s.h> 29 #include <hi_i2c.h> 30 #include <hi_flash.h> 31 #include <es8311_codec.h> 32 #define I2S_TEST_TASK_STAK_SIZE 2048 33 #define I2S_TEST_TASK_PRIORITY 28 34 #define AUDIO_PLAY_BUF_SIZE 4096 35 #define AUDIO_RECORD_BUF_SIZE 3072 36 #define AUDIO_RECORD_FINISH_BIT (1 << 0) 37 #define ALL_AUDIO_RECORD_FINISH_BIT (1 << 1) 38 39 #define AUDIO_PLAY_FIEL_MODE 0 40 #define AUDIO_RECORD_AND_PLAY_MODE 1 41 42 typedef struct { 43 hi_u32 flash_start_addr; 44 hi_u32 data_len; 45 } audio_map; 46 47 typedef struct { 48 hi_u8 *play_buf; 49 hi_u8 *record_buf; 50 } test_audio_attr; 51 52 hi_void i2s_demo(hi_void); 53 #endif 54