1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Consistent naming of library functions and structs

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich 2022-04-24 22:51:37 -07:00
parent d5c2566dff
commit 698fd2f104
11 changed files with 68 additions and 68 deletions

View File

@ -281,7 +281,7 @@ static int mqnic_try_open(struct mqnic *dev, const char *fmt, ...)
goto fail_reset; goto fail_reset;
} }
dev->rb_list = enumerate_reg_block_list(dev->regs, 0, dev->regs_size); dev->rb_list = mqnic_enumerate_reg_block_list(dev->regs, 0, dev->regs_size);
if (!dev->rb_list) if (!dev->rb_list)
{ {
@ -290,7 +290,7 @@ static int mqnic_try_open(struct mqnic *dev, const char *fmt, ...)
} }
// Read ID registers // Read ID registers
dev->fw_id_rb = find_reg_block(dev->rb_list, MQNIC_RB_FW_ID_TYPE, MQNIC_RB_FW_ID_VER, 0); dev->fw_id_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_FW_ID_TYPE, MQNIC_RB_FW_ID_VER, 0);
if (!dev->fw_id_rb) if (!dev->fw_id_rb)
{ {
@ -302,7 +302,7 @@ static int mqnic_try_open(struct mqnic *dev, const char *fmt, ...)
fail_enum: fail_enum:
if (dev->rb_list) if (dev->rb_list)
free_reg_block_list(dev->rb_list); mqnic_free_reg_block_list(dev->rb_list);
fail_reset: fail_reset:
fail_mmap_regs: fail_mmap_regs:
if (dev->ram) if (dev->ram)
@ -360,7 +360,7 @@ static int mqnic_try_open_if_name(struct mqnic *dev, const char *if_name)
struct mqnic *mqnic_open(const char *dev_name) struct mqnic *mqnic_open(const char *dev_name)
{ {
struct mqnic *dev = calloc(1, sizeof(struct mqnic)); struct mqnic *dev = calloc(1, sizeof(struct mqnic));
struct reg_block *rb; struct mqnic_reg_block *rb;
if (!dev) if (!dev)
{ {
@ -414,16 +414,16 @@ open:
struct tm *tm_info = gmtime(&build_date); struct tm *tm_info = gmtime(&build_date);
strftime(dev->build_date_str, sizeof(dev->build_date_str), "%F %T", tm_info); strftime(dev->build_date_str, sizeof(dev->build_date_str), "%F %T", tm_info);
rb = find_reg_block(dev->rb_list, MQNIC_RB_APP_INFO_TYPE, MQNIC_RB_APP_INFO_VER, 0); rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_APP_INFO_TYPE, MQNIC_RB_APP_INFO_VER, 0);
if (rb) { if (rb) {
dev->app_id = mqnic_reg_read32(rb->regs, MQNIC_RB_APP_INFO_REG_ID); dev->app_id = mqnic_reg_read32(rb->regs, MQNIC_RB_APP_INFO_REG_ID);
} }
dev->phc_rb = find_reg_block(dev->rb_list, MQNIC_RB_PHC_TYPE, MQNIC_RB_PHC_VER, 0); dev->phc_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_PHC_TYPE, MQNIC_RB_PHC_VER, 0);
// Enumerate interfaces // Enumerate interfaces
dev->if_rb = find_reg_block(dev->rb_list, MQNIC_RB_IF_TYPE, MQNIC_RB_IF_VER, 0); dev->if_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_IF_TYPE, MQNIC_RB_IF_VER, 0);
if (!dev->if_rb) if (!dev->if_rb)
{ {
@ -477,7 +477,7 @@ void mqnic_close(struct mqnic *dev)
} }
if (dev->rb_list) if (dev->rb_list)
free_reg_block_list(dev->rb_list); mqnic_free_reg_block_list(dev->rb_list);
if (dev->ram) if (dev->ram)
munmap((void *)dev->ram, dev->ram_size); munmap((void *)dev->ram, dev->ram_size);

View File

@ -52,7 +52,7 @@ struct mqnic_sched {
int index; int index;
struct reg_block *rb; struct mqnic_reg_block *rb;
uint32_t type; uint32_t type;
uint32_t offset; uint32_t offset;
@ -72,7 +72,7 @@ struct mqnic_sched_block {
size_t regs_size; size_t regs_size;
volatile uint8_t *regs; volatile uint8_t *regs;
struct reg_block *rb_list; struct mqnic_reg_block *rb_list;
uint32_t sched_count; uint32_t sched_count;
struct mqnic_sched *sched[MQNIC_MAX_SCHED]; struct mqnic_sched *sched[MQNIC_MAX_SCHED];
@ -87,14 +87,14 @@ struct mqnic_if {
volatile uint8_t *regs; volatile uint8_t *regs;
volatile uint8_t *csr_regs; volatile uint8_t *csr_regs;
struct reg_block *rb_list; struct mqnic_reg_block *rb_list;
struct reg_block *if_ctrl_rb; struct mqnic_reg_block *if_ctrl_rb;
struct reg_block *event_queue_rb; struct mqnic_reg_block *event_queue_rb;
struct reg_block *tx_queue_rb; struct mqnic_reg_block *tx_queue_rb;
struct reg_block *tx_cpl_queue_rb; struct mqnic_reg_block *tx_cpl_queue_rb;
struct reg_block *rx_queue_rb; struct mqnic_reg_block *rx_queue_rb;
struct reg_block *rx_cpl_queue_rb; struct mqnic_reg_block *rx_cpl_queue_rb;
struct reg_block *rx_queue_map_rb; struct mqnic_reg_block *rx_queue_map_rb;
uint32_t if_features; uint32_t if_features;
@ -137,10 +137,10 @@ struct mqnic {
size_t ram_size; size_t ram_size;
volatile uint8_t *ram; volatile uint8_t *ram;
struct reg_block *rb_list; struct mqnic_reg_block *rb_list;
struct reg_block *fw_id_rb; struct mqnic_reg_block *fw_id_rb;
struct reg_block *if_rb; struct mqnic_reg_block *if_rb;
struct reg_block *phc_rb; struct mqnic_reg_block *phc_rb;
uint32_t fpga_id; uint32_t fpga_id;
const char *fpga_part; const char *fpga_part;
@ -182,11 +182,11 @@ uint32_t mqnic_interface_get_rx_queue_map_rss_mask(struct mqnic_if *interface, i
uint32_t mqnic_interface_get_rx_queue_map_app_mask(struct mqnic_if *interface, int port); uint32_t mqnic_interface_get_rx_queue_map_app_mask(struct mqnic_if *interface, int port);
// mqnic_sched_block.c // mqnic_sched_block.c
struct mqnic_sched_block *mqnic_sched_block_open(struct mqnic_if *interface, int index, struct reg_block *block_rb); struct mqnic_sched_block *mqnic_sched_block_open(struct mqnic_if *interface, int index, struct mqnic_reg_block *block_rb);
void mqnic_sched_block_close(struct mqnic_sched_block *block); void mqnic_sched_block_close(struct mqnic_sched_block *block);
// mqnic_scheduler.c // mqnic_scheduler.c
struct mqnic_sched *mqnic_sched_open(struct mqnic_sched_block *block, int index, struct reg_block *rb); struct mqnic_sched *mqnic_sched_open(struct mqnic_sched_block *block, int index, struct mqnic_reg_block *rb);
void mqnic_sched_close(struct mqnic_sched *sched); void mqnic_sched_close(struct mqnic_sched *sched);
#endif /* MQNIC_H */ #endif /* MQNIC_H */

View File

@ -58,7 +58,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
} }
// Enumerate registers // Enumerate registers
interface->rb_list = enumerate_reg_block_list(interface->regs, dev->if_csr_offset, interface->regs_size); interface->rb_list = mqnic_enumerate_reg_block_list(interface->regs, dev->if_csr_offset, interface->regs_size);
if (!interface->rb_list) if (!interface->rb_list)
{ {
@ -66,7 +66,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
goto fail; goto fail;
} }
interface->if_ctrl_rb = find_reg_block(interface->rb_list, MQNIC_RB_IF_CTRL_TYPE, MQNIC_RB_IF_CTRL_VER, 0); interface->if_ctrl_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_IF_CTRL_TYPE, MQNIC_RB_IF_CTRL_VER, 0);
if (!interface->if_ctrl_rb) if (!interface->if_ctrl_rb)
{ {
@ -80,7 +80,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
interface->max_tx_mtu = mqnic_reg_read32(interface->if_ctrl_rb->regs, MQNIC_RB_IF_CTRL_REG_MAX_TX_MTU); interface->max_tx_mtu = mqnic_reg_read32(interface->if_ctrl_rb->regs, MQNIC_RB_IF_CTRL_REG_MAX_TX_MTU);
interface->max_rx_mtu = mqnic_reg_read32(interface->if_ctrl_rb->regs, MQNIC_RB_IF_CTRL_REG_MAX_RX_MTU); interface->max_rx_mtu = mqnic_reg_read32(interface->if_ctrl_rb->regs, MQNIC_RB_IF_CTRL_REG_MAX_RX_MTU);
interface->event_queue_rb = find_reg_block(interface->rb_list, MQNIC_RB_EVENT_QM_TYPE, MQNIC_RB_EVENT_QM_VER, 0); interface->event_queue_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_EVENT_QM_TYPE, MQNIC_RB_EVENT_QM_VER, 0);
if (!interface->event_queue_rb) if (!interface->event_queue_rb)
{ {
@ -95,7 +95,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
if (interface->event_queue_count > MQNIC_MAX_EVENT_RINGS) if (interface->event_queue_count > MQNIC_MAX_EVENT_RINGS)
interface->event_queue_count = MQNIC_MAX_EVENT_RINGS; interface->event_queue_count = MQNIC_MAX_EVENT_RINGS;
interface->tx_queue_rb = find_reg_block(interface->rb_list, MQNIC_RB_TX_QM_TYPE, MQNIC_RB_TX_QM_VER, 0); interface->tx_queue_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_TX_QM_TYPE, MQNIC_RB_TX_QM_VER, 0);
if (!interface->tx_queue_rb) if (!interface->tx_queue_rb)
{ {
@ -110,7 +110,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
if (interface->tx_queue_count > MQNIC_MAX_TX_RINGS) if (interface->tx_queue_count > MQNIC_MAX_TX_RINGS)
interface->tx_queue_count = MQNIC_MAX_TX_RINGS; interface->tx_queue_count = MQNIC_MAX_TX_RINGS;
interface->tx_cpl_queue_rb = find_reg_block(interface->rb_list, MQNIC_RB_TX_CQM_TYPE, MQNIC_RB_TX_CQM_VER, 0); interface->tx_cpl_queue_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_TX_CQM_TYPE, MQNIC_RB_TX_CQM_VER, 0);
if (!interface->tx_cpl_queue_rb) if (!interface->tx_cpl_queue_rb)
{ {
@ -125,7 +125,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
if (interface->tx_cpl_queue_count > MQNIC_MAX_TX_CPL_RINGS) if (interface->tx_cpl_queue_count > MQNIC_MAX_TX_CPL_RINGS)
interface->tx_cpl_queue_count = MQNIC_MAX_TX_CPL_RINGS; interface->tx_cpl_queue_count = MQNIC_MAX_TX_CPL_RINGS;
interface->rx_queue_rb = find_reg_block(interface->rb_list, MQNIC_RB_RX_QM_TYPE, MQNIC_RB_RX_QM_VER, 0); interface->rx_queue_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_RX_QM_TYPE, MQNIC_RB_RX_QM_VER, 0);
if (!interface->rx_queue_rb) if (!interface->rx_queue_rb)
{ {
@ -140,7 +140,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
if (interface->rx_queue_count > MQNIC_MAX_RX_RINGS) if (interface->rx_queue_count > MQNIC_MAX_RX_RINGS)
interface->rx_queue_count = MQNIC_MAX_RX_RINGS; interface->rx_queue_count = MQNIC_MAX_RX_RINGS;
interface->rx_cpl_queue_rb = find_reg_block(interface->rb_list, MQNIC_RB_RX_CQM_TYPE, MQNIC_RB_RX_CQM_VER, 0); interface->rx_cpl_queue_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_RX_CQM_TYPE, MQNIC_RB_RX_CQM_VER, 0);
if (!interface->rx_cpl_queue_rb) if (!interface->rx_cpl_queue_rb)
{ {
@ -155,7 +155,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
if (interface->rx_cpl_queue_count > MQNIC_MAX_RX_CPL_RINGS) if (interface->rx_cpl_queue_count > MQNIC_MAX_RX_CPL_RINGS)
interface->rx_cpl_queue_count = MQNIC_MAX_RX_CPL_RINGS; interface->rx_cpl_queue_count = MQNIC_MAX_RX_CPL_RINGS;
interface->rx_queue_map_rb = find_reg_block(interface->rb_list, MQNIC_RB_RX_QUEUE_MAP_TYPE, MQNIC_RB_RX_QUEUE_MAP_VER, 0); interface->rx_queue_map_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_RX_QUEUE_MAP_TYPE, MQNIC_RB_RX_QUEUE_MAP_VER, 0);
if (!interface->rx_queue_map_rb) if (!interface->rx_queue_map_rb)
{ {
@ -165,7 +165,7 @@ struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *r
for (int k = 0; k < interface->sched_block_count; k++) for (int k = 0; k < interface->sched_block_count; k++)
{ {
struct reg_block *sched_block_rb = find_reg_block(interface->rb_list, MQNIC_RB_SCHED_BLOCK_TYPE, MQNIC_RB_SCHED_BLOCK_VER, k); struct mqnic_reg_block *sched_block_rb = mqnic_find_reg_block(interface->rb_list, MQNIC_RB_SCHED_BLOCK_TYPE, MQNIC_RB_SCHED_BLOCK_VER, k);
struct mqnic_sched_block *sched_block; struct mqnic_sched_block *sched_block;
if (!sched_block_rb) if (!sched_block_rb)
@ -201,7 +201,7 @@ void mqnic_if_close(struct mqnic_if *interface)
} }
if (interface->rb_list) if (interface->rb_list)
free_reg_block_list(interface->rb_list); mqnic_free_reg_block_list(interface->rb_list);
free(interface); free(interface);
} }

View File

@ -36,7 +36,7 @@ either expressed or implied, of The Regents of the University of California.
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
struct mqnic_sched_block *mqnic_sched_block_open(struct mqnic_if *interface, int index, struct reg_block *block_rb) struct mqnic_sched_block *mqnic_sched_block_open(struct mqnic_if *interface, int index, struct mqnic_reg_block *block_rb)
{ {
struct mqnic_sched_block *block = calloc(1, sizeof(struct mqnic_sched_block)); struct mqnic_sched_block *block = calloc(1, sizeof(struct mqnic_sched_block));
@ -50,7 +50,7 @@ struct mqnic_sched_block *mqnic_sched_block_open(struct mqnic_if *interface, int
block->index = index; block->index = index;
block->rb_list = enumerate_reg_block_list(interface->regs, offset, interface->regs_size); block->rb_list = mqnic_enumerate_reg_block_list(interface->regs, offset, interface->regs_size);
if (!block->rb_list) if (!block->rb_list)
{ {
@ -59,7 +59,7 @@ struct mqnic_sched_block *mqnic_sched_block_open(struct mqnic_if *interface, int
} }
block->sched_count = 0; block->sched_count = 0;
for (struct reg_block *rb = block->rb_list; rb->type && rb->version; rb++) for (struct mqnic_reg_block *rb = block->rb_list; rb->type && rb->version; rb++)
{ {
if (rb->type == MQNIC_RB_SCHED_RR_TYPE && rb->version == MQNIC_RB_SCHED_RR_VER) if (rb->type == MQNIC_RB_SCHED_RR_TYPE && rb->version == MQNIC_RB_SCHED_RR_VER)
{ {
@ -94,7 +94,7 @@ void mqnic_sched_block_close(struct mqnic_sched_block *block)
} }
if (block->rb_list) if (block->rb_list)
free_reg_block_list(block->rb_list); mqnic_free_reg_block_list(block->rb_list);
free(block); free(block);
} }

View File

@ -36,7 +36,7 @@ either expressed or implied, of The Regents of the University of California.
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
struct mqnic_sched *mqnic_sched_open(struct mqnic_sched_block *block, int index, struct reg_block *rb) struct mqnic_sched *mqnic_sched_open(struct mqnic_sched_block *block, int index, struct mqnic_reg_block *rb)
{ {
struct mqnic_sched *sched = calloc(1, sizeof(struct mqnic_sched)); struct mqnic_sched *sched = calloc(1, sizeof(struct mqnic_sched));

View File

@ -38,10 +38,10 @@ either expressed or implied, of The Regents of the University of California.
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
struct reg_block *enumerate_reg_block_list(volatile uint8_t *base, size_t offset, size_t size) struct mqnic_reg_block *mqnic_enumerate_reg_block_list(volatile uint8_t *base, size_t offset, size_t size)
{ {
int max_count = 8; int max_count = 8;
struct reg_block *reg_block_list = calloc(max_count, sizeof(struct reg_block)); struct mqnic_reg_block *reg_block_list = calloc(max_count, sizeof(struct mqnic_reg_block));
int count = 0; int count = 0;
volatile uint8_t *ptr; volatile uint8_t *ptr;
@ -86,9 +86,9 @@ struct reg_block *enumerate_reg_block_list(volatile uint8_t *base, size_t offset
if (count >= max_count) if (count >= max_count)
{ {
struct reg_block *tmp; struct mqnic_reg_block *tmp;
max_count += 4; max_count += 4;
tmp = realloc(reg_block_list, max_count * sizeof(struct reg_block)); tmp = realloc(reg_block_list, max_count * sizeof(struct mqnic_reg_block));
if (!tmp) if (!tmp)
goto fail; goto fail;
reg_block_list = tmp; reg_block_list = tmp;
@ -101,9 +101,9 @@ fail:
return NULL; return NULL;
} }
struct reg_block *find_reg_block(struct reg_block *list, uint32_t type, uint32_t version, int index) struct mqnic_reg_block *mqnic_find_reg_block(struct mqnic_reg_block *list, uint32_t type, uint32_t version, int index)
{ {
struct reg_block *rb = list; struct mqnic_reg_block *rb = list;
while (rb->regs) while (rb->regs)
{ {
@ -125,7 +125,7 @@ struct reg_block *find_reg_block(struct reg_block *list, uint32_t type, uint32_t
return NULL; return NULL;
} }
void free_reg_block_list(struct reg_block *list) void mqnic_free_reg_block_list(struct mqnic_reg_block *list)
{ {
free(list); free(list);
} }

View File

@ -37,15 +37,15 @@ either expressed or implied, of The Regents of the University of California.
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
struct reg_block { struct mqnic_reg_block {
uint32_t type; uint32_t type;
uint32_t version; uint32_t version;
volatile uint8_t *base; volatile uint8_t *base;
volatile uint8_t *regs; volatile uint8_t *regs;
}; };
struct reg_block *enumerate_reg_block_list(volatile uint8_t *base, size_t offset, size_t size); struct mqnic_reg_block *mqnic_enumerate_reg_block_list(volatile uint8_t *base, size_t offset, size_t size);
struct reg_block *find_reg_block(struct reg_block *list, uint32_t type, uint32_t version, int index); struct mqnic_reg_block *mqnic_find_reg_block(struct mqnic_reg_block *list, uint32_t type, uint32_t version, int index);
void free_reg_block_list(struct reg_block *list); void mqnic_free_reg_block_list(struct mqnic_reg_block *list);
#endif /* REG_BLOCK_H */ #endif /* REG_BLOCK_H */

View File

@ -47,14 +47,14 @@ static void usage(char *name)
name); name);
} }
uint32_t mqnic_alveo_bmc_reg_read(struct reg_block *rb, uint32_t reg) uint32_t mqnic_alveo_bmc_reg_read(struct mqnic_reg_block *rb, uint32_t reg)
{ {
mqnic_reg_write32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_ADDR, reg); mqnic_reg_write32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_ADDR, reg);
mqnic_reg_read32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_DATA); // dummy read mqnic_reg_read32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_DATA); // dummy read
return mqnic_reg_read32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_DATA); return mqnic_reg_read32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_DATA);
} }
void mqnic_alveo_bmc_reg_write(struct reg_block *rb, uint32_t reg, uint32_t val) void mqnic_alveo_bmc_reg_write(struct mqnic_reg_block *rb, uint32_t reg, uint32_t val)
{ {
mqnic_reg_write32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_ADDR, reg); mqnic_reg_write32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_ADDR, reg);
mqnic_reg_write32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_DATA, val); mqnic_reg_write32(rb->regs, MQNIC_RB_ALVEO_BMC_REG_DATA, val);
@ -123,7 +123,7 @@ struct sensor_channel alveo_bmc_sensors[] = {
{0, "", ""} {0, "", ""}
}; };
int mqnic_gecko_bmc_read(struct reg_block *rb) int mqnic_gecko_bmc_read(struct mqnic_reg_block *rb)
{ {
uint32_t val; uint32_t val;
int timeout = 20000; int timeout = 20000;
@ -157,7 +157,7 @@ int mqnic_gecko_bmc_read(struct reg_block *rb)
return -1; return -1;
} }
int mqnic_gecko_bmc_write(struct reg_block *rb, uint16_t cmd, uint32_t data) int mqnic_gecko_bmc_write(struct mqnic_reg_block *rb, uint16_t cmd, uint32_t data)
{ {
int ret; int ret;
ret = mqnic_gecko_bmc_read(rb); ret = mqnic_gecko_bmc_read(rb);
@ -171,7 +171,7 @@ int mqnic_gecko_bmc_write(struct reg_block *rb, uint16_t cmd, uint32_t data)
return 0; return 0;
} }
int mqnic_gecko_bmc_query(struct reg_block *rb, uint16_t cmd, uint32_t data) int mqnic_gecko_bmc_query(struct mqnic_reg_block *rb, uint16_t cmd, uint32_t data)
{ {
int ret; int ret;
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
char *device = NULL; char *device = NULL;
struct mqnic *dev; struct mqnic *dev;
struct reg_block *bmc_rb; struct mqnic_reg_block *bmc_rb;
name = strrchr(argv[0], '/'); name = strrchr(argv[0], '/');
name = name ? 1+name : argv[0]; name = name ? 1+name : argv[0];
@ -237,7 +237,7 @@ int main(int argc, char *argv[])
mqnic_print_fw_id(dev); mqnic_print_fw_id(dev);
if ((bmc_rb = find_reg_block(dev->rb_list, MQNIC_RB_ALVEO_BMC_TYPE, MQNIC_RB_ALVEO_BMC_VER, 0))) if ((bmc_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_ALVEO_BMC_TYPE, MQNIC_RB_ALVEO_BMC_VER, 0)))
{ {
printf("Detected Xilinx Alveo board with MSP430 BMC\n"); printf("Detected Xilinx Alveo board with MSP430 BMC\n");
@ -297,7 +297,7 @@ int main(int argc, char *argv[])
printf("\n"); printf("\n");
} }
} }
else if ((bmc_rb = find_reg_block(dev->rb_list, MQNIC_RB_GECKO_BMC_TYPE, MQNIC_RB_GECKO_BMC_VER, 0))) else if ((bmc_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_GECKO_BMC_TYPE, MQNIC_RB_GECKO_BMC_VER, 0)))
{ {
printf("Detected Silicom board with Gecko BMC\n"); printf("Detected Silicom board with Gecko BMC\n");

View File

@ -79,7 +79,7 @@ int main(int argc, char *argv[])
int port = 0; int port = 0;
int sched_block = 0; int sched_block = 0;
struct reg_block *rb; struct mqnic_reg_block *rb;
struct timespec ts_now; struct timespec ts_now;
struct timespec ts_start; struct timespec ts_start;
@ -226,7 +226,7 @@ int main(int argc, char *argv[])
printf("Sched count: %d\n", dev_sched_block->sched_count); printf("Sched count: %d\n", dev_sched_block->sched_count);
rb = find_reg_block(dev_sched_block->rb_list, MQNIC_RB_TDMA_SCH_TYPE, MQNIC_RB_TDMA_SCH_VER, 0); rb = mqnic_find_reg_block(dev_sched_block->rb_list, MQNIC_RB_TDMA_SCH_TYPE, MQNIC_RB_TDMA_SCH_VER, 0);
if (dev->phc_rb && rb) if (dev->phc_rb && rb)
{ {

View File

@ -114,7 +114,7 @@ int main(int argc, char *argv[])
printf("RAM region size: %lu\n", dev->ram_size); printf("RAM region size: %lu\n", dev->ram_size);
printf("Device-level register blocks:\n"); printf("Device-level register blocks:\n");
for (struct reg_block *rb = dev->rb_list; rb->regs; rb++) for (struct mqnic_reg_block *rb = dev->rb_list; rb->regs; rb++)
printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24, printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24,
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff); (rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
mqnic_reg_read32(dev->phc_rb->regs, MQNIC_RB_PHC_REG_NOM_PERIOD_FNS)); mqnic_reg_read32(dev->phc_rb->regs, MQNIC_RB_PHC_REG_NOM_PERIOD_FNS));
ch = 0; ch = 0;
for (struct reg_block *rb = dev->rb_list; rb->regs; rb++) for (struct mqnic_reg_block *rb = dev->rb_list; rb->regs; rb++)
{ {
if (rb->type == MQNIC_RB_PHC_PEROUT_TYPE && rb->version == MQNIC_RB_PHC_PEROUT_VER) if (rb->type == MQNIC_RB_PHC_PEROUT_TYPE && rb->version == MQNIC_RB_PHC_PEROUT_VER)
{ {
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
} }
printf("Interface-level register blocks:\n"); printf("Interface-level register blocks:\n");
for (struct reg_block *rb = dev_interface->rb_list; rb->regs; rb++) for (struct mqnic_reg_block *rb = dev_interface->rb_list; rb->regs; rb++)
printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24, printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24,
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff); (rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
@ -239,13 +239,13 @@ int main(int argc, char *argv[])
} }
printf("Scheduler block-level register blocks:\n"); printf("Scheduler block-level register blocks:\n");
for (struct reg_block *rb = dev_sched_block->rb_list; rb->regs; rb++) for (struct mqnic_reg_block *rb = dev_sched_block->rb_list; rb->regs; rb++)
printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24, printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24,
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff); (rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
printf("Sched count: %d\n", dev_sched_block->sched_count); printf("Sched count: %d\n", dev_sched_block->sched_count);
for (struct reg_block *rb = dev_sched_block->rb_list; rb->regs; rb++) for (struct mqnic_reg_block *rb = dev_sched_block->rb_list; rb->regs; rb++)
{ {
if (rb->type == MQNIC_RB_SCHED_RR_TYPE && rb->version == MQNIC_RB_SCHED_RR_VER) if (rb->type == MQNIC_RB_SCHED_RR_TYPE && rb->version == MQNIC_RB_SCHED_RR_VER)
{ {

View File

@ -566,7 +566,7 @@ int main(int argc, char *argv[])
struct mqnic *dev = NULL; struct mqnic *dev = NULL;
struct reg_block *flash_rb = NULL; struct mqnic_reg_block *flash_rb = NULL;
struct flash_device *pri_flash = NULL; struct flash_device *pri_flash = NULL;
struct flash_device *sec_flash = NULL; struct flash_device *sec_flash = NULL;
@ -678,7 +678,7 @@ int main(int argc, char *argv[])
size_t segment_size = 0; size_t segment_size = 0;
size_t segment_offset = 0; size_t segment_offset = 0;
if ((flash_rb = find_reg_block(dev->rb_list, MQNIC_RB_SPI_FLASH_TYPE, 0, 0))) if ((flash_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_SPI_FLASH_TYPE, 0, 0)))
{ {
uint32_t reg_val; uint32_t reg_val;
@ -768,7 +768,7 @@ int main(int argc, char *argv[])
flash_size = pri_flash->size; flash_size = pri_flash->size;
} }
} }
else if ((flash_rb = find_reg_block(dev->rb_list, MQNIC_RB_BPI_FLASH_TYPE, 0, 0))) else if ((flash_rb = mqnic_find_reg_block(dev->rb_list, MQNIC_RB_BPI_FLASH_TYPE, 0, 0)))
{ {
uint32_t reg_val; uint32_t reg_val;