NOTE: This forks will try to port it to Mac OS. No clue if thta is even possible, but will try
PdV
This is a Windows-based project for the ADIN6310/(ADIN3310) 6 and 3-port Industrial Ethernet TSN switch. This is a Managed switch with a wealth of TSN and Redundancy features. In this project, a Windows platform acts as the host to configure the switch. This project can be used to understand the driver APIs for configuration and management of the switch functionality. The project serves as a reference to help users familiarize themselves with the implementation of driver APIs for all the features of the switch, prior to porting the driver to their own host platform.
The project includes multiple use-case examples demonstrating switch configuration on a Windows platform. It showcases the integration and usage of different communication interfaces, including Ethernet (MAC) and SPI (Standard, Dual, and Quad), to configure and interact with the switch.
Additionally, it provides configuration examples for all versions of ADI evaluation board harware, EVAL-ADIN6310EBZ, EVAL-ADIN3310EBZ, and the Field Switch EVAL-ADIN6310T1LEBZ, covering essential switch management functions such as initialization, port configuration, VLAN setup, and advanced TSN features. This ensures a structured and hands-on approach for developers to understand and deploy the switch in real-world applications.
Ensure your system meets the following prerequisites:
-
Operating System: Windows 10 or later.
-
Software: [e.g., Visual Studio or other dependencies].
-
adinx310 Driver Library
- 3.1 Download the driver library package for ADIN6310/ADIN3310 from the Software Resources section on the Product Page. The same driver package is used for ADIN3310 and ADIN6310.
- 3.2 Copy the driver files to the
/project/adinx310-driver/
folder. The contents of this folder should look like this:ses-proxy-srv
ses-route-srv
ses-tsn-api-srv
ses-windows-port-srv
smp-stk
tsn-model-srv
-
External Libraries (Third-party libraries)
-
winpcap/npcap:
- 4.1 Get the winpcap library and place it in the
/project/lib/winpcap/
folder. (Tested with version 4.1.3). - 4.2 Download it from http://www.win10pcap.org/download/.
- 4.3 Alternatively, clone winpcap from the source:
git clone https://github.com/SoftEtherVPN/Win10Pcap
- 4.4
npcap
needs to be installed. You can install it through Wireshark. When installing NPCAP, ensure that the Install Npcap in WinPcap API-compatible Mode check box is selected.
- 4.1 Get the winpcap library and place it in the
-
ft42xx/libFT4222: [ Required if using SPI interface only ]
The following dependencies must be resolved to ensure proper functionality when using the SPI interface. This Windows project uses the UMFT4222EV as an SPI dongle which can be plugged directly into the EVAL-ADIN6310EBZ or EVAL-ADIN6310T1LEBZ versions of board.
- 4.5 Download the latest available CDM drivers from FTDI D2XX Drivers and unzip them.
- 4.6 Connect the device to a spare USB port on your PC. If the device is based on an FT2232 chip, the Microsoft composite device driver is automatically loaded first.
- 4.7 Go to the D2XX Driver website, download the driver (.exe file), and install it.
- 4.8 Copy the
ftd2xx.dll
file to the/project/lib/ftd2xx/
directory.
-
The project can be built in the following two configurations:
-
Switch_Ethernet
- In this configuration, SPI-related dependencies (
ft42xx/libFT4222
) are not required. - Only pcap dependencies need to be installed.
- In this configuration, SPI-related dependencies (
-
Switch_SPI
- This configuration requires all dependencies, including
ft42xx/libFT4222
, to be installed. - It works exclusively with the FT4222 SPI interface.
- Using a different SPI interface will require modifications in the porting layer defined in
SES_PORT_interface.h
.
- This configuration requires all dependencies, including
Once the project is successfully built, additional configurations can be adjusted for better functionality and understanding.
The SES_configuration.h
file contains various macros that can be used to enable or disable specific features. Before starting the configuration, the user must update the HOST_MAC macro with the MAC address of the NIC to which the switch is connected.
-
ENABLE_SPI
- To build the project in Switch_SPI mode, this macro must be enabled.
- All SPI-related dependencies must be resolved.
- The SPI mode (StandardSPI, DualSPI, or QuadSPI) can be configured in
SES_example_config.c
inside theses_config
function. - By default, the project uses StandardSPI.
- If SPI is selected as the interface medium, the host strapping must be configured according to the Standard, Dual, or Quad mode specified in the Datasheet under the HOST INTERFACE STRAPPING PINS section.
-
SES_PORT_COUNT
- The project supports a 6-port switch (ADIN6310) and a 3-port switch (ADIN3310).
- This macro must be set according to the switch used.
- The port configuration is available in
SES_example_config.c
for the respective switch.
-
SES_PRIMARY_MAC
- This MAC address is assigned to the connected switches internal Packet Assist Engine, additionally each port gets automatically assigned a MAC address based off the primary MAC address.
- The Primary MAC is used throughout the session for communication with the switch when using an Ethernet host. The per port MAC addresses are used for the various per-port protocols such as LLDP, PTP, MSTP, HSR, and PRP
-
HOST_MAC
- Contains the host MAC address.
- This must be configured as the user's network adapter MAC address.
- The MAC address can be obtained from the command prompt using
ipconfig
(Windows) orifconfig
/ip a
(Linux).
-
DEFAULT_SWITCH
- The switch initializes with the default configuration, enabling LLDP, PTP, and MSTP.
- To enable other features, set this macro to
false
.
-
EVENT
- The switch supports multiple events that can be subscribed to by the host.
- When a subscribed event occurs, the switch triggers a callback function to notify the host.
- A detailed list of events can be found in
SES_event.h
. - Possible values:
0
: Disabled1
: Enable Link Event Example2
: Enable LLDP Event Example3
: Enable Timer Event Example
-
LAYER_2
- This macro allows sending and receiving Layer 2 packets with different configurations:
0
: Disabled1
: L2 Transmit2
: Layer 2 Receive (Stack Processor by MAC)3
: Layer 2 Receive (Stack Processor by Ethertype)4
: Layer 2 Packet Received (Matching Ethertype)5
: Layer 2 Packet Received (Matching MAC)
- This macro allows sending and receiving Layer 2 packets with different configurations:
-
FRAME_PREEMPTION
- Enables frame preemption capability.
- If enabled, Port 5 will use the following queue configuration:
Queue[0] -> Express Queue[1] -> Preemptible Queue[2] -> Express Queue[3] -> Preemptible Queue[4] -> Express Queue[5] -> Preemptible Queue[6] -> Express Queue[7] -> Preemptible
-
SCHEDULED_TRAFFIC
- If enabled, scheduled traffic with guard band is configured for port 2 with a Cycle time of 1ms.
- Gate will open for 300us for Odd queues, 600us for Even queues, and 100us for priority 7.
-
IGMP_SNOOPING
- If set to
1
, enables IGMP snooping. - Also prints GroupMemberTimeout and RouterTimeout.
- If set to
-
REDUNDANCY_TYPE
- Defines the redundancy mode:
0
: HSR1
: HSR REDBOX2
: PRP3
: PRP REDBOX
- If using an Ethernet interface, the HSR/PRP ring ports will be:
- Port 1 → PORT A
- Port 2 → PORT B
- Port C → Host port
- If using SPI, Port C is not available.
- Defines the redundancy mode:
-
MRP (Media Redundancy Protocol)
- Default configuration:
- Ring Role: Client
- Recovery Rate: 500 ms
- Ring Ports: Port 1 & Port 2
- VLAN: No VLAN (
0x0FFF
) - Priority: Default Manager / AutoManager
- Priorities React On Link Change: Disabled
- Default configuration:
-
FIRMWARE_UPDATE
- Firmware updates can be performed in single or multiple blocks.
- If enabled, multiple block updates can be configured using
MULTIPLE_BLOCK = 1
. - Refer to the FIRMWARE LOAD/UPDATE section in the driver user guide for details.
-
TIME_SYNC
- This macro can be enabled to understand following Time synchronization examples related to AS2020 and 1588-2019 profile.
- CLOCK_TYPE 1: SES_Test_Single_PtpInstance
- CLOCK_TYPE 2: Boundary clock example
- CLOCK_TYPE 3: Ordinary clock example
- CLOCK_TYPE 4: Transparent clock example
- This macro can be enabled to understand following Time synchronization examples related to AS2020 and 1588-2019 profile.
-
VLAN_CONFIG
- Can be enabled for following VLAN examples:
- If TRUNK_ACCESS = 0, Configuring Port 3 and port 4 in Learn and Forward Mode for VLAN ID 10
- If TRUNK_ACCESS = 1, Trunk/Access example with following port configurations:
- Port 0 → Access port, VLAN ID 2, PCP 2
- Port 1 → Access port, VLAN ID 2, PCP 2
- Port 2 → Access port, VLAN ID 3, PCP 2
- Port 3 → Access port, VLAN ID 4, PCP 2
- Port 4 → Access port, VLAN ID 5, PCP 2
- Port 5 → Trunk port, VLN ID range 1-5, PCP 2
-
LLDP_INIT
- If enabled, it will initialize LLDP service and stack.
- This subscribes to all the necessary events, updates mandatory TLVs, and enables LLDP transmit and receive on all
- the ports by default.
-
FRER
- If enabled, switch will be configured as Talker, Listener, or Both
- FRER_CONFIG:
0
: Talker1
: Listener2
: Both
-
SENDLIST
- Set to 1 to enable a sendlist example with Port 5 used as a loopback port.
- Registered frames will egress out of Port 3.
-
PSFP
- (To be documented)
-
MSTP (Multiple Spanning Tree Protocol)
- Set to 1 to configure multiple MST instances and enabled MSTP stack. If MSTP stack is already enabled, an error will be returned.
-
SWITCH_EXAMPLE
- Can be enabled for the following examples:
0
: Disable1
: Read Dynamic table Example2
: Read Port Statistics3
: StaticEntry installation
- Can be enabled for the following examples: