vlandemo_example.c
Go to the documentation of this file.
119 * TimeSyncOsTimeReference = None # None* - adapter-0 - adapter-1 - adapter-2 - adapter-3 - adapter-4 - adapter-5 - adapter-6 - adapter-7
134 * HostBufferPollInterval = default # default* - 100 - 250 - 500 - 1000 - 10000 - 25000 - 50000 - 100000
139 * HostBufferSegmentTimeOut = default # default* - 100 - 250 - 500 - 1000 - 10000 - 25000 - 50000 - 100000
156 * TimeSyncConnectorExt1 = PpsIn # None - NttsIn* - PpsIn - NttsOut - PpsOut - RepeatInt1 - RepeatInt2
157 * TimeSyncConnectorInt1 = None # None* - NttsIn - PpsIn - NttsOut - PpsOut - RepeatExt1 - RepeatInt2
158 * TimeSyncConnectorInt2 = None # None* - NttsIn - PpsIn - NttsOut - PpsOut - RepeatExt1 - RepeatInt1
317 printf("Adapter=%d, Port=%d, FeatureLevel=0x%x\n", adapterNo, portNo, infoRead.u.adapter_v7.data.featureLevel );
329 NtNetBuf_t hNetBuf; // Net buffer container. Packet data is returned in this when calling NT_NetRxGet().
359 // Initialize the NTAPI library and thereby check if NTAPI_VERSION can be used together with this library
384 if ((status = NT_NTPL(hCfgStream, "Setup[TxDescriptor=Dyn;TxPorts=0;UseWL=True] = StreamId == 1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
386 // Setup traffic to stream ID(=1) and Tx port = 0, TX Ignore bit position = 42 (located in the rxPort field, which is not used by TX)
387 if ((status = NT_NTPL(hCfgStream, "Setup[TxDescriptor=Dyn;TxPorts=0;TxIgnorePos=42;UseWL=True] = StreamId == 1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
391 // Setup traffic to stream ID(=1), Tx port = 0..1 (within same adapter), RxCRC = false, TxPortPos=112 (to utilize macro)
392 if ((status = NT_NTPL(hCfgStream, "Setup[TxDescriptor=Dyn;TxPorts=(0..1);RxCRC=False;TxPortPos=112;UseWL=True] = StreamId == 1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
395 if ((status = NT_NTPL(hCfgStream, "Setup[TxDescriptor=Dyn;TxPorts=0;UseWL=True] = StreamId == 1", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
411 if ((status = NT_NTPL(hCfgStream, "Assign[StreamId=1;Descriptor=Dyn3,length=62] = Port == 0", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
414 if ((status = NT_NTPL(hCfgStream, "Assign[StreamId=1;Descriptor=Dyn3] = Port == 0", &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {
451 // Get a stream handle with the stream ID(=1). NT_NET_INTERFACE_PACKET specify that we will receive data in a packet based matter.
452 if ((status = NT_NetRxOpen(&hNetRx, "TestStream", NT_NET_INTERFACE_PACKET, 1, -1)) != NT_SUCCESS) {
472 // We got a packet. Check if the timestamp is newer than when the NTPL assign command was applied
474 printf("First packet received: Capture length=%d, Descriptor length=%d, Wire length=%d\n", NT_NET_GET_PKT_CAP_LENGTH(hNetBuf), NT_NET_GET_PKT_DESCR_LENGTH(hNetBuf), NT_NET_GET_PKT_WIRE_LENGTH(hNetBuf) );
475 break; // Break out, we have received a packet that is received after the NTPL assign command was applied
498 pDyn3->descrLength = descrLen & 0x3fU; // create space in actual packet to prepend 4-byte VLAN-tag,
499 memmove(pb + descrLen, pb + descrLen + 4U, 12U); // move actual MAC-header to new start of packet payload
501 pDyn3->wireLength = (pDyn3->wireLength + 4U) & 0x3fffU; // set new wire length to inlude the 4-byte VLAN-tag
592 if ((status = NT_NTPL(hCfgStream, tmpBuffer, &ntplInfo, NT_NTPL_PARSER_VALIDATE_NORMAL)) != NT_SUCCESS) {