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
3c118d68
Commit
3c118d68
authored
Mar 05, 2015
by
henrique-silva
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6 from lerwys/devel-luc
Devel luc
parents
2991fdf5
4af176e4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
674 additions
and
276 deletions
+674
-276
acq.c
examples/acq.c
+4
-4
dsp_swap.c
examples/dsp_swap.c
+77
-19
fmc130m_4ch_ctl.c
examples/fmc130m_4ch_ctl.c
+20
-0
libmdp
foreign/libmdp
+1
-1
dev_io.c
hal/dev_io/dev_io.c
+5
-0
dev_io_core.c
hal/dev_io/dev_io_core.c
+82
-76
dev_io_core.h
hal/dev_io/dev_io_core.h
+1
-1
dev_io_err.c
hal/dev_io/dev_io_err.c
+2
-1
dev_io_err.h
hal/dev_io/dev_io_err.h
+1
-0
dev_mngr_core.c
hal/dev_mngr/dev_mngr_core.c
+0
-4
dispatch_table.c
hal/hal_utils/dispatch_table.c
+79
-56
hal_utils.c
hal/hal_utils/hal_utils.c
+42
-8
hal_utils.h
hal/hal_utils/hal_utils.h
+18
-2
ddr3_map_afcv3.h
hal/include/board/afcv3/ddr3_map_afcv3.h
+18
-18
ddr3_map_ml605.h
hal/include/board/ml605/ddr3_map_ml605.h
+8
-8
sm_io_acq_codes.h
hal/sm_io/modules/acq/sm_io_acq_codes.h
+1
-1
sm_io_acq_exp.c
hal/sm_io/modules/acq/sm_io_acq_exp.c
+10
-2
sm_io_fmc130m_4ch_codes.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_codes.h
+45
-37
sm_io_fmc130m_4ch_core.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.c
+1
-0
sm_io_fmc130m_4ch_exp.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
+48
-0
sm_io_fmc130m_4ch_exports.c
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exports.c
+52
-0
sm_io_fmc130m_4ch_exports.h
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exports.h
+4
-0
sm_io.h
hal/sm_io/sm_io.h
+5
-0
sm_io_bootstrap.c
hal/sm_io/sm_io_bootstrap.c
+55
-19
sm_io_err.c
hal/sm_io/sm_io_err.c
+11
-9
sm_io_err.h
hal/sm_io/sm_io_err.h
+2
-0
Makefile
libclient/Makefile
+4
-0
bpm_client.c
libclient/bpm_client.c
+44
-0
bpm_client.h
libclient/bpm_client.h
+23
-0
deploy.sh
scripts/deploy.sh
+11
-10
No files found.
examples/acq.c
View file @
3c118d68
...
...
@@ -28,7 +28,7 @@
void
print_data
(
uint32_t
chan
,
uint32_t
*
data
,
uint32_t
size
)
{
/* FIXME: Make it more generic */
if
(
chan
==
0
||
chan
==
9
)
{
if
(
chan
==
0
/* Only ADC */
)
{
int16_t
*
raw_data16
=
(
int16_t
*
)
data
;
for
(
uint32_t
i
=
0
;
i
<
(
size
/
sizeof
(
uint16_t
))
/
4
;
i
++
)
{
if
(
zctx_interrupted
)
{
...
...
@@ -66,6 +66,7 @@ void print_help (char *program_name)
"
\t
-b <broker_endpoint> Broker endpoint
\n
"
"
\t
-s <num_samples_str> Number of samples
\n
"
"
\t
-board <AMC board = [0|1|2|3|4|5]>
\n
"
"
\t
-bpm <BPM number = [0|1]>
\n
"
"
\t
-ch <chan_str> Acquisition channel
\n
"
,
program_name
);
}
...
...
@@ -155,10 +156,10 @@ int main (int argc, char *argv [])
else
{
chan
=
strtoul
(
chan_str
,
NULL
,
10
);
if
(
chan
>
MAX_NUM_CHANS
)
{
if
(
chan
>
END_CHAN_ID
-
1
)
{
fprintf
(
stderr
,
"[client:acq]: Channel number too big! Defaulting to: %u
\n
"
,
MAX_NUM_CHANS
);
chan
=
MAX_NUM_CHANS
;
chan
=
END_CHAN_ID
-
1
;
}
}
//fprintf (stdout, "[client:acq]: chan = %u\n", chan);
...
...
@@ -202,7 +203,6 @@ int main (int argc, char *argv [])
uint32_t
data_size
=
num_samples
*
acq_chan
[
chan
].
sample_size
;
uint32_t
*
data
=
(
uint32_t
*
)
zmalloc
(
data_size
*
sizeof
(
uint8_t
));
//bool new_acq = false;
bool
new_acq
=
true
;
acq_trans_t
acq_trans
=
{.
req
=
{
.
num_samples
=
num_samples
,
...
...
examples/dsp_swap.c
View file @
3c118d68
...
...
@@ -26,6 +26,10 @@ void print_help (char *program_name)
"
\t
-board <AMC board = [0|1|2|3|4|5]>
\n
"
"
\t
-bpm <BPM number = [0|1]>
\n
"
"
\t
-b <broker_endpoint> Broker endpoint
\n
"
"
\t
-sw <Switching = [0|1]> Start switching counters
\n
"
"
\t
-sw_en <Switching enable= [0|1]> Enable switching outputs
\n
"
"
\t
-div_clk <Switching divider = [0 to ADC clock period]> Switching clock divider
\n
"
"
\t
-sw_dly <Switching/Deswitching delay = [0 to ADC clock period]> Switching/Deswitching delay
\n
"
,
program_name
);
}
...
...
@@ -35,6 +39,10 @@ int main (int argc, char *argv [])
char
*
broker_endp
=
NULL
;
char
*
board_number_str
=
NULL
;
char
*
bpm_number_str
=
NULL
;
char
*
sw_str
=
NULL
;
char
*
sw_en_str
=
NULL
;
char
*
div_clk_str
=
NULL
;
char
*
sw_dly_str
=
NULL
;
char
**
str_p
=
NULL
;
if
(
argc
<
3
)
{
...
...
@@ -64,6 +72,18 @@ int main (int argc, char *argv [])
{
str_p
=
&
bpm_number_str
;
}
else
if
(
streq
(
argv
[
i
],
"-sw"
))
{
str_p
=
&
sw_str
;
}
else
if
(
streq
(
argv
[
i
],
"-sw_en"
))
{
str_p
=
&
sw_en_str
;
}
else
if
(
streq
(
argv
[
i
],
"-div_clk"
))
{
str_p
=
&
div_clk_str
;
}
else
if
(
streq
(
argv
[
i
],
"-sw_dly"
))
{
str_p
=
&
sw_dly_str
;
}
else
if
(
streq
(
argv
[
i
],
"-b"
))
{
str_p
=
&
broker_endp
;
}
...
...
@@ -184,31 +204,56 @@ int main (int argc, char *argv [])
ksum_get
);
uint32_t
sw
=
0
;
err
=
bpm_set_sw
(
bpm_client
,
service_swap
,
sw
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:swap]: bpm_set_sw failed
\n
"
);
goto
err_bpm_set
;
if
(
sw_str
!=
NULL
)
{
sw
=
strtoul
(
sw_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: sw = %u
\n
"
,
sw
);
err
=
bpm_set_sw
(
bpm_client
,
service_swap
,
sw
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_sw failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_sw was successfully executed
\n
"
);
}
fprintf
(
stdout
,
"[client:swap]: bpm_set_sw = %u was successfully executed
\n
"
,
sw
);
uint32_t
sw_en
=
0
;
err
=
bpm_set_sw_en
(
bpm_client
,
service_swap
,
sw_en
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:swap]: bpm_set_sw_en failed
\n
"
);
goto
err_bpm_set
;
if
(
sw_en_str
!=
NULL
)
{
sw_en
=
strtoul
(
sw_en_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: sw_en = %u
\n
"
,
sw_en
);
err
=
bpm_set_sw_en
(
bpm_client
,
service_swap
,
sw_en
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_sw_en failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_sw_en was successfully executed
\n
"
);
}
fprintf
(
stdout
,
"[client:swap]: bpm_set_sw_en = %u was successfully executed
\n
"
,
sw_en
);
uint32_t
div_clk
=
250
;
err
=
bpm_set_div_clk
(
bpm_client
,
service_swap
,
div_clk
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:swap]: bpm_set_div_clk failed
\n
"
);
goto
err_bpm_set
;
uint32_t
div_clk
=
0
;
if
(
div_clk_str
!=
NULL
)
{
div_clk
=
strtoul
(
div_clk_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: div_clk = %u
\n
"
,
div_clk
);
err
=
bpm_set_div_clk
(
bpm_client
,
service_swap
,
div_clk
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_div_clk failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_div_clk was successfully executed
\n
"
);
}
uint32_t
sw_dly
=
0
;
if
(
sw_dly_str
!=
NULL
)
{
sw_dly
=
strtoul
(
sw_dly_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: sw_dly = %u
\n
"
,
sw_dly
);
err
=
bpm_set_sw_dly
(
bpm_client
,
service_swap
,
sw_dly
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_sw_dly failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_sw_dly was successfully executed
\n
"
);
}
fprintf
(
stdout
,
"[client:swap]: bpm_set_div_clk = %u was successfully executed
\n
"
,
div_clk
);
uint32_t
gain_aa
=
32768
;
uint32_t
gain_ac
=
32768
;
...
...
@@ -244,9 +289,22 @@ int main (int argc, char *argv [])
fprintf
(
stdout
,
"[client:swap]: bpm_set_gain_d = direct %u, inverted %u was successfully executed
\n
"
,
gain_aa
,
gain_ac
);
err_bpm_exit:
err_bpm_get:
err_bpm_set:
bpm_client_destroy
(
&
bpm_client
);
str_p
=
&
div_clk_str
;
free
(
*
str_p
);
div_clk_str
=
NULL
;
str_p
=
&
sw_dly_str
;
free
(
*
str_p
);
sw_dly_str
=
NULL
;
str_p
=
&
sw_str
;
free
(
*
str_p
);
sw_str
=
NULL
;
str_p
=
&
sw_en_str
;
free
(
*
str_p
);
sw_en_str
=
NULL
;
str_p
=
&
broker_endp
;
free
(
*
str_p
);
broker_endp
=
NULL
;
...
...
examples/fmc130m_4ch_ctl.c
View file @
3c118d68
...
...
@@ -38,6 +38,7 @@ int main (int argc, char *argv [])
char
*
board_number_str
=
NULL
;
char
*
bpm_number_str
=
NULL
;
char
*
trig_dir_str
=
NULL
;
char
*
trig_term_str
=
NULL
;
uint32_t
get_pll_status
=
0
;
char
**
str_p
=
NULL
;
...
...
@@ -78,6 +79,9 @@ int main (int argc, char *argv [])
else
if
(
streq
(
argv
[
i
],
"-trig_dir"
))
{
str_p
=
&
trig_dir_str
;
}
else
if
(
streq
(
argv
[
i
],
"-trig_term"
))
{
str_p
=
&
trig_term_str
;
}
/* Fallout for options with parameters */
else
{
*
str_p
=
strdup
(
argv
[
i
]);
...
...
@@ -143,6 +147,19 @@ int main (int argc, char *argv [])
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_trig_dir was successfully executed
\n
"
);
}
uint32_t
trig_term
=
0
;
if
(
trig_term_str
!=
NULL
)
{
trig_term
=
strtoul
(
trig_term_str
,
NULL
,
10
);
fprintf
(
stdout
,
"[client:fmc130m_4ch]: trig_term = %u
\n
"
,
trig_term
);
err
=
bpm_set_trig_term
(
bpm_client
,
service
,
trig_term
);
if
(
err
!=
BPM_CLIENT_SUCCESS
){
fprintf
(
stderr
,
"[client:fmc130m_4ch]: bpm_set_trig_term failed
\n
"
);
goto
err_bpm_exit
;
}
fprintf
(
stdout
,
"[client:fmc130m_4ch]: bpm_set_trig_term was successfully executed
\n
"
);
}
if
(
get_pll_status
)
{
uint32_t
pll_status
=
0
;
bpm_client_err_e
err
=
bpm_get_fmc_pll_status
(
bpm_client
,
service
,
&
pll_status
);
...
...
@@ -156,6 +173,9 @@ int main (int argc, char *argv [])
err_bpm_exit:
bpm_client_destroy
(
&
bpm_client
);
str_p
=
&
trig_term_str
;
free
(
*
str_p
);
trig_term_str
=
NULL
;
str_p
=
&
trig_dir_str
;
free
(
*
str_p
);
trig_dir_str
=
NULL
;
...
...
libmdp
@
5008743e
Subproject commit
16a0b9a4cf387148b77d874938b9dfec09f4eaa5
Subproject commit
5008743e14bf166304fa776e8b0601ca81b890fb
hal/dev_io/dev_io.c
View file @
3c118d68
...
...
@@ -178,6 +178,9 @@ int main (int argc, char *argv[])
dev_id
);
/* We don't need it anymore */
str_p
=
&
fe_smio_id_str
;
free
(
*
str_p
);
fe_smio_id_str
=
NULL
;
str_p
=
&
dev_type
;
free
(
*
str_p
);
dev_type
=
NULL
;
...
...
@@ -241,6 +244,8 @@ err_devio:
err_exit:
str_p
=
&
log_file_name
;
free
(
*
str_p
);
str_p
=
&
fe_smio_id_str
;
free
(
*
str_p
);
str_p
=
&
broker_endp
;
free
(
*
str_p
);
str_p
=
&
dev_id_str
;
...
...
hal/dev_io/dev_io_core.c
View file @
3c118d68
...
...
@@ -50,8 +50,9 @@
/* Do the SMIO operation */
static
devio_err_e
_devio_do_smio_op
(
devio_t
*
self
,
void
*
msg
);
static
void
_devio_destroy_smio
(
devio_t
*
self
,
uint32_t
smio_id
);
static
void
_devio_destroy_smio_all
(
devio_t
*
self
);
static
devio_err_e
_devio_send_destruct_msg
(
devio_t
*
self
,
void
*
pipe
);
static
devio_err_e
_devio_destroy_smio
(
devio_t
*
self
,
const
char
*
smio_key
);
static
devio_err_e
_devio_destroy_smio_all
(
devio_t
*
self
);
/* Creates a new instance of Device Information */
devio_t
*
devio_new
(
char
*
name
,
char
*
endpoint_dev
,
llio_type_e
type
,
...
...
@@ -233,9 +234,9 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
* the sm_io module */
th_boot_args_t
*
th_args
=
NULL
;
th_config_args_t
*
th_config_args
=
NULL
;
char
*
smio_service
=
NULL
;
void
*
config_pipe
=
NULL
;
char
*
key
=
NULL
;
uint32_t
pipe_idx
=
0
;
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] smio_mod_dispatch table size = %ld
\n
"
,
...
...
@@ -251,11 +252,20 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
/* Found! Call bootstrap code and insert in
* hash table */
/* FIXME: Why do I need this? smio always gets initilized
* after smio_mod_dispatch[i].bootstrap_ops->smio_boot (self); */
/* smio_t *smio = NULL; */
/* It is expected tha after the boot () call the operations
* this sm_io inscate can handle are already registered! */
/* Stringify ID. We do it before spawning a new thread as
* alloc can fail */
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Stringify hash ID
\n
"
);
char
*
inst_id_str
=
halutils_stringify_dec_key
(
inst_id
);
ASSERT_ALLOC
(
inst_id_str
,
err_inst_id_str_alloc
);
char
*
key
=
halutils_concat_strings_no_sep
(
smio_mod_dispatch
[
i
].
name
,
inst_id_str
);
/* We don't need this anymore */
free
(
inst_id_str
);
inst_id_str
=
NULL
;
ASSERT_ALLOC
(
key
,
err_key_alloc
);
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Allocating thread args
\n
"
);
...
...
@@ -276,34 +286,25 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Calling boot func
\n
"
);
uint32_t
pipe_idx
=
self
->
nnodes
++
;
pipe_idx
=
self
->
nnodes
++
;
self
->
pipes
[
pipe_idx
]
=
zthread_fork
(
self
->
ctx
,
smio_startup
,
th_args
);
ASSERT_TEST
(
self
->
pipes
[
pipe_idx
]
!=
NULL
,
"Could not spawn SMIO thread"
,
err_spawn_smio_thread
);
/* self->pipes [pipe_idx] = zthread_fork (self->ctx,
smio_mod_dispatch[i].bootstrap_ops->thread_boot, th_args); */
/*smio = smio_mod_dispatch[i].bootstrap_ops->boot (self);*/
/*ASSERT_ALLOC (smio, err_smio_alloc); */
/* Stringify ID */
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Stringify hash ID
\n
"
);
char
*
key
=
halutils_stringify_hex_key
(
smio_mod_dispatch
[
i
].
id
);
ASSERT_ALLOC
(
key
,
err_key_alloc
);
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] Inserting hash with key: %s
\n
"
,
key
);
zhash_insert
(
self
->
sm_io_h
,
key
,
self
->
pipes
[
pipe_idx
]);
int
zerr
=
zhash_insert
(
self
->
sm_io_h
,
key
,
self
->
pipes
[
pipe_idx
]);
/* We must not fail here, as we will loose our reference to the SMIO
* thread otherwise */
ASSERT_TEST
(
zerr
==
0
,
"Could not insert PIPE hash key. Duplicated value?"
,
err_pipe_hash_insert
);
/* Configure default values of the recently created SMIO using the
* bootstrap registered function config_defaults () */
smio_service
=
halutils_concat_strings
(
th_args
->
service
,
smio_mod_dispatch
[
th_args
->
smio_id
].
name
,
':'
);
ASSERT_ALLOC
(
smio_service
,
err_smio_service_alloc
);
/* Now, we create a short lived thread just to configure our SMIO */
/* Allo
a
cate config thread arguments struct and pass it to the
/* Allocate config thread arguments struct and pass it to the
* thread. It is the responsability of the calling thread
* to clear this structure after using it! */
th_config_args
=
zmalloc
(
sizeof
*
th_config_args
);
...
...
@@ -324,24 +325,27 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
break
;
}
/* On success, just "key"" is not deallocated. All of the other
* allocated parameters are either free'd or its ownership
* is transfered to the calling function/thread */
free
(
key
);
return
DEVIO_SUCCESS
;
err_spawn_config_thread:
free
(
smio_service
);
/* FIXME: Destroy SMIO thread as we could configure it? */
free
(
th_config_args
);
/* FIXME: Destroy SMIO thread? */
_devio_destroy_smio
(
self
,
smio_id
);
err_th_config_args_alloc:
free
(
smio_service
);
err_smio_service_alloc:
free
(
key
);
err_key_alloc:
/* This is safe to call more than once */
_devio_destroy_smio
(
self
,
smio_id
);
zhash_delete
(
self
->
sm_io_h
,
key
);
err_pipe_hash_insert:
/* If we can't insert the SMIO thread key in hash,
* destroy it as we won't have a reference to it later! */
_devio_send_destruct_msg
(
self
,
self
->
pipes
[
pipe_idx
]);
err_spawn_smio_thread:
free
(
th_args
);
err_th_args_alloc:
free
(
key
);
err_key_alloc:
err_inst_id_str_alloc:
return
DEVIO_ERR_ALLOC
;
}
...
...
@@ -353,19 +357,14 @@ devio_err_e devio_register_all_sm (devio_t *self)
return
DEVIO_ERR_FUNC_NOT_IMPL
;
}
devio_err_e
devio_unregister_sm
(
devio_t
*
self
,
uint32_t
smio_id
,
uint32_t
inst_id
)
devio_err_e
devio_unregister_sm
(
devio_t
*
self
,
const
char
*
smio_key
)
{
(
void
)
self
;
(
void
)
smio_id
;
(
void
)
inst_id
;
return
DEVIO_ERR_FUNC_NOT_IMPL
;
return
_devio_destroy_smio
(
self
,
smio_key
);
}
devio_err_e
devio_unregister_all_sm
(
devio_t
*
self
)
{
(
void
)
self
;
return
DEVIO_ERR_FUNC_NOT_IMPL
;
return
_devio_destroy_smio_all
(
self
);
}
devio_err_e
devio_init_poller_sm
(
devio_t
*
self
)
...
...
@@ -517,69 +516,76 @@ err_hand_req:
return
err
;
}
static
void
_devio_destroy_smio_all
(
devio_t
*
self
)
static
devio_err_e
_devio_destroy_smio_all
(
devio_t
*
self
)
{
#if 0
unsigned i;
for (i = 0; i < self->nnodes; ++i) {
/* This cannot fail at this point... but it can */
zmsg_t *msg = zmsg_new ();
/* An empty message means to selfdestruct */
zmsg_pushstr (msg, "");
zmsg_send (&msg, self->pipes [i]);
}
#endif
assert
(
self
);
devio_err_e
err
=
DEVIO_SUCCESS
;
/* Get all hash keys */
zlist_t
*
hash_keys
=
zhash_keys
(
self
->
sm_io_h
);
ASSERT_ALLOC
(
hash_keys
,
err_hash_keys_alloc
);
ASSERT_ALLOC
(
hash_keys
,
err_hash_keys_alloc
,
DEVIO_ERR_ALLOC
);
char
*
hash_item
=
zlist_first
(
hash_keys
);
/* Iterate over all keys removing each of one */
for
(;
hash_item
!=
NULL
;
hash_item
=
zlist_next
(
hash_keys
))
{
/* FIXME: Usage of stroul fucntion for reconverting the string
* into a uint32_t */
_devio_destroy_smio
(
self
,
(
uint32_t
)
strtoul
(
hash_item
,
(
char
**
)
NULL
,
16
));
err
=
_devio_destroy_smio
(
self
,
hash_item
);
ASSERT_TEST
(
err
==
DEVIO_SUCCESS
,
"Could not destroy SMIO "
"instance"
,
err_smio_destroy
,
DEVIO_ERR_SMIO_DESTROY
);
}
err_smio_destroy:
zlist_destroy
(
&
hash_keys
);
err_hash_keys_alloc:
return
;
return
err
;
}
static
void
_devio_destroy_smio
(
devio_t
*
self
,
uint32_t
smio_id
)
static
devio_err_e
_devio_send_destruct_msg
(
devio_t
*
self
,
void
*
pipe
)
{
assert
(
self
);
assert
(
pipe
);
/* Stringify ID */
char
*
key_c
=
halutils_stringify_hex_key
(
smio_id
);
ASSERT_ALLOC
(
key_c
,
err_key_alloc
);
/* Lookup SMIO reference in hash table */
void
*
pipe
=
zhash_lookup
(
self
->
sm_io_h
,
key_c
);
ASSERT_TEST
(
pipe
!=
NULL
,
"Could not find SMIO registered with this ID"
,
err_hash_lookup
);
devio_err_e
err
=
DEVIO_SUCCESS
;
/* Send message to SMIO informing it to destroy itself */
/* This cannot fail at this point... but it can */
zmsg_t
*
send_msg
=
zmsg_new
();
ASSERT_ALLOC
(
send_msg
,
err_msg_alloc
);
ASSERT_ALLOC
(
send_msg
,
err_msg_alloc
,
DEVIO_ERR_ALLOC
);
/* An empty message means to selfdestruct */
zmsg_pushstr
(
send_msg
,
""
);
int
zerr
=
zmsg_send
(
&
send_msg
,
pipe
);
ASSERT_TEST
(
zerr
==
0
,
"Could not send self-destruct message to SMIO instance"
,
err_send_msg
);
err_send_msg
,
DEVIO_ERR_SMIO_DESTROY
);
/* Finally, remove the pipe from hash */
zhash_delete
(
self
->
sm_io_h
,
key_c
);
DBE_DEBUG
(
DBG_DEV_MNGR
|
DBG_LVL_INFO
,
"[dev_io_core] Self-destruct message "
"to SMIO sent"
);
err_send_msg:
zmsg_destroy
(
&
send_msg
);
err_msg_alloc:
return
err
;
}
/* smio_key is the name of the SMIO + instance number, e.g.,
* FMC130M_4CH0*/
static
devio_err_e
_devio_destroy_smio
(
devio_t
*
self
,
const
char
*
smio_key
)
{
assert
(
self
);
devio_err_e
err
=
DEVIO_SUCCESS
;
/* Lookup SMIO reference in hash table */
void
*
pipe
=
zhash_lookup
(
self
->
sm_io_h
,
smio_key
);
ASSERT_TEST
(
pipe
!=
NULL
,
"Could not find SMIO registered with this ID"
,
err_hash_lookup
,
DEVIO_ERR_SMIO_DESTROY
);
err
=
_devio_send_destruct_msg
(
self
,
pipe
);
ASSERT_TEST
(
err
==
DEVIO_SUCCESS
,
"Could not send self-destruct message to "
"PIPE"
,
err_send_msg
,
DEVIO_ERR_SMIO_DESTROY
);
/* Finally, remove the pipe from hash. FIXME: What if the SMIO does not
* exit? We will loose its reference ...*/
zhash_delete
(
self
->
sm_io_h
,
smio_key
);
err_send_msg:
err_hash_lookup:
free
(
key_c
);
err_key_alloc:
return
;
return
err
;
}
hal/dev_io/dev_io_core.h
View file @
3c118d68
...
...
@@ -97,7 +97,7 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint32_t base,
/* Register all sm_io module that this device can handle,
* according to the device information stored in the SDB */
devio_err_e
devio_register_all_sm
(
devio_t
*
self
);
devio_err_e
devio_unregister_sm
(
devio_t
*
self
,
uint32_t
smio_id
,
uint32_t
inst_id
);
devio_err_e
devio_unregister_sm
(
devio_t
*
self
,
const
char
*
smio_key
);
devio_err_e
devio_unregister_all_sm
(
devio_t
*
self
);
/* Initilize poller with all of the initialized PIPE sockets */
devio_err_e
devio_init_poller_sm
(
devio_t
*
self
);
...
...
hal/dev_io/dev_io_err.c
View file @
3c118d68
...
...
@@ -22,7 +22,8 @@ static const char *devio_err [DEVIO_ERR_END] =
[
DEVIO_ERR_UNINIT_POLLER
]
=
"Poller uninitilized"
,
[
DEVIO_ERR_INTERRUPTED_POLLER
]
=
"Poller interrupted. zeroMQ context was terminated or received interrupt signal"
,
[
DEVIO_ERR_BAD_MSG
]
=
"Malformed message received"
,
[
DEVIO_ERR_TERMINATED
]
=
"Terminated devio instance"
[
DEVIO_ERR_TERMINATED
]
=
"Terminated devio instance"
,
[
DEVIO_ERR_SMIO_DESTROY
]
=
"Could not destroy sm_io instance"
};
/* Convert enumeration type to string */
...
...
hal/dev_io/dev_io_err.h
View file @
3c118d68
...
...
@@ -24,6 +24,7 @@ enum _devio_err_e
DEVIO_ERR_INTERRUPTED_POLLER
,
/* Poller interrupted. zeroMQ context was terminated or received interrupt signal */
DEVIO_ERR_BAD_MSG
,
/* Malformed message received */
DEVIO_ERR_TERMINATED
,
/* Terminated devio instance */
DEVIO_ERR_SMIO_DESTROY
,
/* Could not destroy sm_io instance */
DEVIO_ERR_END
/* End of enum marker */
};
...
...
hal/dev_mngr/dev_mngr_core.c
View file @
3c118d68
...
...
@@ -678,10 +678,6 @@ dmngr_err_e dmngr_get_hints (zconfig_t *root_cfg, zhash_t *hints_h)
}
}
/* As we only have strings in our hash, we can use the simple autofree
* feature to cleanly destroy the items later. */
zhash_autofree
(
hints_h
);
err_cfg_exit:
return
err
;
}
...
...
hal/hal_utils/dispatch_table.c
View file @
3c118d68
...
...
@@ -42,6 +42,9 @@
halutils_err_str (err_type))
static
halutils_err_e
_disp_table_insert
(
disp_table_t
*
self
,
const
disp_op_t
*
disp_op
);
static
halutils_err_e
_disp_table_insert_all
(
disp_table_t
*
self
,
const
disp_op_t
**
disp_ops
);
static
halutils_err_e
_disp_table_remove
(
disp_table_t
*
self
,
uint32_t
key
);
static
halutils_err_e
_disp_table_remove_all
(
disp_table_t
*
self
);
static
void
_disp_table_free_item
(
void
*
data
);
static
disp_op_t
*
_disp_table_lookup
(
disp_table_t
*
self
,
uint32_t
key
);
static
halutils_err_e
_disp_table_check_args_op
(
const
disp_op_t
*
disp_op
,
void
*
msg
);
...
...
@@ -84,6 +87,7 @@ halutils_err_e disp_table_destroy (disp_table_t **self_p)
if
(
*
self_p
)
{
disp_table_t
*
self
=
*
self_p
;
_disp_table_remove_all
(
self
);
zhash_destroy
(
&
self
->
table_h
);
free
(
self
);
*
self_p
=
NULL
;
...
...
@@ -99,69 +103,17 @@ halutils_err_e disp_table_insert (disp_table_t *self, const disp_op_t* disp_op)
halutils_err_e
disp_table_insert_all
(
disp_table_t
*
self
,
const
disp_op_t
**
disp_ops
)
{
assert
(
self
);
assert
(
disp_ops
);
halutils_err_e
err
=
HALUTILS_SUCCESS
;
const
disp_op_t
**
disp_op_it
=
disp_ops
;
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_TRACE
,
"[halutils:disp_table] Preparing to insert function in dispatch table
\n
"
);
for
(
;
*
disp_op_it
!=
NULL
;
++
disp_op_it
)
{
halutils_err_e
err
=
_disp_table_insert
(
self
,
*
disp_op_it
);
ASSERT_TEST
(
err
==
HALUTILS_SUCCESS
,
"disp_table_insert_all: Could not insert function"
,
err_disp_insert
);
}
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_TRACE
,
"[halutils:disp_table] Exiting insert_all
\n
"
);
err_disp_insert:
return
err
;
return
_disp_table_insert_all
(
self
,
disp_ops
);
}
halutils_err_e
disp_table_remove
(
disp_table_t
*
self
,
uint32_t
key
)
{
char
*
key_c
=
halutils_stringify_hex_key
(
key
);
ASSERT_ALLOC
(
key_c
,
err_key_c_alloc
);
/* Do a lookup first to free the return value */
disp_op_t
*
disp_op
=
_disp_table_lookup
(
self
,
key
);
ASSERT_TEST
(
disp_op
!=
NULL
,
"Could not find registered key"
,
err_disp_op_null
);
halutils_err_e
err
=
_disp_table_cleanup_args_op
(
disp_op
);
ASSERT_TEST
(
err
==
HALUTILS_SUCCESS
,
"Could not free registered return value"
,
err_disp_op_null
);
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_TRACE
,
"[halutils:disp_table] Removing function (key = %u) into dispatch table
\n
"
,
key
);
/* This will trigger the free function previously registered */
zhash_delete
(
self
->
table_h
,
key_c
);
free
(
key_c
);
return
HALUTILS_SUCCESS
;
err_disp_op_null:
free
(
key_c
);
err_key_c_alloc:
return
HALUTILS_ERR_ALLOC
;
return
_disp_table_remove
(
self
,
key
);
}
halutils_err_e
disp_table_remove_all
(
disp_table_t
*
self
)
{
assert
(
self
);
zlist_t
*
hash_keys
=
zhash_keys
(
self
->
table_h
);
void
*
table_item
=
zlist_first
(
hash_keys
);
for
(
;
table_item
;
table_item
=
zlist_next
(
hash_keys
))
{
zhash_delete
(
self
->
table_h
,
(
char
*
)
table_item
);
}
zlist_destroy
(
&
hash_keys
);
return
HALUTILS_SUCCESS
;
return
_disp_table_remove_all
(
self
);
}
halutils_err_e
disp_table_fill_desc
(
disp_table_t
*
self
,
disp_op_t
**
disp_ops
,
...
...
@@ -248,6 +200,50 @@ halutils_err_e disp_table_set_ret (disp_table_t *self, uint32_t key, void **ret)
/**** Local helper functions ****/
static
halutils_err_e
_disp_table_remove
(
disp_table_t
*
self
,
uint32_t
key
)
{
char
*
key_c
=
halutils_stringify_hex_key
(
key
);
ASSERT_ALLOC
(
key_c
,
err_key_c_alloc
);
/* Do a lookup first to free the return value */
disp_op_t
*
disp_op
=
_disp_table_lookup
(
self
,
key
);
ASSERT_TEST
(
disp_op
!=
NULL
,
"Could not find registered key"
,
err_disp_op_null
);
halutils_err_e
err
=
_disp_table_cleanup_args_op
(
disp_op
);
ASSERT_TEST
(
err
==
HALUTILS_SUCCESS
,
"Could not free registered return value"
,
err_disp_op_null
);
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_TRACE
,
"[halutils:disp_table] Removing function (key = %u) into dispatch table
\n
"
,
key
);
/* This will trigger the free function previously registered */
zhash_delete
(
self
->
table_h
,
key_c
);
free
(
key_c
);
return
HALUTILS_SUCCESS
;
err_disp_op_null:
free
(
key_c
);
err_key_c_alloc:
return
HALUTILS_ERR_ALLOC
;
}
static
halutils_err_e
_disp_table_remove_all
(
disp_table_t
*
self
)
{
assert
(
self
);
zlist_t
*
hash_keys
=
zhash_keys
(
self
->
table_h
);
void
*
table_item
=
zlist_first
(
hash_keys
);
for
(
;
table_item
;
table_item
=
zlist_next
(
hash_keys
))
{
_disp_table_remove
(
self
,
halutils_numerify_hex_key
((
char
*
)
table_item
));
}
zlist_destroy
(
&
hash_keys
);
return
HALUTILS_SUCCESS
;
}
static
halutils_err_e
_disp_table_insert
(
disp_table_t
*
self
,
const
disp_op_t
*
disp_op
)
{
assert
(
self
);
...
...
@@ -281,6 +277,30 @@ err_alloc_ret:
return
HALUTILS_ERR_ALLOC
;
}
static
halutils_err_e
_disp_table_insert_all
(
disp_table_t
*
self
,
const
disp_op_t
**
disp_ops
)
{
assert
(
self
);
assert
(
disp_ops
);
halutils_err_e
err
=
HALUTILS_SUCCESS
;
const
disp_op_t
**
disp_op_it
=
disp_ops
;
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_TRACE
,
"[halutils:disp_table] Preparing to insert function in dispatch table
\n
"
);
for
(
;
*
disp_op_it
!=
NULL
;
++
disp_op_it
)
{
halutils_err_e
err
=
_disp_table_insert
(
self
,
*
disp_op_it
);
ASSERT_TEST
(
err
==
HALUTILS_SUCCESS
,
"disp_table_insert_all: Could not insert function"
,
err_disp_insert
);
}
DBE_DEBUG
(
DBG_HAL_UTILS
|
DBG_LVL_TRACE
,
"[halutils:disp_table] Exiting insert_all
\n
"
);
err_disp_insert:
return
err
;
}
static
halutils_err_e
_disp_table_alloc_ret
(
const
disp_op_t
*
disp_op
,
void
**
ret
)
{
assert
(
disp_op
);
...
...
@@ -474,7 +494,10 @@ static halutils_err_e _disp_table_cleanup_args_op (const disp_op_t *disp_op)
goto
err_no_ownership
;
}
free
(
disp_op
->
ret
);
/* I know... But we have to free the item anyway */
disp_op_t
*
disp_op_tmp
=
(
disp_op_t
*
)
disp_op
;
free
(
disp_op_tmp
->
ret
);
}
err_no_ownership:
...
...
hal/hal_utils/hal_utils.c
View file @
3c118d68
...
...
@@ -36,7 +36,7 @@
halutils_err_str (err_type))
static
char
*
_halutils_concat_strings_raw
(
const
char
*
str1
,
const
char
*
str2
,
const
char
*
str3
,
char
sep
);
const
char
*
str3
,
bool
with_sep
,
char
sep
);
uint32_t
num_to_str_len
(
uint32_t
key
,
uint32_t
base
)
{
...
...
@@ -88,26 +88,55 @@ char *halutils_stringify_hex_key (uint32_t key)
return
halutils_stringify_key
(
key
,
16
);
}
uint32_t
halutils_numerify_key
(
const
char
*
key
,
uint32_t
base
)
{
return
strtoul
(
key
,
NULL
,
base
);
}
uint32_t
halutils_numerify_dec_key
(
const
char
*
key
)
{
return
halutils_numerify_key
(
key
,
10
);
}
uint32_t
halutils_numerify_hex_key
(
const
char
*
key
)
{
return
halutils_numerify_key
(
key
,
16
);
}
#define SEPARATOR_BYTES 1
/* FIXME: poorly written */
static
char
*
_halutils_concat_strings_raw
(
const
char
*
str1
,
const
char
*
str2
,
const
char
*
str3
,
char
sep
)
const
char
*
str3
,
bool
with_sep
,
char
sep
)
{
assert
(
str1
);
assert
(
str2
);
uint32_t
num_sep_bytes
=
(
with_sep
)
?
SEPARATOR_BYTES
:
0
;
char
*
str
=
NULL
;
if
(
str3
!=
NULL
)
{
str
=
zmalloc
(
strlen
(
str1
)
+
strlen
(
str2
)
+
strlen
(
str3
)
+
SEPARATOR_BYTES
/* separator length */
+
1
/* \0 */
);
num_sep_bytes
/* separator length */
+
1
/* \0 */
);
ASSERT_ALLOC
(
str
,
err_str3_alloc
);
sprintf
(
str
,
"%s%c%s%s"
,
str1
,
sep
,
str2
,
str3
);
if
(
with_sep
)
{
sprintf
(
str
,
"%s%c%s%s"
,
str1
,
sep
,
str2
,
str3
);
}
else
{
sprintf
(
str
,
"%s%s%s"
,
str1
,
str2
,
str3
);
}
}
else
{
str
=
zmalloc
(
strlen
(
str1
)
+
strlen
(
str2
)
+
SEPARATOR_BYTES
/* separator length */
+
1
/* \0 */
);
num_sep_bytes
/* separator length */
+
1
/* \0 */
);
ASSERT_ALLOC
(
str
,
err_str2_alloc
);
sprintf
(
str
,
"%s%c%s"
,
str1
,
sep
,
str2
);
if
(
with_sep
)
{
sprintf
(
str
,
"%s%c%s"
,
str1
,
sep
,
str2
);
}
else
{
sprintf
(
str
,
"%s%s"
,
str1
,
str2
);
}
}
return
str
;
...
...
@@ -119,11 +148,16 @@ err_str2_alloc:
char
*
halutils_concat_strings
(
const
char
*
str1
,
const
char
*
str2
,
char
sep
)
{
return
_halutils_concat_strings_raw
(
str1
,
str2
,
NULL
,
sep
);
return
_halutils_concat_strings_raw
(
str1
,
str2
,
NULL
,
true
,
sep
);
}
char
*
halutils_concat_strings_no_sep
(
const
char
*
str1
,
const
char
*
str2
)
{
return
_halutils_concat_strings_raw
(
str1
,
str2
,
NULL
,
false
,
0
);
}
char
*
halutils_concat_strings3
(
const
char
*
str1
,
const
char
*
str2
,
const
char
*
str3
,
char
sep
)
{
return
_halutils_concat_strings_raw
(
str1
,
str2
,
str3
,
sep
);
return
_halutils_concat_strings_raw
(
str1
,
str2
,
str3
,
true
,
sep
);
}
hal/hal_utils/hal_utils.h
View file @
3c118d68
...
...
@@ -31,11 +31,27 @@ char *halutils_stringify_dec_key (uint32_t key);
/* Allocates a string with the necessary size to fit an hexadecimal key */
char
*
halutils_stringify_hex_key
(
uint32_t
key
);
/* Concatenates 2 strings togheter with a separator. returns the string if
/* Converts a key string into the specified numeric base. Must fit into
* a uint32_t */
uint32_t
halutils_numerify_key
(
const
char
*
key
,
uint32_t
base
);
/* Converts a key string into the decimal base. Result must fit into
* a uint32_t */
uint32_t
halutils_numerify_dec_key
(
const
char
*
key
);
/* Converts a key string into the hexadecimal base. Result must fit into
* a uint32_t */
uint32_t
halutils_numerify_hex_key
(
const
char
*
key
);
/* Concatenates 2 strings together with a separator. returns the string if
* OK, NULL in case of error */
char
*
halutils_concat_strings
(
const
char
*
str1
,
const
char
*
str2
,
char
sep
);
/* Concatenates 3 strings togheter with a separator between the first and second
/* Concatenates 2 strings together without a separator. returns the string if
* OK, NULL in case of error */
char
*
halutils_concat_strings_no_sep
(
const
char
*
str1
,
const
char
*
str2
);
/* Concatenates 3 strings together with a separator between the first and second
* strings. returns the string if OK, NULL in case of error */
char
*
halutils_concat_strings3
(
const
char
*
str1
,
const
char
*
str2
,
const
char
*
str3
,
char
sep
);
...
...
hal/include/board/afcv3/ddr3_map_afcv3.h
View file @
3c118d68
This diff is collapsed.
Click to expand it.
hal/include/board/ml605/ddr3_map_ml605.h
View file @
3c118d68
...
...
@@ -28,7 +28,7 @@
#define DDR3_ADC0_MEM_SIZE 2
#define DDR3_ADC0_MEM_BOOL DDR3_MEM_BOOL(DDR3_ADC0_MEM_SIZE)
#define DDR3_ADC0_START_ADDR (DDR3_DUMMY_INIT0_START_ADDR + DDR3_
ADC
0_MEM_BOOL*DDR3_DUMMY_INIT0_SAMPLE_SIZE)
#define DDR3_ADC0_START_ADDR (DDR3_DUMMY_INIT0_START_ADDR + DDR3_
DUMMY_INIT
0_MEM_BOOL*DDR3_DUMMY_INIT0_SAMPLE_SIZE)
#define DDR3_ADC0_END_ADDR (DDR3_ADC0_START_ADDR + DDR3_ADC0_MEM_SIZE*MEM_REGION_SIZE - DDR3_ADC0_MEM_BOOL*DDR3_ADC0_SAMPLE_SIZE)
#define DDR3_ADC0_MAX_SAMPLES ((DDR3_ADC0_END_ADDR-DDR3_ADC0_START_ADDR) / DDR3_ADC0_SAMPLE_SIZE)
...
...
@@ -38,7 +38,7 @@
#define DDR3_TBTAMP0_MEM_SIZE 2
#define DDR3_TBTAMP0_MEM_BOOL DDR3_MEM_BOOL(DDR3_TBTAMP0_MEM_SIZE)
#define DDR3_TBTAMP0_START_ADDR (DDR3_ADC0_END_ADDR + DDR3_
TBTAMP
0_MEM_BOOL*DDR3_ADC0_SAMPLE_SIZE)
#define DDR3_TBTAMP0_START_ADDR (DDR3_ADC0_END_ADDR + DDR3_
ADC
0_MEM_BOOL*DDR3_ADC0_SAMPLE_SIZE)
#define DDR3_TBTAMP0_END_ADDR (DDR3_TBTAMP0_START_ADDR + DDR3_TBTAMP0_MEM_SIZE*MEM_REGION_SIZE - DDR3_TBTAMP0_MEM_BOOL*DDR3_TBTAMP0_SAMPLE_SIZE)
#define DDR3_TBTAMP0_MAX_SAMPLES ((DDR3_TBTAMP0_END_ADDR-DDR3_TBTAMP0_START_ADDR) / DDR3_TBTAMP0_SAMPLE_SIZE)
...
...
@@ -48,7 +48,7 @@
#define DDR3_TBTPOS0_MEM_SIZE 0
#define DDR3_TBTPOS0_MEM_BOOL DDR3_MEM_BOOL(DDR3_TBTPOS0_MEM_SIZE)
#define DDR3_TBTPOS0_START_ADDR (DDR3_TBTAMP0_END_ADDR + DDR3_TBT
POS
0_MEM_BOOL*DDR3_TBTAMP0_SAMPLE_SIZE)
#define DDR3_TBTPOS0_START_ADDR (DDR3_TBTAMP0_END_ADDR + DDR3_TBT
AMP
0_MEM_BOOL*DDR3_TBTAMP0_SAMPLE_SIZE)
#define DDR3_TBTPOS0_END_ADDR (DDR3_TBTPOS0_START_ADDR + DDR3_TBTPOS0_MEM_SIZE*MEM_REGION_SIZE - DDR3_TBTPOS0_MEM_BOOL*DDR3_TBTPOS0_SAMPLE_SIZE)
#define DDR3_TBTPOS0_MAX_SAMPLES ((DDR3_TBTPOS0_END_ADDR-DDR3_TBTPOS0_START_ADDR) / DDR3_TBTPOS0_SAMPLE_SIZE)
...
...
@@ -58,7 +58,7 @@
#define DDR3_FOFBAMP0_MEM_SIZE 2
#define DDR3_FOFBAMP0_MEM_BOOL DDR3_MEM_BOOL(DDR3_FOFBAMP0_MEM_SIZE)
#define DDR3_FOFBAMP0_START_ADDR (DDR3_TBTPOS0_END_ADDR + DDR3_
FOFBAMP
0_MEM_BOOL*DDR3_TBTPOS0_SAMPLE_SIZE)
#define DDR3_FOFBAMP0_START_ADDR (DDR3_TBTPOS0_END_ADDR + DDR3_
TBTPOS
0_MEM_BOOL*DDR3_TBTPOS0_SAMPLE_SIZE)
#define DDR3_FOFBAMP0_END_ADDR (DDR3_FOFBAMP0_START_ADDR + DDR3_FOFBAMP0_MEM_SIZE*MEM_REGION_SIZE - DDR3_FOFBAMP0_MEM_BOOL*DDR3_FOFBAMP0_SAMPLE_SIZE)
#define DDR3_FOFBAMP0_MAX_SAMPLES ((DDR3_FOFBAMP0_END_ADDR-DDR3_FOFBAMP0_START_ADDR) / DDR3_FOFBAMP0_SAMPLE_SIZE)
...
...
@@ -68,7 +68,7 @@
#define DDR3_FOFBPOS0_MEM_SIZE 0
#define DDR3_FOFBPOS0_MEM_BOOL DDR3_MEM_BOOL(DDR3_FOFBPOS0_MEM_SIZE)
#define DDR3_FOFBPOS0_START_ADDR (DDR3_FOFBAMP0_END_ADDR + DDR3_FOFB
POS
0_MEM_BOOL*DDR3_FOFBAMP0_SAMPLE_SIZE)
#define DDR3_FOFBPOS0_START_ADDR (DDR3_FOFBAMP0_END_ADDR + DDR3_FOFB
AMP
0_MEM_BOOL*DDR3_FOFBAMP0_SAMPLE_SIZE)
#define DDR3_FOFBPOS0_END_ADDR (DDR3_FOFBPOS0_START_ADDR + DDR3_FOFBPOS0_MEM_SIZE*MEM_REGION_SIZE - DDR3_FOFBPOS0_MEM_BOOL*DDR3_FOFBPOS0_SAMPLE_SIZE)
#define DDR3_FOFBPOS0_MAX_SAMPLES ((DDR3_FOFBPOS0_END_ADDR-DDR3_FOFBPOS0_START_ADDR) / DDR3_FOFBPOS0_SAMPLE_SIZE)
...
...
@@ -78,7 +78,7 @@
#define DDR3_MONITAMP0_MEM_SIZE 0
#define DDR3_MONITAMP0_MEM_BOOL DDR3_MEM_BOOL(DDR3_MONITAMP0_MEM_SIZE)
#define DDR3_MONITAMP0_START_ADDR (DDR3_FOFBPOS0_END_ADDR + DDR3_
MONITAMP
0_MEM_BOOL*DDR3_FOFBPOS0_SAMPLE_SIZE)
#define DDR3_MONITAMP0_START_ADDR (DDR3_FOFBPOS0_END_ADDR + DDR3_
FOFBPOS
0_MEM_BOOL*DDR3_FOFBPOS0_SAMPLE_SIZE)
#define DDR3_MONITAMP0_END_ADDR (DDR3_MONITAMP0_START_ADDR + DDR3_MONITAMP0_MEM_SIZE*MEM_REGION_SIZE - DDR3_MONITAMP0_MEM_BOOL*DDR3_MONITAMP0_SAMPLE_SIZE)
#define DDR3_MONITAMP0_MAX_SAMPLES ((DDR3_MONITAMP0_END_ADDR-DDR3_MONITAMP0_START_ADDR) / DDR3_MONITAMP0_SAMPLE_SIZE)
...
...
@@ -88,7 +88,7 @@
#define DDR3_MONITPOS0_MEM_SIZE 0
#define DDR3_MONITPOS0_MEM_BOOL DDR3_MEM_BOOL(DDR3_MONITPOS0_MEM_SIZE)
#define DDR3_MONITPOS0_START_ADDR (DDR3_MONITAMP0_END_ADDR + DDR3_MONIT
POS
0_MEM_BOOL*DDR3_MONITAMP0_SAMPLE_SIZE)
#define DDR3_MONITPOS0_START_ADDR (DDR3_MONITAMP0_END_ADDR + DDR3_MONIT
AMP
0_MEM_BOOL*DDR3_MONITAMP0_SAMPLE_SIZE)
#define DDR3_MONITPOS0_END_ADDR (DDR3_MONITPOS0_START_ADDR + DDR3_MONITPOS0_MEM_SIZE*MEM_REGION_SIZE - DDR3_MONITPOS0_MEM_BOOL*DDR3_MONITPOS0_SAMPLE_SIZE)
#define DDR3_MONITPOS0_MAX_SAMPLES ((DDR3_MONITPOS0_END_ADDR-DDR3_MONITPOS0_START_ADDR) / DDR3_MONITPOS0_SAMPLE_SIZE)
...
...
@@ -98,7 +98,7 @@
#define DDR3_MONIT1POS0_MEM_SIZE 0
#define DDR3_MONIT1POS0_MEM_BOOL DDR3_MEM_BOOL(DDR3_MONIT1POS0_MEM_SIZE)
#define DDR3_MONIT1POS0_START_ADDR (DDR3_MONITPOS0_END_ADDR + DDR3_MONIT
1
POS0_MEM_BOOL*DDR3_MONITPOS0_SAMPLE_SIZE)
#define DDR3_MONIT1POS0_START_ADDR (DDR3_MONITPOS0_END_ADDR + DDR3_MONITPOS0_MEM_BOOL*DDR3_MONITPOS0_SAMPLE_SIZE)
#define DDR3_MONIT1POS0_END_ADDR (DDR3_MONIT1POS0_START_ADDR + DDR3_MONIT1POS0_MEM_SIZE*MEM_REGION_SIZE - DDR3_MONIT1POS0_MEM_BOOL*DDR3_MONIT1POS0_SAMPLE_SIZE)
#define DDR3_MONIT1POS0_MAX_SAMPLES ((DDR3_MONIT1POS0_END_ADDR-DDR3_MONIT1POS0_START_ADDR) / DDR3_MONIT1POS0_SAMPLE_SIZE)
...
...
hal/sm_io/modules/acq/sm_io_acq_codes.h
View file @
3c118d68
...
...
@@ -39,7 +39,7 @@ typedef struct _smio_acq_data_block_t smio_acq_data_block_t;
#define ACQ_NOT_COMPLETED 2
/* Acquisition not completed */
#define ACQ_BLOCK_OOR 3
/* Block number out of range */
#define ACQ_NUM_CHAN_OOR 4
/* Channel number out of range */
#define ACQ_COULD_NOT_READ 5
/* C
hannel number out of range
*/
#define ACQ_COULD_NOT_READ 5
/* C
ould not read memory block
*/
#define ACQ_REPLY_END 6
/* End marker */
#endif
hal/sm_io/modules/acq/sm_io_acq_exp.c
View file @
3c118d68
...
...
@@ -71,7 +71,7 @@ static int _acq_data_acquire (void *owner, void *args, void *ret)
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_WARN
,
"[sm_io:acq] data_acquire: "
"Channel required is out of the maximum limit
\n
"
);
return
-
ACQ_NUM_
SAMPLES
_OOR
;
return
-
ACQ_NUM_
CHAN
_OOR
;
}
/* number of samples required is out of the maximum limit */
...
...
@@ -193,7 +193,15 @@ static int _acq_get_data_block (void *owner, void *args, void *ret)
uint32_t
chan
=
*
(
uint32_t
*
)
EXP_MSG_ZMQ_FIRST_ARG
(
args
);
uint32_t
block_n
=
*
(
uint32_t
*
)
EXP_MSG_ZMQ_NEXT_ARG
(
args
);
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:acq] get_data_block: "
"chan = %u, block_n = %u
\n
"
,
chan
,
block_n
);
"chan = %u, block_n = %u
\n
"
,
chan
,
block_n
);
/* channel required is out of the limit */
if
(
chan
>
SMIO_ACQ_NUM_CHANNELS
-
1
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_WARN
,
"[sm_io:acq] data_acquire: "
"Channel required is out of the maximum limit
\n
"
);
return
-
ACQ_NUM_CHAN_OOR
;
}
/* Channel features */
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io:acq] get_data_block: "
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_codes.h
View file @
3c118d68
...
...
@@ -24,79 +24,87 @@
#define FMC130M_4CH_NAME_PLL_STATUS "fmc130m_4ch_pll_status"
#define FMC130M_4CH_OPCODE_CLK_SEL 4
#define FMC130M_4CH_NAME_CLK_SEL "fmc130m_4ch_clk_sel"
#define FMC130M_4CH_OPCODE_ADC_DATA0 5
#define FMC130M_4CH_OPCODE_ADC_RAND 5
#define FMC130M_4CH_NAME_ADC_RAND "fmc130m_4ch_adc_rand"
#define FMC130M_4CH_OPCODE_ADC_DITH 6
#define FMC130M_4CH_NAME_ADC_DITH "fmc130m_4ch_adc_dith"
#define FMC130M_4CH_OPCODE_ADC_SHDN 7
#define FMC130M_4CH_NAME_ADC_SHDN "fmc130m_4ch_adc_shdn"
#define FMC130M_4CH_OPCODE_ADC_PGA 8
#define FMC130M_4CH_NAME_ADC_PGA "fmc130m_4ch_adc_pga"
#define FMC130M_4CH_OPCODE_ADC_DATA0 9
#define FMC130M_4CH_NAME_ADC_DATA0 "fmc130m_4ch_adc_data0"
#define FMC130M_4CH_OPCODE_ADC_DATA1
6
#define FMC130M_4CH_OPCODE_ADC_DATA1
10
#define FMC130M_4CH_NAME_ADC_DATA1 "fmc130m_4ch_adc_data1"
#define FMC130M_4CH_OPCODE_ADC_DATA2
7
#define FMC130M_4CH_OPCODE_ADC_DATA2
11
#define FMC130M_4CH_NAME_ADC_DATA2 "fmc130m_4ch_adc_data2"
#define FMC130M_4CH_OPCODE_ADC_DATA3
8
#define FMC130M_4CH_OPCODE_ADC_DATA3
12
#define FMC130M_4CH_NAME_ADC_DATA3 "fmc130m_4ch_adc_data3"
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL0
9
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL0
13
#define FMC130M_4CH_NAME_ADC_DLY_VAL0 "fmc130m_4ch_adc_dly_val0"
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL1 1
0
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL1 1
4
#define FMC130M_4CH_NAME_ADC_DLY_VAL1 "fmc130m_4ch_adc_dly_val1"
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL2 1
1
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL2 1
5
#define FMC130M_4CH_NAME_ADC_DLY_VAL2 "fmc130m_4ch_adc_dly_val2"
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL3 1
2
#define FMC130M_4CH_OPCODE_ADC_DLY_VAL3 1
6
#define FMC130M_4CH_NAME_ADC_DLY_VAL3 "fmc130m_4ch_adc_dly_val3"
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE0 1
3
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE0 1
7
#define FMC130M_4CH_NAME_ADC_DLY_LINE0 "fmc130m_4ch_adc_dly_line0"
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE1 1
4
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE1 1
8
#define FMC130M_4CH_NAME_ADC_DLY_LINE1 "fmc130m_4ch_adc_dly_line1"
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE2 1
5
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE2 1
9
#define FMC130M_4CH_NAME_ADC_DLY_LINE2 "fmc130m_4ch_adc_dly_line2"
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE3
16
#define FMC130M_4CH_OPCODE_ADC_DLY_LINE3
20
#define FMC130M_4CH_NAME_ADC_DLY_LINE3 "fmc130m_4ch_adc_dly_line3"
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT0
17
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT0
21
#define FMC130M_4CH_NAME_ADC_DLY_UPDT0 "fmc130m_4ch_adc_dly_updt0"
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT1
18
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT1
22
#define FMC130M_4CH_NAME_ADC_DLY_UPDT1 "fmc130m_4ch_adc_dly_updt1"
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT2
19
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT2
23
#define FMC130M_4CH_NAME_ADC_DLY_UPDT2 "fmc130m_4ch_adc_dly_updt2"
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT3 2
0
#define FMC130M_4CH_OPCODE_ADC_DLY_UPDT3 2
4
#define FMC130M_4CH_NAME_ADC_DLY_UPDT3 "fmc130m_4ch_adc_dly_updt3"
#define FMC130M_4CH_OPCODE_ADC_DLY0 2
1
#define FMC130M_4CH_OPCODE_ADC_DLY0 2
5
#define FMC130M_4CH_NAME_ADC_DLY0 "fmc130m_4ch_adc_dly0"
#define FMC130M_4CH_OPCODE_ADC_DLY1 2
2
#define FMC130M_4CH_OPCODE_ADC_DLY1 2
6
#define FMC130M_4CH_NAME_ADC_DLY1 "fmc130m_4ch_adc_dly1"
#define FMC130M_4CH_OPCODE_ADC_DLY2 2
3
#define FMC130M_4CH_OPCODE_ADC_DLY2 2
7
#define FMC130M_4CH_NAME_ADC_DLY2 "fmc130m_4ch_adc_dly2"
#define FMC130M_4CH_OPCODE_ADC_DLY3 2
4
#define FMC130M_4CH_OPCODE_ADC_DLY3 2
8
#define FMC130M_4CH_NAME_ADC_DLY3 "fmc130m_4ch_adc_dly3"
#define FMC130M_4CH_OPCODE_TEST_DATA_EN 2
5
#define FMC130M_4CH_OPCODE_TEST_DATA_EN 2
9
#define FMC130M_4CH_NAME_TEST_DATA_EN "fmc130m_4ch_adc_test_data_en"
#define FMC130M_4CH_OPCODE_TRIG_DIR
26
#define FMC130M_4CH_OPCODE_TRIG_DIR
30
#define FMC130M_4CH_NAME_TRIG_DIR "fmc130m_4ch_trig_dir"
#define FMC130M_4CH_OPCODE_TRIG_TERM
27
#define FMC130M_4CH_OPCODE_TRIG_TERM
31
#define FMC130M_4CH_NAME_TRIG_TERM "fmc130m_4ch_trig_term"
#define FMC130M_4CH_OPCODE_TRIG_VAL
28
#define FMC130M_4CH_OPCODE_TRIG_VAL
32
#define FMC130M_4CH_NAME_TRIG_VAL "fmc130m_4ch_trig_val"
#define FMC130M_4CH_OPCODE_AD9510_CFG_DEFAULTS
29
#define FMC130M_4CH_OPCODE_AD9510_CFG_DEFAULTS
33
#define FMC130M_4CH_NAME_AD9510_CFG_DEFAULTS "fmc130m_4ch_ad9510_cfg_defaults"
#define FMC130M_4CH_OPCODE_AD9510_PLL_A_DIV 3
0
#define FMC130M_4CH_OPCODE_AD9510_PLL_A_DIV 3
4
#define FMC130M_4CH_NAME_AD9510_PLL_A_DIV "fmc130m_4ch_ad9510_pll_a_div"
#define FMC130M_4CH_OPCODE_AD9510_PLL_B_DIV 3
1
#define FMC130M_4CH_OPCODE_AD9510_PLL_B_DIV 3
5
#define FMC130M_4CH_NAME_AD9510_PLL_B_DIV "fmc130m_4ch_ad9510_pll_b_div"
#define FMC130M_4CH_OPCODE_AD9510_PLL_PRESCALER 3
2
#define FMC130M_4CH_OPCODE_AD9510_PLL_PRESCALER 3
6
#define FMC130M_4CH_NAME_AD9510_PLL_PRESCALER "fmc130m_4ch_ad9510_pll_prescaler"
#define FMC130M_4CH_OPCODE_AD9510_R_DIV 3
3
#define FMC130M_4CH_OPCODE_AD9510_R_DIV 3
7
#define FMC130M_4CH_NAME_AD9510_R_DIV "fmc130m_4ch_ad9510_r_div"
#define FMC130M_4CH_OPCODE_AD9510_PLL_PDOWN 3
4
#define FMC130M_4CH_OPCODE_AD9510_PLL_PDOWN 3
8
#define FMC130M_4CH_NAME_AD9510_PLL_PDOWN "fmc130m_4ch_ad9510_pll_pdown"
#define FMC130M_4CH_OPCODE_AD9510_MUX_STATUS 3
5
#define FMC130M_4CH_OPCODE_AD9510_MUX_STATUS 3
9
#define FMC130M_4CH_NAME_AD9510_MUX_STATUS "fmc130m_4ch_ad9510_mux_status"
#define FMC130M_4CH_OPCODE_AD9510_CP_CURRENT
36
#define FMC130M_4CH_OPCODE_AD9510_CP_CURRENT
40
#define FMC130M_4CH_NAME_AD9510_CP_CURRENT "fmc130m_4ch_ad9510_cp_current"
#define FMC130M_4CH_OPCODE_AD9510_OUTPUTS
37
#define FMC130M_4CH_OPCODE_AD9510_OUTPUTS
41
#define FMC130M_4CH_NAME_AD9510_OUTPUTS "fmc130m_4ch_ad9510_outputs"
#define FMC130M_4CH_OPCODE_AD9510_PLL_CLK_SEL
38
#define FMC130M_4CH_OPCODE_AD9510_PLL_CLK_SEL
42
#define FMC130M_4CH_NAME_AD9510_PLL_CLK_SEL "fmc130m_4ch_ad9510_pll_clk_sel"
#define FMC130M_4CH_OPCODE_SI571_SET_FREQ
39
#define FMC130M_4CH_OPCODE_SI571_SET_FREQ
43
#define FMC130M_4CH_NAME_SI571_SET_FREQ "fmc130m_4ch_si571_set_freq"
#define FMC130M_4CH_OPCODE_SI571_GET_DEFAULTS 4
0
#define FMC130M_4CH_OPCODE_SI571_GET_DEFAULTS 4
4
#define FMC130M_4CH_NAME_SI571_GET_DEFAULTS "fmc130m_4ch_si571_get_defaults"
#define FMC130M_4CH_OPCODE_END 4
1
#define FMC130M_4CH_OPCODE_END 4
5
/* Messaging Reply OPCODES */
#define FMC130M_4CH_REPLY_SIZE (sizeof(uint32_t))
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_core.c
View file @
3c118d68
...
...
@@ -168,6 +168,7 @@ smio_err_e smio_fmc130m_4ch_destroy (smio_fmc130m_4ch_t **self_p)
if
(
*
self_p
)
{
smio_fmc130m_4ch_t
*
self
=
*
self_p
;
smch_si57x_destroy
(
&
self
->
smch_si571
);
smch_ad9510_destroy
(
&
self
->
smch_ad9510
);
smch_24aa64_destroy
(
&
self
->
smch_24aa64
);
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
View file @
3c118d68
...
...
@@ -116,6 +116,50 @@ RW_PARAM_FUNC(fmc130m_4ch, clk_sel) {
NO_FMT_FUNC
,
SET_FIELD
);
}
/***************************** ADC LT2208 Control ***************************/
#define BPM_FMC130M_4CH_RAND_MIN 0
/* RAND disabled */
#define BPM_FMC130M_4CH_RAND_MAX 1
/* RAND enabled */
RW_PARAM_FUNC
(
fmc130m_4ch
,
adc_rand
)
{
SET_GET_PARAM
(
fmc130m_4ch
,
FMC_130M_CTRL_REGS_OFFS
,
WB_FMC_130M_4CH_CSR
,
ADC
,
RAND
,
SINGLE_BIT_PARAM
,
BPM_FMC130M_4CH_RAND_MIN
,
BPM_FMC130M_4CH_RAND_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC130M_4CH_DITH_MIN 0
/* DITH disabled */
#define BPM_FMC130M_4CH_DITH_MAX 1
/* DITH enabled */
RW_PARAM_FUNC
(
fmc130m_4ch
,
adc_dith
)
{
SET_GET_PARAM
(
fmc130m_4ch
,
FMC_130M_CTRL_REGS_OFFS
,
WB_FMC_130M_4CH_CSR
,
ADC
,
DITH
,
SINGLE_BIT_PARAM
,
BPM_FMC130M_4CH_DITH_MIN
,
BPM_FMC130M_4CH_DITH_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC130M_4CH_SHDN_MIN 0
/* SHDN disabled */
#define BPM_FMC130M_4CH_SHDN_MAX 1
/* SHDN enabled */
RW_PARAM_FUNC
(
fmc130m_4ch
,
adc_shdn
)
{
SET_GET_PARAM
(
fmc130m_4ch
,
FMC_130M_CTRL_REGS_OFFS
,
WB_FMC_130M_4CH_CSR
,
ADC
,
SHDN
,
SINGLE_BIT_PARAM
,
BPM_FMC130M_4CH_SHDN_MIN
,
BPM_FMC130M_4CH_SHDN_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
#define BPM_FMC130M_4CH_PGA_MIN 0
/* PGA disabled */
#define BPM_FMC130M_4CH_PGA_MAX 1
/* PGA enabled */
RW_PARAM_FUNC
(
fmc130m_4ch
,
adc_pga
)
{
SET_GET_PARAM
(
fmc130m_4ch
,
FMC_130M_CTRL_REGS_OFFS
,
WB_FMC_130M_4CH_CSR
,
ADC
,
PGA
,
SINGLE_BIT_PARAM
,
BPM_FMC130M_4CH_PGA_MIN
,
BPM_FMC130M_4CH_PGA_MAX
,
NO_CHK_FUNC
,
NO_FMT_FUNC
,
SET_FIELD
);
}
/********************* ADC RAW Data registers (for simple debug) **************/
/* FIXME: Override DATA<channel_number>_VAL macros with the DATA_GLOBAL ones.
* As the macros are defined with 32-bits and there is a shift involved, the
* compiler complains about the size of the macro being bigger the the type
...
...
@@ -611,6 +655,10 @@ const disp_table_func_fp fmc130m_4ch_exp_fp [] = {
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
pll_func
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
pll_status
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
clk_sel
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_rand
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_dith
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_shdn
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_pga
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_data0
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_data1
),
RW_PARAM_FUNC_NAME
(
fmc130m_4ch
,
adc_data2
),
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exports.c
View file @
3c118d68
...
...
@@ -70,6 +70,54 @@ disp_op_t fmc130m_4ch_clk_sel_exp = {
}
};
disp_op_t
fmc130m_4ch_adc_rand_exp
=
{
.
name
=
FMC130M_4CH_NAME_ADC_RAND
,
.
opcode
=
FMC130M_4CH_OPCODE_ADC_RAND
,
.
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
fmc130m_4ch_adc_dith_exp
=
{
.
name
=
FMC130M_4CH_NAME_ADC_DITH
,
.
opcode
=
FMC130M_4CH_OPCODE_ADC_DITH
,
.
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
fmc130m_4ch_adc_shdn_exp
=
{
.
name
=
FMC130M_4CH_NAME_ADC_SHDN
,
.
opcode
=
FMC130M_4CH_OPCODE_ADC_SHDN
,
.
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
fmc130m_4ch_adc_pga_exp
=
{
.
name
=
FMC130M_4CH_NAME_ADC_PGA
,
.
opcode
=
FMC130M_4CH_OPCODE_ADC_PGA
,
.
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
fmc130m_4ch_adc_data0_exp
=
{
.
name
=
FMC130M_4CH_NAME_ADC_DATA0
,
.
opcode
=
FMC130M_4CH_OPCODE_ADC_DATA0
,
...
...
@@ -508,6 +556,10 @@ const disp_op_t *fmc130m_4ch_exp_ops [] = {
&
fmc130m_4ch_pll_func_exp
,
&
fmc130m_4ch_pll_status_exp
,
&
fmc130m_4ch_clk_sel_exp
,
&
fmc130m_4ch_adc_rand_exp
,
&
fmc130m_4ch_adc_dith_exp
,
&
fmc130m_4ch_adc_shdn_exp
,
&
fmc130m_4ch_adc_pga_exp
,
&
fmc130m_4ch_adc_data0_exp
,
&
fmc130m_4ch_adc_data1_exp
,
&
fmc130m_4ch_adc_data2_exp
,
...
...
hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exports.h
View file @
3c118d68
...
...
@@ -15,6 +15,10 @@ extern disp_op_t fmc130m_4ch_si571_oe_exp;
extern
disp_op_t
fmc130m_4ch_pll_func_exp
;
extern
disp_op_t
fmc130m_4ch_pll_status_exp
;
extern
disp_op_t
fmc130m_4ch_clk_sel_exp
;
extern
disp_op_t
fmc130m_4ch_adc_rand_exp
;
extern
disp_op_t
fmc130m_4ch_adc_dith_exp
;
extern
disp_op_t
fmc130m_4ch_adc_shdn_exp
;
extern
disp_op_t
fmc130m_4ch_adc_pga_exp
;
extern
disp_op_t
fmc130m_4ch_adc_data0_exp
;
extern
disp_op_t
fmc130m_4ch_adc_data1_exp
;
extern
disp_op_t
fmc130m_4ch_adc_data2_exp
;
...
...
hal/sm_io/sm_io.h
View file @
3c118d68
...
...
@@ -22,6 +22,11 @@
#include "dispatch_table.h"
#include "mdp.h"
/* SMIO sockets IDs */
#define SMIO_PIPE_SOCK 0
#define SMIO_END_SOCK 1
#define SMIO_SOCKS_NUM SMIO_END_SOCK
struct
_devio_t
;
struct
_smio_ops_t
;
struct
_smio_thsafe_client_ops_t
;
...
...
hal/sm_io/sm_io_bootstrap.c
View file @
3c118d68
...
...
@@ -254,31 +254,67 @@ static smio_err_e _smio_loop (smio_t *self)
* and exit if the parent send a message through
* the pipe socket */
while
(
!
zctx_interrupted
)
{
/* Listen to WORKER (requests from clients) and PIPE (managment) sockets */
zmq_pollitem_t
items
[]
=
{
[
SMIO_PIPE_SOCK
]
=
{
.
socket
=
self
->
pipe
,
.
fd
=
0
,
.
events
=
ZMQ_POLLIN
,
.
revents
=
0
}
};
/* Check for activity on WORKER socket */
zframe_t
*
reply_to
=
NULL
;
zmsg_t
*
request
=
mdp_worker_recv
(
self
->
worker
,
&
reply_to
);
if
(
request
==
NULL
)
{
break
;
/* Worker has been interrupted */
zmsg_t
*
request
=
mdp_worker_recv
(
self
->
worker
,
&
reply_to
,
true
);
if
(
request
!=
NULL
)
{
exp_msg_zmq_t
smio_args
=
{
.
tag
=
EXP_MSG_ZMQ_TAG
,
.
msg
=
&
request
,
.
reply_to
=
reply_to
};
err
=
smio_do_op
(
self
,
&
smio_args
);
/* What can I do in case of error ?*/
if
(
err
!=
SMIO_SUCCESS
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io_bootstrap] smio_do_op: %s
\n
"
,
smio_err_str
(
err
));
}
/* Cleanup */
zframe_destroy
(
&
reply_to
);
zmsg_destroy
(
&
request
);
}
exp_msg_zmq_t
smio_args
=
{
.
tag
=
EXP_MSG_ZMQ_TAG
,
.
msg
=
&
request
,
.
reply_to
=
reply_to
};
err
=
smio_do_op
(
self
,
&
smio_args
);
/* What can I do in case of error ?*/
if
(
err
!=
SMIO_SUCCESS
)
{
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_TRACE
,
"[sm_io_bootstrap] smio_do_op: %s
\n
"
,
smio_err_str
(
err
));
/* Wait up to 100 ms */
int
rc
=
zmq_poll
(
items
,
SMIO_SOCKS_NUM
,
SMIO_POLLER_TIMEOUT
);
ASSERT_TEST
(
rc
!=
-
1
,
"Poller has been interrupted"
,
err_loop_interrupted
,
SMIO_ERR_INTERRUPTED_POLLER
);
/* Check for activity on PIPE socket */
if
(
items
[
SMIO_PIPE_SOCK
].
revents
&
ZMQ_POLLIN
)
{
/* On any activity we destroy ourselves */
zmsg_t
*
request
=
zmsg_recv
(
self
->
pipe
);
if
(
request
==
NULL
)
{
break
;
/* Worker has been interrupted */
}
/* Every message through this channel is interpreted as a
* self-destruct one */
zmsg_destroy
(
&
request
);
/* Destroy SMIO instance. As we already do this on the main
* smio_startup (), we just need to exit this cleanly */
DBE_DEBUG
(
DBG_SM_IO
|
DBG_LVL_WARN
,
"[sm_io_bootstrap] Received shutdown message on "
"PIPE socket. Exiting ...
\n
"
);
break
;
}
/* Cleanup */
zframe_destroy
(
&
reply_to
);
zmsg_destroy
(
&
request
);
}
err_loop_interrupted:
return
err
;
}
hal/sm_io/sm_io_err.c
View file @
3c118d68
...
...
@@ -12,15 +12,17 @@
static
const
char
*
smio_err
[
SMIO_ERR_END
]
=
{
[
SMIO_SUCCESS
]
=
"Success"
,
[
SMIO_ERR_ALLOC
]
=
"Could not allocate memory"
,
[
SMIO_ERR_FUNC_NOT_IMPL
]
=
"Function not implemented"
,
[
SMIO_ERR_OPCODE_NOT_SUPP
]
=
"Opcode not supported"
,
[
SMIO_ERR_WRONG_PARAM
]
=
"Wrong parameter value"
,
[
SMIO_ERR_LLIO
]
=
"Low-level I/O could not complete operation"
,
[
SMIO_ERR_EXPORT_OP
]
=
"Could not export function"
,
[
SMIO_ERR_CONFIG_DFLT
]
=
"Could not configure the default values"
,
[
SMIO_ERR_MSG_NOT_SUPP
]
=
"Exported message not supported"
[
SMIO_SUCCESS
]
=
"Success"
,
[
SMIO_ERR_ALLOC
]
=
"Could not allocate memory"
,
[
SMIO_ERR_FUNC_NOT_IMPL
]
=
"Function not implemented"
,
[
SMIO_ERR_OPCODE_NOT_SUPP
]
=
"Opcode not supported"
,
[
SMIO_ERR_WRONG_PARAM
]
=
"Wrong parameter value"
,
[
SMIO_ERR_LLIO
]
=
"Low-level I/O could not complete operation"
,
[
SMIO_ERR_EXPORT_OP
]
=
"Could not export function"
,
[
SMIO_ERR_CONFIG_DFLT
]
=
"Could not configure the default values"
,
[
SMIO_ERR_MSG_NOT_SUPP
]
=
"Exported message not supported"
,
[
SMIO_ERR_INTERRUPTED_POLLER
]
=
"Poller interrupted. zeroMQ context was "
"terminated or received interrupt signal"
};
/* Convert enumeration type to string */
...
...
hal/sm_io/sm_io_err.h
View file @
3c118d68
...
...
@@ -22,6 +22,8 @@ enum _smio_err_e
SMIO_ERR_EXPORT_OP
,
/* Error exporting function */
SMIO_ERR_CONFIG_DFLT
,
/* Error configuring the default values */
SMIO_ERR_MSG_NOT_SUPP
,
/* Exported message not supported */
SMIO_ERR_INTERRUPTED_POLLER
,
/* SMIO Poller interrupted. zeroMQ context was
terminated or received interrupt signal */
SMIO_ERR_END
/* End of enum marker */
};
...
...
libclient/Makefile
View file @
3c118d68
...
...
@@ -176,6 +176,10 @@ all: $(TARGET_STATIC) $(TARGET_SHARED_VER) pre_inst
$(REVISION_NAME).o
:
$(REVISION_NAME).c
$(CC)
$(CFLAGS)
-DGIT_REVISION
=
\"
$(REVISION)
\"
-c
$<
# Pull in dependency info for *existing* .o files and don't complain if the
# corresponding .d file is not found
-include $(OBJS_all
:
.o=.d)
# Compile with position-independent objects.
# Autodependencies generatation by Scott McPeak, November 2001,
# from article "Autodependencies with GNU make"
...
...
libclient/bpm_client.c
View file @
3c118d68
...
...
@@ -322,6 +322,50 @@ err_send_msg_alloc:
return
err
;
}
/* ADC LTC2208 RAND */
PARAM_FUNC_CLIENT_WRITE
(
adc_rand
)
{
return
param_client_write
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_RAND
,
adc_rand
);
}
PARAM_FUNC_CLIENT_READ
(
adc_rand
)
{
return
param_client_read
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_RAND
,
adc_rand
);
}
/* ADC LTC2208 DITH */
PARAM_FUNC_CLIENT_WRITE
(
adc_dith
)
{
return
param_client_write
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_DITH
,
adc_dith
);
}
PARAM_FUNC_CLIENT_READ
(
adc_dith
)
{
return
param_client_read
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_DITH
,
adc_dith
);
}
/* ADC LTC2208 SHDN */
PARAM_FUNC_CLIENT_WRITE
(
adc_shdn
)
{
return
param_client_write
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_SHDN
,
adc_shdn
);
}
PARAM_FUNC_CLIENT_READ
(
adc_shdn
)
{
return
param_client_read
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_SHDN
,
adc_shdn
);
}
/* ADC LTC2208 PGA */
PARAM_FUNC_CLIENT_WRITE
(
adc_pga
)
{
return
param_client_write
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_PGA
,
adc_pga
);
}
PARAM_FUNC_CLIENT_READ
(
adc_pga
)
{
return
param_client_read
(
self
,
service
,
FMC130M_4CH_OPCODE_ADC_PGA
,
adc_pga
);
}
/* RAW ADC data 0 value */
PARAM_FUNC_CLIENT_WRITE
(
adc_data0
)
{
...
...
libclient/bpm_client.h
View file @
3c118d68
...
...
@@ -100,6 +100,29 @@ bpm_client_err_e bpm_set_fmc_clk_sel (bpm_client_t *self, char *service,
bpm_client_err_e
bpm_get_fmc_clk_sel
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
*
clk_sel
);
/* ADC LTC2208 Control */
/* These set of functions read (get) or write (set) some ADC LTC2208
* functionalities. Check LTC2208 datasheet for details.
* All of the functions returns BPM_CLIENT_SUCCESS if the
* parameter was correctly set or error (see bpm_client_err.h
* for all possible errors)*/
bpm_client_err_e
bpm_set_adc_rand
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
adc_rand
);
bpm_client_err_e
bpm_get_adc_rand
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
*
adc_rand
);
bpm_client_err_e
bpm_set_adc_dith
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
adc_dith
);
bpm_client_err_e
bpm_get_adc_dith
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
*
adc_dith
);
bpm_client_err_e
bpm_set_adc_shdn
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
adc_shdn
);
bpm_client_err_e
bpm_get_adc_shdn
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
*
adc_shdn
);
bpm_client_err_e
bpm_set_adc_pga
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
adc_pga
);
bpm_client_err_e
bpm_get_adc_pga
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
*
adc_pga
);
/* RAW ADC data functions */
/* These set of functions read (get) the RAW ADC values.
* All of the functions returns BPM_CLIENT_SUCCESS if the
...
...
scripts/deploy.sh
View file @
3c118d68
...
...
@@ -3,7 +3,7 @@
TOP_DIR
=
..
REMOTE_HOME
=
"/home"
REMOTE_USERNAME
=
"lnls-bpm"
REMOTE_IP
=
10.0.18.
41
REMOTE_IP
=
10.0.18.
39
LOCAL_IP
=
10.0.18.35
REMOTE_DIR
=
"bpm-sw-deploy"
BOARD_TYPE
=
"afcv3"
...
...
@@ -13,9 +13,9 @@ REMOTE_LOG_DIR="/media/remote_logs"
CREATE_DIR_CMD
=
"mkdir -p
${
REMOTE_DEPLOY_DIR
}
"
MOUNT_REMOTE_LOG_CMD
=
"sshfs
${
whoami
}
@
${
LOCAL_IP
}
:~/remote_logs
${
REMOTE_LOG_DIR
}
"
COMPILE_CMD
=
"
make mrproper && make DBE_DBG=y FMC130M_4CH_TYPE=passive
\
BOARD=
${
BOARD_TYPE
}
&& make install
"
RUN_CMD
=
"./init.sh tcp
${
REMOTE_IP
}
${
REMOTE_LOG_DIR
}
"
COMPILE_CMD
=
"
./compile.sh"
#RUN_CMD="./init.sh tcp ${REMOTE_IP} ${REMOTE_LOG_DIR}
"
#RUN_CMD="systemctl start bpm-sw.service
"
# Change working directory
cd
${
TOP_DIR
}
...
...
@@ -25,15 +25,15 @@ echo "Creating remote directories on ${REMOTE_USERNAME}@${REMOTE_IP}"
ssh
-l
${
REMOTE_USERNAME
}
${
REMOTE_IP
}
"
${
CREATE_DIR_CMD
}
"
# Mount remote log directory
echo
"Mounting remote LOG directory to
${
REMOTE_LOG_DIR
}
"
ssh
-l
${
REMOTE_USERNAME
}
${
REMOTE_IP
}
"
${
MOUNT_REMOTE_LOG_CMD
}
"
#
echo "Mounting remote LOG directory to ${REMOTE_LOG_DIR}"
#
ssh -l ${REMOTE_USERNAME} ${REMOTE_IP} "${MOUNT_REMOTE_LOG_CMD}"
# Find all source files
SRC_FILES
=
$(
find
.
-type
f
-type
l
!
-iname
"*.[o|a]"
!
-iname
"*orig"
\
!
-iname
"*.swp"
!
-iname
"*.swap"
!
-iname
"*.txt"
\
SRC_FILES
=
$(
find
.
-type
f
!
-iname
"*.[o|a]"
!
-iname
"*orig"
\
!
-iname
"*.swp"
!
-iname
"*.swap"
!
-iname
"*.txt"
!
-iname
"*.pyc"
\
!
-path
"./majordomo*"
!
-path
"./.git*"
)
SYM_FILES
=
$(
find
.
-type
l
!
-iname
"*.[o|a]"
!
-iname
"*orig"
\
!
-iname
"*.swp"
!
-iname
"*.swap"
!
-iname
"*.txt"
\
!
-iname
"*.swp"
!
-iname
"*.swap"
!
-iname
"*.txt"
!
-iname
"*.pyc"
\
!
-path
"./majordomo*"
!
-path
"./.git*"
)
echo
"Copying files to
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DEPLOY_DIR
}
"
...
...
@@ -41,5 +41,6 @@ rsync -Rpr ${SRC_FILES} ${REMOTE_USERNAME}@${REMOTE_IP}:${REMOTE_DEPLOY_DIR}
rsync
-Rpr
${
SYM_FILES
}
${
REMOTE_USERNAME
}
@
${
REMOTE_IP
}
:
${
REMOTE_DEPLOY_DIR
}
echo
"Compiling source files with
\"
${
COMPILE_CMD
}
\"
"
ssh
-l
${
REMOTE_USERNAME
}
${
REMOTE_IP
}
"cd
${
REMOTE_DIR
}
&&
${
COMPILE_CMD
}
&&
${
RUN_CMD
}
"
ssh
-l
${
REMOTE_USERNAME
}
${
REMOTE_IP
}
"cd
${
REMOTE_DEPLOY_DIR
}
&&
\
${
COMPILE_CMD
}
"
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