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
Issues
0
Issues
0
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
adc-lib
Commits
61a6d23d
Commit
61a6d23d
authored
Aug 19, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/v2.5.0'
parents
903ba410
37a35337
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
513 additions
and
56 deletions
+513
-56
Makefile
lib/PyAdcLib/Makefile
+8
-0
PyAdcGenericFake.py
lib/PyAdcLib/PyAdcLib/PyAdcGenericFake.py
+7
-0
PyAdcLib.py
lib/PyAdcLib/PyAdcLib/PyAdcLib.py
+378
-0
PyAdcLibFmcAdc100m14b4ch.py
lib/PyAdcLib/PyAdcLib/PyAdcLibFmcAdc100m14b4ch.py
+27
-0
PyAdcZioFake.py
lib/PyAdcLib/PyAdcLib/PyAdcZioFake.py
+7
-0
__init__.py
lib/PyAdcLib/PyAdcLib/__init__.py
+11
-0
setup.py
lib/PyAdcLib/setup.py
+15
-0
adc-lib.h
lib/adc-lib.h
+7
-56
lib.c
lib/lib.c
+53
-0
No files found.
lib/PyAdcLib/Makefile
0 → 100644
View file @
61a6d23d
-include
Makefile.specific
all
:
clean
:
install
:
python setup.py
install
.PHONY
:
all clean install
lib/PyAdcLib/PyAdcLib/PyAdcGenericFake.py
0 → 100644
View file @
61a6d23d
from
PyAdcLib
import
ADC_Generic
class
AdcGenericFake
(
ADC_Generic
):
BOARD_NAME
=
b
"adc-genericfake"
def
__init__
(
self
,
devid
):
super
(
AdcGenericFake
,
self
)
.
__init__
(
devid
)
lib/PyAdcLib/PyAdcLib/PyAdcLib.py
0 → 100644
View file @
61a6d23d
This diff is collapsed.
Click to expand it.
lib/PyAdcLib/PyAdcLib/PyAdcLibFmcAdc100m14b4ch.py
0 → 100644
View file @
61a6d23d
from
.PyAdcLib
import
ADC_Generic
class
FmcAdc100m14b4ch
(
ADC_Generic
):
BOARD_NAME
=
b
"fmc-adc-100m14b4cha"
ADC_CONF_100M14B4CHA_CHN_RANGE_N
=
3
ADC_CONF_100M14B4CHA_CHN_RANGE_OPEN_DRAIN
=
0
ADC_CONF_100M14B4CHA_CHN_RANGE_100mV
=
0x23
ADC_CONF_100M14B4CHA_CHN_RANGE_1V
=
0x11
ADC_CONF_100M14B4CHA_CHN_RANGE_10V
=
0x45
ADC_CONF_100M14B4CHA_CHN_RANGE_100mV_CAL
=
0x42
ADC_CONF_100M14B4CHA_CHN_RANGE_1V_CAL
=
0x40
ADC_CONF_100M14B4CHA_CHN_RANGE_10V_CAL
=
0x44
ADC_CONF_100M14B4CHA_BUF_KMALLOC
=
0
ADC_CONF_100M14B4CHA_BUF_VMALLOC
=
1
ADC_CONF_100M14B4CHA_BUF_TYPE
=
0
ADC_CONF_100M14B4CHA_TRG_SW_EN
=
1
ADC_CONF_100M14B4CHA_ACQ_MSHOT_MAX
=
2
ADC_CONF_100M14B4CHA_BUF_SIZE_KB
=
3
ADC_CONF_100M14B4CHA_TRG_ALT_EN
=
4
__ADC_CONF_100M14B4CHA_LAST_INDEX
=
5
def
__init__
(
self
,
devid
):
super
(
FmcAdc100m14b4ch
,
self
)
.
__init__
(
devid
)
lib/PyAdcLib/PyAdcLib/PyAdcZioFake.py
0 → 100644
View file @
61a6d23d
from
PyAdcLib
import
ADC_Generic
class
AdcZioFake
(
ADC_Generic
):
BOARD_NAME
=
b
"adc-ziofake"
def
__init__
(
self
,
devid
):
super
(
AdcZioFake
,
self
)
.
__init__
(
devid
)
lib/PyAdcLib/PyAdcLib/__init__.py
0 → 100644
View file @
61a6d23d
"""
@package docstring
@author: Federico Vaga <federico.vaga@cern.ch>
@copyright: Copyright (c) 2019 CERN (home.cern)
@license: GNU Library General Public License version 2 or later
SPDX-License-Identifier: LGPL-3.0-or-later
"""
__all__
=
(
)
lib/PyAdcLib/setup.py
0 → 100644
View file @
61a6d23d
#!/usr/bin/env python
from
distutils.core
import
setup
setup
(
name
=
'PyAdcLib'
,
version
=
'1.0'
,
description
=
'Python Module to handle ADC lib devices'
,
author
=
'Milosz Malczak, Federico Vaga'
,
author_email
=
'milosz.malczak@cern.ch, federico.vaga@cern.ch'
,
maintainer
=
"Federico Vaga"
,
maintainer_email
=
"federico.vaga@cern.ch"
,
url
=
'https://www.ohwr.org/projects/adc-lib'
,
packages
=
[
'PyAdcLib'
],
license
=
'LGPLv3'
,
)
lib/adc-lib.h
View file @
61a6d23d
...
...
@@ -362,51 +362,13 @@ extern int adc_acq_flush(struct adc_dev *dev, unsigned int flags);
* Device configuration functions
* @{
*/
/**
* It sets the bit mask for the given option
* @param[in] conf configuration structure where apply this operation
* @param[in] conf_index configuration value to set (see configuration enum)
*/
static
inline
void
adc_set_conf_mask
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
)
{
conf
->
mask
|=
(
1LL
<<
conf_index
);
}
/**
* It assigns a configuration item, and its mask
* @param[in] conf configuration structure where apply this operation
* @param[in] conf_index configuration value to set (see configuration enum)
* @param[in] val value to set
*/
static
inline
void
adc_set_conf
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
,
uint32_t
val
)
{
conf
->
value
[
conf_index
]
=
val
;
adc_set_conf_mask
(
conf
,
conf_index
);
}
/**
* It retrieve a configuration value from the configuration descriptor
* @param[in] conf configuration structure where apply this operation
* @param[in] conf_index configuration value to set (see configuration enum)
* @param[out] val value read
* @return 0 in success, -1 on error
*/
static
inline
int
adc_get_conf
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
,
uint32_t
*
val
)
{
if
(
conf
->
mask
&
(
1LL
<<
conf_index
))
{
*
val
=
conf
->
value
[
conf_index
];
return
0
;
}
else
{
return
-
1
;
}
}
extern
void
adc_set_conf_mask
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
);
extern
void
adc_set_conf
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
,
uint32_t
val
);
extern
int
adc_get_conf
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
,
uint32_t
*
val
);
extern
void
adc_set_conf_mask_all
(
struct
adc_conf
*
conf
,
struct
adc_dev
*
dev
);
/**@}*/
extern
int
adc_reset_conf
(
struct
adc_dev
*
dev
,
unsigned
int
flags
,
struct
adc_conf
*
conf
);
...
...
@@ -426,17 +388,6 @@ extern int adc_get_param(struct adc_dev *dev, char *name,
extern
int
adc_set_param
(
struct
adc_dev
*
dev
,
char
*
name
,
char
*
sptr
,
int
*
iptr
);
/**
* It enables the configuration for all the supported field by the given device
* At least the `type` must be set in `conf`
* @param[in] conf configuration structure to use
* @param[in] dev the ADC device token
*/
static
inline
void
adc_set_conf_mask_all
(
struct
adc_conf
*
conf
,
struct
adc_dev
*
dev
)
{
conf
->
mask
=
adc_get_capabilities
(
dev
,
conf
->
type
);
}
/**@}*/
/**
* @defgroup buf Buffer
...
...
lib/lib.c
View file @
61a6d23d
...
...
@@ -11,6 +11,7 @@
*/
#include <errno.h>
#include <string.h>
#define ADC_INLINE
#include "adc-lib.h"
#include "adc-lib-int.h"
...
...
@@ -95,6 +96,58 @@ uint64_t adc_get_capabilities(struct adc_dev *dev,
return
b
->
board
->
capabilities
[
type
];
}
/**
* It sets the bit mask for the given option
* @param[in] conf configuration structure where apply this operation
* @param[in] conf_index configuration value to set (see configuration enum)
*/
void
adc_set_conf_mask
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
)
{
conf
->
mask
|=
(
1LL
<<
conf_index
);
}
/**
* It assigns a configuration item, and its mask
* @param[in] conf configuration structure where apply this operation
* @param[in] conf_index configuration value to set (see configuration enum)
* @param[in] val value to set
*/
void
adc_set_conf
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
,
uint32_t
val
)
{
conf
->
value
[
conf_index
]
=
val
;
adc_set_conf_mask
(
conf
,
conf_index
);
}
/**
* It retrieve a configuration value from the configuration descriptor
* @param[in] conf configuration structure where apply this operation
* @param[in] conf_index configuration value to set (see configuration enum)
* @param[out] val value read
* @return 0 in success, -1 on error
*/
int
adc_get_conf
(
struct
adc_conf
*
conf
,
unsigned
int
conf_index
,
uint32_t
*
val
)
{
if
(
conf
->
mask
&
(
1LL
<<
conf_index
))
{
*
val
=
conf
->
value
[
conf_index
];
return
0
;
}
else
{
return
-
1
;
}
}
/**
* It enables the configuration for all the supported field by the given device
* At least the `type` must be set in `conf`
* @param[in] conf configuration structure to use
* @param[in] dev the ADC device token
*/
void
adc_set_conf_mask_all
(
struct
adc_conf
*
conf
,
struct
adc_dev
*
dev
)
{
conf
->
mask
=
adc_get_capabilities
(
dev
,
conf
->
type
);
}
/**
* It computes what are the necessary offsets to apply on channels
* in order to clear a constant offset.
...
...
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