CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
internal_utility.c File Reference

This file contains the definitions of the functions that comprise internal utility functions. More...

#include "internal_utility.h"
#include <stddef.h>
#include "adapter_api.h"
#include "adapter_efa_probe.h"
#include "endpoint_manager.h"
#include "cdi_os_api.h"

Functions

static const CdiEnumStringKeyUtilityKeyGetArray (InternalEnumStringKeyTypes key_type)
 Update InternalEnumStringKeyTypes in internal_utility.h whenever an entry is added to this function's switch statement.
 
const char * InternalUtilityKeyEnumToString (InternalEnumStringKeyTypes key_type, int enum_value)
 

Variables

static const CdiEnumStringKey probe_state_key_array []
 Enum/String keys for ProbeState. NOTE: Must match ProbeState.
 
static const CdiEnumStringKey probe_command_key_array []
 Enum/String keys for ProbeCommand. NOTE: Must match ProbeCommand.
 
static const CdiEnumStringKey endpoint_manager_command_key_array []
 Enum/String keys for EndpointState. NOTE: Must match EndpointState.
 

Detailed Description

This file contains the definitions of the functions that comprise internal utility functions.

Function Documentation

◆ InternalUtilityKeyEnumToString()

const char * InternalUtilityKeyEnumToString ( InternalEnumStringKeyTypes key_type,
int enum_value )

Function used to convert an internal enum value to a string.

Parameters
key_typeEnum from InternalEnumStringKeyTypes which indicates which key-value array to search for enum_value.
enum_valueValue to convert to a string.
Returns
Pointer to returned string. If no match was found, NULL is returned.

Variable Documentation

◆ endpoint_manager_command_key_array

const CdiEnumStringKey endpoint_manager_command_key_array[]
static
Initial value:
= {
{ kEndpointStateIdle, "Idle" },
{ kEndpointStateReset, "Reset" },
{ kEndpointStateStart, "Start" },
{ kEndpointStateShutdown, "Shutdown" },
}
#define CDI_INVALID_ENUM_VALUE
Used to define an invalid enum found.
Definition cdi_utility_api.h:38
@ kEndpointStateShutdown
Shutdown the endpoint.
Definition endpoint_manager.h:47
@ kEndpointStateIdle
Endpoint Manager is idle. Nothing special to do.
Definition endpoint_manager.h:44
@ kEndpointStateReset
Reset the endpoint.
Definition endpoint_manager.h:45
@ kEndpointStateStart
Start the endpoint.
Definition endpoint_manager.h:46

Enum/String keys for EndpointState. NOTE: Must match EndpointState.

◆ probe_command_key_array

const CdiEnumStringKey probe_command_key_array[]
static
Initial value:
= {
{ kProbeCommandReset, "Reset" },
{ kProbeCommandPing, "Ping" },
{ kProbeCommandConnected, "Connected" },
{ kProbeCommandAck, "Ack" },
{ kProbeCommandProtocolVersion, "Protocol Version" },
}
@ kProbeCommandAck
Packet is an ACK response to a previously sent command.
Definition protocol.h:150
@ kProbeCommandPing
Request to ping the connection.
Definition protocol.h:148
@ kProbeCommandConnected
Notification that connection has been established (probe has completed).
Definition protocol.h:149
@ kProbeCommandReset
Request to reset the connection. Start with 1 so no commands have the value 0.
Definition protocol.h:147
@ kProbeCommandProtocolVersion
Packet contains protocol version of sender.
Definition protocol.h:151

Enum/String keys for ProbeCommand. NOTE: Must match ProbeCommand.

◆ probe_state_key_array

const CdiEnumStringKey probe_state_key_array[]
static
Initial value:
= {
{ kProbeStateIdle, "Idle" },
{ kProbeStateSendReset, "SendReset" },
{ kProbeStateSendProtocolVersion, "SendProtocolVersion" },
{ kProbeStateResetting, "Resetting" },
{ kProbeStateResetDone, "ResetDone" },
{ kProbeStateWaitForStart, "WaitForStart" },
{ kProbeStateEfaStart, "EfaStart"},
{ kProbeStateEfaProbe, "EFAProbe" },
{ kProbeStateEfaTxProbeAcks, "EFAProbeAcks" },
{ kProbeStateEfaConnected, "EFAConnected" },
{ kProbeStateEfaReset, "EfaReset" },
{ kProbeStateDestroy, "Destroy" },
}
@ kProbeStateEfaProbe
Definition adapter_efa_probe.h:68
@ kProbeStateEfaStart
Definition adapter_efa_probe.h:64
@ kProbeStateWaitForStart
Definition adapter_efa_probe.h:60
@ kProbeStateDestroy
Endpoint is being destroyed.
Definition adapter_efa_probe.h:87
@ kProbeStateSendProtocolVersion
After ACK from reset has been received by Tx, send protocol version to Rx.
Definition adapter_efa_probe.h:48
@ kProbeStateIdle
Probe just started. Advance to kProbeStateSendReset.
Definition adapter_efa_probe.h:41
@ kProbeStateResetting
Definition adapter_efa_probe.h:52
@ kProbeStateEfaConnected
Definition adapter_efa_probe.h:76
@ kProbeStateResetDone
Definition adapter_efa_probe.h:56
@ kProbeStateSendReset
Definition adapter_efa_probe.h:45
@ kProbeStateEfaTxProbeAcks
The EFA Rx has received all the probe packets and now the TX is waiting to receive all the probe pack...
Definition adapter_efa_probe.h:71
@ kProbeStateEfaReset
Send a request to reset the connection to the Endpoint Manager and advance to the kProbeStateSendRese...
Definition adapter_efa_probe.h:84
@ kProbeStateEfaConnectedPing
Definition adapter_efa_probe.h:81

Enum/String keys for ProbeState. NOTE: Must match ProbeState.