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
8f65da09
Commit
8f65da09
authored
Dec 05, 2014
by
Lucas Russo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel-luc' into smio_fmc130m_active
parents
812d118f
79cd3626
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
25 deletions
+79
-25
sm_ch_ad9510.c
hal/sm_io/chips/sm_ch_ad9510.c
+13
-2
sm_ch_si57x.c
hal/sm_io/chips/sm_ch_si57x.c
+5
-5
sm_io_fmc130m_4ch_codes.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_codes.h
+3
-1
sm_io_fmc130m_4ch_core.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.h
+0
-12
sm_io_fmc130m_4ch_defaults.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_defaults.c
+8
-0
sm_io_fmc130m_4ch_defaults.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_defaults.h
+3
-2
sm_io_fmc130m_4ch_exp.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
+32
-1
bpm_client.c
libclient/bpm_client.c
+8
-1
bpm_client.h
libclient/bpm_client.h
+3
-1
rw_param_client.h
libclient/rw_param_client.h
+4
-0
No files found.
hal/sm_io/chips/sm_ch_ad9510.c
View file @
8f65da09
...
...
@@ -473,6 +473,9 @@ smch_err_e smch_ad9510_outputs (smch_ad9510_t *self, uint32_t out_en)
uint32_t
__out_en
=
AD9510_OUTPUT_EN_R
(
out_en
);
uint8_t
data
=
0
;
DBE_DEBUG
(
DBG_SM_CH
|
DBG_LVL_TRACE
,
"[sm_ch:ad9510] Output control enable word: 0x%02X
\n
"
,
__out_en
);
uint32_t
i
;
/* LVPECL outputs */
for
(
i
=
0
;
i
<
AD9510_NUM_LVPECL_OUTPUTS
;
++
i
,
__out_en
>>=
...
...
@@ -482,11 +485,15 @@ smch_err_e smch_ad9510_outputs (smch_ad9510_t *self, uint32_t out_en)
/* Output disabled */
if
((
__out_en
&
AD9510_OUTPUT_EN_LSB_MASK
)
==
0
)
{
DBE_DEBUG
(
DBG_SM_CH
|
DBG_LVL_INFO
,
"[sm_ch:ad9510] Output #%u is going to be disabled
\n
"
,
i
);
data
=
(
data
&
~
AD9510_LVPECL_OUT_PDOWN_MASK
)
|
AD9510_LVPECL_OUT_PDOWN_W
(
0x02
);
/* Safe power down */
}
/* Output enabled */
else
{
DBE_DEBUG
(
DBG_SM_CH
|
DBG_LVL_INFO
,
"[sm_ch:ad9510] Output #%u is going to be enabled
\n
"
,
i
);
data
=
(
data
&
~
AD9510_LVPECL_OUT_PDOWN_MASK
)
|
AD9510_LVPECL_OUT_PDOWN_W
(
0x00
);
/* Power up */
}
...
...
@@ -501,11 +508,15 @@ smch_err_e smch_ad9510_outputs (smch_ad9510_t *self, uint32_t out_en)
/* Output disabled */
if
((
__out_en
&
AD9510_OUTPUT_EN_LSB_MASK
)
==
0
)
{
data
&=
AD9510_LVDS_CMOS_PDOWN
;
DBE_DEBUG
(
DBG_SM_CH
|
DBG_LVL_INFO
,
"[sm_ch:ad9510] Output #%u is going to be enabled
\n
"
,
i
);
data
|=
AD9510_LVDS_CMOS_PDOWN
;
}
/* Output enabled */
else
{
data
|=
AD9510_LVDS_CMOS_PDOWN
;
DBE_DEBUG
(
DBG_SM_CH
|
DBG_LVL_INFO
,
"[sm_ch:ad9510] Output #%u is going to be enabled
\n
"
,
i
);
data
&=
~
AD9510_LVDS_CMOS_PDOWN
;
}
_smch_ad9510_write_8
(
self
,
AD9510_REG_OUTPUT_START
+
i
,
&
data
);
}
...
...
hal/sm_io/chips/sm_ch_si57x.c
View file @
8f65da09
...
...
@@ -493,8 +493,8 @@ static smch_err_e _smch_si57x_calc_divs (smch_si57x_t *self, double frequency,
unsigned
int
n1
,
hs_div
;
double
fdco
,
best_fdco
=
DBL_MAX
;
double
rfreq_tmp
;
uint
16
_t
rfreq_integer
=
0
;
uint
32
_t
rfreq_frac
=
0
;
uint
64
_t
rfreq_integer
=
0
;
uint
64
_t
rfreq_frac
=
0
;
static
const
uint8_t
si57x_hs_div_values
[]
=
{
11
,
9
,
7
,
6
,
5
,
4
};
uint32_t
i
;
...
...
@@ -542,9 +542,9 @@ static smch_err_e _smch_si57x_calc_divs (smch_si57x_t *self, double frequency,
}
DBE_DEBUG
(
DBG_SM_CH
|
DBG_LVL_TRACE
,
"[sm_ch:si57x_calc_divs] Divider values:
\n
"
"
\t
frequency: %f, rfreq: %"
PRIu64
", rfreq_integer: %
u, rfreq_frac: %u
, "
"n1: %u, hs_div: %u
\n
"
,
frequency
,
*
out_rfreq
,
rfreq_integer
,
rfreq_frac
,
*
out_n1
,
*
out_hs_div
);
"
\t
frequency: %f, rfreq: %"
PRIu64
", rfreq_integer: %
"
PRIu64
"
, "
"rfreq_frac: %"
PRIu64
", n1: %u, hs_div: %u
\n
"
,
frequency
,
*
out_rfreq
,
rfreq_integer
,
rfreq_frac
,
*
out_n1
,
*
out_hs_div
);
return
err
;
}
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_codes.h
View file @
8f65da09
...
...
@@ -84,7 +84,9 @@
#define FMC130M_4CH_NAME_AD9510_PLL_CLK_SEL "ad9510_pll_clk_sel"
#define FMC130M_4CH_OPCODE_SI571_SET_FREQ 34
#define FMC130M_4CH_NAME_SI571_SET_FREQ "si571_set_freq"
#define FMC130M_4CH_OPCODE_END 35
#define FMC130M_4CH_OPCODE_SI571_GET_DEFAULTS 35
#define FMC130M_4CH_NAME_SI571_GET_DEFAULTS "si571_get_defaults"
#define FMC130M_4CH_OPCODE_END 36
/* Messaging Reply OPCODES */
#define FMC130M_4CH_REPLY_SIZE (sizeof(uint32_t))
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.h
View file @
8f65da09
...
...
@@ -32,18 +32,6 @@
/* Start writing on EEPROM address 0x0 */
#define FMC130M_4CH_EEPROM_START_ADDR 0x0
#define FMC130M_4CH_CHECK_ACTIVE(self) \
({ \
ASSERT_TEST(SMIO_FMC130_HANDLER(self)->type == \
TYPE_FMC130M_4CH_ACTIVE, \
"Board is not of ACTIVE type. Unimplemented " \
"function for this type of FMC130M_4CH board", \
err_uninp_func, \
-FMC130M_4CH_UNINPL); \
err_uninp_func: \
return err; \
})
enum
_fmc130m_4ch_type_e
{
TYPE_FMC130M_4CH_UNDEF
=
0xFF
,
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_defaults.c
View file @
8f65da09
...
...
@@ -58,6 +58,14 @@ smio_err_e fmc130m_4ch_config_defaults (char *broker_endp, char *service,
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
,
FMC130M_4CH_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
,
FMC130M_4CH_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
,
FMC130M_4CH_DFLT_SI571_OE
);
ASSERT_TEST
(
client_err
==
BPM_CLIENT_SUCCESS
,
"Could not enable SI571 Output"
,
err_param_set
,
SMIO_ERR_CONFIG_DFLT
);
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_defaults.h
View file @
8f65da09
...
...
@@ -9,14 +9,15 @@
#define _FMC130M_4CH_DEFAULTS_H_
#include "sm_io_err.h"
#include "s
m_ch_si57x
.h"
#include "s
i57x_regs
.h"
#include "sm_ch_pca9547.h"
#define FMC130M_4CH_DFLT_PLL_FUNC 0x1
#define FMC130M_4CH_DFLT_PCA9547_CFG SMCH_PCA9547_NO_CHANNEL
/* No channel selected */
#define FMC130M_4CH_DFLT_SI571_OE 0x1
#define FMC130M_4CH_DFLT_SI57X_FOUT_FACTORY SMCH_SI57X_FOUT_FACTORY_DFLT
#define FMC130M_4CH_DFLT_SI57X_FOUT_FACTORY SI57X_FOUT_FACTORY_DFLT
#define FMC130M_4CH_DFLT_SI57X_FOUT 100000000
/* 100 MHz default */
smio_err_e
fmc130m_4ch_config_defaults
(
char
*
broker_endp
,
char
*
service
,
const
char
*
log_file_name
);
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
View file @
8f65da09
...
...
@@ -40,6 +40,17 @@
CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc130m_4ch_exp]", \
smio_err_str (err_type))
#define FMC130M_4CH_CHECK_ACTIVE(self) \
({ \
if (SMIO_FMC130_HANDLER(self)->type != \
TYPE_FMC130M_4CH_ACTIVE) { \
DBE_DEBUG (DBG_SM_IO | DBG_LVL_ERR, "[sm_io:fmc130m_4ch_exp] "\
"Board is not of ACTIVE type. Unimplemented " \
"function for this type of FMC130M_4CH board"); \
return -FMC130M_4CH_UNINPL; \
} \
})
/************************************************************/
/************ Specific FMC_130M_4CH Operations **************/
/************************************************************/
...
...
@@ -925,7 +936,7 @@ typedef smch_err_e (*smch_si57x_func_fp) (smch_si57x_t *self, double param);
smch_si57x_t *smch_si57x = SMIO_SI57X_HANDLER(self); \
uint32_t rw = *(uint32_t *) EXP_MSG_ZMQ_FIRST_ARG(args); \
(void) rw;
/* Ignored for now */
\
uint32_t param = *(uint32_t *) EXP_MSG_ZMQ_NEXT_ARG(args);
\
double param = *(uint32_t *) EXP_MSG_ZMQ_NEXT_ARG(args);
\
\
FMC130M_4CH_CHECK_ACTIVE(self); \
\
...
...
@@ -958,6 +969,25 @@ disp_op_t fmc130m_4ch_si571_set_freq_exp = {
}
};
FMC130M_4CH_SI571_FUNC_NAME_HEADER
(
get_defaults
)
{
FMC130M_4CH_SI571_FUNC_BODY
(
owner
,
args
,
ret
,
smch_si57x_get_defaults
,
"Could not restart SI571 to its defaults"
);
}
disp_op_t
fmc130m_4ch_si571_get_defaults_exp
=
{
.
name
=
FMC130M_4CH_NAME_SI571_GET_DEFAULTS
,
.
opcode
=
FMC130M_4CH_OPCODE_SI571_GET_DEFAULTS
,
.
func_fp
=
FMC130M_4CH_SI571_FUNC_NAME
(
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
}
};
const
disp_op_t
*
fmc130m_exp_ops
[]
=
{
&
fmc130m_4ch_leds_exp
,
&
fmc130m_4ch_pll_func_exp
,
...
...
@@ -994,6 +1024,7 @@ const disp_op_t *fmc130m_exp_ops [] = {
&
fmc130m_4ch_ad9510_outputs_exp
,
&
fmc130m_4ch_ad9510_pll_clk_sel_exp
,
&
fmc130m_4ch_si571_set_freq_exp
,
&
fmc130m_4ch_si571_get_defaults_exp
,
&
disp_op_end
};
...
...
libclient/bpm_client.c
View file @
8f65da09
...
...
@@ -480,12 +480,19 @@ PARAM_FUNC_CLIENT_WRITE(ad9510_pll_clk_sel)
}
/* SI571 Set frequency */
PARAM_FUNC_CLIENT_WRITE
(
si571_set_freq
)
PARAM_FUNC_CLIENT_WRITE
_DOUBLE
(
si571_set_freq
)
{
return
param_client_write_double
(
self
,
service
,
FMC130M_4CH_OPCODE_SI571_SET_FREQ
,
si571_set_freq
);
}
/* SI571 Get defaults */
PARAM_FUNC_CLIENT_WRITE_DOUBLE
(
si571_defaults
)
{
return
param_client_write_double
(
self
,
service
,
FMC130M_4CH_OPCODE_SI571_GET_DEFAULTS
,
si571_defaults
);
}
/****************** ACQ SMIO Functions ****************/
#define MIN_WAIT_TIME 1
/* in ms */
#define MSECS 1000
/* in seconds */
...
...
libclient/bpm_client.h
View file @
8f65da09
...
...
@@ -233,7 +233,9 @@ bpm_client_err_e bpm_set_ad9510_pll_clk_sel (bpm_client_t *self, char *service,
* Returns BPM_CLIENT_SUCCESS if ok and BPM_CLIIENT_ERR_SERVER if
* if server could not complete the request */
bpm_client_err_e
bpm_set_si571_set_freq
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
si571_set_freq
);
double
si571_set_freq
);
bpm_client_err_e
bpm_set_si571_defaults
(
bpm_client_t
*
self
,
char
*
service
,
double
si571_defaults
);
/********************** ACQ SMIO Functions ********************/
...
...
libclient/rw_param_client.h
View file @
8f65da09
...
...
@@ -34,6 +34,10 @@
bpm_client_err_e PARAM_FUNC_CLIENT_NAME_WRITE(reg) (bpm_client_t *self, \
char *service, uint32_t reg)
#define PARAM_FUNC_CLIENT_WRITE_DOUBLE(reg) \
bpm_client_err_e PARAM_FUNC_CLIENT_NAME_WRITE(reg) (bpm_client_t *self, \
char *service, double reg)
#define PARAM_FUNC_CLIENT_WRITE2(reg, param1, param2) \
bpm_client_err_e PARAM_FUNC_CLIENT_NAME_WRITE(reg) (bpm_client_t *self, \
char *service, uint32_t param1, uint32_t param2)
...
...
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