Software Library API naibrd 1.62
See all documentation at naii.docs.com
Ethernet Utility Functions

Functions

NAIFUNC int32_t NAIAPI nai_ether_FinishMessage (uint8_t msgbuf[], int32_t offset, nai_ether_gen_t gen)
 Handles filling in the message size field and the postamble fields in the message buffer.
 
NAIFUNC int32_t NAIAPI nai_ether_DecodeMessageHeader (const uint8_t msg[], int32_t msgsize, uint16_t *seq, nai_ether_typecode_t *typecode, nai_ether_gen_t gen, int32_t *size)
 Handles decoding the Ethernet Message Header and extracting the sequence number, type code and message size.
 
NAIFUNC int32_t NAIAPI nai_ether_BeginWriteMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen, nai_intf_t intf, uint32_t addr, uint32_t stride, uint32_t count, uint32_t datawidth)
 Handles filling in the message buffer with the data associated with the Ethernet Write Registers message. The data to be written to the Ethernet Write Registers message is handled by calling nai_ether_WriteMessageData().
 
NAIFUNC int32_t NAIAPI nai_ether_BeginWriteNoReplyMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen, nai_intf_t intf, uint32_t addr, uint32_t stride, uint32_t count, uint32_t datawidth)
 Handles filling in the message buffer with the data associated with the Ethernet Write with No Reply Registers message. The data to be written to the Ethernet Write No Reply Registers message is handled by calling nai_ether_WriteMessageData().
 
NAIFUNC int32_t NAIAPI nai_ether_MakeNopMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen)
 Handles filling in the message buffer with the data associated with the Ethernet NOP message.
 
NAIFUNC int32_t NAIAPI nai_ether_MakeReadMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen, nai_intf_t intf, uint32_t addr, uint32_t stride, uint32_t count, uint32_t datawidth)
 Handles filling in the message buffer with the data associated with the Ethernet Read Registers message.
 
NAIFUNC int32_t NAIAPI nai_ether_DecodeReadMessage (nai_ether_typecode_t typecode, nai_ether_gen_t gen, const uint8_t msg[], int32_t offset, uint32_t *count, uint32_t *regwidth, void *buffer, uint32_t bufferwidth, uint32_t buffercnt)
 Handles decoding the Ethernet Read Message and extracting the count, register width and start of the data.
 
NAIFUNC int32_t NAIAPI nai_ether_MakeReadBlockMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen, uint16_t blockid)
 Handles filling in the message buffer with the data associated with the Ethernet Read Block message.
 
NAIFUNC int32_t NAIAPI nai_ether_MakeWriteBlockMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen, uint16_t blockid, uint32_t regwidth, uint32_t count, uint32_t data[])
 Handles filling in the message buffer with the data associated with the Ethernet Write Block message.
 
NAIFUNC int32_t NAIAPI nai_ether_MakeWriteNoReplyBlockMessage (uint8_t msgbuf[], uint16_t seq, nai_ether_gen_t gen, uint16_t blockid, uint32_t regwidth, uint32_t count, uint32_t data[])
 Handles filling in the message buffer with the data associated with the Ethernet Write Block with No Reply message.
 
NAIFUNC int32_t NAIAPI nai_ether_WriteMessageData (uint8_t msgbuf[], int32_t offset, uint32_t msgdatawidth, const void *data, uint32_t datawidth, uint32_t count)
 Handles filling in the message buffer with the data values associated with the Ethernet Write Registers message.
 

Detailed Description


Function Documentation

◆ nai_ether_BeginWriteMessage()

NAIFUNC int32_t NAIAPI nai_ether_BeginWriteMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen,
nai_intf_t intf,
uint32_t addr,
uint32_t stride,
uint32_t count,
uint32_t datawidth )

Handles filling in the message buffer with the data associated with the Ethernet Write Registers message. The data to be written to the Ethernet Write Registers message is handled by calling nai_ether_WriteMessageData().

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code.
intf: (Input) Refer to nai_intf_t for valid interface types.
addr: (Input) Register Address.
stride: (Input) Number of bytes to increment the register addressing for each consecutive read.
count: (Input) Number of Register Size reads to perform.
datawidth: (Input) Data width specified in bytes.
Returns
  • returns the message size.

◆ nai_ether_BeginWriteNoReplyMessage()

NAIFUNC int32_t NAIAPI nai_ether_BeginWriteNoReplyMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen,
nai_intf_t intf,
uint32_t addr,
uint32_t stride,
uint32_t count,
uint32_t datawidth )

Handles filling in the message buffer with the data associated with the Ethernet Write with No Reply Registers message. The data to be written to the Ethernet Write No Reply Registers message is handled by calling nai_ether_WriteMessageData().

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code - Only Gen 4 supports this feature.
intf: (Input) Refer to nai_intf_t for valid interface types.
addr: (Input) Register Address.
stride: (Input) Number of bytes to increment the register addressing for each consecutive read.
count: (Input) Number of Register Size reads to perform.
datawidth: (Input) Data width specified in bytes.
Returns
  • returns the message size.

◆ nai_ether_DecodeMessageHeader()

NAIFUNC int32_t NAIAPI nai_ether_DecodeMessageHeader ( const uint8_t msg[],
int32_t msgsize,
uint16_t * seq,
nai_ether_typecode_t * typecode,
nai_ether_gen_t gen,
int32_t * size )

Handles decoding the Ethernet Message Header and extracting the sequence number, type code and message size.

Parameters
msg: (Input) Message buffer to decode.
msgsize: (Input) Number of bytes in message buffer.
seq: (Output) Sequence number retrieved from message buffer.
typecode: (Output) Type code retrieved from message buffer.
gen: (Input) Ethernet message generation code.
size: (Output) Message size retrieved from message buffer.
Returns
  • If no errors were encountered, the index after 'Length' (for Gen 4) or 'Block Size' (prior to Gen 4) is returned.
  • NAI_ERROR_INVALID_MESSAGE when a malformed message is detected.
  • NAI_ERROR_OVERFLOW when an size specified in the message is greater than the message received.
  • NAI_ERROR_INVALID_VALUE when an invalid value is detected.
  • NAI_ERROR_INVALID_SIZE when an invalid size is detected.
  • NAI_ERROR_INVALID_ADDRESS when an invalid address is detected.
  • NAI_ERROR_INVALID_ADDRBOUND when an invalid address boundary is detected.
  • NAI_ERROR_INVALID_COMMAND when an invalid command is detected.
  • NAI_ERROR_NOT_MASTER when trying to access a board as master when it's not configured as a master board.
  • NAI_ERROR_IN_USE when port is in use.
  • NAI_ERROR_DISCONNECTED when the ethernet connection on board has been disconnected.
  • NAI_ERROR_UNKNOWN when unknown error has been detected.

◆ nai_ether_DecodeReadMessage()

NAIFUNC int32_t NAIAPI nai_ether_DecodeReadMessage ( nai_ether_typecode_t typecode,
nai_ether_gen_t gen,
const uint8_t msg[],
int32_t offset,
uint32_t * count,
uint32_t * regwidth,
void * buffer,
uint32_t bufferwidth,
uint32_t buffercnt )

Handles decoding the Ethernet Read Message and extracting the count, register width and start of the data.

Parameters
typecode: (Input) Type code retrieved from message buffer.
gen: (Input) Ethernet message generation code.
msg: (Input) Message buffer to decode.
offset: (Input) Index to the Message buffer to start decoding.
count: (Output) Number of data elements in the message buffer.
regwidth: (Output) Register width specified in bytes.
buffer: (Output) Data buffer.
bufferwidth: (Input) Data width.
buffercnt: (Input) Size of Data buffer.
Returns
  • If no errors were encountered, the index before the postamble is returned.
  • NAI_ERROR_COMM_ERROR
  • NAI_ERROR_BUS_TIMEOUT

