MAX32660 Peripheral Driver API
Peripheral Driver API for the MAX32660
i2s.h
1
6/******************************************************************************
7 *
8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9 * Analog Devices, Inc.),
10 * Copyright (C) 2023-2024 Analog Devices, Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 ******************************************************************************/
25
26#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32660_I2S_H_
27#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32660_I2S_H_
28
29/* **** Includes **** */
30#include "mxc_sys.h"
31#include "dma.h"
32#include "spimss_regs.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
44/* **** Definitions **** */
45
46typedef enum {
47 I2S_MAP_A = 0,
48 I2S_MAP_B = 1,
49} mxc_i2s_sys_map_t;
50
51typedef enum {
52 LEFT_JUSTIFIED = 0,
53 RIGHT_JUSTIFIED = 1,
54} mxc_i2s_justify_t;
55
56typedef enum {
57 STEREO_MODE = 0,
58 MONO_MODE = 1,
59} mxc_i2s_audio_mode_t;
60
62typedef enum {
63 AUDIO_OUT = 1,
64 AUDIO_IN = 2,
66
68typedef struct {
69 mxc_i2s_sys_map_t map;
70 mxc_i2s_justify_t justify;
71 mxc_i2s_audio_mode_t audio_mode;
72 mxc_i2s_direction_t audio_direction;
73 uint16_t sample_rate;
74 unsigned int start_immediately;
75 unsigned int dma_reload_en;
76 void *src_addr;
77 void *dst_addr;
78 uint32_t length;
80
81/* **** Function Prototypes **** */
82
90int MXC_I2S_Init(const mxc_i2s_config_t *config, void (*dma_ctz_cb)(int, int));
91
98
104int MXC_I2S_Mute(void);
105
112
119
126
132int MXC_I2S_Stop(void);
133
140
147
157int MXC_I2S_DMA_SetAddrCnt(void *src_addr, void *dst_addr, unsigned int count);
158
169int MXC_I2S_DMA_SetReload(void *src_addr, void *dst_addr, unsigned int count);
172#ifdef __cplusplus
173}
174#endif
175
176#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32660_I2S_H_
int MXC_I2S_Start(void)
Starts I2S Output.
int MXC_I2S_DMA_SetAddrCnt(void *src_addr, void *dst_addr, unsigned int count)
Set DMA Addr (Source or Dest) and bytes to transfer.
int MXC_I2S_Stop(void)
Stops I2S Output.
int MXC_I2S_Pause(void)
Pause I2S Output.
int MXC_I2S_DMA_SetReload(void *src_addr, void *dst_addr, unsigned int count)
Sets the DMA reload address and count.
mxc_i2s_direction_t
I2S audio directions.
Definition: i2s.h:62
int MXC_I2S_Init(const mxc_i2s_config_t *config, void(*dma_ctz_cb)(int, int))
Initialize I2S resources.
int MXC_I2S_Unpause(void)
Unpause I2S Output.
int MXC_I2S_DMA_ClearFlags(void)
Clears DMA Interrupt Flags.
int MXC_I2S_Unmute(void)
Unmute I2S Output.
int MXC_I2S_Shutdown(void)
Release I2S.
int MXC_I2S_Mute(void)
Mute I2S Output.
I2S Configuration Struct.
Definition: i2s.h:68
Registers, Bit Masks and Bit Positions for the SPIMSS Peripheral Module.