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
444378c7
Commit
444378c7
authored
Apr 19, 2016
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sm_io/modules/*: add new fmc_active_clk module
parent
56a80de8
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1030 additions
and
0 deletions
+1030
-0
fmc_active_clk.mk
src/sm_io/modules/fmc_active_clk/fmc_active_clk.mk
+6
-0
sm_io_fmc_active_clk_codes.h
...sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_codes.h
+58
-0
sm_io_fmc_active_clk_core.c
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_core.c
+94
-0
sm_io_fmc_active_clk_core.h
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_core.h
+26
-0
sm_io_fmc_active_clk_defaults.c
...io/modules/fmc_active_clk/sm_io_fmc_active_clk_defaults.c
+89
-0
sm_io_fmc_active_clk_defaults.h
...io/modules/fmc_active_clk/sm_io_fmc_active_clk_defaults.h
+25
-0
sm_io_fmc_active_clk_exp.c
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_exp.c
+450
-0
sm_io_fmc_active_clk_exp.h
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_exp.h
+19
-0
sm_io_fmc_active_clk_exports.c
..._io/modules/fmc_active_clk/sm_io_fmc_active_clk_exports.c
+225
-0
sm_io_fmc_active_clk_exports.h
..._io/modules/fmc_active_clk/sm_io_fmc_active_clk_exports.h
+33
-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_active_clk/fmc_active_clk.mk
0 → 100644
View file @
444378c7
sm_io_fmc_active_clk_DIR = $(SRC_DIR)/sm_io/modules/fmc_active_clk
sm_io_fmc_active_clk_OBJS = $(sm_io_fmc_active_clk_DIR)/sm_io_fmc_active_clk_core.o \
$(sm_io_fmc_active_clk_DIR)/sm_io_fmc_active_clk_exp.o \
$(sm_io_fmc_active_clk_DIR)/sm_io_fmc_active_clk_exports.o \
$(sm_io_fmc_active_clk_DIR)/sm_io_fmc_active_clk_defaults.o
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_codes.h
0 → 100644
View file @
444378c7
/*
* 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_ACTIVE_CLK_CODES_H_
#define _SM_IO_FMC_ACTIVE_CLK_CODES_H_
/* Messaging OPCODES */
#define FMC_ACTIVE_CLK_OPCODE_TYPE uint32_t
#define FMC_ACTIVE_CLK_OPCODE_SIZE (sizeof (FMC_ACTIVE_CLK_OPCODE_TYPE))
#define FMC_ACTIVE_CLK_OPCODE_SI571_OE 0
#define FMC_ACTIVE_CLK_NAME_SI571_OE "fmc_active_clk_si571_oe"
#define FMC_ACTIVE_CLK_OPCODE_PLL_FUNCTION 1
#define FMC_ACTIVE_CLK_NAME_PLL_FUNCTION "fmc_active_clk_pll_function"
#define FMC_ACTIVE_CLK_OPCODE_PLL_STATUS 2
#define FMC_ACTIVE_CLK_NAME_PLL_STATUS "fmc_active_clk_pll_status"
#define FMC_ACTIVE_CLK_OPCODE_CLK_SEL 3
#define FMC_ACTIVE_CLK_NAME_CLK_SEL "fmc_active_clk_clk_sel"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_CFG_DEFAULTS 4
#define FMC_ACTIVE_CLK_NAME_AD9510_CFG_DEFAULTS "fmc_active_clk_ad9510_cfg_defaults"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_A_DIV 5
#define FMC_ACTIVE_CLK_NAME_AD9510_PLL_A_DIV "fmc_active_clk_ad9510_pll_a_div"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_B_DIV 6
#define FMC_ACTIVE_CLK_NAME_AD9510_PLL_B_DIV "fmc_active_clk_ad9510_pll_b_div"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_PRESCALER 7
#define FMC_ACTIVE_CLK_NAME_AD9510_PLL_PRESCALER "fmc_active_clk_ad9510_pll_prescaler"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_R_DIV 8
#define FMC_ACTIVE_CLK_NAME_AD9510_R_DIV "fmc_active_clk_ad9510_r_div"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_PDOWN 9
#define FMC_ACTIVE_CLK_NAME_AD9510_PLL_PDOWN "fmc_active_clk_ad9510_pll_pdown"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_MUX_STATUS 10
#define FMC_ACTIVE_CLK_NAME_AD9510_MUX_STATUS "fmc_active_clk_ad9510_mux_status"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_CP_CURRENT 11
#define FMC_ACTIVE_CLK_NAME_AD9510_CP_CURRENT "fmc_active_clk_ad9510_cp_current"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_OUTPUTS 12
#define FMC_ACTIVE_CLK_NAME_AD9510_OUTPUTS "fmc_active_clk_ad9510_outputs"
#define FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_CLK_SEL 13
#define FMC_ACTIVE_CLK_NAME_AD9510_PLL_CLK_SEL "fmc_active_clk_ad9510_pll_clk_sel"
#define FMC_ACTIVE_CLK_OPCODE_SI571_SET_FREQ 14
#define FMC_ACTIVE_CLK_NAME_SI571_SET_FREQ "fmc_active_clk_si571_set_freq"
#define FMC_ACTIVE_CLK_OPCODE_SI571_GET_DEFAULTS 15
#define FMC_ACTIVE_CLK_NAME_SI571_GET_DEFAULTS "fmc_active_clk_si571_get_defaults"
#define FMC_ACTIVE_CLK_OPCODE_END 16
/* Messaging Reply OPCODES */
#define FMC_ACTIVE_CLK_REPLY_TYPE uint32_t
#define FMC_ACTIVE_CLK_REPLY_SIZE (sizeof (FMC_ACTIVE_CLK_REPLY_TYPE))
#define FMC_ACTIVE_CLK_OK 0
/* Operation was successful */
#define FMC_ACTIVE_CLK_ERR 1
/* Could not set/get value */
#define FMC_ACTIVE_CLK_UNINPL 2
/* Unimplemented function or operation */
#define FMC_ACTIVE_CLK_REPLY_END 3
/* End marker */
#endif
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_core.c
0 → 100644
View file @
444378c7
/*
* 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_active_clk_defaults.h"
#include "sm_io_fmc_active_clk_core.h"
#include "chips_addr.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_active_clk_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_active_clk_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_active_clk_core]", \
smio_err_str (err_type))
/* Creates a new instance of Device Information */
smio_fmc_active_clk_t
*
smio_fmc_active_clk_new
(
smio_t
*
parent
)
{
assert
(
parent
);
smio_fmc_active_clk_t
*
self
=
(
smio_fmc_active_clk_t
*
)
zmalloc
(
sizeof
*
self
);
ASSERT_ALLOC
(
self
,
err_self_alloc
);
uint32_t
inst_id
=
smio_get_inst_id
(
parent
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc_active_clk_core] AD9510 initializing, "
"addr: 0x%08X, Inst ID: %u
\n
"
,
fmc_active_clk_ad9510_addr
,
inst_id
);
self
->
smch_ad9510
=
smch_ad9510_new
(
parent
,
FMC_ACTIVE_CLK_AD9510_SPI_OFFS
,
fmc_active_clk_ad9510_addr
,
0
);
ASSERT_ALLOC
(
self
->
smch_ad9510
,
err_smch_ad9510_alloc
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc_active_clk_core] SI571 initializing, "
"addr: 0x%08X, Inst ID: %u
\n
"
,
fmc_active_clk_si571_addr
,
inst_id
);
self
->
smch_si571
=
smch_si57x_new
(
parent
,
FMC_ACTIVE_CLK_SI571_I2C_OFFS
,
fmc_active_clk_si571_addr
[
inst_id
],
0
);
ASSERT_ALLOC
(
self
->
smch_si571
,
err_smch_si571_alloc
);
return
self
;
err_smch_si571_alloc:
if
(
self
->
smch_ad9510
!=
NULL
)
{
smch_ad9510_destroy
(
&
self
->
smch_ad9510
);
}
err_smch_ad9510_alloc:
smch_24aa64_destroy
(
&
self
->
smch_24aa64
);
err_smch_24aa64_alloc:
if
(
self
->
smch_pca9547
!=
NULL
)
{
smch_pca9547_destroy
(
&
self
->
smch_pca9547
);
}
err_smch_pca9547_alloc:
err_num_fmc_active_clk_smios:
free
(
self
);
err_self_alloc:
return
NULL
;
}
/* Destroy an instance of the Device Information */
smio_err_e
smio_fmc_active_clk_destroy
(
smio_fmc_active_clk_t
**
self_p
)
{
assert
(
self_p
);
if
(
*
self_p
)
{
smio_fmc_active_clk_t
*
self
=
*
self_p
;
smch_si57x_destroy
(
&
self
->
smch_si571
);
smch_ad9510_destroy
(
&
self
->
smch_ad9510
);
free
(
self
);
*
self_p
=
NULL
;
}
return
SMIO_SUCCESS
;
}
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_core.h
0 → 100644
View file @
444378c7
/*
* 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_ACTIVE_CLK_CORE_H_
#define _SM_IO_FMC_ACTIVE_CLK_CORE_H_
#define SMIO_AD9510_HANDLER(smio_handler) ((smch_ad9510_t *) smio_handler->smch_ad9510)
#define SMIO_SI57X_HANDLER(smio_handler) ((smch_si57x_t *) smio_handler->smch_si571)
typedef
struct
{
smch_ad9510_t
*
smch_ad9510
;
/* AD9510 chip handler */
smch_si57x_t
*
smch_si571
;
/* SI571 chip handler */
}
smio_fmc_active_clk_t
;
/***************** Our methods *****************/
/* Creates a new instance of the smio realization */
smio_fmc_active_clk_t
*
smio_fmc_active_clk_new
(
smio_t
*
parent
);
/* Destroys the smio realization */
smio_err_e
smio_fmc_active_clk_destroy
(
smio_fmc_active_clk_t
**
self_p
);
#endif
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_defaults.c
0 → 100644
View file @
444378c7
/*
* 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_active_clk_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_active_clk_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_active_clk_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_active_clk_defaults]", \
smio_err_str (err_type))
#define SMIO_FMC_ACTIVE_CLK_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_active_clk_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_active_clk_defaults] Configuring SMIO "
"FMC_ACTIVE_CLK 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_ACTIVE_CLK_LIBBPMCLIENT_LOG_MODE
);
ASSERT_ALLOC
(
config_client
,
err_alloc_client
);
client_err
=
bpm_set_fmc_pll_function
(
config_client
,
service
,
FMC_ACTIVE_CLK_DFLT_PLL_FUNC
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not set FMC PLL function"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
client_err
=
bpm_set_fmc_clk_sel
(
config_client
,
service
,
FMC_ACTIVE_CLK_DFLT_CLK_SEL
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not set FMC CLK SEL function"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
client_err
=
bpm_ad9510_cfg_defaults
(
config_client
,
service
,
0
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
||
client_err
==
BPM_CLIENT_ERR_AGAIN
,
"Could not configure AD9510"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
client_err
=
bpm_set_si571_defaults
(
config_client
,
service
,
FMC_ACTIVE_CLK_DFLT_SI57X_FOUT_FACTORY
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not get Si571 defaults"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
client_err
=
bpm_set_si571_set_freq
(
config_client
,
service
,
FMC_ACTIVE_CLK_DFLT_SI57X_FOUT
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not set Si571 frequency"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
client_err
=
bpm_set_si571_oe
(
config_client
,
service
,
FMC_ACTIVE_CLK_DFLT_SI571_OE
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not enable SI571 Output"
,
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_active_clk_defaults] Exiting Config thread %s
\n
"
,
service
);
return
err
;
}
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_defaults.h
0 → 100644
View file @
444378c7
/*
* 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_ACTIVE_CLK_DEFAULTS_H_
#define _FMC_ACTIVE_CLK_DEFAULTS_H_
#include "sm_io_err.h"
#include "chips/si57x_regs.h"
#define FMC_ACTIVE_CLK_DFLT_PLL_FUNC 0x1
#define FMC_ACTIVE_CLK_DFLT_CLK_SEL 0x0
/* Clock from FMC front panel */
#define FMC_ACTIVE_CLK_DFLT_SI571_OE 0x1
#define FMC_ACTIVE_CLK_DFLT_SI57X_FOUT_FACTORY SI57X_FOUT_FACTORY_DFLT
#define FMC_ACTIVE_CLK_DFLT_SI57X_FOUT 113040445
/* 113.040445 MHz default */
smio_err_e
fmc_active_clk_config_defaults
(
char
*
broker_endp
,
char
*
service
,
const
char
*
log_file_name
);
#endif
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_exp.c
0 → 100644
View file @
444378c7
/*
* 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_active_clk_codes.h"
#include "sm_io_fmc_active_clk_defaults.h"
#include "sm_io_fmc_active_clk_exports.h"
#include "sm_io_fmc_active_clk_core.h"
#include "sm_io_fmc_active_clk_exp.h"
#include "hw/wb_fmc_active_clk_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_active_clk_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_active_clk_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_active_clk_exp]", \
smio_err_str (err_type))
static
smch_err_e
smch_ad9510_cfg_defaults_compat
(
smch_ad9510_t
*
self
,
uint32_t
*
param
);
/************************************************************/
/*********** Specific FMC_ACTIVE_CLK Operations *************/
/************************************************************/
#define BPM_FMC_ACTIVE_CLK_SI571_OE_MIN 0
/* SI571 Output disable */
#define BPM_FMC_ACTIVE_CLK_SI571_OE_MAX 1
/* SI571 Output enable */
RW_PARAM_FUNC
(
fmc_active_clk
,
si571_oe
)
{
SET_GET_PARAM
(
fmc_active_clk
,
FMC_ACTIVE_CLK_CTRL_REGS_OFFS
,
WB_FMC_ACTIVE_CLK_CSR
,
CLK_DISTRIB
,
SI571_OE
,
SINGLE_BIT_PARAM
,
BPM_FMC_ACTIVE_CLK_SI571_OE_MIN
,
BPM_FMC_ACTIVE_CLK_SI571_OE_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC_ACTIVE_CLK_PLL_FUNC_MIN 0
/* PLL FUNCTION pin 0 */
#define BPM_FMC_ACTIVE_CLK_PLL_FUNC_MAX 1
/* PLL FUNCTION pin 1 */
RW_PARAM_FUNC
(
fmc_active_clk
,
pll_func
)
{
SET_GET_PARAM
(
fmc_active_clk
,
FMC_ACTIVE_CLK_CTRL_REGS_OFFS
,
WB_FMC_ACTIVE_CLK_CSR
,
CLK_DISTRIB
,
PLL_FUNCTION
,
SINGLE_BIT_PARAM
,
BPM_FMC_ACTIVE_CLK_PLL_FUNC_MIN
,
BPM_FMC_ACTIVE_CLK_PLL_FUNC_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC_ACTIVE_CLK_PLL_STATUS_MIN 0
/* PLL STATUS pin 0 */
#define BPM_FMC_ACTIVE_CLK_PLL_STATUS_MAX 1
/* PLL STATUS pin 1 */
RW_PARAM_FUNC
(
fmc_active_clk
,
pll_status
)
{
SET_GET_PARAM
(
fmc_active_clk
,
FMC_ACTIVE_CLK_CTRL_REGS_OFFS
,
WB_FMC_ACTIVE_CLK_CSR
,
CLK_DISTRIB
,
PLL_STATUS
,
SINGLE_BIT_PARAM
,
BPM_FMC_ACTIVE_CLK_PLL_STATUS_MIN
,
BPM_FMC_ACTIVE_CLK_PLL_STATUS_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC_ACTIVE_CLK_CLK_SEL_MIN 0
/* PLL CLK_SEL pin 0 */
#define BPM_FMC_ACTIVE_CLK_CLK_SEL_MAX 1
/* PLL CLK_SEL pin 1 */
RW_PARAM_FUNC
(
fmc_active_clk
,
clk_sel
)
{
SET_GET_PARAM
(
fmc_active_clk
,
FMC_ACTIVE_CLK_CTRL_REGS_OFFS
,
WB_FMC_ACTIVE_CLK_CSR
,
CLK_DISTRIB
,
CLK_SEL
,
SINGLE_BIT_PARAM
,
BPM_FMC_ACTIVE_CLK_CLK_SEL_MIN
,
BPM_FMC_ACTIVE_CLK_CLK_SEL_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
/******************************** Chips Export functions *************************/
/* Macros to avoid repetition of the function body AD9510 */
typedef
smch_err_e
(
*
smch_ad9510_func_fp
)
(
smch_ad9510_t
*
self
,
uint32_t
*
param
);
#define FMC_ACTIVE_CLK_AD9510_FUNC_NAME(func_name) \
_fmc_active_clk_ad9510_ ## func_name
#define FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER(func_name) \
static int FMC_ACTIVE_CLK_AD9510_FUNC_NAME(func_name) (void *owner, void *args, void *ret)
#define FMC_ACTIVE_CLK_AD9510_FUNC_BODY(owner, args, ret, read_func, write_func, \
error_msg) \
do { \
assert (owner); \
assert (args); \
\
int err = -FMC_ACTIVE_CLK_OK; \
SMIO_OWNER_TYPE *self = SMIO_EXP_OWNER(owner); \
smio_fmc_active_clk_t *fmcaclk = smio_get_handler (self); \
ASSERT_TEST(fmcaclk != NULL, "Could not get SMIO FMC ACTIVE CLK handler", \
err_get_fmcaclk_handler, -FMC_ACTIVE_CLK_ERR); \
smch_ad9510_t *smch_ad9510 = SMIO_AD9510_HANDLER(fmcaclk); \
uint32_t rw = *(uint32_t *) EXP_MSG_ZMQ_FIRST_ARG(args); \
uint32_t param = *(uint32_t *) EXP_MSG_ZMQ_NEXT_ARG(args); \
\
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc_active_clk_exp] Calling " \
"AD9510 function\n"); \
\
smch_err_e serr = SMCH_SUCCESS; \
/* Call specific function */
\
if (rw) { \
WHEN(ISEMPTY(read_func))( \
(void) ret; \
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc_active_clk_exp] " \
"AD9510 read function not implemented\n"); \
err = -FMC_ACTIVE_CLK_UNINPL; \
return err; \
) \
WHENNOT(ISEMPTY(read_func))( \
uint32_t value = 0; \
serr = ((smch_ad9510_func_fp) read_func) (smch_ad9510, \
&value); \
if (serr != SMCH_SUCCESS) { \
err = -FMC_ACTIVE_CLK_ERR; \
} \
else { \
*((uint32_t *) ret) = value; \
err = sizeof (value); \
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc_active_clk_exp] " \
"AD9510 function read value = 0x%08X\n", value); \
} \
) \
} \
else { \
WHEN(ISEMPTY(write_func))( \
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc_active_clk_exp] " \
"AD9510 write function not implemented\n"); \
err = -FMC_ACTIVE_CLK_UNINPL; \
return err; \
) \
WHENNOT(ISEMPTY(write_func))( \
serr = ((smch_ad9510_func_fp) write_func) (smch_ad9510, \
¶m); \
if (serr != SMCH_SUCCESS) { \
err = -FMC_ACTIVE_CLK_ERR; \
} \
else { \
err = -FMC_ACTIVE_CLK_OK; \
} \
) \
} \
\
err_get_fmcaclk_handler: \
return err; \
} while(0)
static
smch_err_e
smch_ad9510_cfg_defaults_compat
(
smch_ad9510_t
*
self
,
uint32_t
*
param
)
{
(
void
)
param
;
return
smch_ad9510_cfg_defaults
(
self
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
cfg_defaults
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
/* No read function */
,
smch_ad9510_cfg_defaults_compat
,
"Could not set/get AD9510 defaults"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
pll_a_div
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_pll_a_div
,
smch_ad9510_set_pll_a_div
,
"Could not set/get AD9510 PLL A divider"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
pll_b_div
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_pll_b_div
,
smch_ad9510_set_pll_b_div
,
"Could not set/get AD9510 PLL B divider"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
pll_prescaler
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_pll_prescaler
,
smch_ad9510_set_pll_prescaler
,
"Could not set/get AD9510 PLL Prescaler"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
r_div
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_r_div
,
smch_ad9510_set_r_div
,
"Could not set/get AD9510 R Divider"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
pll_pdown
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_pll_pdown
,
smch_ad9510_set_pll_pdown
,
"Could not set/get AD9510 PLL power down"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
mux_status
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_mux_status
,
smch_ad9510_set_mux_status
,
"Could not set/get AD9510 MUX status"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
cp_current
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_cp_current
,
smch_ad9510_set_cp_current
,
"Could not set/get AD9510 CP current"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
outputs
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_outputs
,
smch_ad9510_set_outputs
,
"Could not set/get AD9510 Outputs"
);
}
FMC_ACTIVE_CLK_AD9510_FUNC_NAME_HEADER
(
pll_clk_sel
)
{
FMC_ACTIVE_CLK_AD9510_FUNC_BODY
(
owner
,
args
,
ret
,
smch_ad9510_get_pll_clk_sel
,
smch_ad9510_set_pll_clk_sel
,
"Could not set/get AD9510 PLL CLK selection"
);
}
/* Macros to avoid repetition of the function body Si57X */
typedef
smch_err_e
(
*
smch_si57x_func_fp
)
(
smch_si57x_t
*
self
,
double
param
);
#define FMC_ACTIVE_CLK_SI571_FUNC_NAME(func_name) \
_fmc_active_clk_si571_ ## func_name
#define FMC_ACTIVE_CLK_SI571_FUNC_NAME_HEADER(func_name) \
static int FMC_ACTIVE_CLK_SI571_FUNC_NAME(func_name) (void *owner, void *args, void *ret)
#define FMC_ACTIVE_CLK_SI571_FUNC_BODY(owner, args, ret, func, error_msg) \
do { \
(void) ret; \
assert (owner); \
assert (args); \
\
int err = -FMC_ACTIVE_CLK_OK; \
SMIO_OWNER_TYPE *self = SMIO_EXP_OWNER(owner); \
smio_fmc_active_clk_t *fmcaclk = smio_get_handler (self); \
ASSERT_TEST(fmcaclk != NULL, "Could not get SMIO FMC ACTIVE CLK handler", \
err_get_fmcaclk_handler, -FMC_ACTIVE_CLK_ERR); \
smch_si57x_t *smch_si57x = SMIO_SI57X_HANDLER(fmcaclk); \
uint32_t rw = *(uint32_t *) EXP_MSG_ZMQ_FIRST_ARG(args); \
(void) rw;
/* Ignored for now */
\
double param = *(double *) EXP_MSG_ZMQ_NEXT_ARG(args); \
\
/* Call specific function */
\
smch_err_e serr = ((smch_si57x_func_fp) func) (smch_si57x, param); \
ASSERT_TEST(serr == SMCH_SUCCESS, error_msg, \
err_smpr_write, -FMC_ACTIVE_CLK_ERR); \
\
err_smpr_write: \
err_get_fmcaclk_handler: \
return err; \
\
} while(0)
FMC_ACTIVE_CLK_SI571_FUNC_NAME_HEADER
(
set_freq
)
{
FMC_ACTIVE_CLK_SI571_FUNC_BODY
(
owner
,
args
,
ret
,
smch_si57x_set_freq
,
"Could not set SI571 frequency"
);
}
FMC_ACTIVE_CLK_SI571_FUNC_NAME_HEADER
(
get_defaults
)
{
FMC_ACTIVE_CLK_SI571_FUNC_BODY
(
owner
,
args
,
ret
,
smch_si57x_get_defaults
,
"Could not restart SI571 to its defaults"
);
}
/* Exported function pointers */
const
disp_table_func_fp
fmc_active_clk_exp_fp
[]
=
{
RW_PARAM_FUNC_NAME
(
fmc_active_clk
,
si571_oe
),
RW_PARAM_FUNC_NAME
(
fmc_active_clk
,
pll_func
),
RW_PARAM_FUNC_NAME
(
fmc_active_clk
,
pll_status
),
RW_PARAM_FUNC_NAME
(
fmc_active_clk
,
clk_sel
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
cfg_defaults
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
pll_a_div
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
pll_b_div
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
pll_prescaler
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
r_div
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
pll_pdown
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
mux_status
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
cp_current
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
outputs
),
FMC_ACTIVE_CLK_AD9510_FUNC_NAME
(
pll_clk_sel
),
FMC_ACTIVE_CLK_SI571_FUNC_NAME
(
set_freq
),
FMC_ACTIVE_CLK_SI571_FUNC_NAME
(
get_defaults
),
NULL
};
/************************************************************/
/***************** Export methods functions *****************/
/************************************************************/
static
smio_err_e
_fmc_active_clk_do_op
(
void
*
owner
,
void
*
msg
);
/* Attach an instance of sm_io to dev_io function pointer */
smio_err_e
fmc_active_clk_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_active_clk_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_active_clk_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_active_clk_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_active_clk_do_op
(
void
*
owner
,
void
*
msg
)
{
(
void
)
owner
;
(
void
)
msg
;
return
SMIO_ERR_FUNC_NOT_IMPL
;
}
smio_err_e
fmc_active_clk_do_op
(
void
*
self
,
void
*
msg
)
{
return
_fmc_active_clk_do_op
(
self
,
msg
);
}
const
smio_ops_t
fmc_active_clk_ops
=
{
.
attach
=
fmc_active_clk_attach
,
/* Attach sm_io instance to dev_io */
.
deattach
=
fmc_active_clk_deattach
,
/* Deattach sm_io instance to dev_io */
.
export_ops
=
fmc_active_clk_export_ops
,
/* Export sm_io operations to dev_io */
.
unexport_ops
=
fmc_active_clk_unexport_ops
,
/* Unexport sm_io operations to dev_io */
.
do_op
=
fmc_active_clk_do_op
/* Generic wrapper for handling specific operations */
};
/************************************************************/
/****************** Bootstrap Operations ********************/
/************************************************************/
smio_err_e
fmc_active_clk_init
(
smio_t
*
self
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc_active_clk_exp] Initializing fmc_active_clk
\n
"
);
smio_err_e
err
=
SMIO_SUCCESS
;
err
=
smio_set_id
(
self
,
FMC_ACTIVE_CLK_SDB_DEVID
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO id"
,
err_set_id
);
err
=
smio_set_name
(
self
,
FMC_ACTIVE_CLK_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_active_clk_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_active_clk_exp_ops
,
fmc_active_clk_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_active_clk_exp_ops
);
ASSERT_TEST
(
err
==
SMIO_SUCCESS
,
"Could not set SMIO exported operations"
,
err_smio_set_exp_ops
);
/* Initialize specific structure */
smio_fmc_active_clk_t
*
smio_handler
=
smio_fmc_active_clk_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_active_clk_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_active_clk */
smio_err_e
fmc_active_clk_shutdown
(
smio_t
*
self
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:fmc_active_clk_exp] Shutting down fmc_active_clk
\n
"
);
smio_err_e
err
=
SMIO_SUCCESS
;
smio_fmc_active_clk_t
*
fmcaclk
=
smio_get_handler
(
self
);
ASSERT_TEST
(
fmcaclk
!=
NULL
,
"Could not get FMC ACTIVE CLK handler"
,
err_fmcaclk_handler
,
SMIO_ERR_ALLOC
/* FIXME: improve return code */
);
/* Destroy SMIO instance */
smio_fmc_active_clk_destroy
(
&
fmcaclk
);
/* Nullify operation pointers */
smio_set_exp_ops
(
self
,
NULL
);
smio_set_thsafe_client_ops
(
self
,
NULL
);
smio_set_ops
(
self
,
NULL
);
err_fmcaclk_handler:
return
err
;
}
const
smio_bootstrap_ops_t
fmc_active_clk_bootstrap_ops
=
{
.
init
=
fmc_active_clk_init
,
.
shutdown
=
fmc_active_clk_shutdown
,
.
config_defaults
=
fmc_active_clk_config_defaults
};
SMIO_MOD_DECLARE
(
FMC_ACTIVE_CLK_SDB_DEVID
,
FMC_ACTIVE_CLK_SDB_NAME
,
fmc_active_clk_bootstrap_ops
)
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_exp.h
0 → 100644
View file @
444378c7
/*
* 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_ACTIVE_CLK_H_
#define _FMC_ACTIVE_CLK_H_
/* Known modules IDs (from SDB records defined in FPGA) */
#define FMC_ACTIVE_CLK_SDB_DEVID 0x88c67d9c
#define FMC_ACTIVE_CLK_SDB_NAME "FMC_ACTIVE_CLK"
extern
const
smio_bootstrap_ops_t
fmc_active_clk_bootstrap_ops
;
#endif
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_exports.c
0 → 100644
View file @
444378c7
/*
* 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_ACTIVE_CLK functions */
disp_op_t
fmc_active_clk_si571_oe_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_SI571_OE
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_SI571_OE
,
.
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_active_clk_pll_func_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_PLL_FUNCTION
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_PLL_FUNCTION
,
.
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_active_clk_pll_status_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_PLL_STATUS
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_PLL_STATUS
,
.
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_active_clk_clk_sel_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_CLK_SEL
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_CLK_SEL
,
.
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_active_clk_ad9510_cfg_defaults_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_CFG_DEFAULTS
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_CFG_DEFAULTS
,
.
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_active_clk_ad9510_pll_a_div_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_PLL_A_DIV
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_A_DIV
,
.
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_active_clk_ad9510_pll_b_div_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_PLL_B_DIV
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_B_DIV
,
.
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_active_clk_ad9510_pll_prescaler_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_PLL_PRESCALER
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_PRESCALER
,
.
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_active_clk_ad9510_r_div_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_R_DIV
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_R_DIV
,
.
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_active_clk_ad9510_pll_pdown_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_PLL_PDOWN
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_PDOWN
,
.
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_active_clk_ad9510_mux_status_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_MUX_STATUS
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_MUX_STATUS
,
.
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_active_clk_ad9510_cp_current_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_CP_CURRENT
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_CP_CURRENT
,
.
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_active_clk_ad9510_outputs_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_OUTPUTS
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_OUTPUTS
,
.
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_active_clk_ad9510_pll_clk_sel_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_AD9510_PLL_CLK_SEL
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_AD9510_PLL_CLK_SEL
,
.
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_active_clk_si571_set_freq_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_SI571_SET_FREQ
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_SI571_SET_FREQ
,
.
retval
=
DISP_ARG_END
,
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_DOUBLE
,
double
),
DISP_ARG_END
}
};
disp_op_t
fmc_active_clk_si571_get_defaults_exp
=
{
.
name
=
FMC_ACTIVE_CLK_NAME_SI571_GET_DEFAULTS
,
.
opcode
=
FMC_ACTIVE_CLK_OPCODE_SI571_GET_DEFAULTS
,
.
retval
=
DISP_ARG_END
,
.
retval_owner
=
DISP_OWNER_OTHER
,
.
args
=
{
DISP_ARG_ENCODE
(
DISP_ATYPE_UINT32
,
uint32_t
),
DISP_ARG_ENCODE
(
DISP_ATYPE_DOUBLE
,
double
),
DISP_ARG_END
}
};
/* Exported function description */
const
disp_op_t
*
fmc_active_clk_exp_ops
[]
=
{
&
fmc_active_clk_si571_oe_exp
,
&
fmc_active_clk_pll_func_exp
,
&
fmc_active_clk_pll_status_exp
,
&
fmc_active_clk_clk_sel_exp
,
&
fmc_active_clk_ad9510_cfg_defaults_exp
,
&
fmc_active_clk_ad9510_pll_a_div_exp
,
&
fmc_active_clk_ad9510_pll_b_div_exp
,
&
fmc_active_clk_ad9510_pll_prescaler_exp
,
&
fmc_active_clk_ad9510_r_div_exp
,
&
fmc_active_clk_ad9510_pll_pdown_exp
,
&
fmc_active_clk_ad9510_mux_status_exp
,
&
fmc_active_clk_ad9510_cp_current_exp
,
&
fmc_active_clk_ad9510_outputs_exp
,
&
fmc_active_clk_ad9510_pll_clk_sel_exp
,
&
fmc_active_clk_si571_set_freq_exp
,
&
fmc_active_clk_si571_get_defaults_exp
,
NULL
};
src/sm_io/modules/fmc_active_clk/sm_io_fmc_active_clk_exports.h
0 → 100644
View file @
444378c7
/*
* 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_ACTIVE_CLK_EXPORTS_H_
#define _SM_IO_FMC_ACTIVE_CLK_EXPORTS_H_
#include "disptable.h"
extern
disp_op_t
fmc_active_clk_si571_oe_exp
;
extern
disp_op_t
fmc_active_clk_pll_func_exp
;
extern
disp_op_t
fmc_active_clk_pll_status_exp
;
extern
disp_op_t
fmc_active_clk_clk_sel_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_cfg_defaults_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_pll_a_div_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_pll_b_div_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_pll_prescaler_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_r_div_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_pll_pdown_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_mux_status_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_cp_current_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_outputs_exp
;
extern
disp_op_t
fmc_active_clk_ad9510_pll_clk_sel_exp
;
extern
disp_op_t
fmc_active_clk_si571_set_freq_exp
;
extern
disp_op_t
fmc_active_clk_si571_get_defaults_exp
;
extern
const
disp_op_t
*
fmc_active_clk_exp_ops
[];
#endif
src/sm_io/modules/modules.mk
View file @
444378c7
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/fmc_active_clk/fmc_active_clk.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 \
...
...
@@ -13,6 +14,7 @@ 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_fmc_active_clk_OBJS) \
$(sm_io_acq_OBJS) \
$(sm_io_dsp_OBJS) \
$(sm_io_swap_OBJS) \
...
...
src/sm_io/modules/sm_io_codes.c
View file @
444378c7
...
...
@@ -13,6 +13,7 @@ const disp_op_t **smio_exp_ops [] = {
fmc130m_4ch_exp_ops
,
fmc250m_4ch_exp_ops
,
fmc_adc_common_exp_ops
,
fmc_active_clk_exp_ops
,
swap_exp_ops
,
rffe_exp_ops
,
afc_diag_exp_ops
,
...
...
src/sm_io/modules/sm_io_codes.h
View file @
444378c7
...
...
@@ -25,6 +25,7 @@ typedef struct _smio_rffe_version_t smio_rffe_version_t;
#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_fmc_active_clk_codes.h"
#include "sm_io_acq_codes.h"
#include "sm_io_dsp_codes.h"
#include "sm_io_swap_codes.h"
...
...
@@ -35,6 +36,7 @@ typedef struct _smio_rffe_version_t smio_rffe_version_t;
#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_fmc_active_clk_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