Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
adc-lib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
misc
adc-lib
Commits
fe930ae2
Commit
fe930ae2
authored
Oct 17, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix/tools' into develop
parents
b281e255
6ae307aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
adc-lib.h
lib/adc-lib.h
+2
-1
adc-acq.c
tools/adc-acq.c
+14
-8
No files found.
lib/adc-lib.h
View file @
fe930ae2
...
...
@@ -57,7 +57,8 @@ enum adc_supported_boards {
struct
adc_buffer
{
void
*
data
;
/**< container for all the samples */
void
*
metadata
;
/**< description of the acquisition */
int
samplesize
;
/**< size of a single sample in Byte */
int
samplesize
;
/**< size of a single sample in Byte (a sample for
each channel, e.g 4 chan 14bit sample => samplesize = 8 Byte) */
int
nsamples
;
/**< number of samples in the buffer */
struct
adc_dev
*
dev
;
/**< the device used for the acquisition */
void
*
mapaddr
;
/**< mmap address */
...
...
tools/adc-acq.c
View file @
fe930ae2
...
...
@@ -690,9 +690,9 @@ static void fald_acq_print_data(struct adc_buffer *buf,
data
=
buf
->
data
;
/* Print data */
for
(
j
=
0
;
j
<
nsamples
/
nchan
;
j
++
)
{
for
(
j
=
0
;
j
<
nsamples
;
j
++
)
{
if
(
(
n
>
0
&&
j
<
n
)
||
(
n
<
0
&&
(
nsamples
/
nchan
-
j
)
<=
(
-
n
))
)
{
(
n
<
0
&&
(
nsamples
-
j
)
<=
(
-
n
))
)
{
printf
(
"%5i "
,
j
-
pre
);
for
(
ch
=
0
;
ch
<
nchan
;
ch
++
)
printf
(
"%7i"
,
*
(
data
++
));
...
...
@@ -876,14 +876,17 @@ static int fald_acq_parse_args_basic(int argc, char *argv[])
strdevid
++
;
/* +1 to skip '@' */
sscanf
(
strdevid
,
"0x%x"
,
&
devid
);
len
=
(
int
)(
strdevid
-
1
-
optarg
);
/* -1 count '@' it will be replaced by 0 */
/* -1 count '@' it will be replaced by 0
* +1 for \0
*/
len
=
(
int
)(
strdevid
-
1
-
optarg
+
1
);
devname
=
malloc
(
len
);
if
(
!
devname
)
{
fprintf
(
stderr
,
"Cannot allocate memory
\n
"
);
exit
(
1
);
}
memset
(
devname
,
0
,
len
);
strncpy
(
devname
,
optarg
,
len
);
strncpy
(
devname
,
optarg
,
len
-
1
);
fprintf
(
stdout
,
"%s: %s -> type:%s, devid:%s
\n
"
,
_argv
[
0
],
optarg
,
devname
,
strdevid
);
...
...
@@ -952,7 +955,7 @@ int main(int argc, char *argv[])
* configuration
*/
memset
(
&
cfg_brd
,
0
,
sizeof
(
struct
adc_conf
));
cfg_
acq
.
type
=
ADC_CONF_TYPE_ACQ
;
cfg_
brd
.
type
=
ADC_CONF_TYPE_BRD
;
adc_set_conf_mask_all
(
&
cfg_brd
,
adc
);
err
=
adc_retrieve_config
(
adc
,
&
cfg_brd
);
if
(
err
)
{
...
...
@@ -975,9 +978,9 @@ int main(int argc, char *argv[])
adc_get_conf
(
&
cfg_brd
,
ADC_CONF_BRD_N_CHAN
,
&
nchan
);
adc_get_conf
(
&
cfg_acq
,
ADC_CONF_ACQ_PRE_SAMP
,
&
pre
);
adc_get_conf
(
&
cfg_acq
,
ADC_CONF_ACQ_POST_SAMP
,
&
post
);
adc_get_conf
(
&
cfg_acq
,
ADC_CONF_ACQ_
POST_SAMP
,
&
bits
);
adc_get_conf
(
&
cfg_acq
,
ADC_CONF_ACQ_
N_BITS
,
&
bits
);
adc_get_conf
(
&
cfg_acq
,
ADC_CONF_ACQ_N_SHOTS
,
&
nshots
);
nsamples
=
(
pre
+
post
)
*
nchan
;
nsamples
=
pre
+
post
;
ssize
=
(
bits
+
(
8
-
1
))
/
8
;
/* get sample size - round up */
buf
=
adc_request_buffer
(
adc
,
nsamples
,
NULL
/* alloc */
,
0
);
...
...
@@ -1030,9 +1033,11 @@ int main(int argc, char *argv[])
}
}
adc_close
(
adc
);
adc_release_buffer
(
adc
,
buf
,
NULL
);
adc_close
(
adc
);
adc_exit
();
free
(
devname
);
exit
(
EXIT_SUCCESS
);
err_conf_get:
...
...
@@ -1041,5 +1046,6 @@ err_parse:
err_open:
err_devid_invalid:
adc_exit
();
free
(
devname
);
exit
(
EXIT_FAILURE
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment