Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC ADC 100M 14b 4cha - Software
Commits
5d7b8075
Commit
5d7b8075
authored
Jul 03, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: reviewed apply/retrieve config. Minor details
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
e688cd5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
60 deletions
+14
-60
boards.c
lib/boards.c
+3
-2
fmcadc-lib-int.h
lib/fmcadc-lib-int.h
+3
-6
route.c
lib/route.c
+8
-52
No files found.
lib/boards.c
View file @
5d7b8075
...
...
@@ -39,8 +39,9 @@ struct fmcadc_operations fa_100ms_4ch_14bit_op = {
.
acq_poll
=
fmcadc_zio_acq_poll
,
.
acq_stop
=
fmcadc_zio_acq_stop
,
.
apply_config
=
fmcadc_zio_apply_config
,
.
retrieve_config
=
fmcadc_zio_retrieve_config
,
.
apply_config
=
fmcadc_zio_apply_config
,
.
retrieve_config
=
fmcadc_zio_retrieve_config
,
.
request_buffer
=
fmcadc_zio_request_buffer
,
.
release_buffer
=
fmcadc_zio_release_buffer
,
};
...
...
lib/fmcadc-lib-int.h
View file @
5d7b8075
...
...
@@ -34,12 +34,9 @@ struct fmcadc_operations {
typeof
(
fmcadc_acq_poll
)
*
acq_poll
;
typeof
(
fmcadc_acq_stop
)
*
acq_stop
;
/* Handle configuration */
int
(
*
apply_config
)(
struct
fmcadc_dev
*
dev
,
unsigned
int
flags
,
struct
fmcadc_conf
*
conf
);
int
(
*
retrieve_config
)(
struct
fmcadc_dev
*
dev
,
struct
fmcadc_conf
*
conf
);
typeof
(
fmcadc_apply_config
)
*
apply_config
;
typeof
(
fmcadc_retrieve_config
)
*
retrieve_config
;
/* Handle buffers */
struct
fmcadc_buffer
*
(
*
request_buffer
)(
struct
fmcadc_dev
*
dev
,
int
nsamples
,
...
...
lib/route.c
View file @
5d7b8075
...
...
@@ -48,87 +48,43 @@ int fmcadc_acq_stop(struct fmcadc_dev *dev, unsigned int flags)
return
b
->
fa_op
->
acq_stop
(
dev
,
flags
);
}
/* * * * * * * * * * * * * * Handle Configuration * * * * * * * * * * * * * */
/*
* fmcadc_apply_config
* @dev: device to configure
* @flags:
* @conf: configuration to apply on device.
*/
int
fmcadc_apply_config
(
struct
fmcadc_dev
*
dev
,
unsigned
int
flags
,
struct
fmcadc_conf
*
conf
)
{
struct
fmcadc_gid
*
b
=
(
void
*
)
dev
;
struct
fmcadc_gid
*
g
=
(
void
*
)
dev
;
const
struct
fmcadc_board_type
*
b
=
g
->
board
;
uint64_t
cap_mask
;
if
(
!
conf
||
!
dev
)
{
/* conf and dev cannot be NULL*/
errno
=
EINVAL
;
return
-
1
;
}
if
(
!
conf
->
mask
)
{
errno
=
FMCADC_ENOMASK
;
return
-
1
;
/* Nothing to do */
}
cap_mask
=
b
->
board
->
capabilities
[
conf
->
type
];
cap_mask
=
b
->
capabilities
[
conf
->
type
];
if
((
cap_mask
&
conf
->
mask
)
!=
conf
->
mask
)
{
/* Unsupported capabilities */
fprintf
(
stderr
,
"Apply Config, wrong mask 0x%llx (0x%llx)"
,
conf
->
mask
,
cap_mask
);
errno
=
FMCADC_ENOCAP
;
return
-
1
;
}
if
(
b
->
board
->
fa_op
->
apply_config
)
{
/* Apply config */
return
b
->
board
->
fa_op
->
apply_config
(
dev
,
flags
,
conf
);
}
else
{
/* Unsupported */
errno
=
FMCADC_ENOP
;
return
-
1
;
}
return
b
->
fa_op
->
apply_config
(
dev
,
flags
,
conf
);
}
/*
* fmcadc_retrieve_config
* @dev: device where retireve configuration
* @flags:
* @conf: configuration to retrieve. The mask tell which value acquire, then
* the library will acquire and set the value in the "value" array
*/
int
fmcadc_retrieve_config
(
struct
fmcadc_dev
*
dev
,
struct
fmcadc_conf
*
conf
)
{
struct
fmcadc_gid
*
b
=
(
void
*
)
dev
;
struct
fmcadc_gid
*
g
=
(
void
*
)
dev
;
const
struct
fmcadc_board_type
*
b
=
g
->
board
;
uint64_t
cap_mask
;
if
(
!
conf
||
!
dev
)
{
/* conf and dev cannot be NULL*/
errno
=
EINVAL
;
return
-
1
;
}
if
(
!
conf
->
mask
)
{
errno
=
FMCADC_ENOMASK
;
return
-
1
;
/* Nothing to do */
}
cap_mask
=
b
->
board
->
capabilities
[
conf
->
type
];
cap_mask
=
b
->
capabilities
[
conf
->
type
];
if
((
cap_mask
&
conf
->
mask
)
!=
conf
->
mask
)
{
/* Unsupported capabilities */
fprintf
(
stderr
,
"Apply Config, wrong mask 0x%llx (0x%llx)"
,
conf
->
mask
,
cap_mask
);
errno
=
FMCADC_ENOCAP
;
return
-
1
;
}
if
(
b
->
board
->
fa_op
->
retrieve_config
)
{
/* Apply config */
return
b
->
board
->
fa_op
->
retrieve_config
(
dev
,
conf
);
}
else
{
/* Unsupported */
errno
=
FMCADC_ENOP
;
return
-
1
;
}
return
b
->
fa_op
->
retrieve_config
(
dev
,
conf
);
}
/*
...
...
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