Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bpm-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
bpm
bpm-sw
Commits
5981696a
Commit
5981696a
authored
Jan 28, 2016
by
Lucas Russo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'smio-table-linker' into devel
parents
68971496
aed79199
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
57 additions
and
67 deletions
+57
-67
Makefile
Makefile
+4
-1
sm_io.h
include/sm_io.h
+1
-0
sm_io_mod_dispatch.h
include/sm_io_mod_dispatch.h
+21
-2
bpm-sw.ld
linker/bpm-sw.ld
+10
-0
dev_io_core.c
src/dev_io/dev_io_core.c
+6
-3
sm_io_acq_exp.c
src/sm_io/modules/acq/sm_io_acq_exp.c
+2
-0
sm_io_afc_diag_exp.c
src/sm_io/modules/afc_diag/sm_io_afc_diag_exp.c
+2
-0
sm_io_dsp_exp.c
src/sm_io/modules/dsp/sm_io_dsp_exp.c
+2
-0
sm_io_fmc130m_4ch_exp.c
src/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
+2
-0
modules.mk
src/sm_io/modules/modules.mk
+1
-2
sm_io_rffe_exp.c
src/sm_io/modules/rffe/sm_io_rffe_exp.c
+2
-0
sm_io_mod_dispatch.c
src/sm_io/modules/sm_io_mod_dispatch.c
+0
-59
sm_io_swap_exp.c
src/sm_io/modules/swap/sm_io_swap_exp.c
+2
-0
sm_io_bootstrap.c
src/sm_io/sm_io_bootstrap.c
+2
-0
No files found.
Makefile
View file @
5981696a
...
...
@@ -46,6 +46,9 @@ export CFG
# Config filename
CFG_FILENAME
=
bpm_sw.cfg
# Linker script
LD_SCRIPT
=
linker/bpm-sw.ld
# Init sripts
INIT_SCRIPTS
=
...
...
@@ -158,7 +161,7 @@ CFLAGS_DEBUG += -g
# Specific platform Flags
CFLAGS_PLATFORM
=
-Wall
-Wextra
-Werror
LDFLAGS_PLATFORM
=
LDFLAGS_PLATFORM
=
-T
$(LD_SCRIPT)
# Libraries
LIBS
=
-lm
-lzmq
-lczmq
-lmlm
...
...
include/sm_io.h
View file @
5981696a
...
...
@@ -30,6 +30,7 @@ extern "C" {
#define SMIO_DISPATCH_FUNC_WRAPPER_GEN(func_name, ...) \
({ \
volatile const smio_mod_dispatch_t *smio_mod_dispatch = &_smio_mod_dispatch; \
smio_err_e local_err = SMIO_ERR_FUNC_NOT_IMPL; \
if (smio_mod_dispatch[th_args->smio_id].bootstrap_ops && \
smio_mod_dispatch[th_args->smio_id].bootstrap_ops->func_name) { \
...
...
include/sm_io_mod_dispatch.h
View file @
5981696a
...
...
@@ -18,9 +18,28 @@ typedef struct {
uint32_t
id
;
const
char
*
name
;
const
smio_bootstrap_ops_t
*
bootstrap_ops
;
}
smio_mod_dispatch_t
;
}
__attribute__
((
aligned
(
16
)))
smio_mod_dispatch_t
;
extern
const
smio_mod_dispatch_t
smio_mod_dispatch
[];
/*
* WARNING! Using SMIO_MOD_DECLARE requires .smio_mod_dispatch section in linker script
* .smio_mod_dispatch : ALIGN(4)
* {
* _smio_mod_dispatch = .;
* KEEP(*(.smio_mod_dispatch))
* _esmio_mod_dispatch = .;
* }
*/
extern
const
smio_mod_dispatch_t
_smio_mod_dispatch
;
extern
const
smio_mod_dispatch_t
_esmio_mod_dispatch
;
#define SMIO_MOD_DECLARE(mod_id, mod_name, mod_bootstrap_ops) \
const smio_mod_dispatch_t __attribute__ ((section (".smio_mod_dispatch"))) \
smio_mod_ ## mod_id ## _ ## mod_name = { \
.id = mod_id, \
.name = mod_name, \
.bootstrap_ops = &mod_bootstrap_ops \
};
#ifdef __cplusplus
}
...
...
linker/bpm-sw.ld
0 → 100644
View file @
5981696a
SECTIONS
{
.smio_mod_dispatch : ALIGN(8)
{
_smio_mod_dispatch = .;
KEEP(*(.smio_mod_dispatch))
_esmio_mod_dispatch = .;
}
}
INSERT AFTER .rodata;
src/dev_io/dev_io_core.c
View file @
5981696a
...
...
@@ -389,6 +389,9 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint64_t base,
uint32_t
pipe_mgmt_idx
=
0
;
uint32_t
pipe_msg_idx
=
0
;
uint32_t
pipe_config_idx
=
0
;
volatile
const
smio_mod_dispatch_t
*
smio_mod_dispatch_start
=
&
_smio_mod_dispatch
;
volatile
const
smio_mod_dispatch_t
*
smio_mod_dispatch_end
=
&
_esmio_mod_dispatch
;
smio_mod_dispatch_t
*
smio_mod_handler
=
(
smio_mod_dispatch_t
*
)
smio_mod_dispatch_start
;
DBE_DEBUG
(
DBG_DEV_IO
|
DBG_LVL_TRACE
,
"[dev_io_core:register_sm] searching for SMIO ID match
\n
"
);
...
...
@@ -396,8 +399,8 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint64_t base,
/* For now, just do a simple linear search. We can afford this, as
* we don't expect to insert new sm_io modules often */
unsigned
int
i
;
for
(
i
=
0
;
smio_mod_
dispatch
[
i
].
id
!=
SMIO_DISPATCH_END_ID
;
++
i
)
{
if
(
smio_mod_
dispatch
[
i
].
id
!=
smio_id
)
{
for
(
i
=
0
;
smio_mod_
handler
<
smio_mod_dispatch_end
;
++
i
,
++
smio_mod_handler
)
{
if
(
smio_mod_
handler
->
id
!=
smio_id
)
{
continue
;
}
...
...
@@ -410,7 +413,7 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint64_t base,
"[dev_io_core:register_sm] Stringify hash ID
\n
"
);
char
*
inst_id_str
=
hutils_stringify_dec_key
(
inst_id
);
ASSERT_ALLOC
(
inst_id_str
,
err_inst_id_str_alloc
);
char
*
key
=
hutils_concat_strings_no_sep
(
smio_mod_
dispatch
[
i
].
name
,
char
*
key
=
hutils_concat_strings_no_sep
(
smio_mod_
handler
->
name
,
inst_id_str
);
/* We don't need this anymore */
free
(
inst_id_str
);
...
...
src/sm_io/modules/acq/sm_io_acq_exp.c
View file @
5981696a
...
...
@@ -892,3 +892,5 @@ const smio_bootstrap_ops_t acq_bootstrap_ops = {
.
init
=
acq_init
,
.
shutdown
=
acq_shutdown
};
SMIO_MOD_DECLARE
(
ACQ_SDB_DEVID
,
ACQ_SDB_NAME
,
acq_bootstrap_ops
)
src/sm_io/modules/afc_diag/sm_io_afc_diag_exp.c
View file @
5981696a
...
...
@@ -283,3 +283,5 @@ const smio_bootstrap_ops_t afc_diag_bootstrap_ops = {
.
shutdown
=
afc_diag_shutdown
,
.
config_defaults
=
afc_diag_config_defaults
};
SMIO_MOD_DECLARE
(
AFC_DIAG_DEVID
,
AFC_DIAG_NAME
,
afc_diag_bootstrap_ops
)
src/sm_io/modules/dsp/sm_io_dsp_exp.c
View file @
5981696a
...
...
@@ -337,3 +337,5 @@ const smio_bootstrap_ops_t dsp_bootstrap_ops = {
.
shutdown
=
dsp_shutdown
,
.
config_defaults
=
dsp_config_defaults
};
SMIO_MOD_DECLARE
(
DSP_SDB_DEVID
,
DSP_SDB_NAME
,
dsp_bootstrap_ops
)
src/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exp.c
View file @
5981696a
...
...
@@ -855,3 +855,5 @@ const smio_bootstrap_ops_t fmc130m_4ch_bootstrap_ops = {
.
shutdown
=
fmc130m_4ch_shutdown
,
.
config_defaults
=
fmc130m_4ch_config_defaults
};
SMIO_MOD_DECLARE
(
FMC130M_4CH_SDB_DEVID
,
FMC130M_4CH_SDB_NAME
,
fmc130m_4ch_bootstrap_ops
)
src/sm_io/modules/modules.mk
View file @
5981696a
...
...
@@ -7,8 +7,7 @@ include $(SRC_DIR)/sm_io/modules/fmc130m_4ch/fmc130m_4ch.mk \
sm_io_modules_DIR = $(SRC_DIR)/sm_io/modules
sm_io_modules_OBJS = $(sm_io_modules_DIR)/sm_io_mod_dispatch.o \
$(sm_io_modules_DIR)/sm_io_codes.o \
sm_io_modules_OBJS = $(sm_io_modules_DIR)/sm_io_codes.o \
$(sm_io_fmc130m_4ch_OBJS) \
$(sm_io_acq_OBJS) \
$(sm_io_dsp_OBJS) \
...
...
src/sm_io/modules/rffe/sm_io_rffe_exp.c
View file @
5981696a
...
...
@@ -389,3 +389,5 @@ const smio_bootstrap_ops_t rffe_bootstrap_ops = {
.
shutdown
=
rffe_shutdown
,
.
config_defaults
=
rffe_config_defaults
};
SMIO_MOD_DECLARE
(
RFFE_DEVID
,
RFFE_NAME
,
rffe_bootstrap_ops
)
src/sm_io/modules/sm_io_mod_dispatch.c
deleted
100644 → 0
View file @
68971496
/*
* 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 all available module we can handle */
#include "fmc130m_4ch/sm_io_fmc130m_4ch_exp.h"
#include "acq/sm_io_acq_exp.h"
#include "dsp/sm_io_dsp_exp.h"
#include "swap/sm_io_swap_exp.h"
#include "rffe/sm_io_rffe_exp.h"
#if defined (__BOARD_AFCV3__)
#include "afc_diag/sm_io_afc_diag_exp.h"
#endif
/* Table of all known modules we can handle */
const
smio_mod_dispatch_t
smio_mod_dispatch
[]
=
{
{
.
id
=
FMC130M_4CH_SDB_DEVID
,
.
name
=
FMC130M_4CH_SDB_NAME
,
.
bootstrap_ops
=
&
fmc130m_4ch_bootstrap_ops
},
{
.
id
=
ACQ_SDB_DEVID
,
.
name
=
ACQ_SDB_NAME
,
.
bootstrap_ops
=
&
acq_bootstrap_ops
},
{
.
id
=
DSP_SDB_DEVID
,
.
name
=
DSP_SDB_NAME
,
.
bootstrap_ops
=
&
dsp_bootstrap_ops
},
{
.
id
=
SWAP_SDB_DEVID
,
.
name
=
SWAP_SDB_NAME
,
.
bootstrap_ops
=
&
swap_bootstrap_ops
},
{
.
id
=
RFFE_DEVID
,
/* No SDB as this is not an FPGA module */
.
name
=
RFFE_NAME
,
.
bootstrap_ops
=
&
rffe_bootstrap_ops
},
#if defined (__BOARD_AFCV3__)
{
.
id
=
AFC_DIAG_DEVID
,
.
name
=
AFC_DIAG_NAME
,
.
bootstrap_ops
=
&
afc_diag_bootstrap_ops
},
#endif
{
.
id
=
SMIO_DISPATCH_END_ID
,
.
name
=
"SMIO_DISPATCH_END"
,
.
bootstrap_ops
=
NULL
}
};
src/sm_io/modules/swap/sm_io_swap_exp.c
View file @
5981696a
...
...
@@ -325,3 +325,5 @@ const smio_bootstrap_ops_t swap_bootstrap_ops = {
.
shutdown
=
swap_shutdown
,
.
config_defaults
=
swap_config_defaults
};
SMIO_MOD_DECLARE
(
SWAP_SDB_DEVID
,
SWAP_SDB_NAME
,
swap_bootstrap_ops
)
src/sm_io/sm_io_bootstrap.c
View file @
5981696a
...
...
@@ -42,6 +42,7 @@ void smio_startup (zsock_t *pipe, void *args)
th_boot_args_t
*
th_args
=
(
th_boot_args_t
*
)
args
;
zsock_t
*
pipe_mgmt
=
pipe
;
zsock_t
*
pipe_msg
=
th_args
->
pipe_msg
;
volatile
const
smio_mod_dispatch_t
*
smio_mod_dispatch
=
&
_smio_mod_dispatch
;
/* Signal parent we are initializing */
zsock_signal
(
pipe_mgmt
,
0
);
...
...
@@ -116,6 +117,7 @@ err_inst_id_str_alloc:
void
smio_config_defaults
(
zsock_t
*
pipe
,
void
*
args
)
{
th_config_args_t
*
th_args
=
(
th_config_args_t
*
)
args
;
volatile
const
smio_mod_dispatch_t
*
smio_mod_dispatch
=
&
_smio_mod_dispatch
;
/* Signal parent we are initializing */
zsock_signal
(
pipe
,
0
);
...
...
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