Commit e520fbe3 authored by Lucas Russo's avatar Lucas Russo

hal/sm_io/*/fmc130m_4ch/*: add SMIO core structure to init

Added an example of a specific structure used to
hold internal SMIO state information. For now
it just holds a dummy value
parent b46de623
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "sm_io_fmc130m_4ch.h" #include "sm_io_fmc130m_4ch_exp.h"
#include "sm_io.h" #include "sm_io.h"
#include "dev_io.h" #include "dev_io.h"
#include "hal_assert.h" #include "hal_assert.h"
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
#undef ASSERT_TEST #undef ASSERT_TEST
#endif #endif
#define ASSERT_TEST(test_boolean, err_str, err_goto_label) \ #define ASSERT_TEST(test_boolean, err_str, err_goto_label) \
ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io:fmc130m_4ch]",\ ASSERT_HAL_TEST(test_boolean, SM_IO, "[sm_io:fmc130m_4ch_exp]", \
err_str, err_goto_label) err_str, err_goto_label)
#ifdef ASSERT_ALLOC #ifdef ASSERT_ALLOC
#undef ASSERT_ALLOC #undef ASSERT_ALLOC
#endif #endif
#define ASSERT_ALLOC(ptr, err_goto_label) \ #define ASSERT_ALLOC(ptr, err_goto_label) \
ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io:fmc130m_4ch]", \ ASSERT_HAL_ALLOC(ptr, SM_IO, "[sm_io:fmc130m_4ch_exp]", \
smio_err_str(SMIO_ERR_ALLOC), \ smio_err_str(SMIO_ERR_ALLOC), \
err_goto_label) err_goto_label)
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#undef CHECK_ERR #undef CHECK_ERR
#endif #endif
#define CHECK_ERR(err, err_type) \ #define CHECK_ERR(err, err_type) \
CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc130m_4ch]", \ CHECK_HAL_ERR(err, SM_IO, "[sm_io:fmc130m_4ch_exp]", \
smio_err_str (err_type)) smio_err_str (err_type))
/************************************************************/ /************************************************************/
...@@ -63,11 +63,11 @@ static void *_fmc130m_4ch_leds (void *owner, void *args) ...@@ -63,11 +63,11 @@ static void *_fmc130m_4ch_leds (void *owner, void *args)
exp_msg_zmq_t *exp_msg = (exp_msg_zmq_t *) args; exp_msg_zmq_t *exp_msg = (exp_msg_zmq_t *) args;
assert (zmsg_size (*exp_msg->msg) > 0); assert (zmsg_size (*exp_msg->msg) > 0);
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch] Calling _fmc130m_4ch_leds\n"); DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch_exp] Calling _fmc130m_4ch_leds\n");
uint32_t leds = *(uint32_t *) zframe_data (zmsg_pop (*exp_msg->msg)); uint32_t leds = *(uint32_t *) zframe_data (zmsg_pop (*exp_msg->msg));
smio_thsafe_client_write_32 (self, BAR4_ADDR | FMC1_ADDR | FMC_MONITOR_REG, smio_thsafe_client_write_32 (self, BAR4_ADDR | FMC1_ADDR | FMC_MONITOR_REG,
&leds); &leds);
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch_boot] Led write: 0x%08x\n", DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch_exp] Led write: 0x%08x\n",
leds); leds);
/* Don't send any response, for now... */ /* Don't send any response, for now... */
...@@ -151,7 +151,7 @@ const smio_ops_t fmc130m_4ch_ops = { ...@@ -151,7 +151,7 @@ const smio_ops_t fmc130m_4ch_ops = {
smio_err_e fmc130m_4ch_init (smio_t * self) smio_err_e fmc130m_4ch_init (smio_t * self)
{ {
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch] Initializing fmc130m_4ch\n"); DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch_exp] Initializing fmc130m_4ch\n");
smio_err_e err = SMIO_ERR_ALLOC; smio_err_e err = SMIO_ERR_ALLOC;
...@@ -163,8 +163,16 @@ smio_err_e fmc130m_4ch_init (smio_t * self) ...@@ -163,8 +163,16 @@ smio_err_e fmc130m_4ch_init (smio_t * self)
self->ops = &fmc130m_4ch_ops; self->ops = &fmc130m_4ch_ops;
self->thsafe_client_ops = &smio_thsafe_client_zmq_ops; self->thsafe_client_ops = &smio_thsafe_client_zmq_ops;
self->exp_ops = fmc130m_exp_ops; self->exp_ops = fmc130m_exp_ops;
/* Initialize specific structure */
self->smio_handler = smio_fmc130m_4ch_new (0);
ASSERT_ALLOC(self->smio_handler, err_smio_handler_alloc);
err = SMIO_SUCCESS; err = SMIO_SUCCESS;
return err;
err_smio_handler_alloc:
free (self->name);
err_name_alloc: err_name_alloc:
return err; return err;
} }
...@@ -172,8 +180,9 @@ err_name_alloc: ...@@ -172,8 +180,9 @@ err_name_alloc:
/* Destroy sm_io instance of fmc130m_4ch */ /* Destroy sm_io instance of fmc130m_4ch */
smio_err_e fmc130m_4ch_shutdown (smio_t *self) smio_err_e fmc130m_4ch_shutdown (smio_t *self)
{ {
DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch] Shutting down fmc130m_4ch\n"); DBE_DEBUG (DBG_SM_IO | DBG_LVL_TRACE, "[sm_io:fmc130m_4ch_exp] Shutting down fmc130m_4ch\n");
smio_fmc130m_4ch_destroy (self->smio_handler);
self->exp_ops = NULL; self->exp_ops = NULL;
self->thsafe_client_ops = NULL; self->thsafe_client_ops = NULL;
self->ops = NULL; self->ops = NULL;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "sm_io_bootstrap.h" #include "sm_io_bootstrap.h"
#include "smio_thsafe_zmq_client.h" #include "smio_thsafe_zmq_client.h"
#include "exp_ops_codes.h" #include "exp_ops_codes.h"
#include "sm_io_fmc130m_4ch_core.h"
/* Known modules IDs (from SDB records defined in FPGA) */ /* Known modules IDs (from SDB records defined in FPGA) */
#define FMC130M_4CH_SDB_DEVID 0x7085ef15 #define FMC130M_4CH_SDB_DEVID 0x7085ef15
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment