Commit Graph
265 Commits
Author SHA1 Message Date
Hans-Erik Floryd 676ebb4cb5 Fix msvc warning
segmentdata may be used uninitialized if slave returns EC_FOE_BUSY
before segmentdata is set.

Change-Id: I4fdc4460e76af03d4de0839cd3b163117621ce40
2025-07-10 10:23:07 +02:00
Hans-Erik Floryd d5124435f0 Let coetest/redtest build on other platforms
Use the new osal functions to let tests build on all supported
platforms.

Change-Id: I6519ee55588e7bf0dff8d412679db268abbe86ce
2025-07-10 10:23:07 +02:00
Hans-Erik Floryd 7c2da72988 Add OSAL functions for monotonic time
This commit adds osal_get_monotonic_time() and
osal_monotonic_sleep(). These functions are designed to facilitate
synchronization with DC time, which can achieve nanosecond precision.

To support this functionality, the ec_timet structure has been
refactored to hold time values in nanoseconds, eliminating the need to
maintain separate time representations.

Change-Id: I039a006ccdb21ba35c437ab76e44e5153c711998
2025-07-10 10:23:07 +02:00
Hans-Erik Floryd a2af88bc79 Update win32/rtk nic driver
Incorporate changes from the Linux NIC driver.

Change-Id: Ibc273c3dec01c0b872876686c95aad064ff25f2f
2025-07-10 10:23:07 +02:00
Hans-Erik Floryd dc11bdd460 Delete obsolete or duplicate tests
Portable sample code is now in the sample folder.

Change-Id: I6d9315c92152ca4321bec325f78e64849e6b1e47
2025-07-10 10:23:07 +02:00
Hans-Erik Floryd 5d87e8d9a2 Add contrib folder
Move unmaintained ports and samples to contrib folder.

Change-Id: Ie1b1a8290a0e2204b6e4e2e5c838585eb88d9e81
2025-07-10 10:23:07 +02:00
Hans-Erik Floryd d1c95dfb7d Add eni_test sample
Add a simple test showing how to use the ENI parser.

Change-Id: I23755d29b10a40fc3ddb21b0780f7e000d9fbdfe
2025-07-10 10:23:07 +02:00
Mattias Nilsson 2eec21727e Add basic ENI support
Change-Id: I6abcb3b4a1248acadbbe2ed93fcd901304320d02
2025-07-09 17:21:28 +02:00
Hans-Erik Floryd 08064ae3fa Add more samples
Change-Id: I6bf219887efd88a69a257815f1974759d56fd3c3
2025-07-09 17:21:26 +02:00
Hans-Erik Floryd 51efd156cc Restore linux nicdrv recv non-blocking behaviour
In commit [091a465], socket send/recv timeouts were temporarily
disabled. Restore non-blocking behaviour on recv by calling recv with
MSG_DONTWAIT.

Closes #451.

Change-Id: Ia5966ad55deec4d9364838f4ea4880fce37273fa
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 7b71cf8aa4 Add options header file
Add an options header file containing build-time configurable
settings.

Change-Id: Icfd71571ea6a3033416106cd114e6d464a47ecdc
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 0ae3d2f056 Run clang-format on sources
Change-Id: Ide59897b87104bfb71e953b7f8dace00e441e245
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd c5987aead6 Add .clang-format
Change-Id: I48865eab483d0ed38d268c805d0007876971b924
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 9582886c2c Refactor repository layout (step 2 of 2)
Rename files ethercat to ec_

Change-Id: If79f133fa37147bf509a3a75b0f4e14de860fea3
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 78b757b2bf Refactor repository layout (step 1 of 2)
Create include,src and test folders and move files accordingly.

Change-Id: I3caf7a8de2ba1a9ad5a9cedbaad3942657a3753d
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 195a3c90e7 Remove legacy API
Change-Id: I4c8bcbfc84408d26267d88117bd89dd07231e786
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 8caa0ab601 Update jenkins build
Add more information to job display name.

Change-Id: Ica1bd80efcb0d909ef945561fdfc4baae90404a7
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd c6cbe15ad0 Add jenkins build
Change-Id: Id05cfdc0ccca85f6e534f6dfab7b39479c67da16
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd d7c2bc5f1b MinGW support
Support building SOEM with MinGW.

Change-Id: I7ea59e168ae382b99d7904cffc0719701d44cefc
2025-07-09 17:20:48 +02:00
Hans-Erik Floryd 3eeb1d9b57 Modernize CMakeLists
Change-Id: Ie3877370918315d1452d2ea0a0013f12bffcbcc2
2025-07-09 17:20:46 +02:00
Hans-Erik Floryd 62a4c44336 Add win32 mutex
Change-Id: I40a29cfa3f3b669f04140b6dcf572d0e8d2f6509
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd e8e06d19ef Update rt-kernel port
Add a method for choosing L2 driver and add support for sabresd board.

Change-Id: Ib5bbcb53990ffdbe4345cf99f69c44192250e0d8
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd bfe480dfbe Remove unused stdio.h
Change-Id: I27f8020ec375dede88a1dc87e531dcd9d7ad6f26
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd bb3e83d6bf Workaround for -Wstringop-truncation
Replace strncpy with memcpy to eliminate warnings about potential
truncation of the NULL terminator. This warning is likely a false
positive, as the NULL terminator is explicitly appended after the copy
operation.

Change-Id: I47bf9cc312506e20dbcb5ebe1ae1ac05d3b742d5
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd 6e82414ec3 Fix build error
Make ec_mbxreceive take the same arguments as ecx_mbxreceive apart
from the context.

Change-Id: I3a0748a34792ae36b583332c3b247d9b4e9751f4
2025-07-09 12:15:39 +02:00
Andreas Karlsson d4cc1b9323 Update EoE and config overlap to dynamic mailboxes
- Remove old mbxreceive
- Rename mbxreceive2 to mbxreceive
- Add EoE to mbxreceive
- Refactor EoE to use dynamic mailbox handling
- Add mailbox status mapping to config overlap
- correct length calculations in send_process_data

Change-Id: Ia51402a8c73e59dfb6ed23d98916156f81b17103
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd 68330229f6 Improved mailbox handling
This commit includes extensive changes across multiple files to
refactor the mailbox handling system and improve performance and
reliability in EtherCAT communication.

Update from Arthur Ketels 20240911.

Change-Id: I1177aea8b71156671a465473b7393af76be19c1c
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd 71b4c02e45 Bump version
Change-Id: Id0aa1f9d3e9c9fb244087b294ed54da8c1894180
2025-07-09 12:15:39 +02:00
Hans-Erik Floryd 29a4f009de Change licensing
This software is now dual-licensed, see LICENSE.md for details.

Change-Id: I646ab4a6e69f9f8c3cdfadd9ad3e4ca7007f729d
2025-07-09 12:15:39 +02:00
Ryan Zoeller 12c95117a8 Add AL status codes from ETG.1020 2025-07-09 12:15:18 +02:00
Tore Fuglestad 393433c0e8 fix windows warning
avoid : error C4703: potentially uninitialized local pointer variable 'prev_adapter' used

Fix #831

Change-Id: Iacc399b5d58fe95a55ca96a87ca6b37be306db26
2025-07-09 12:11:38 +02:00
ddi-kkugler 66a0bf1c55 Fix single device inputs/outputs overruning segment size (#907)
* Fix single device inputs/outputs overruning segment size
* Refactor to pack segments tightly. 
* Allow segments 2-64 to be EC_MAXLRWDATA bytes. 
* Move wkc calcs into relevant config map functions.
* Only split slave data between segments when it is larger than one segment
* Only update wkc when we include data for the current device
2025-05-05 16:44:49 +02:00
Sebastian Block 83d2f22758 FoE: resend packet on BUSY answer while writing
Change-Id: Ifbcfd90628fd92297434ecc3dba4a1299cdcd7a9
2025-04-15 15:59:10 +02:00
Hans-Erik Floryd fed0fd538a Increase possible FOE data size limit to max mailbox length
Handle slaves having large mailboxes in bootstrap. Calculate data size
based on max mailbox size minus FOE overhead.

Change-Id: Ie62afcb278e6a9f84f8be004e1a2173b19673810
2025-04-15 15:59:10 +02:00
Iain Anderson 76863fe873 Add serial number to ec_slave 2025-04-15 11:59:42 +02:00
Henrik Fransson 3011f0a46b Check that socket was successfully created 2025-04-15 11:36:51 +02:00
Henrik Fransson 298744937e Fix return value check when setting up NIC 2025-04-15 11:36:51 +02:00
Johannes Kauffmann 2f08b49aac tests: fix linked list leak
Don't overwrite the original pointer returned by ec_find_adapters(),
otherwise the linked list is leaked. Instead, save original pointer to
the head of the list use and `adapters` as a temporary variable. Pass
the original pointer to ec_free_adapters().

For win32, ec_free_adapters() was missing entirely.
2025-04-08 14:33:08 +02:00
ArthurKetels 7271d3663e Merge pull request #895 from OpenEtherCATsociety/fix/al_ctrl_16bit_access
Use 16bit access for AL Ctrl
2025-03-12 09:33:07 +01:00
Matthias Schoepfer 5c35c34a91 CMakeLists.txt: Add possibility to build library as shared
This adds the option to build the soem library also as shared object.
Note that the default is untouched, so by default, it will still build
a static library.

The [BUILD_SHARED_LIBS](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html)
is the standard way of doing it, many tools use this semantics to influence
the output to be the desired type (whichever you want).

Signed-off-by: Matthias Schoepfer <matthias.schoepfer@googlemail.com>
2025-03-11 19:44:21 +01:00
Andreas Karlsson 61840d4cbb Use 16bit access for AL Ctrl
By using 16bit access Wireshark will dissect the
the access accordingly.

fixes #894
2025-03-10 15:39:51 +01:00
ArthurKetels 2752dc2588 Merge pull request #875 from jalius/master
Update to support MSYS2/GCC
2025-01-27 10:52:57 +01:00
jawelch 49f2d8af36 Fix MSVC build: include lean windows.h, include stdlib.h for malloc/free 2025-01-24 13:43:37 -07:00
Jalius Welch cc7caf4751 include minwindefs.h for missing HANDLE definition 2024-11-29 01:39:29 -07:00
Jalius Welch 1ae89e23cb Address unused parameter and unused argument warnings. 2024-11-29 01:39:25 -07:00
Jalius Welch 30c5768485 Fix build errors due to signature mismatch in osal_thread_create.
Fix missing timezone struct declaration.
2024-11-29 01:39:22 -07:00
Jalius Welch 7189adba3c Update CMakeLists for non-MSVC, remove standard library files, add GCC-style struct packing 2024-11-29 01:38:44 -07:00
Hans-Erik Floryd 83c6264f99 Fix potential buffer overflow in exc_FOEread/write
An excessively long filename could overflow the mailbox buffer. Fix by
limiting the filename size to EC_MAXFOEDATA.

Problem found and fix proposed by m1etz.
2024-04-04 09:55:57 +02:00
Windsgo d478bce787 Fix add_timespec in other codes besides red_test (#794) 2024-03-21 07:51:29 +01:00
nakarlssonandAndreas Karlsson 1817b8b4fe Allow FoE write of 0byte file (#769)
If FoE write of a file is done, no check
of incoming size is performed. If the
file is 0byte, a FoE Write Request is
sent but no ACK since dofinalzero
is initialized to FALSE.

fixes #766

Co-authored-by: Andreas Karlsson <andreas.karlsson@rt-labs.com>
2023-12-06 19:54:05 +01:00