Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
sound
compress_driver.h
Go to the documentation of this file.
1
/*
2
* compress_driver.h - compress offload driver definations
3
*
4
* Copyright (C) 2011 Intel Corporation
5
* Authors: Vinod Koul <
[email protected]
>
6
* Pierre-Louis Bossart <
[email protected]
>
7
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; version 2 of the License.
12
*
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License along
19
* with this program; if not, write to the Free Software Foundation, Inc.,
20
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21
*
22
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
*
24
*/
25
#ifndef __COMPRESS_DRIVER_H
26
#define __COMPRESS_DRIVER_H
27
28
#include <linux/types.h>
29
#include <linux/sched.h>
30
#include <
sound/compress_offload.h
>
31
#include <
sound/asound.h
>
32
#include <
sound/pcm.h
>
33
34
struct
snd_compr_ops
;
35
52
struct
snd_compr_runtime
{
53
snd_pcm_state_t
state
;
54
struct
snd_compr_ops
*
ops
;
55
void
*
buffer
;
56
u64
buffer_size
;
57
u32
fragment_size
;
58
u32
fragments
;
59
u64
hw_pointer
;
60
u64
app_pointer
;
61
u64
total_bytes_available
;
62
u64
total_bytes_transferred
;
63
wait_queue_head_t
sleep
;
64
void
*
private_data
;
65
};
66
76
struct
snd_compr_stream
{
77
const
char
*
name
;
78
struct
snd_compr_ops
*
ops
;
79
struct
snd_compr_runtime
*
runtime
;
80
struct
snd_compr
*
device
;
81
enum
snd_compr_direction
direction
;
82
void
*
private_data
;
83
};
84
106
struct
snd_compr_ops
{
107
int
(*
open
)(
struct
snd_compr_stream
*
stream
);
108
int
(*
free
)(
struct
snd_compr_stream
*
stream
);
109
int
(*
set_params
)(
struct
snd_compr_stream
*
stream
,
110
struct
snd_compr_params
*
params
);
111
int
(*
get_params
)(
struct
snd_compr_stream
*
stream
,
112
struct
snd_codec
*
params
);
113
int
(*
trigger
)(
struct
snd_compr_stream
*
stream
,
int
cmd
);
114
int
(*
pointer
)(
struct
snd_compr_stream
*
stream
,
115
struct
snd_compr_tstamp
*
tstamp
);
116
int
(*
copy
)(
struct
snd_compr_stream
*
stream
,
const
char
__user
*
buf
,
117
size_t
count
);
118
int
(*
mmap
)(
struct
snd_compr_stream
*
stream
,
119
struct
vm_area_struct
*vma);
120
int
(*
ack
)(
struct
snd_compr_stream
*
stream
,
size_t
bytes
);
121
int
(*
get_caps
) (
struct
snd_compr_stream
*
stream
,
122
struct
snd_compr_caps
*
caps
);
123
int
(*
get_codec_caps
) (
struct
snd_compr_stream
*
stream
,
124
struct
snd_compr_codec_caps
*
codec
);
125
};
126
138
struct
snd_compr
{
139
const
char
*
name
;
140
struct
device
*
dev
;
141
struct
snd_compr_ops
*
ops
;
142
void
*
private_data
;
143
struct
snd_card
*
card
;
144
unsigned
int
direction
;
145
struct
mutex
lock
;
146
int
device
;
147
};
148
149
/* compress device register APIs */
150
int
snd_compress_register
(
struct
snd_compr
*
device
);
151
int
snd_compress_deregister
(
struct
snd_compr
*
device
);
152
int
snd_compress_new
(
struct
snd_card
*
card
,
int
device
,
153
int
type
,
struct
snd_compr
*
compr
);
154
155
/* dsp driver callback apis
156
* For playback: driver should call snd_compress_fragment_elapsed() to let the
157
* framework know that a fragment has been consumed from the ring buffer
158
*
159
* For recording: we want to know when a frame is available or when
160
* at least one frame is available so snd_compress_frame_elapsed()
161
* callback should be called when a encodeded frame is available
162
*/
163
static
inline
void
snd_compr_fragment_elapsed(
struct
snd_compr_stream
*stream)
164
{
165
wake_up
(&stream->
runtime
->sleep);
166
}
167
168
#endif
Generated on Thu Jan 10 2013 14:53:32 for Linux Kernel by
1.8.2