Commit 61a6d23d authored by Federico Vaga's avatar Federico Vaga

Merge branch 'release/v2.5.0'

parents 903ba410 37a35337
-include Makefile.specific
all:
clean:
install:
python setup.py install
.PHONY: all clean install
from PyAdcLib import ADC_Generic
class AdcGenericFake(ADC_Generic):
BOARD_NAME = b"adc-genericfake"
def __init__(self, devid):
super(AdcGenericFake, self).__init__(devid)
This diff is collapsed.
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)
from PyAdcLib import ADC_Generic
class AdcZioFake(ADC_Generic):
BOARD_NAME = b"adc-ziofake"
def __init__(self, devid):
super(AdcZioFake, self).__init__(devid)
"""
@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__ = (
)
#!/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',
)
......@@ -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
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment