Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
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
Beam Positoning Monitor - Software
Commits
f212bfac
Commit
f212bfac
authored
Apr 19, 2016
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sm_io/modules/*: add new fmc_adc_common module
parent
1e076822
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
600 additions
and
0 deletions
+600
-0
fmc_adc_common.mk
src/sm_io/modules/fmc_adc_common/fmc_adc_common.mk
+6
-0
sm_io_fmc_adc_common_codes.h
...sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_codes.h
+36
-0
sm_io_fmc_adc_common_core.c
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_core.c
+64
-0
sm_io_fmc_adc_common_core.h
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_core.h
+22
-0
sm_io_fmc_adc_common_defaults.c
...io/modules/fmc_adc_common/sm_io_fmc_adc_common_defaults.c
+68
-0
sm_io_fmc_adc_common_defaults.h
...io/modules/fmc_adc_common/sm_io_fmc_adc_common_defaults.h
+19
-0
sm_io_fmc_adc_common_exp.c
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_exp.c
+257
-0
sm_io_fmc_adc_common_exp.h
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_exp.h
+19
-0
sm_io_fmc_adc_common_exports.c
..._io/modules/fmc_adc_common/sm_io_fmc_adc_common_exports.c
+82
-0
sm_io_fmc_adc_common_exports.h
..._io/modules/fmc_adc_common/sm_io_fmc_adc_common_exports.h
+22
-0
modules.mk
src/sm_io/modules/modules.mk
+2
-0
sm_io_codes.c
src/sm_io/modules/sm_io_codes.c
+1
-0
sm_io_codes.h
src/sm_io/modules/sm_io_codes.h
+2
-0
No files found.
src/sm_io/modules/fmc_adc_common/fmc_adc_common.mk
0 → 100644
View file @
f212bfac
sm_io_fmc_adc_common_DIR = $(SRC_DIR)/sm_io/modules/fmc_adc_common
sm_io_fmc_adc_common_OBJS = $(sm_io_fmc_adc_common_DIR)/sm_io_fmc_adc_common_core.o \
$(sm_io_fmc_adc_common_DIR)/sm_io_fmc_adc_common_exp.o \
$(sm_io_fmc_adc_common_DIR)/sm_io_fmc_adc_common_exports.o \
$(sm_io_fmc_adc_common_DIR)/sm_io_fmc_adc_common_defaults.o
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_codes.h
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#ifndef _SM_IO_FMC_ADC_COMMON_CODES_H_
#define _SM_IO_FMC_ADC_COMMON_CODES_H_
/* Messaging OPCODES */
#define FMC_ADC_COMMON_OPCODE_TYPE uint32_t
#define FMC_ADC_COMMON_OPCODE_SIZE (sizeof (FMC_ADC_COMMON_OPCODE_TYPE))
#define FMC_ADC_COMMON_OPCODE_LEDS 0
#define FMC_ADC_COMMON_NAME_LEDS "fmc_adc_common_leds"
#define FMC_ADC_COMMON_OPCODE_TEST_DATA_EN 1
#define FMC_ADC_COMMON_NAME_TEST_DATA_EN "fmc_adc_common_adc_test_data_en"
#define FMC_ADC_COMMON_OPCODE_TRIG_DIR 2
#define FMC_ADC_COMMON_NAME_TRIG_DIR "fmc_adc_common_trig_dir"
#define FMC_ADC_COMMON_OPCODE_TRIG_TERM 3
#define FMC_ADC_COMMON_NAME_TRIG_TERM "fmc_adc_common_trig_term"
#define FMC_ADC_COMMON_OPCODE_TRIG_VAL 4
#define FMC_ADC_COMMON_NAME_TRIG_VAL "fmc_adc_common_trig_val"
#define FMC_ADC_COMMON_OPCODE_END 5
/* Messaging Reply OPCODES */
#define FMC_ADC_COMMON_REPLY_TYPE uint32_t
#define FMC_ADC_COMMON_REPLY_SIZE (sizeof (FMC_ADC_COMMON_REPLY_TYPE))
#define FMC_ADC_COMMON_OK 0
/* Operation was successful */
#define FMC_ADC_COMMON_ERR 1
/* Could not set/get value */
#define FMC_ADC_COMMON_UNINPL 2
/* Unimplemented function or operation */
#define FMC_ADC_COMMON_REPLY_END 3
/* End marker */
#endif
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_core.c
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#include "bpm_server.h"
/* Private headers */
#include "sm_io_fmc_adc_common_defaults.h"
#include "sm_io_fmc_adc_common_core.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
#undef ASSERT_TEST
#endif
#define ASSERT_TEST(test_boolean, err_str, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io_fmc_adc_common_core]", \
err_str, err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC
#endif
#define ASSERT_ALLOC(ptr, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io_fmc_adc_common_core]", \
smio_err_str(SMIO_ERR_ALLOC), \
err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef CHECK_ERR
#undef CHECK_ERR
#endif
#define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, SM_IO, "[sm_io_fmc_adc_common_core]", \
smio_err_str (err_type))
/* Creates a new instance of Device Information */
smio_fmc_adc_common_t
*
smio_fmc_adc_common_new
(
smio_t
*
parent
)
{
(
void
)
parent
;
smio_fmc_adc_common_t
*
self
=
(
smio_fmc_adc_common_t
*
)
zmalloc
(
sizeof
*
self
);
ASSERT_ALLOC
(
self
,
err_self_alloc
);
return
self
;
err_self_alloc:
return
NULL
;
}
/* Destroy an instance of the Device Information */
smio_err_e
smio_fmc_adc_common_destroy
(
smio_fmc_adc_common_t
**
self_p
)
{
assert
(
self_p
);
if
(
*
self_p
)
{
smio_fmc_adc_common_t
*
self
=
*
self_p
;
free
(
self
);
*
self_p
=
NULL
;
}
return
SMIO_SUCCESS
;
}
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_core.h
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#ifndef _SM_IO_FMC_ADC_COMMON_CORE_H_
#define _SM_IO_FMC_ADC_COMMON_CORE_H_
typedef
struct
{
const
uint32_t
example
;
}
smio_fmc_adc_common_t
;
/***************** Our methods *****************/
/* Creates a new instance of the smio realization */
smio_fmc_adc_common_t
*
smio_fmc_adc_common_new
(
smio_t
*
parent
);
/* Destroys the smio realization */
smio_err_e
smio_fmc_adc_common_destroy
(
smio_fmc_adc_common_t
**
self_p
);
#endif
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_defaults.c
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#include "bpm_server.h"
/* Private headers */
#include "sm_io_fmc_adc_common_defaults.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
#undef ASSERT_TEST
#endif
#define ASSERT_TEST(test_boolean, err_str, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io:fmc_adc_common_defaults]", \
err_str, err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC
#endif
#define ASSERT_ALLOC(ptr, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io:fmc_adc_common_defaults]", \
smio_err_str(SMIO_ERR_ALLOC), \
err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef CHECK_ERR
#undef CHECK_ERR
#endif
#define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc_adc_common_defaults]", \
smio_err_str (err_type))
#define SMIO_FMC_ADC_COMMON_LIBBPMCLIENT_LOG_MODE "a"
/* We use the actual libclient to send and configure our default values,
* maintaining internal consistency. So, in fact, we are sending ourselves
* a message containing the default values. Because of this approach, we
* only get to default our values when the functions are already exported
* to the broker, which happens on a late stage. This could cause a fast
* client to get an inconsistent state from our server */
/* TODO: Avoid exporting the functions before we have initialized
* our server with the default values */
smio_err_e
fmc_adc_common_config_defaults
(
char
*
broker_endp
,
char
*
service
,
const
char
*
log_file_name
)
{
(
void
)
log_file_name
;
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_INFO
,
"[sm_io:fmc_adc_common_defaults] Configuring SMIO "
"FMC_ADC_COMMON with default values ...
\n
"
);
bpm_client_err_e
client_err
=
BPM_CLIENT_SUCCESS
;
smio_err_e
err
=
SMIO_SUCCESS
;
bpm_client_t
*
config_client
=
bpm_client_new_log_mode
(
broker_endp
,
0
,
log_file_name
,
SMIO_FMC_ADC_COMMON_LIBBPMCLIENT_LOG_MODE
);
ASSERT_ALLOC
(
config_client
,
err_alloc_client
);
client_err
=
bpm_set_trig_dir
(
config_client
,
service
,
FMC_ADC_COMMON_DFLT_TRIG_DIR
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not set FMC TRIG DIR function"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
err_param_set:
bpm_client_destroy
(
&
config_client
);
err_alloc_client:
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_INFO
,
"[sm_io:fmc_adc_common_defaults] Exiting Config thread %s
\n
"
,
service
);
return
err
;
}
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_defaults.h
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#ifndef _FMC_ADC_COMMON_DEFAULTS_H_
#define _FMC_ADC_COMMON_DEFAULTS_H_
#include "sm_io_err.h"
#define FMC_ADC_COMMON_DFLT_TRIG_DIR 0x0
/* Output direction */
smio_err_e
fmc_adc_common_config_defaults
(
char
*
broker_endp
,
char
*
service
,
const
char
*
log_file_name
);
#endif
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_exp.c
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#include "bpm_server.h"
/* Private headers */
#include "sm_io_fmc_adc_common_codes.h"
#include "sm_io_fmc_adc_common_defaults.h"
#include "sm_io_fmc_adc_common_exports.h"
#include "sm_io_fmc_adc_common_core.h"
#include "sm_io_fmc_adc_common_exp.h"
#include "hw/wb_fmc_adc_common_regs.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
#undef ASSERT_TEST
#endif
#define ASSERT_TEST(test_boolean, err_str, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io:fmc_adc_common_exp]", \
err_str, err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC
#endif
#define ASSERT_ALLOC(ptr, err_goto_label,
/* err_core */
...) \
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io:fmc_adc_common_exp]", \
smio_err_str(SMIO_ERR_ALLOC), \
err_goto_label,
/* err_core */
__VA_ARGS__)
#ifdef CHECK_ERR
#undef CHECK_ERR
#endif
#define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc_adc_common_exp]", \
smio_err_str (err_type))
/************************************************************/
/************ Specific FMC_ADC_COMMON Operations **************/
/************************************************************/
#define BPM_FMC_ADC_COMMON_LEDS_MIN 0
/* LED 0 = 0, LED 1 = 0, LED 3 = 0*/
#define BPM_FMC_ADC_COMMON_LEDS_MAX 7
/* LED 0 = 1, LED 1 = 1, LED 2 = 1*/
#define WB_FMC_ADC_COMMON_CSR_MONITOR_GLOBAL_MASK WBGEN2_GEN_MASK(1, 3)
#define WB_FMC_ADC_COMMON_CSR_MONITOR_GLOBAL_W(val) WBGEN2_GEN_WRITE(val, 1, 3)
#define WB_FMC_ADC_COMMON_CSR_MONITOR_GLOBAL_R(reg) WBGEN2_GEN_READ(reg, 1, 3)
RW_PARAM_FUNC
(
fmc_adc_common
,
leds
)
{
SET_GET_PARAM
(
fmc_adc_common
,
FMC_130M_FMC_ADC_COMMON_OFFS
,
WB_FMC_ADC_COMMON_CSR
,
MONITOR
,
GLOBAL
,
MULT_BIT_PARAM
,
BPM_FMC_ADC_COMMON_LEDS_MIN
,
BPM_FMC_ADC_COMMON_LEDS_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
/***************************** FPGA Control ***************************/
#define BPM_FMC_ADC_COMMON_TEST_DATA_EN_MIN 0
/* TEST data enable off */
#define BPM_FMC_ADC_COMMON_TEST_DATA_EN_MAX 1
/* TEST data enable on */
RW_PARAM_FUNC
(
fmc_adc_common
,
test_data_en
)
{
SET_GET_PARAM
(
fmc_adc_common
,
FMC_130M_FMC_ADC_COMMON_OFFS
,
WB_FMC_ADC_COMMON_CSR
,
MONITOR
,
TEST_DATA_EN
,
SINGLE_BIT_PARAM
,
BPM_FMC_ADC_COMMON_TEST_DATA_EN_MIN
,
BPM_FMC_ADC_COMMON_TEST_DATA_EN_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC_ADC_COMMON_TRIG_DIR_MIN 0
/* Trigger direction input */
#define BPM_FMC_ADC_COMMON_TRIG_DIR_MAX 1
/* Trigger direction output */
RW_PARAM_FUNC
(
fmc_adc_common
,
trig_dir
)
{
SET_GET_PARAM
(
fmc_adc_common
,
FMC_130M_FMC_ADC_COMMON_OFFS
,
WB_FMC_ADC_COMMON_CSR
,
TRIGGER
,
DIR
,
SINGLE_BIT_PARAM
,
BPM_FMC_ADC_COMMON_TRIG_DIR_MIN
,
BPM_FMC_ADC_COMMON_TRIG_DIR_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC_ADC_COMMON_TRIG_TERM_MIN 0
/* Trigger termination disabled */
#define BPM_FMC_ADC_COMMON_TRIG_TERM_MAX 1
/* Trigger termination enabled */
RW_PARAM_FUNC
(
fmc_adc_common
,
trig_term
)
{
SET_GET_PARAM
(
fmc_adc_common
,
FMC_130M_FMC_ADC_COMMON_OFFS
,
WB_FMC_ADC_COMMON_CSR
,
TRIGGER
,
TERM
,
SINGLE_BIT_PARAM
,
BPM_FMC_ADC_COMMON_TRIG_TERM_MIN
,
BPM_FMC_ADC_COMMON_TRIG_TERM_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC_ADC_COMMON_TRIG_VAL_MIN 0
/* Trigger value 0 */
#define BPM_FMC_ADC_COMMON_TRIG_VAL_MAX 1
/* Trigger value 1 */
RW_PARAM_FUNC
(
fmc_adc_common
,
trig_val
)
{
SET_GET_PARAM
(
fmc_adc_common
,
FMC_130M_FMC_ADC_COMMON_OFFS
,
WB_FMC_ADC_COMMON_CSR
,
TRIGGER
,
TRIG_VAL
,
SINGLE_BIT_PARAM
,
BPM_FMC_ADC_COMMON_TRIG_VAL_MIN
,
BPM_FMC_ADC_COMMON_TRIG_VAL_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
/* Exported function pointers */
const
disp_table_func_fp
fmc_adc_common_exp_fp
[]
=
{
RW_PARAM_FUNC_NAME
(
fmc_adc_common
,
leds
),
RW_PARAM_FUNC_NAME
(
fmc_adc_common
,
test_data_en
),
RW_PARAM_FUNC_NAME
(
fmc_adc_common
,
trig_dir
),
RW_PARAM_FUNC_NAME
(
fmc_adc_common
,
trig_term
),
RW_PARAM_FUNC_NAME
(
fmc_adc_common
,
trig_val
),
NULL
};
/************************************************************/
/***************** Export methods functions *****************/
/************************************************************/
static
smio_err_e
_fmc_adc_common_do_op
(
void
*
owner
,
void
*
msg
);
/* Attach an instance of sm_io to dev_io function pointer */
smio_err_e
fmc_adc_common_attach
(
smio_t
*
self
,
devio_t
*
parent
)
{
(
void
)
self
;
(
void
)
parent
;
return
SMIO_ERR_FUNC_NOT_IMPL
;
}
/* Deattach an instance of sm_io to dev_io function pointer */
smio_err_e
fmc_adc_common_deattach
(
smio_t
*
self
)
{
(
void
)
self
;
return
SMIO_ERR_FUNC_NOT_IMPL
;
}
/* Export (register) sm_io to handle operations function pointer */
smio_err_e
fmc_adc_common_export_ops
(
smio_t
*
self
,
const
disp_op_t
**
smio_exp_ops
)
{
(
void
)
self
;
(
void
)
smio_exp_ops
;
return
SMIO_ERR_FUNC_NOT_IMPL
;
}
/* Unexport (unregister) sm_io to handle operations function pointer */
smio_err_e
fmc_adc_common_unexport_ops
(
smio_t
*
self
)
{
(
void
)
self
;
return
SMIO_ERR_FUNC_NOT_IMPL
;
}
/* Generic wrapper for receiving opcodes and arguments to specific funtions function pointer */
/* FIXME: Code repetition! _devio_do_smio_op () function does almost the same!!! */
smio_err_e
_fmc_adc_common_do_op
(
void
*
owner
,
void
*
msg
)
{
(
void
)
owner
;
(
void
)
msg
;
return
SMIO_ERR_FUNC_NOT_IMPL
;
}
smio_err_e
fmc_adc_common_do_op
(
void
*
self
,
void
*
msg
)
{
return
_fmc_adc_common_do_op
(
self
,
msg
);
}
const
smio_ops_t
fmc_adc_common_ops
=
{
.
attach
=
fmc_adc_common_attach
,
/* Attach sm_io instance to dev_io */
.
deattach
=
fmc_adc_common_deattach
,
/* Deattach sm_io instance to dev_io */
.
export_ops
=
fmc_adc_common_export_ops
,
/* Export sm_io operations to dev_io */
.
unexport_ops
=
fmc_adc_common_unexport_ops
,
/* Unexport sm_io operations to dev_io */
.
do_op
=
fmc_adc_common_do_op
/* Generic wrapper for handling specific operations */
};
/************************************************************/
/****************** Bootstrap Operations ********************/
/************************************************************/
smio_err_e
fmc_adc_common_init
(
smio_t
*
self
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc_adc_common_exp] Initializing fmc_adc_common
\n
"
);
smio_err_e
err
=
SMIO_SUCCESS
;
err
=
smio_set_id
(
self
,
FMC_ADC_COMMON_SDB_DEVID
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO id"
,
err_set_id
);
err
=
smio_set_name
(
self
,
FMC_ADC_COMMON_SDB_NAME
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO name"
,
err_set_name
);
/* Set SMIO ops pointers */
err
=
smio_set_ops
(
self
,
&
fmc_adc_common_ops
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO operations"
,
err_smio_set_ops
);
err
=
smio_set_thsafe_client_ops
(
self
,
&
smio_thsafe_client_zmq_ops
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO thsafe operations"
,
err_smio_set_thsafe_ops
);
/* Fill the disp_op_t description structure with the callbacks. */
/* disp_op_t structure is const and all of the functions performing on it
* obviously receives a const argument, but here (and only on the SMIO
* initialization) we need to make an exception if we want to keep the
* functions' description and the function pointers separate */
err
=
smio_init_exp_ops
(
self
,
(
disp_op_t
**
)
fmc_adc_common_exp_ops
,
fmc_adc_common_exp_fp
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not fill SMIO "
"function descriptors with the callbacks"
,
err_fill_desc
);
err
=
smio_set_exp_ops
(
self
,
fmc_adc_common_exp_ops
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO exported operations"
,
err_smio_set_exp_ops
);
/* Initialize specific structure */
smio_fmc_adc_common_t
*
smio_handler
=
smio_fmc_adc_common_new
(
self
);
ASSERT_ALLOC
(
smio_handler
,
err_smio_handler_alloc
,
SMIO_ERR_ALLOC
);
err
=
smio_set_handler
(
self
,
smio_handler
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO handler"
,
err_smio_set_handler
);
return
err
;
err_smio_set_handler:
smio_fmc_adc_common_destroy
(
&
smio_handler
);
err_smio_handler_alloc:
smio_set_exp_ops
(
self
,
NULL
);
err_smio_set_exp_ops:
err_fill_desc:
smio_set_thsafe_client_ops
(
self
,
NULL
);
err_smio_set_thsafe_ops:
smio_set_ops
(
self
,
NULL
);
err_smio_set_ops:
err_set_name:
err_set_id:
return
err
;
}
/* Destroy sm_io instance of fmc_adc_common */
smio_err_e
fmc_adc_common_shutdown
(
smio_t
*
self
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc_adc_common_exp] Shutting down fmc_adc_common
\n
"
);
smio_err_e
err
=
SMIO_SUCCESS
;
smio_fmc_adc_common_t
*
fmcacommon
=
smio_get_handler
(
self
);
ASSERT_TEST
(
fmcacommon
!=
NULL
,
"Could not get FMC ADC COMMON handler"
,
err_fmcacommon_handler
,
SMIO_ERR_ALLOC
/* FIXME: improve return code */
);
/* Destroy SMIO instance */
smio_fmc_adc_common_destroy
(
&
fmcacommon
);
/* Nullify operation pointers */
smio_set_exp_ops
(
self
,
NULL
);
smio_set_thsafe_client_ops
(
self
,
NULL
);
smio_set_ops
(
self
,
NULL
);
err_fmcacommon_handler:
return
err
;
}
const
smio_bootstrap_ops_t
fmc_adc_common_bootstrap_ops
=
{
.
init
=
fmc_adc_common_init
,
.
shutdown
=
fmc_adc_common_shutdown
,
.
config_defaults
=
fmc_adc_common_config_defaults
};
SMIO_MOD_DECLARE
(
FMC_ADC_COMMON_SDB_DEVID
,
FMC_ADC_COMMON_SDB_NAME
,
fmc_adc_common_bootstrap_ops
)
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_exp.h
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#ifndef _FMC_ADC_COMMON_H_
#define _FMC_ADC_COMMON_H_
/* Known modules IDs (from SDB records defined in FPGA) */
#define FMC_ADC_COMMON_SDB_DEVID 0x2403f569
#define FMC_ADC_COMMON_SDB_NAME "FMC_ADC_COMMON"
extern
const
smio_bootstrap_ops_t
fmc_adc_common_bootstrap_ops
;
#endif
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_exports.c
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#include "sm_io_exports_helper.h"
#include "sm_io_codes.h"
/* Description SMIO FMC_ADC_COMMON functions */
disp_op_t
fmc_adc_common_leds_exp
=
{
.
name
=
FMC_ADC_COMMON_NAME_LEDS
,
.
opcode
=
FMC_ADC_COMMON_OPCODE_LEDS
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
disp_op_t
fmc_adc_common_test_data_en_exp
=
{
.
name
=
FMC_ADC_COMMON_NAME_TEST_DATA_EN
,
.
opcode
=
FMC_ADC_COMMON_OPCODE_TEST_DATA_EN
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
disp_op_t
fmc_adc_common_trig_dir_exp
=
{
.
name
=
FMC_ADC_COMMON_NAME_TRIG_DIR
,
.
opcode
=
FMC_ADC_COMMON_OPCODE_TRIG_DIR
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
disp_op_t
fmc_adc_common_trig_term_exp
=
{
.
name
=
FMC_ADC_COMMON_NAME_TRIG_TERM
,
.
opcode
=
FMC_ADC_COMMON_OPCODE_TRIG_TERM
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
disp_op_t
fmc_adc_common_trig_val_exp
=
{
.
name
=
FMC_ADC_COMMON_NAME_TRIG_VAL
,
.
opcode
=
FMC_ADC_COMMON_OPCODE_TRIG_VAL
,
.
retval
=
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_END
}
};
/* Exported function description */
const
disp_op_t
*
fmc_adc_common_exp_ops
[]
=
{
&
fmc_adc_common_leds_exp
,
&
fmc_adc_common_test_data_en_exp
,
&
fmc_adc_common_trig_dir_exp
,
&
fmc_adc_common_trig_term_exp
,
&
fmc_adc_common_trig_val_exp
,
NULL
};
src/sm_io/modules/fmc_adc_common/sm_io_fmc_adc_common_exports.h
0 → 100644
View file @
f212bfac
/*
* Copyright (C) 2014 LNLS (www.lnls.br)
* Author: Lucas Russo <lucas.russo@lnls.br>
*
* Released according to the GNU GPL, version 3 or any later version.
*/
#ifndef _SM_IO_FMC_ADC_COMMON_EXPORTS_H_
#define _SM_IO_FMC_ADC_COMMON_EXPORTS_H_
#include "disptable.h"
extern
disp_op_t
fmc_adc_common_leds_exp
;
extern
disp_op_t
fmc_adc_common_test_data_en_exp
;
extern
disp_op_t
fmc_adc_common_trig_dir_exp
;
extern
disp_op_t
fmc_adc_common_trig_term_exp
;
extern
disp_op_t
fmc_adc_common_trig_val_exp
;
extern
const
disp_op_t
*
fmc_adc_common_exp_ops
[];
#endif
src/sm_io/modules/modules.mk
View file @
f212bfac
include $(SRC_DIR)/sm_io/modules/fmc130m_4ch/fmc130m_4ch.mk \
$(SRC_DIR)/sm_io/modules/fmc250m_4ch/fmc250m_4ch.mk \
$(SRC_DIR)/sm_io/modules/fmc_adc_common/fmc_adc_common.mk \
$(SRC_DIR)/sm_io/modules/acq/acq.mk \
$(SRC_DIR)/sm_io/modules/dsp/dsp.mk \
$(SRC_DIR)/sm_io/modules/swap/swap.mk \
...
...
@@ -11,6 +12,7 @@ sm_io_modules_DIR = $(SRC_DIR)/sm_io/modules
sm_io_modules_OBJS = $(sm_io_modules_DIR)/sm_io_codes.o \
$(sm_io_fmc130m_4ch_OBJS) \
$(sm_io_fmc250m_4ch_OBJS) \
$(sm_io_fmc_adc_common_OBJS) \
$(sm_io_acq_OBJS) \
$(sm_io_dsp_OBJS) \
$(sm_io_swap_OBJS) \
...
...
src/sm_io/modules/sm_io_codes.c
View file @
f212bfac
...
...
@@ -12,6 +12,7 @@ const disp_op_t **smio_exp_ops [] = {
dsp_exp_ops
,
fmc130m_4ch_exp_ops
,
fmc250m_4ch_exp_ops
,
fmc_adc_common_exp_ops
,
swap_exp_ops
,
rffe_exp_ops
,
afc_diag_exp_ops
,
...
...
src/sm_io/modules/sm_io_codes.h
View file @
f212bfac
...
...
@@ -24,6 +24,7 @@ typedef struct _smio_rffe_version_t smio_rffe_version_t;
/* Include all module's codes */
#include "sm_io_fmc130m_4ch_codes.h"
#include "sm_io_fmc250m_4ch_codes.h"
#include "sm_io_fmc_adc_common_codes.h"
#include "sm_io_acq_codes.h"
#include "sm_io_dsp_codes.h"
#include "sm_io_swap_codes.h"
...
...
@@ -33,6 +34,7 @@ typedef struct _smio_rffe_version_t smio_rffe_version_t;
/* Include all function descriptors */
#include "sm_io_fmc130m_4ch_exports.h"
#include "sm_io_fmc250m_4ch_exports.h"
#include "sm_io_fmc_adc_common_exports.h"
#include "sm_io_acq_exports.h"
#include "sm_io_dsp_exports.h"
#include "sm_io_swap_exports.h"
...
...
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