stream_config.h Source File

Reference Documentation

Platform
Intel® PAC
Napatech SmartNIC
Content Type
Reference Information
Capture Software Version
Link™ Capture Software 12.10
Napatech Software Suite: include/ntapi/stream_config.h Source File
stream_config.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2023 Napatech A/S.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Napatech A/S nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL NAPATECH A/S BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  *
29 
30  */
31 
32 /**
33  * @file
34  *
35  * This header file is the STREAMTYPE_CONFIG interface
36  *
37  */
38 #ifndef __STREAM_CONFIG_H__
39 #define __STREAM_CONFIG_H__
40 
41 #if !defined(__NT_H__)
42  #error: My interface file is 'nt.h'. Please include that via #include "nt.h" directly.
43 #endif
44 
45 /** @addtogroup ConfigStream
46  * @{
47  *
48  * Configuration streams are used to read and write configuration data
49  * and to set the filter configuration using NTPL commands. This
50  * includes everything that can be changed on the fly. All static
51  * configuration is done in the <tt>ntservice.ini</tt> file.
52  *
53  * All configuration parameters are organized in a parameter tree
54  * structure @ref NtConfig_t where some parameters are read only (static
55  * configuration parameters) and some parameters are read and write
56  * (dynamic configuration parameters).
57  *
58  * To open a configuration stream call @ref NT_ConfigOpen. Once the
59  * configuration stream is open use @ref NT_ConfigRead and @ref
60  * NT_ConfigWrite with the @ref NtConfig_t structure to retrieve and
61  * change the configuration. When done, call @ref NT_ConfigClose to close
62  * the stream.
63  *
64  * @note Changing a configuration setting will trigger an @ref
65  * NtEventSource_e::NT_EVENT_SOURCE_CONFIG
66  * "NT_EVENT_SOURCE_CONFIG" when the changes have been made.
67  *
68  * The configuration parameter types currently supported are:
69  * @li <tt>Port settings</tt> - retrieves or changes link speed, IFG, MDI mode
70  * @li <tt>Time stamp type</tt> Retrieves or changes time stamp configuration
71  * @li <tt>Time synchronization</tt> Retrieves or changes time synchronization configuration
72  * @li <tt>Sensor min/max alarm settings</tt> Retrieves or changes sensor min/max alarm limits configuration
73  * @li <tt>Coordinated time synchronized transmit</tt> Sets the coordinated time synchronized transmit configuration
74  *
75  * To set up or change filter configuration using NTPL commands use
76  * the @ref NT_NTPL function call on an open configuration stream. For
77  * a complete description of the NTPL syntax see @ref
78  * NtplOverview "NTPL Overview".
79  *
80  * For an example of using the configuration stream see @ref
81  * config/config_example.c "config/config_example.c".
82  *
83  * @note The config stream is not thread-safe. If the same stream handle is to be used by multiple threads,
84  * it must be mutex protected in the application.
85  *
86  */
87 #include "ntapi/commontypes.h"
88 
89 /**
90  * Configuration parameters
91  */
93  NT_CONFIG_PARM_UNKNOWN=0, //!< Unknown command
94  NT_CONFIG_PARM_PORT_COMPAT_0 = 1, //!< Port settings configuration parameter - defined in stream_config_compat.h
95  NT_CONFIG_PARM_ADAPTER_TIMESTAMP, //!< Time stamp configuration parameter - use @ref NtConfigTimestampRead_s or @ref NtConfigTimestampWrite_s
96  NT_CONFIG_PARM_ADAPTER_TIMESYNC, //!< Time synchronization configuration parameter - use @ref NtConfigTimesyncWrite_s
97  NT_CONFIG_PARM_SENSOR, //!< Sensor configuration parameter - use @ref NtConfigSensor_s
99  NT_CONFIG_PARM_BYPASS_ADAPTER, //!< Bypass adapter settings configuration parameter - use @ref NtConfigBypass_s
100  NT_CONFIG_PARM_BYPASS_PORT, //!< Bypass port settings configuration parameter - use @ref NtConfigBypass_s
101  NT_CONFIG_PARM_BYPASS_ADAPTER_WATCHDOG_TIMEOUT, //!< Bypass watchdog timeout setup configuration parameter - use @ref NtConfigBypassWatchdogTimeout_s
102  NT_CONFIG_PARM_BYPASS_PORT_WATCHDOG_TIMEOUT, //!< Bypass adapter port watchdog timeout setup configuration parameter - use @ref NtConfigBypassWatchdogTimeout_s
103  NT_CONFIG_PARM_BYPASS_ADAPTER_WATCHDOG_TIMER, //!< Bypass adapter watchdog settings configuration parameter - use @ref NtConfigBypassWatchdogTimer_s
104  NT_CONFIG_PARM_BYPASS_PORT_WATCHDOG_TIMER, //!< Bypass port watchdog settings configuration parameter - use @ref NtConfigBypassWatchdogTimer_s
105  NT_CONFIG_PARM_ADAPTER_GLOBAL_SYNC, //!< Enable/disable GlobalSync on the adapter - use @ref NtConfigGlobalSyncWrite_s
106  NT_CONFIG_PARM_NIM_ACCESS, //!< NIM data access for a Port - use @ref NtConfigNimAccess_s
107  NT_CONFIG_PARM_VPD, //!< VPD data access. - use @ref NtVpd_s
108  NT_CONFIG_PARM_PTP_PORT, //!< PTP port on PTP adapter - defined in stream_config_compat.h
109  NT_CONFIG_PARM_ADAPTER_TIMESYNC_RESET, //!< Timesync hard reset and PTP stat reset - use @ref NtConfigTimesyncReset_s
110  NT_CONFIG_PARM_ADAPTER_PTP_IMPL_CFG, //!< PTP configuration settings - use @ref NtConfigPtpImpl_s
111  NT_CONFIG_PARM_PORT_COMPAT_1, //!< Port settings configuration parameter - defined in stream_config_compat.h
112  NT_CONFIG_PARM_ADAPTER_MONITOR, //!< AdapterMonitor configuration parameter - use @ref NtConfigAdapterMonitor_s
113  NT_CONFIG_PARM_PORT_TRANSMIT_ON_TIMESTAMP, //!< Port TX time delta - use @ref NtConfigTransmitOnTimestamp_s
114  NT_CONFIG_PARM_PORT_SETTINGS_V2, //!< Port settings configuration parameter - use @ref NtConfigPort_v2_s
115 //
116 
117 };
118 
119 /**
120  * Configuration stream handle
121  */
122 typedef struct NtConfigStream_s* NtConfigStream_t;
123 
124 /**
125  * Array of manual port setting parameters
126  */
128  NtLinkSpeed_t speed; //!< The interface speed - this is in effect if @ref NtLinkAutoNeg_e "autoNegotiation" = @ref NT_LINK_AUTONEG_MANUAL
129  NtLinkDuplex_t duplex; //!< The duplex mode - this is in effect if @ref NtLinkAutoNeg_e "autoNegotiation" = @ref NT_LINK_AUTONEG_MANUAL
130 };
131 
132 /**
133  * Array of parameters to be advertised when autonegotiation is enabled
134  */
136  uint32_t halfDuplexMask; //!< Available half duplex (uses @ref NtLinkSpeed_e as bitmask)
137  uint32_t fullDuplexMask; //!< Available full duplex (uses @ref NtLinkSpeed_e as bitmask)
138 };
139 
140 
141 /**
142  * The settings reflect how the interface should be configured.
143  * The advertise section tells what should be advertised when
144  * autonegotiation is enabled.
145  * halfDuplexMask=0.
146  * fullDuplexMask=NT_LINK_SPEED_100M.
147  *
148  * When a parameter does not apply on a particular adapter, then this parameter is ignored.
149  *
150  * @internal
151  * Note: This is part of the NTDS structure. Changing this requires the service to be recompiled.
152  */
154  int enable; //!< 0 = Disable interface, 1 = Enable interface. If disabled, the port will still be visible, but has status link down.
155 #ifndef DOXYGEN_IGNORE
156  // Not supported
157  int flow; //!< 0 = No flow control, 1 = Flow control
158 #endif
159  enum NtLinkMDI_e mdi; //!< MDI mode
160  /**
161  * NOTE: Cannot be set on optical NIM interfaces
162  */
163  enum NtLinkAutoNeg_e autoNegotiation; //!< Link speed negotiation mode (manual or auto).
164  /**
165  * NOTE: Cannot be set on optical NIM interfaces
166  */
167  struct NtPortSettingsManual_s manual; //!< Array of manual port setting parameters
168  /**
169  * NOTE: Cannot be set on optical NIM interfaces
170  */
171  struct NtPortSettingsAdvertise_s advertise; //!< Array of parameters to be advertised when autonegotiation is enabled
172 
173  uint32_t minIFG; //!< Depending on the IfgMode parameter in ntservice.ini the minimum interframe-gap is either interpreted as 10 ns steps or bytes. If IfgMode is set to NS the value will be rounded up or down to the nearest HW-supported value, which depends on the link speed. The default minimum gap is 0 ns. If the IfgMode is set to BYTE the value is written directly to the HW.
174  uint32_t maxIFG; //!< Depending on the IfgMode parameter in ntservice.ini the maximum interframe-gap is either interpreted as 10 ns steps or bytes. If the IfgMode is set to NS the value will be rounded up or down to the nearest HW-supported value, which depends on the link speed. The default maximum gap is the maximum HW-supported value. If the IfgMode is set to BYTE the value will be written directly to the HW. Setting the maximum interframe gap to 0, corresponds to disabling the check for maximum IFG.
175 
176  enum NtTxPower_e TxPower; //!< TX power state on read and command on write. Controls laser power on/off on fiber SFP, XFP, SFP+ and QSFP+ modules. Note that not all modules support enable/disable of the laser. An error code is returned if not supported.
177  int hostLoopback; //!< Host loopback position.\n
178  //!< Applying host loopback has the effect that data sent from the host is looped
179  //!< back to the host on the same port regardless of, if a NIM (Network Interface
180  //!< Module) has been plugged in, and if a physical loopback has been applied.
181  //!< The link will therefore be reported as up despite that no NIM is present
182  //!< or that no physical link is present.\n
183  //!< In general simultaneous host and line loopback is not allowed.\n
184  //!< The available loopback positions are adapter dependent and applying a loopback
185  //!< position that is not supported will result in a returned error code by the API
186  //!< function. In general only the following values @ref NtHostLoopback_e should be
187  //!< used.\n
188  //!< Applying loopback along with settings that require PHY setup changes or
189  //!< applying these settings when already in loopback mode represents a conflict
190  //!< and will not be carried out. A returned error code will indicate this. In order
191  //!< to avoid conflicts, it is in general recommended to enable loopback separately.\n
192  //!< When applying loopback special settings are used and for trispeed modules
193  //!< this means that the link speed is changed to maximum. The original settings
194  //!< are restored when loopback is removed.
195 
196  int lineLoopback; //!< Line loopback position.\n
197  //!< Applying line loopback has the effect that data sent from the line is looped
198  //!< back to the line on the same port. This requires that a NIM (Network Interface
199  //!< Module) has been plugged in.
200  //!< The link will in general be reported as up and traffic can be received by
201  //!< the host but any traffic transmitted by the host will be replaced by the
202  //!< traffic looped back.
203  //!< In general simultaneous host and line loopback is NOT allowed.\n
204  //!< The available loopback positions are adapter dependent and applying a loopback
205  //!< position that is not supported will result in a returned error code by the API
206  //!< function. In general only the following values @ref NtLineLoopback_e should be
207  //!< used.\n
208  //!< Applying loopback along with settings that require PHY setup changes or
209  //!< applying these settings when already in loopback mode represents a conflict
210  //!< and will not be carried out. A returned error code will indicate this. In order
211  //!< to avoid conflicts, it is in general recommended to enable loopback separately.\n
212  //!< When applying loopback special settings are used and for trispeed modules
213  //!< this means that the link speed is changed to maximum. The original settings
214  //!< are restored when loopback is removed.
215  enum NtPortId_e PortId; //!< Port identification state.
216  //!< Turns the port identification feature on/off. An error code is returned if
217  //!< not supported.
218  //!< When enabled the port led will start to blink regardless if the link is up
219  //!< or the port receives data or not.
220  int wisModeEnable; //!< 0 = Wismode disabled on port, 1 = Enable Wismode enabled on port.
221  int txReplicatePort; //!< Set TX port replication.\n
222  //!< An error code is returned if not supported or the configuration
223  //!< is invalid.
224  //!< When set to a different port it will replicate all TX traffic from that port. It will
225  //!< not be possible to transmit on this port when replication is activated. It is not
226  //!< possible to change the replication configuration while TX traffic is active on this port
227  //!< or the port it is replicating from.
228  uint64_t txPortRateLimit; //!< Set Tx port rate limit in bits per second.\n
229  //!< A value of zero disables the Tx port rate limit.
230  //!< The resulting ports speed will be an aproximated value close to the specified value.
231  //!< An error code is returned if not supported or the configuration is invalid.
232  //!< Special case: a value in the range of 1 to 100 specifies a limit as percentage of the link speed.
233 };
234 
235 /***********************************************************************
236  * Config read and write port settings - NT_CONFIG_PARM_PORT_SETTINGS_V2 *
237  ***********************************************************************/
239  uint8_t portNo; //!< Port number to read from
240  uint8_t Reserved1[3];
241  struct NtPortSettings_v2_s data; //!< Port settings
242 };
243 
244 /************************************************************
245  * Config read timestamp - NT_CONFIG_PARM_ADAPTER_TIMESTAMP *
246  ************************************************************/
248  uint8_t adapter; //!< Adapter number to read from
249  uint8_t Reserved1[3];
251  uint64_t ts; //!< The time stamp
252  uint64_t nativeUnixTs; //!< Value converted to native Unix (read only)
253  enum NtTimestampType_e tsType; //!< The time stamp type used by the adapter
254  } data;
255 };
256 
257 /*************************************************************
258  * Config write timestamp - NT_CONFIG_PARM_ADAPTER_TIMESTAMP *
259  *************************************************************/
261  uint8_t adapter; //!< Adapter number to write to
262  uint8_t Reserved1[3];
264  uint64_t ts; //!< The time stamp
265  uint32_t bCurrent; //!< Uses current OS time
266  } data;
267 };
268 
269 /****************************************************************
270  * Config write timesync data - NT_CONFIG_PARM_ADAPTER_TIMESYNC *
271  ****************************************************************/
273  uint8_t adapter; //!< Adapter number to write to
274  uint8_t Reserved1[3];
276  uint32_t action; //!< 0 = Reference time, 1 = Enable PPS, 2 = Disable PPS
277  uint64_t refTime; //!< PPS reference time
278  } data;
279 };
280 
281 
282 
283 /**
284  * TimeSync Reset commands
285  */
288  NT_TIMESYNC_RESET_COMPAT_0, //!< Command for backward compatibility - defined in stream_config_compat.h
289  NT_TIMESYNC_RESET_PTP_PORT_STAT, //!< Reset PTP port statistics
290  NT_TIMESYNC_RESET_HARD_RESET_TIME_TO_REF, //!< Hard reset Time to reference clock (temporary time jumps allowed)
291  NT_TIMESYNC_RESET_TS_STATISTICS //!< Reset global time sync statistics
292 };
293 
294 /*****************************************************************
295  * Config timesync reset - NT_CONFIG_PARM_ADAPTER_TIMESYNC_RESET *
296  *****************************************************************/
298  uint8_t adapter; //!< Adapter number to write to
299  uint8_t Reserved1[3];
300  enum NtTimeSyncReset_e resetCmd; //!< Timesync reset command
301 };
302 
303 
304 
305 
306 /*****************************************************************
307  * PTP configuration - NT_CONFIG_PARM_ADAPTER_PTP_IMPL_CFG *
308  *****************************************************************/
309 typedef struct NtConfigPtpImplData_s {
310  int32_t PTPDelayAsymmetry; //!< The PTP delay asymmetry compensation to set
312 
314  uint8_t adapter; //!< Adapter number to write to
315  uint8_t Reserved1[3];
317 };
318 
319 
320 
321 /************************************************************
322  * Config read or write sensor data - NT_CONFIG_PARM_SENSOR *
323  ************************************************************/
325  enum NtSensorSource_e source; //!< The source of the sensor - either a port or an adapter sensor
326  uint32_t sourceIndex; //!< The source index - either adapter number or port number on which the sensor resides
327  uint32_t sensorIndex; //!< The sensor index within the sensor group, see @ref MainDocMainFeaturesInfo_Sensors
329  int32_t limitLow; //!< The minimum sensor value before an alarm is triggered
330  int32_t limitHigh; //!< The maximum sensor value before an alarm is triggered
331  } data;
332 };
333 
334 
335 /**************************************************************
336  * Config globalsync - NT_CONFIG_PARM_ADAPTER_GLOBAL_SYNC *
337  **************************************************************/
338 
340  uint8_t adapterNo; //!< Adapter number to write to
341  uint8_t Reserved1[3];
343  uint32_t portEnableMask; //!< Enable coordinated time synchronized transmit on port bit mask
344  uint64_t timeSynchronizedTxOffset; //!< Time offset between time stamp in first frame and adapter time
345  int timeSynchronizedTxOffsetUpdate; //!< Set to 1 to update the offset value
346  } data;
347 };
348 
349 /********************************************************
350  * Structure for bypass related port settings
351  *
352  * cmd parm: NT_CONFIG_PARM_BYPASS_PORT
353  * NT_CONFIG_PARM_BYPASS_ADAPTER
354  ********************************************************/
355 typedef struct NtConfigBypassData_s {
356  enum NtBypassTrigger_e bypassTriggerModes; //!< Bypass triggers that affect bypass states using @ref NtBypassTrigger_e
357  enum NtBypassPortState_e currentBypassPortState; //!< Current (live) bypass state using @ref NtBypassPortState_e
358  enum NtBypassPortState_e onInitBypassPortState; //!< onInit bypass state using @ref NtBypassPortState_e
359  enum NtBypassPortState_e onPowerFailBypassPortState; //!< onPowerFail bypass state using @ref NtBypassPortState_e
360  enum NtBypassPortState_e onWatchdogFailBypassPortState; //!< onWatchdogFail bypass state using @ref NtBypassPortState_e
361  uint32_t onPowerFailBypassSwitchDelay; //!< onPowerFail bypass switch delay (msec)
363 
365  union NtConfigBypassParam_u { //!< Input key parameter union
366  uint8_t adapterNo; //!< Adapter number to read from or write to
367  uint8_t portNo; //!< port number to read from or write to
368  uint32_t Reserved;
369  } u;
371 };
372 
373 
374 /********************************************************
375  * Structure for bypass watchdog timer pings "heartbeat"
376  *
377  * cmd parm: NT_CONFIG_PARM_BYPASS_PORT_WATCHDOG_TIMER
378  * NT_CONFIG_PARM_BYPASS_ADAPTER_WATCHDOG_TIMER
379  ********************************************************/
381  //
382  uint32_t bypassWatchdogTimeout; //!< Bypass watchdog timeout in msec.
383  uint32_t bypassWatchdogTimeRemaining; //!< Bypass watchdog remaining time before timeout (msec)
385 
387  union NtConfigBypassWatchdogTimerParam_u { //!< Input key parameter union
388  uint8_t adapterNo; //!< Adapter number to read from or write to
389  uint8_t portNo; //!< port number to read from or write to
390  uint32_t Reserved;
391  } u;
393 };
394 
395 /********************************************************
396  * Structure for bypass port watchdog timer setup
397  *
398  * cmd parm: NT_CONFIG_PARM_BYPASS_PORT_WATCHDOG_TIMEOUT
399  * NT_CONFIG_PARM_BYPASS_ADAPTER_WATCHDOG_TIMEOUT
400  ********************************************************/
402  uint32_t bypassWatchdogTimeout; //!< Bypass watchdog timeout (msec)
404 
406  union NtConfigBypassWatchdogTimeoutParam_u { //!< Input key parameter union
407  uint8_t adapterNo; //!< Adapter number to read from or write to
408  uint8_t portNo; //!< port number to read from or write to
409  uint32_t Reserved;
410  } u;
412 };
413 
415  uint8_t adapter; //!< Adapter number to write to
416  unsigned portCtrlInterval; //!< Number of milliseconds between each scan
417  bool run; //!< Indicate if the thread should run
418 };
419 
420 /********************************************************
421  * Structure to configure transmit on timestamp
422  *
423  * cmd parm: NT_CONFIG_PARM_PORT_TRANSMIT_ON_TIMESTAMP
424  *
425  ********************************************************/
427  uint8_t portNo; //!< Port to configure transmit on timestamp for
428  uint8_t Reserved[3];
430  uint64_t timeDelta; //!< Delta in nanoseconds to add to packet time before comparing to adapter time
431  bool enable; //!< Enable transmit on timestamp
432  bool forceTxOnTs; //!< Force transmit on timestamp
433  uint64_t timeDeltaAdjust; //!< Delta in nanoseconds added by adapter to timeDelta whenever a TXSETCLOCK packet is encountered
434  } data;
435 };
436 
437 //*****************************************************************************
438 //Structures and enums for accessing NIM via the config stream.
439 //*****************************************************************************
441  NT_NIM_READ_DATA_LIN, //!< Read NIM data using linear address convention
442 //
443 
444 };
445 
447  uint16_t linAddr;
448  uint16_t length;
449  uint8_t data[512];
450 };
451 
453  enum NtNimAccessType_e accessType;
454  uint8_t portNo;
455  uint8_t Reserved1[3];
456 
458  struct NtNimRawData_s rawData;
459  } u;
460 };
461 
463 
464 
466  /** @brief PTP active flag.
467 
468 On read: 0 = PTP is not active, 1 = PTP is active.
469 On Write: Value is ignored. */
470  int enable;
471  /** @brief PTP port enable flag.
472 
473 On read: 0 = PTP port is not enabled, 1 = PTP port is enabled.
474 On Write: 0 = disable PTP port, 1 = enable PTP port.
475 
476  A PTP port must be enabled to achieve link up. */
478  /** @brief Manual or auto negotiation of link speed and duplex mode.
479 
480  This field specifies whether link speed and duplex mode of the
481 PTP port is set manually or auto negotiated. */
482  enum NtLinkAutoNeg_e autoNegotiation;
483  /** @brief Bit mask of manual port setting parameters.
484 
485 This field specifies the manually configured link speed and
486 duplex mode of the PTP port. These values are ignored when
487 auto negotiation is enabled.*/
488  struct NtPortSettingsManual_s manual;
489  /** @brief The speeds to advertise during auto negotiation.
490 
491 This field is a bit mask of the speeds that are advertised
492 during auto negotiation. These values are ignored when auto
493 negotiation is disabled. */
494  struct NtPortSettingsAdvertise_s advertise;
495 };
497 
498 
499 /*************************************************************************
500  * Config read or write PTP port configuration - NT_CONFIG_PARM_PTP_PORT *
501  *************************************************************************/
503  uint8_t adapterNo; //!< Number of adapter with PTP functionality.
504  /** @brief PTP port number.
505 
506  On Read: Always 0 (zero), currently.
507  On Write: Must be 0 (zero), currently. */
508  uint8_t portNo;
509  uint8_t reserved[2]; //!< Reserved for future use.
511 };
513 
514 
515 /****************************************************************/
516 /* NTPL Info data structures */
517 /****************************************************************/
518 /**
519  * NTPL command execution mode
520  */
522  NT_NTPL_PARSER_VALIDATE_NORMAL, //!< NTPL expression is validated and executed
523  NT_NTPL_PARSER_VALIDATE_PARSE_ONLY, //!< NTPL expression is only validated and has no effect
524 };
525 
526 /**
527  * NTPL parser error description and error code
528  */
530 #define NT_MAX_NTPL_BUFFER_SIZE (4*1024) //!< NTPL maximum buffer size
531  char errBuffer[3][NT_MAX_NTPL_BUFFER_SIZE]; //!< NTPL error description
532  int32_t errCode; //!< NTPL error code
533 };
534 
535 #ifndef DOXYGEN_INTERNAL_ONLY
536 /**
537  * NTPL filter counters. Deprecated. Use info stream instead.
538  */
539 struct NtNtplFilterCounters_s {
540  uint8_t sizeCount; //!< Number of frame length filters used
541  uint8_t protocolCount; //!< Number of protocol filters used
542  uint8_t errorCount; //!< Number of error filters used
543  uint8_t patternCount; //!< Number of data filters used
544  uint8_t dynOffsetCount; //!< Number of dynamic offsets used
545  uint8_t group4PlusCount; //!< Number of group filters used combining 4 patterns with 4 different dynamic offsets
546  uint8_t group8Count; //!< Number of group filters used combining 8 patterns with 2 different dynamic offsets
547 };
548 #endif
549 
550 /**
551  * NTPL return values
552  */
554  NT_NTPL_PARSER_NORMAL, //!< No error data returned
555  NT_NTPL_PARSER_ERROR_DATA, //!< Error data returned - errorData is filled
556 #ifndef DOXYGEN_INTERNAL_ONLY
557  NT_NTPL_PARSER_FILTERINFO, //!< Filter info data returned, see @ref NtNtplFilterCounters_s
558 //
559 
560 #endif
561 };
562 
563 /**
564  * NTPL Info
565  */
566 typedef struct NtNtplInfo_s {
567  enum NtNTPLReturnType_e eType; //!< Returned status
568  uint32_t ntplId; //!< ID of the NTPL command
569  int streamId; //!< The selected stream ID
570  uint64_t ts; //!< Time when the NTPL command is in effect
571  enum NtTimestampType_e timestampType; //!< The time stamp type of NtNtplInfo_t::ts
572  /**
573  * NTPL return data.
574  * Error or filter information.
575  */
576 #ifndef DOXYGEN_INTERNAL_ONLY
577  uint32_t reserved[50];
578 #endif
580  struct NtNtplParserErrorData_s errorData; //!< Error code and error text
581 #ifndef DOXYGEN_INTERNAL_ONLY
582  struct NtNtplFilterCounters_s aFilterInfo[NT_MAX_NUM_ADAPTERS]; // Deprecated. Use info stream instead
583 //
584 
585 #endif
586  } u;
587 } NtNtplInfo_t;
588 
589 
590 /* Include commands for backward compatibility */
591 #if !defined(_NT_NTAPI_NO_COMPAT)
592 #include "stream_config_compat.h"
593 #endif
594 
595 /********************************************************
596  * Structure for vpd access
597  ********************************************************/
598 #define VPD_USER_SIZE 400
599 
600 /**
601  * VPD commands
602  */
605 };
606 
607 typedef struct NtVpd_s {
608  uint8_t adapterNo; //!< Adapter number to write to
609  uint16_t length; //!< Length of data
610  enum NtVpdCommands_e vpdCommand; //!< VPD command using command @ref NtVpdCommands_e.
611  union data_u {
612  uint8_t userData[VPD_USER_SIZE]; //!< Userdata section of VPD
613  } u;
614 } NtVpd_t;
615 
616 
617 //
618 
619 
620 //
621 
622 
623 
624 
625 
626 //
627 
628 
629 
630 
631 /**************************************************************
632  * Config change information
633  **************************************************************/
634 typedef struct NtConfig_s {
635  enum NtConfigParm_e parm; //!<Configuration parameter
636  union NtConfig_u {
637  struct NtConfigPort_v2_s portSettings_v2; //!< Port setting struct is used when reading or writing using command @ref NT_CONFIG_PARM_PORT_SETTINGS_V2
638 #if !defined(_NT_NTAPI_NO_COMPAT)
639  struct NtConfigPort_v1_s portSettings_v1; //!< Port setting struct is used when reading or writing using command @ref NT_CONFIG_PARM_PORT_SETTINGS_V1
640 #endif
641  struct NtConfigTimestampRead_s timestampRead; //!< Time stamp read struct is used when reading using command @ref NT_CONFIG_PARM_ADAPTER_TIMESTAMP
642  struct NtConfigTimestampWrite_s timestampWrite; //!< Time stamp write struct is used when writing using command @ref NT_CONFIG_PARM_ADAPTER_TIMESTAMP
643  struct NtConfigTimesyncWrite_s timesyncWrite; //!< Time sync write struct is used when writing using command @ref NT_CONFIG_PARM_ADAPTER_TIMESYNC
644  struct NtConfigSensor_s sensor; //!< Sensor read and write struct is used to read or write sensor alarm limits using command @ref NT_CONFIG_PARM_SENSOR
645  struct NtConfigGlobalSyncWrite_s globalSyncWrite; //!< Stream write struct is used when writing using command @ref NT_CONFIG_PARM_ADAPTER_GLOBAL_SYNC
646  struct NtConfigBypass_s bypassConfig; //!< Bypass adapter and port setting struct is used when reading or writing using commands @ref NT_CONFIG_PARM_BYPASS_PORT @ref NT_CONFIG_PARM_BYPASS_ADAPTER
647  struct NtConfigBypassWatchdogTimer_s bypassWatchdogTimer; //!< Bypass watchdog reading or writing using commands @ref NT_CONFIG_PARM_BYPASS_PORT_WATCHDOG_TIMER @ref NT_CONFIG_PARM_BYPASS_ADAPTER_WATCHDOG_TIMER
648  struct NtConfigBypassWatchdogTimeout_s bypassWatchdogTimeout; //!< Bypass watchdog reading or writing using commands @ref NT_CONFIG_PARM_BYPASS_PORT_WATCHDOG_TIMEOUT @ref NT_CONFIG_PARM_BYPASS_ADAPTER_WATCHDOG_TIMEOUT
649  struct NtConfigNimAccess_s nimAccess; //!< NIM data access using command @ref NT_CONFIG_PARM_NIM_ACCESS
650 #if !defined(_NT_NTAPI_NO_COMPAT)
651  struct NtConfigSensor_s sensorWrite; //!< Sensor write struct is used when writing using command @ref NT_CONFIG_PARM_SENSOR
652 #endif
653  struct NtVpd_s vpdData; //!< VPD write structure @ref NT_CONFIG_PARM_VPD
654  struct NtConfigPtpPort_s ptpPort; //!< PTP port configuation @ref NT_CONFIG_PARM_PTP_PORT
655  struct NtConfigTimesyncReset_s timesyncReset; //!< Time sync hard reset time command
656  struct NtConfigPtpImpl_s ptpImplCfg; //!< PTP configuration settings
657 #if !defined(_NT_NTAPI_NO_COMPAT)
658  struct NtConfigPort_s portSettings; //!< Port setting struct defined in stream_config_compat.h
659 #endif
660  struct NtConfigAdapterMonitor_s adapterMonitorSettings; //!< Adapter Monitor settings
661  struct NtConfigTransmitOnTimestamp_s transmitOnTimestamp; //!< Port transmit on timestamp settings
662 //
663 
664  } u;
665 } NtConfig_t;
666 
667 /**
668  * @brief Opens a configuration stream
669  *
670  * This function is called to retrieve a handle to a configuration stream
671  *
672  * @param[out] hStream Reference to an NtConfigStream_t stream pointer
673  * @param[in] name Stream friendly name - used in, for example, logging statements
674  *
675  * @retval 0 Success
676  * @retval !=0 Error
677  */
678 int NT_ConfigOpen(NtConfigStream_t *hStream, const char *name);
679 
680 /**
681  * @brief Closes a configuration stream
682  *
683  * This function is called to close a configuration stream
684  *
685  * @param[in] hStream Reference to a NtConfigStream_t stream pointer
686  *
687  * @retval 0 Success
688  * @retval !=0 Error
689  */
690 int NT_ConfigClose(NtConfigStream_t hStream);
691 
692 /**
693  * @brief Reads data from a configuration stream
694  *
695  * Returns configuration data
696  *
697  * @param[in] hStream NtSystemStream_t handle
698  * @param[in,out] data NtConfig_t structure containing configuration query and serving as output buffer for data
699  *
700  * @retval 0 Success
701  * @retval !=0 Error
702  */
703 int NT_ConfigRead(NtConfigStream_t hStream, NtConfig_t *data);
704 
705 /**
706  * @brief Writes data to a configuration stream
707  *
708  * Writes configuration data
709  *
710  * @param[in] hStream NtSystemStream_t handle
711  * @param[in,out] data NtConfig_t structure containing the configuration to write
712  *
713  * @retval 0 Success
714  * @retval !=0 Error
715  */
716 int NT_ConfigWrite(NtConfigStream_t hStream, NtConfig_t *data);
717 
718 /**
719  * @brief Sends an NTPL line buffer to the parser
720  *
721  * This function is used to send an NTPL line buffer to the
722  * parser. The config stream is defined by the hStream stream
723  * handle.
724  *
725  * When using validate mode no data is written to the adapter. The
726  * different modes define how far down the parsing is done.
727  *
728  * Note: Return data is stored in the stream handle and must be
729  * read by the HAL functions.
730  *
731  * @param[in] hStream Config stream for the NTPL
732  * @param[in] ntplBuffer NTPL line buffer containing NTPL code
733  * @param[in] info NTPL Info
734  * @param[in] validate Set parsing mode to validate. See @ref NtNTPLCommands_e
735  *
736  * @retval NT_SUCCESS NTPL command has been succesfully executed
737  * @retval NT_ERROR_WRONG_STREAM_TYPE The stream is not a config stream
738  * @retval NT_ERROR_NT_SERVICE_NOT_STARTED NT service is not started
739  * @retval NT_ERROR_INVALID_STREAM_POINTER Stream handle is a NULL pointer
740  * @retval NT_ERROR_INVALID_STREAM_HANDLE Stream handle is not a valid handle
741  * @retval NT_STATUS_TRYAGAIN Host buffers are temporarily unavailable - please try again
742  */
743 int NT_NTPL(NtConfigStream_t hStream, const char *ntplBuffer, NtNtplInfo_t *info, uint32_t validate);
744 
745 /** @} */
746 
747 #endif // __STREAM_CONFIG_H__