◆ nai_ether_FinishMessage()

NAIFUNC int32_t NAIAPI nai_ether_FinishMessage ( uint8_t msgbuf[],
int32_t offset,
nai_ether_gen_t gen )

Handles filling in the message size field and the postamble fields in the message buffer.

Parameters
msgbuf: (Input) Message buffer to fill with the message size and postamble elements.
offset: (Input) Index where the postamble field should be written.
gen: (Input) Ethernet message generation code.
Returns
  • returns the message size.

◆ nai_ether_MakeNopMessage()

NAIFUNC int32_t NAIAPI nai_ether_MakeNopMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen )

Handles filling in the message buffer with the data associated with the Ethernet NOP message.

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet NOP elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code.
Returns
  • returns the message size.

◆ nai_ether_MakeReadBlockMessage()

NAIFUNC int32_t NAIAPI nai_ether_MakeReadBlockMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen,
uint16_t blockid )

Handles filling in the message buffer with the data associated with the Ethernet Read Block message.

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code.
blockid: (Input) Block ID.
Returns
  • returns the message size.

◆ nai_ether_MakeReadMessage()

NAIFUNC int32_t NAIAPI nai_ether_MakeReadMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen,
nai_intf_t intf,
uint32_t addr,
uint32_t stride,
uint32_t count,
uint32_t datawidth )

Handles filling in the message buffer with the data associated with the Ethernet Read Registers message.

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code.
intf: (Input) Refer to nai_intf_t for valid interface types.
addr: (Input) Register Address.
stride: (Input) Number of bytes to increment the register addressing for each consecutive read.
count: (Input) Number of Register Size reads to perform.
datawidth: (Input) Data width specified in bytes.
Returns
  • returns the message size.

◆ nai_ether_MakeWriteBlockMessage()

NAIFUNC int32_t NAIAPI nai_ether_MakeWriteBlockMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen,
uint16_t blockid,
uint32_t regwidth,
uint32_t count,
uint32_t data[] )

Handles filling in the message buffer with the data associated with the Ethernet Write Block message.

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code.
blockid: (Input) Block ID.
regwidth: (Input) Register width specified in bytes.
count: (Input) Number of Register Size writes to perform.
data: (Input) Data values.
Returns
  • returns the message size.

◆ nai_ether_MakeWriteNoReplyBlockMessage()

NAIFUNC int32_t NAIAPI nai_ether_MakeWriteNoReplyBlockMessage ( uint8_t msgbuf[],
uint16_t seq,
nai_ether_gen_t gen,
uint16_t blockid,
uint32_t regwidth,
uint32_t count,
uint32_t data[] )

Handles filling in the message buffer with the data associated with the Ethernet Write Block with No Reply message.

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
seq: (Input) Sequence number.
gen: (Input) Ethernet message generation code.
blockid: (Input) Block ID.
regwidth: (Input) Register width specified in bytes.
count: (Input) Number of Register Size writes to perform.
data: (Input) Data values.
Returns
  • returns the message size.

◆ nai_ether_WriteMessageData()

NAIFUNC int32_t NAIAPI nai_ether_WriteMessageData ( uint8_t msgbuf[],
int32_t offset,
uint32_t msgdatawidth,
const void * data,
uint32_t datawidth,
uint32_t count )

Handles filling in the message buffer with the data values associated with the Ethernet Write Registers message.

Parameters
msgbuf: (Input) Message buffer to fill with the Ethernet Read Registers elements.
offset: (Input) Index where the data values should be written to in the Message buffer.
msgdatawidth: (Input) Register size in bytes.
data: (Input) Data values.
datawidth: (Input) Data size in bytes.
count: (Input) Number of Register Size writes to perform.
Returns
  • returns the index of the last data element written to in the message buffer.