Skip to content

NIC Driver Register Library

mshahbaz edited this page Jul 15, 2012 · 4 revisions

The driver comes with a shared library for reading and writing registers in the hardware called libnf10reg. It exports two principle functions which at the time of writing have the following prototypes:

/* Function prototypes. */
int  nf10_reg_rd(uint32_t addr, uint32_t *val_ptr);
int  nf10_reg_wr(uint32_t addr, uint32_t val);

The return value of each of these functions is an NLE_* (netlink error) type error code, where 0 indicates success and all other values indicate different types of failures.

Tip: If an error occurs, try checking the output of dmesg to see if the driver has anything to say about the error.

For an example of how to use the library, see the 10G Reference NIC's sw/host/apps/libnf10reg_example/ directory. There you will find an example Makefile and two example read and write applications that show how to use the library.

NOTE: Before linking programs with the library, make sure you have compiled and installed the NF10 register library with the following commands in the driver's root directory:

make
sudo make install_nf10_reg_lib

Otherwise your system will not be able to find the library at compile time, nor will it be able to load the library at runtime.

Clone this wiki locally