Commit 61c66844 authored by Lucas Russo's avatar Lucas Russo

libs/libllio/*: add SDB base address attribute/methods

This will be used as a prefix address for read/writing
to the SDB memory space. If an endpoint does not implement
or support SDB, it should set SDB address to 0x0.
parent a1214616
......@@ -84,6 +84,10 @@ llio_err_e llio_set_dev_handler (llio_t *self, void *dev_handler);
void *llio_get_dev_handler (llio_t *self);
/* Get type */
llio_type_e llio_get_type (llio_t *self);
/* Set SDB prefix ADDR */
llio_err_e llio_set_sdb_prefix_addr (llio_t *self, uint64_t sdb_prefix_addr);
/* Get SDB prefix ADDR */
uint64_t llio_get_sdb_prefix_addr (llio_t *self);
/************************************************************/
/**************** Low Level generic methods API *************/
......
......@@ -38,6 +38,8 @@ struct _llio_t {
devices functions */
char *name; /* Identification of this llio instance */
int verbose; /* Print activity to stdout */
uint64_t sdb_prefix_addr; /* SDB prefix address. Used to read/write to the
SDB address space. To be set by the specific ops */
/* Endpoint to connect to */
llio_endpoint_t *endpoint;
......@@ -69,6 +71,8 @@ llio_t * llio_new (char *name, char *endpoint, llio_type_e type, int verbose)
self->name = strdup (name);
ASSERT_ALLOC(self->name, err_name_alloc);
self->verbose = verbose;
/* This shoule be set by the specific operations (e.g., PCIe, ETH) */
self->sdb_prefix_addr = 0x0;
/* Initilialize llio_endpoint */
self->endpoint = NULL;
......@@ -193,6 +197,20 @@ llio_type_e llio_get_type (llio_t *self)
{
return self->type;
}
llio_err_e llio_set_sdb_prefix_addr (llio_t *self, uint64_t sdb_prefix_addr)
{
assert (self);
self->sdb_prefix_addr = sdb_prefix_addr;
return LLIO_SUCCESS;
}
uint64_t llio_get_sdb_prefix_addr (llio_t *self)
{
assert (self);
return self->sdb_prefix_addr;
}
/**************** Static function ****************/
static bool _llio_get_endpoint_open (llio_t *self)
......
......@@ -195,6 +195,9 @@ static int eth_open (llio_t *self, llio_endpoint_t *endpoint)
/* Signal that the endpoint is opened and ready to work */
llio_set_endpoint_open (self, true);
/* Set SDB prefix adress */
llio_set_sdb_prefix_addr (self, 0x0);
DBE_DEBUG (DBG_LL_IO | DBG_LVL_INFO,
"[ll_io_eth] Opened ETH device located at %s\n",
llio_get_endpoint_name (self));
......
......@@ -188,6 +188,9 @@ static int pcie_open (llio_t *self, llio_endpoint_t *endpoint)
DBE_DEBUG (DBG_LL_IO | DBG_LVL_INFO,
"[ll_io_pcie] Opened PCIe device located at %s\n",
llio_get_endpoint_name (self));
/* Set SDB prefix adress */
llio_set_sdb_prefix_addr (self, BAR4_ADDR);
/* Reset FPGA */
_pcie_reset_fpga (self);
......
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