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
drivers
staging
comedi
drivers
pcm_common.c
Go to the documentation of this file.
1
#include "../comedidev.h"
2
3
#include "
comedi_fc.h
"
4
#include "
pcm_common.h
"
5
6
int
comedi_pcm_cmdtest
(
struct
comedi_device
*
dev
,
7
struct
comedi_subdevice
*
s
,
struct
comedi_cmd
*
cmd
)
8
{
9
int
err
= 0;
10
11
/* Step 1 : check if triggers are trivially valid */
12
13
err |= cfc_check_trigger_src(&cmd->
start_src
,
TRIG_NOW
|
TRIG_INT
);
14
err |= cfc_check_trigger_src(&cmd->
scan_begin_src
,
TRIG_EXT
);
15
err |= cfc_check_trigger_src(&cmd->
convert_src
,
TRIG_NOW
);
16
err |= cfc_check_trigger_src(&cmd->
scan_end_src
,
TRIG_COUNT
);
17
err |= cfc_check_trigger_src(&cmd->
stop_src
,
TRIG_COUNT
|
TRIG_NONE
);
18
19
if
(err)
20
return
1;
21
22
/* Step 2a : make sure trigger sources are unique */
23
24
err |= cfc_check_trigger_is_unique(cmd->
start_src
);
25
err |= cfc_check_trigger_is_unique(cmd->
stop_src
);
26
27
/* Step 2b : and mutually compatible */
28
29
if
(err)
30
return
2;
31
32
/* step 3: make sure arguments are trivially compatible */
33
34
/* cmd->start_src == TRIG_NOW || cmd->start_src == TRIG_INT */
35
if
(cmd->
start_arg
!= 0) {
36
cmd->
start_arg
= 0;
37
err++;
38
}
39
40
/* cmd->scan_begin_src == TRIG_EXT */
41
if
(cmd->
scan_begin_arg
!= 0) {
42
cmd->
scan_begin_arg
= 0;
43
err++;
44
}
45
46
/* cmd->convert_src == TRIG_NOW */
47
if
(cmd->
convert_arg
!= 0) {
48
cmd->
convert_arg
= 0;
49
err++;
50
}
51
52
/* cmd->scan_end_src == TRIG_COUNT */
53
if
(cmd->
scan_end_arg
!= cmd->
chanlist_len
) {
54
cmd->
scan_end_arg
= cmd->
chanlist_len
;
55
err++;
56
}
57
58
switch
(cmd->
stop_src
) {
59
case
TRIG_COUNT
:
60
/* any count allowed */
61
break
;
62
case
TRIG_NONE
:
63
if
(cmd->
stop_arg
!= 0) {
64
cmd->
stop_arg
= 0;
65
err++;
66
}
67
break
;
68
default
:
69
break
;
70
}
71
72
if
(err)
73
return
3;
74
75
/* step 4: fix up any arguments */
76
77
/* if (err) return 4; */
78
79
return
0;
80
}
81
EXPORT_SYMBOL
(
comedi_pcm_cmdtest
);
82
83
MODULE_AUTHOR
(
"Comedi http://www.comedi.org"
);
84
MODULE_DESCRIPTION
(
"Comedi low-level driver"
);
85
MODULE_LICENSE
(
"GPL"
);
Generated on Thu Jan 10 2013 14:27:20 for Linux Kernel by
1.8.2