Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
240491e1
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
240491e1
编写于
12月 30, 2014
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'topic/pcm-params' into for-next
上级
614acf93
757b0376
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
59 deletion
+56
-59
include/sound/pcm.h
include/sound/pcm.h
+5
-8
include/sound/pcm_params.h
include/sound/pcm_params.h
+48
-48
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_oss.c
+3
-3
未找到文件。
include/sound/pcm.h
浏览文件 @
240491e1
...
@@ -94,9 +94,6 @@ struct snd_pcm_ops {
...
@@ -94,9 +94,6 @@ struct snd_pcm_ops {
#define SNDRV_PCM_DEVICES 8
#define SNDRV_PCM_DEVICES 8
#endif
#endif
#define SNDRV_PCM_IOCTL1_FALSE ((void *)0)
#define SNDRV_PCM_IOCTL1_TRUE ((void *)1)
#define SNDRV_PCM_IOCTL1_RESET 0
#define SNDRV_PCM_IOCTL1_RESET 0
#define SNDRV_PCM_IOCTL1_INFO 1
#define SNDRV_PCM_IOCTL1_INFO 1
#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
...
@@ -857,7 +854,7 @@ static inline unsigned int params_channels(const struct snd_pcm_hw_params *p)
...
@@ -857,7 +854,7 @@ static inline unsigned int params_channels(const struct snd_pcm_hw_params *p)
}
}
/**
/**
* params_
channels
- Get the sample rate from the hw params
* params_
rate
- Get the sample rate from the hw params
* @p: hw params
* @p: hw params
*/
*/
static
inline
unsigned
int
params_rate
(
const
struct
snd_pcm_hw_params
*
p
)
static
inline
unsigned
int
params_rate
(
const
struct
snd_pcm_hw_params
*
p
)
...
@@ -866,7 +863,7 @@ static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
...
@@ -866,7 +863,7 @@ static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
}
}
/**
/**
* params_
channels
- Get the period size (in frames) from the hw params
* params_
period_size
- Get the period size (in frames) from the hw params
* @p: hw params
* @p: hw params
*/
*/
static
inline
unsigned
int
params_period_size
(
const
struct
snd_pcm_hw_params
*
p
)
static
inline
unsigned
int
params_period_size
(
const
struct
snd_pcm_hw_params
*
p
)
...
@@ -875,7 +872,7 @@ static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
...
@@ -875,7 +872,7 @@ static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
}
}
/**
/**
* params_
channel
s - Get the number of periods from the hw params
* params_
period
s - Get the number of periods from the hw params
* @p: hw params
* @p: hw params
*/
*/
static
inline
unsigned
int
params_periods
(
const
struct
snd_pcm_hw_params
*
p
)
static
inline
unsigned
int
params_periods
(
const
struct
snd_pcm_hw_params
*
p
)
...
@@ -884,7 +881,7 @@ static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
...
@@ -884,7 +881,7 @@ static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
}
}
/**
/**
* params_
channels
- Get the buffer size (in frames) from the hw params
* params_
buffer_size
- Get the buffer size (in frames) from the hw params
* @p: hw params
* @p: hw params
*/
*/
static
inline
unsigned
int
params_buffer_size
(
const
struct
snd_pcm_hw_params
*
p
)
static
inline
unsigned
int
params_buffer_size
(
const
struct
snd_pcm_hw_params
*
p
)
...
@@ -893,7 +890,7 @@ static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
...
@@ -893,7 +890,7 @@ static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
}
}
/**
/**
* params_
channel
s - Get the buffer size (in bytes) from the hw params
* params_
buffer_byte
s - Get the buffer size (in bytes) from the hw params
* @p: hw params
* @p: hw params
*/
*/
static
inline
unsigned
int
params_buffer_bytes
(
const
struct
snd_pcm_hw_params
*
p
)
static
inline
unsigned
int
params_buffer_bytes
(
const
struct
snd_pcm_hw_params
*
p
)
...
...
include/sound/pcm_params.h
浏览文件 @
240491e1
...
@@ -38,31 +38,6 @@ int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
...
@@ -38,31 +38,6 @@ int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
#define MASK_OFS(i) ((i) >> 5)
#define MASK_OFS(i) ((i) >> 5)
#define MASK_BIT(i) (1U << ((i) & 31))
#define MASK_BIT(i) (1U << ((i) & 31))
static
inline
unsigned
int
ld2
(
u_int32_t
v
)
{
unsigned
r
=
0
;
if
(
v
>=
0x10000
)
{
v
>>=
16
;
r
+=
16
;
}
if
(
v
>=
0x100
)
{
v
>>=
8
;
r
+=
8
;
}
if
(
v
>=
0x10
)
{
v
>>=
4
;
r
+=
4
;
}
if
(
v
>=
4
)
{
v
>>=
2
;
r
+=
2
;
}
if
(
v
>=
2
)
r
++
;
return
r
;
}
static
inline
size_t
snd_mask_sizeof
(
void
)
static
inline
size_t
snd_mask_sizeof
(
void
)
{
{
return
sizeof
(
struct
snd_mask
);
return
sizeof
(
struct
snd_mask
);
...
@@ -92,7 +67,7 @@ static inline unsigned int snd_mask_min(const struct snd_mask *mask)
...
@@ -92,7 +67,7 @@ static inline unsigned int snd_mask_min(const struct snd_mask *mask)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
SNDRV_MASK_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
SNDRV_MASK_SIZE
;
i
++
)
{
if
(
mask
->
bits
[
i
])
if
(
mask
->
bits
[
i
])
return
ffs
(
mask
->
bits
[
i
])
-
1
+
(
i
<<
5
);
return
__ffs
(
mask
->
bits
[
i
])
+
(
i
<<
5
);
}
}
return
0
;
return
0
;
}
}
...
@@ -102,7 +77,7 @@ static inline unsigned int snd_mask_max(const struct snd_mask *mask)
...
@@ -102,7 +77,7 @@ static inline unsigned int snd_mask_max(const struct snd_mask *mask)
int
i
;
int
i
;
for
(
i
=
SNDRV_MASK_SIZE
-
1
;
i
>=
0
;
i
--
)
{
for
(
i
=
SNDRV_MASK_SIZE
-
1
;
i
>=
0
;
i
--
)
{
if
(
mask
->
bits
[
i
])
if
(
mask
->
bits
[
i
])
return
ld2
(
mask
->
bits
[
i
])
+
(
i
<<
5
);
return
__fls
(
mask
->
bits
[
i
])
+
(
i
<<
5
);
}
}
return
0
;
return
0
;
}
}
...
@@ -325,43 +300,68 @@ static inline int snd_interval_eq(const struct snd_interval *i1, const struct sn
...
@@ -325,43 +300,68 @@ static inline int snd_interval_eq(const struct snd_interval *i1, const struct sn
i1
->
max
==
i2
->
max
&&
i1
->
openmax
==
i2
->
openmax
;
i1
->
max
==
i2
->
max
&&
i1
->
openmax
==
i2
->
openmax
;
}
}
static
inline
unsigned
int
add
(
unsigned
int
a
,
unsigned
int
b
)
/**
* params_access - get the access type from the hw params
* @p: hw params
*/
static
inline
snd_pcm_access_t
params_access
(
const
struct
snd_pcm_hw_params
*
p
)
{
{
if
(
a
>=
UINT_MAX
-
b
)
return
(
__force
snd_pcm_access_t
)
snd_mask_min
(
hw_param_mask_c
(
p
,
return
UINT_MAX
;
SNDRV_PCM_HW_PARAM_ACCESS
));
return
a
+
b
;
}
}
static
inline
unsigned
int
sub
(
unsigned
int
a
,
unsigned
int
b
)
/**
* params_format - get the sample format from the hw params
* @p: hw params
*/
static
inline
snd_pcm_format_t
params_format
(
const
struct
snd_pcm_hw_params
*
p
)
{
{
if
(
a
>
b
)
return
(
__force
snd_pcm_format_t
)
snd_mask_min
(
hw_param_mask_c
(
p
,
return
a
-
b
;
SNDRV_PCM_HW_PARAM_FORMAT
));
return
0
;
}
}
#define params_access(p) ((__force snd_pcm_access_t)\
/**
snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_ACCESS)))
* params_subformat - get the sample subformat from the hw params
#define params_format(p) ((__force snd_pcm_format_t)\
* @p: hw params
snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_FORMAT)))
*/
#define params_subformat(p) \
static
inline
snd_pcm_subformat_t
snd_mask_min(hw_param_mask_c((p), SNDRV_PCM_HW_PARAM_SUBFORMAT))
params_subformat
(
const
struct
snd_pcm_hw_params
*
p
)
{
return
(
__force
snd_pcm_subformat_t
)
snd_mask_min
(
hw_param_mask_c
(
p
,
SNDRV_PCM_HW_PARAM_SUBFORMAT
));
}
/**
* params_period_bytes - get the period size (in bytes) from the hw params
* @p: hw params
*/
static
inline
unsigned
int
static
inline
unsigned
int
params_period_bytes
(
const
struct
snd_pcm_hw_params
*
p
)
params_period_bytes
(
const
struct
snd_pcm_hw_params
*
p
)
{
{
return
(
params_period_size
(
p
)
*
return
hw_param_interval_c
(
p
,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES
)
->
min
;
snd_pcm_format_physical_width
(
params_format
(
p
))
*
params_channels
(
p
))
/
8
;
}
}
static
inline
int
/**
params_width
(
const
struct
snd_pcm_hw_params
*
p
)
* params_width - get the number of bits of the sample format from the hw params
* @p: hw params
*
* This function returns the number of bits per sample that the selected sample
* format of the hw params has.
*/
static
inline
int
params_width
(
const
struct
snd_pcm_hw_params
*
p
)
{
{
return
snd_pcm_format_width
(
params_format
(
p
));
return
snd_pcm_format_width
(
params_format
(
p
));
}
}
static
inline
int
/*
params_physical_width
(
const
struct
snd_pcm_hw_params
*
p
)
* params_physical_width - get the storage size of the sample format from the hw params
* @p: hw params
*
* This functions returns the number of bits per sample that the selected sample
* format of the hw params takes up in memory. This will be equal or larger than
* params_width().
*/
static
inline
int
params_physical_width
(
const
struct
snd_pcm_hw_params
*
p
)
{
{
return
snd_pcm_format_physical_width
(
params_format
(
p
));
return
snd_pcm_format_physical_width
(
params_format
(
p
));
}
}
...
...
sound/core/oss/pcm_oss.c
浏览文件 @
240491e1
...
@@ -719,7 +719,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
...
@@ -719,7 +719,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
oss_buffer_size
=
snd_pcm_plug_client_size
(
substream
,
oss_buffer_size
=
snd_pcm_plug_client_size
(
substream
,
snd_pcm_hw_param_value_max
(
slave_params
,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE
,
NULL
))
*
oss_frame_size
;
snd_pcm_hw_param_value_max
(
slave_params
,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE
,
NULL
))
*
oss_frame_size
;
oss_buffer_size
=
1
<<
ld2
(
oss_buffer_size
);
oss_buffer_size
=
rounddown_pow_of_two
(
oss_buffer_size
);
if
(
atomic_read
(
&
substream
->
mmap_count
))
{
if
(
atomic_read
(
&
substream
->
mmap_count
))
{
if
(
oss_buffer_size
>
runtime
->
oss
.
mmap_bytes
)
if
(
oss_buffer_size
>
runtime
->
oss
.
mmap_bytes
)
oss_buffer_size
=
runtime
->
oss
.
mmap_bytes
;
oss_buffer_size
=
runtime
->
oss
.
mmap_bytes
;
...
@@ -755,14 +755,14 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
...
@@ -755,14 +755,14 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
min_period_size
=
snd_pcm_plug_client_size
(
substream
,
min_period_size
=
snd_pcm_plug_client_size
(
substream
,
snd_pcm_hw_param_value_min
(
slave_params
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
,
NULL
));
snd_pcm_hw_param_value_min
(
slave_params
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
,
NULL
));
min_period_size
*=
oss_frame_size
;
min_period_size
*=
oss_frame_size
;
min_period_size
=
1
<<
(
ld2
(
min_period_size
-
1
)
+
1
);
min_period_size
=
roundup_pow_of_two
(
min_period_size
);
if
(
oss_period_size
<
min_period_size
)
if
(
oss_period_size
<
min_period_size
)
oss_period_size
=
min_period_size
;
oss_period_size
=
min_period_size
;
max_period_size
=
snd_pcm_plug_client_size
(
substream
,
max_period_size
=
snd_pcm_plug_client_size
(
substream
,
snd_pcm_hw_param_value_max
(
slave_params
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
,
NULL
));
snd_pcm_hw_param_value_max
(
slave_params
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
,
NULL
));
max_period_size
*=
oss_frame_size
;
max_period_size
*=
oss_frame_size
;
max_period_size
=
1
<<
ld2
(
max_period_size
);
max_period_size
=
rounddown_pow_of_two
(
max_period_size
);
if
(
oss_period_size
>
max_period_size
)
if
(
oss_period_size
>
max_period_size
)
oss_period_size
=
max_period_size
;
oss_period_size
=
max_period_size
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录