VSF Documented
vsf_audio_i2s.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_AUDIO_I2S_H__
19#define __VSF_AUDIO_I2S_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "../../../vsf_av_cfg.h"
24// for VSF_HAL_USE_I2S
25#include "hal/vsf_hal.h"
26
27#if VSF_USE_AUDIO == ENABLED && VSF_HAL_USE_I2S == ENABLED
28
29#include "component/av/vsf_av.h"
30
31#if defined(__VSF_AUDIO_I2S_CLASS_IMPLEMENT)
32# undef __VSF_AUDIO_I2S_CLASS_IMPLEMENT
33# define __VSF_CLASS_IMPLEMENT__
34#elif defined(__VSF_AUDIO_I2S_CLASS_INHERIT__)
35# undef __VSF_AUDIO_I2S_CLASS_INHERIT__
36# define __VSF_CLASS_INHERIT__
37#endif
38
39#include "utilities/ooc_class.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45/*============================ MACROS ========================================*/
46/*============================ MACROFIED FUNCTIONS ===========================*/
47/*============================ TYPES =========================================*/
48
50 public_member(
51 implement(vk_audio_dev_t)
52 vsf_i2s_t *i2s;
53 vsf_i2s_mode_t i2s_mode;
54 vsf_arch_prio_t arch_prio;
55 )
56 protected_member(
57#if VSF_AUDIO_USE_PLAYBACK == ENABLED
58 struct {
59 bool stream_started;
60 uint8_t channel_num;
61 uint8_t sample_bitlen;
62 uint16_t sample_rate;
63 uint16_t hw_sample_rate;
64 } playback;
65#endif
66#if VSF_AUDIO_USE_CAPTURE == ENABLED
67 struct {
68 bool stream_started;
69 uint8_t channel_num;
70 uint8_t sample_bitlen;
71 uint16_t sample_rate;
72 uint16_t hw_sample_rate;
73 } capture;
74#endif
75 vk_audio_stream_t __stream[
76#if VSF_AUDIO_USE_PLAYBACK == ENABLED && VSF_AUDIO_USE_CAPTURE == ENABLED
77 2
78#else
79 1
80#endif
81 ];
82 )
83};
84
85/*============================ GLOBAL VARIABLES ==============================*/
86
90
91/*============================ PROTOTYPES ====================================*/
92
93#ifdef __cplusplus
94}
95#endif
96
97#endif // VSF_USE_AUDIO && VSF_HAL_USE_I2S
98#endif // __VSF_AUDIO_I2S_H__
#define ENABLED
Definition __type.h:28
vsf_i2s_mode_t
Definition i2s.h:37
Definition vsf_audio.h:158
Definition vsf_audio.h:74
Definition vsf_audio_i2s.h:49
Definition vsf_audio.h:145
vsf_arch_prio_t
Definition cortex_a_generic.h:88
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned short uint16_t
Definition stdint.h:7
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_audio.h:68
Definition vsf_template_i2s.h:283
const vk_audio_stream_drv_t vk_audio_i2s_stream_drv_playback
Definition vsf_audio_i2s.c:60
const vk_audio_stream_drv_t vk_audio_i2s_stream_drv_capture
Definition vsf_audio_i2s.c:67
const vk_audio_drv_t vk_audio_i2s_drv