From 9ea1caaa9f01633de90bf5d5d22f0c96446489d3 Mon Sep 17 00:00:00 2001 From: Lucas Russo <lerwys@gmail.com> Date: Tue, 19 Apr 2016 10:28:44 -0300 Subject: [PATCH] {src,include}/sm_io.*: add option to SMIO register another SMIO This opens new possibilities for chaining SMIOs. For instance, the FMC_250M SMIO can register 2 more SMIOs: FMC_ADC_COMMON and FMC_ACTIVE_CLK --- include/sm_io.h | 3 +++ src/sm_io/sm_io.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/sm_io.h b/include/sm_io.h index 96ff84c9..1ec7a574 100644 --- a/include/sm_io.h +++ b/include/sm_io.h @@ -124,6 +124,9 @@ smio_t *smio_new (th_boot_args_t *args, zsock_t *pipe_mgmt, zsock_t *pipe_msg, smio_err_e smio_destroy (smio_t **self_p); /* Loop through all interface sockets */ smio_err_e smio_loop (smio_t *self); +/* Register SMIO */ +smio_err_e smio_register_sm (smio_t *self, uint32_t smio_id, uint64_t base, + uint32_t inst_id); smio_err_e smio_init_exp_ops (smio_t *self, disp_op_t** smio_exp_ops, const disp_table_func_fp *func_fps); diff --git a/src/sm_io/sm_io.c b/src/sm_io/sm_io.c index 32a986a1..568d80f7 100644 --- a/src/sm_io/sm_io.c +++ b/src/sm_io/sm_io.c @@ -364,6 +364,20 @@ smio_err_e smio_loop (smio_t *self) return err; } +smio_err_e smio_register_sm (smio_t *self, uint32_t smio_id, uint64_t base, + uint32_t inst_id) +{ + assert (self); + smio_err_e err = SMIO_SUCCESS; + + devio_err_e derr = devio_register_sm (self->parent, smio_id, base, inst_id); + ASSERT_TEST(derr == DEVIO_SUCCESS, "Could not register SM", err_register_sm, + SMIO_ERR_REGISTER_SM); + +err_register_sm: + return err; +} + /************************************************************/ /***************** Dispatch table callbacks *****************/ /************************************************************/ -- GitLab