HPM SDK
HPMicro Software Development Kit
hpm_i2s_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_I2S_COMMON_H
9 #define HPM_I2S_COMMON_H
10 
18 #define I2S_PROTOCOL_I2S_PHILIPS (0U)
19 #define I2S_PROTOCOL_MSB_JUSTIFIED (1U)
20 #define I2S_PROTOCOL_LEFT_JUSTIFIED (1U)
21 #define I2S_PROTOCOL_LSB_JUSTIFIED (2U)
22 #define I2S_PROTOCOL_RIGHT_JUSTIFIED (2U)
23 #define I2S_PROTOCOL_PCM (3U)
24 
25 /* i2s channel slot mask */
26 #define I2S_CHANNEL_SLOT_MASK(x) (1U << (x))
27 /* convert audio depth value into CFGR[DATASIZ] value map */
28 #define I2S_CFGR_DATASIZ(x) ((x - 16) >> 3)
29 /* convert channel length value into CFGR[CHSIZ] value map */
30 #define I2S_CFGR_CHSIZ(x) ((x - 16) >> 4)
31 
35 enum {
39 };
40 
44 enum {
47 };
48 
52 enum {
56 };
57 
62 #endif /* HPM_I2S_COMMON_H */
@ i2s_stereo
Definition: hpm_i2s_common.h:55
@ i2s_mono_right
Definition: hpm_i2s_common.h:54
@ i2s_mono_left
Definition: hpm_i2s_common.h:53
@ i2s_audio_depth_32_bits
Definition: hpm_i2s_common.h:38
@ i2s_audio_depth_24_bits
Definition: hpm_i2s_common.h:37
@ i2s_audio_depth_16_bits
Definition: hpm_i2s_common.h:36
@ i2s_channel_length_32_bits
Definition: hpm_i2s_common.h:46
@ i2s_channel_length_16_bits
Definition: hpm_i2s_common.h:45