Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
6e310ef8
提交
6e310ef8
authored
12月 13, 2010
作者:
Giovanni Maruzzelli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
skypopen: slightly improve OSS audio driver
上级
0e83cbe5
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
17 行删除
+17
-17
main.c
src/mod/endpoints/mod_skypopen/oss/main.c
+17
-17
没有找到文件。
src/mod/endpoints/mod_skypopen/oss/main.c
浏览文件 @
6e310ef8
...
@@ -61,14 +61,14 @@ MODULE_LICENSE("Dual BSD/GPL");
...
@@ -61,14 +61,14 @@ MODULE_LICENSE("Dual BSD/GPL");
static
struct
scull_dev
*
scull_devices
;
/* allocated in scull_init_module */
static
struct
scull_dev
*
scull_devices
;
/* allocated in scull_init_module */
#define GIOVA_BLK 1920
#define GIOVA_BLK 1920
#define GIOVA_SLEEP 20
000
#define GIOVA_SLEEP 20
void
my_timer_callback_inq
(
unsigned
long
data
)
void
my_timer_callback_inq
(
unsigned
long
data
)
{
{
struct
scull_dev
*
dev
=
(
void
*
)
data
;
struct
scull_dev
*
dev
=
(
void
*
)
data
;
wake_up_interruptible
(
&
dev
->
inq
);
wake_up_interruptible
(
&
dev
->
inq
);
mod_timer
(
&
dev
->
timer_inq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
/
1000
)
);
mod_timer
(
&
dev
->
timer_inq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
)
);
}
}
...
@@ -77,7 +77,7 @@ void my_timer_callback_outq( unsigned long data )
...
@@ -77,7 +77,7 @@ void my_timer_callback_outq( unsigned long data )
struct
scull_dev
*
dev
=
(
void
*
)
data
;
struct
scull_dev
*
dev
=
(
void
*
)
data
;
wake_up_interruptible
(
&
dev
->
outq
);
wake_up_interruptible
(
&
dev
->
outq
);
mod_timer
(
&
dev
->
timer_outq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
/
1000
)
);
mod_timer
(
&
dev
->
timer_outq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
)
);
}
}
/* The clone-specific data structure includes a key field */
/* The clone-specific data structure includes a key field */
...
@@ -117,9 +117,9 @@ static struct scull_dev *scull_c_lookfor_device(dev_t key)
...
@@ -117,9 +117,9 @@ static struct scull_dev *scull_c_lookfor_device(dev_t key)
printk
(
" Timer installing
\n
"
);
printk
(
" Timer installing
\n
"
);
setup_timer
(
&
lptr
->
device
.
timer_inq
,
my_timer_callback_inq
,
(
long
int
)
lptr
);
setup_timer
(
&
lptr
->
device
.
timer_inq
,
my_timer_callback_inq
,
(
long
int
)
lptr
);
setup_timer
(
&
lptr
->
device
.
timer_outq
,
my_timer_callback_outq
,
(
long
int
)
lptr
);
setup_timer
(
&
lptr
->
device
.
timer_outq
,
my_timer_callback_outq
,
(
long
int
)
lptr
);
printk
(
"Starting timer to fire in %dms (%ld)
\n
"
,
GIOVA_SLEEP
/
1000
,
jiffies
);
printk
(
"Starting timer to fire in %dms (%ld)
\n
"
,
GIOVA_SLEEP
,
jiffies
);
mod_timer
(
&
lptr
->
device
.
timer_inq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
/
1000
)
);
mod_timer
(
&
lptr
->
device
.
timer_inq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
)
);
mod_timer
(
&
lptr
->
device
.
timer_outq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
/
1000
)
);
mod_timer
(
&
lptr
->
device
.
timer_outq
,
jiffies
+
msecs_to_jiffies
(
GIOVA_SLEEP
)
);
/* place it in the list */
/* place it in the list */
list_add
(
&
lptr
->
list
,
&
scull_c_list
);
list_add
(
&
lptr
->
list
,
&
scull_c_list
);
...
@@ -170,11 +170,11 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count,
...
@@ -170,11 +170,11 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count,
{
{
struct
scull_dev
*
dev
=
filp
->
private_data
;
struct
scull_dev
*
dev
=
filp
->
private_data
;
DEFINE_WAIT
(
wait
);
DEFINE_WAIT
(
wait
);
prepare_to_wait
(
&
dev
->
inq
,
&
wait
,
TASK_INTERRUPTIBLE
);
prepare_to_wait
(
&
dev
->
inq
,
&
wait
,
TASK_INTERRUPTIBLE
);
schedule
();
schedule
();
finish_wait
(
&
dev
->
inq
,
&
wait
);
finish_wait
(
&
dev
->
inq
,
&
wait
);
//memset(buf, 255, count);
//memset(buf, 255, count);
return
count
;
return
count
;
...
@@ -184,10 +184,10 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count,
...
@@ -184,10 +184,10 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count,
loff_t
*
f_pos
)
loff_t
*
f_pos
)
{
{
struct
scull_dev
*
dev
=
filp
->
private_data
;
struct
scull_dev
*
dev
=
filp
->
private_data
;
DEFINE_WAIT
(
wait
);
DEFINE_WAIT
(
wait
);
prepare_to_wait
(
&
dev
->
outq
,
&
wait
,
TASK_INTERRUPTIBLE
);
prepare_to_wait
(
&
dev
->
outq
,
&
wait
,
TASK_INTERRUPTIBLE
);
schedule
();
schedule
();
finish_wait
(
&
dev
->
outq
,
&
wait
);
finish_wait
(
&
dev
->
outq
,
&
wait
);
return
count
;
return
count
;
...
@@ -252,7 +252,7 @@ void scull_cleanup_module(void)
...
@@ -252,7 +252,7 @@ void scull_cleanup_module(void)
}
}
/* And all the cloned devices */
/* And all the cloned devices */
list_for_each_entry_safe
(
lptr
,
next
,
&
scull_c_list
,
list
)
{
list_for_each_entry_safe
(
lptr
,
next
,
&
scull_c_list
,
list
)
{
ret
=
del_timer
(
&
lptr
->
device
.
timer_inq
);
ret
=
del_timer
(
&
lptr
->
device
.
timer_inq
);
if
(
ret
)
printk
(
"The inq timer was still in use...
\n
"
);
if
(
ret
)
printk
(
"The inq timer was still in use...
\n
"
);
...
@@ -261,7 +261,7 @@ void scull_cleanup_module(void)
...
@@ -261,7 +261,7 @@ void scull_cleanup_module(void)
list_del
(
&
lptr
->
list
);
list_del
(
&
lptr
->
list
);
kfree
(
lptr
);
kfree
(
lptr
);
}
}
printk
(
"Timer uninstalling
\n
"
);
printk
(
"Timer uninstalling
\n
"
);
/* cleanup_module is never called if registering failed */
/* cleanup_module is never called if registering failed */
unregister_chrdev_region
(
devno
,
scull_nr_devs
);
unregister_chrdev_region
(
devno
,
scull_nr_devs
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论