summaryrefslogtreecommitdiff
path: root/snd-alpx-dkms/snd-alpx/alpx_streams.h
blob: bb3355467eff86a74381a08311cf53b1a4ffe87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: GPL-2.0-or-later
/*
*  Support for Digigram AlpX PCI-e boards
*
*  Copyright (c) 2024 Digigram Digital (info@digigram.com)
*/
#ifndef _ALPX_STREAMS_EDF_H
#define _ALPX_STREAMS_EDF_H

#include <sound/pcm.h>

/* Structures */

enum alpx_pipe_status {
	ALPX_PIPE_STATUS_IDLE = 0,
	ALPX_PIPE_STATUS_RUNNING,
	ALPX_PIPE_STATUS_STOPPING,
	ALPX_PIPE_STATUS_STOPPED,
};

struct alpx_pipe {
    u32				period_qty_on_start; /* 2^64-1 periods @ 192kHZ = 2M years ! , u32 => 0.2year , enough to debug*/
	struct snd_pcm_substream	*substream;

	enum alpx_pipe_status		status;
	bool				configured;
	bool				xdma_write;
};


/* Pipe */

int alpx_pipe_init(struct alpx_pipe *pipe, bool xdma_write);

/* Playback */
extern const struct snd_pcm_ops alpx_playback_ops;

int alpx_playback_open(struct snd_pcm_substream *substream);
int alpx_playback_close(struct snd_pcm_substream *substream);
int alpx_playback_hw_params(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *hw_params);
int alpx_playback_hw_free(struct snd_pcm_substream *substream);
int alpx_playback_prepare(struct snd_pcm_substream *substream);
int alpx_playback_trigger(struct snd_pcm_substream *substream,
				int command);
snd_pcm_uframes_t alpx_playback_pointer(struct snd_pcm_substream *substream);

/* Capture */

extern const struct snd_pcm_ops alpx_capture_ops;


int alpx_capture_open(struct snd_pcm_substream *substream);
int alpx_capture_close(struct snd_pcm_substream *substream);
int alpx_capture_hw_params(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *hw_params);
int alpx_capture_hw_free(struct snd_pcm_substream *substream);
int alpx_capture_prepare(struct snd_pcm_substream *substream);
int alpx_capture_trigger(struct snd_pcm_substream *substream,
				int command);

#endif