Skip to content

Add bit-aligned / sub-byte PDO entry support to the emulator#375

Open
leducp wants to merge 1 commit intomasterfrom
bit_support
Open

Add bit-aligned / sub-byte PDO entry support to the emulator#375
leducp wants to merge 1 commit intomasterfrom
bit_support

Conversation

@leducp
Copy link
Copy Markdown
Owner

@leducp leducp commented Apr 15, 2026

Lets the emulator host slaves that declare sub-byte PDO entries (e.g.
4 BOOL GPIOs at 1):

  • EmulatedESC honors FMMU logical/physical bit offsets via a per-bit slow path; byte-aligned mappings keep the memcpy fast path. FMMUs targeting addresses < 0x1000 (e.g. mailbox-status) now work.
  • CoE::Entry gains data_bit_offset; addEntry/EsiParser allocate (bitlen+7)/8 bytes (was 0 for BOOL/BIT2..7). New copyBits / read/writeEntryBits helpers.
  • SDO upload/download/complete-access switched to bit-accurate payload positioning. Sub-byte entries travel as 1 octet per ETG1000.5 §5.3.1; CA packs entries by bitoff per ETG2000.

  Lets the emulator host slaves that declare sub-byte PDO entries (e.g.
  4 BOOL GPIOs at <BitLen>1</BitLen>):

  - EmulatedESC honors FMMU logical/physical bit offsets via a per-bit
    slow path; byte-aligned mappings keep the memcpy fast path.
    FMMUs targeting addresses < 0x1000 (e.g. mailbox-status) now work.
  - CoE::Entry gains data_bit_offset; addEntry/EsiParser allocate
    (bitlen+7)/8 bytes (was 0 for BOOL/BIT2..7). New copyBits /
    read/writeEntryBits helpers.
  - SDO upload/download/complete-access switched to bit-accurate
    payload positioning. Sub-byte entries travel as 1 octet per
    ETG1000.5 §5.3.1; CA packs entries by bitoff per ETG2000.
@leducp leducp requested a review from trns1997 April 15, 2026 09:31
@leducp
Copy link
Copy Markdown
Owner Author

leducp commented Apr 15, 2026

ping @phamnhatha090805 this PR should enable bit support for the emulator and the stack in general

@leducp
Copy link
Copy Markdown
Owner Author

leducp commented Apr 15, 2026

!!! Need proper testing before merge !!!

@github-actions
Copy link
Copy Markdown

File Coverage Lines Branches
All files 78% 81% 76%
lib/include/kickcat/Error.h 91% 100% 83%
lib/include/kickcat/SBufQueue.h 80% 98% 63%
lib/master/src/Bus.cc 90% 92% 89%
lib/master/src/CoE.cc 61% 71% 51%
lib/master/src/Link.cc 98% 100% 97%
lib/master/src/MailboxSequencer.cc 97% 100% 94%
lib/master/src/MasterOD.cc 99% 98% 100%
lib/master/src/Prints.cc 95% 95% 95%
lib/master/src/Slave.cc 21% 39% 3%
lib/master/src/dc.cc 0% 0% 0%
lib/slave/src/AbstractESC.cc 92% 100% 84%
lib/slave/src/AbstractEmulatedEEPROM.cc 0% 0% 0%
lib/slave/src/ESMStates.cc 96% 98% 94%
lib/slave/src/ESM.cc 95% 100% 90%
lib/slave/src/PDO.cc 92% 97% 88%
lib/slave/src/ESC/EmulatedESC.cc 61% 68% 55%
lib/slave/src/ESC/Lan9252.cc 0% 0% 0%
lib/src/Frame.cc 98% 100% 97%
lib/src/Mailbox.cc 90% 94% 86%
lib/src/SIIParser.cc 40% 50% 30%
lib/src/protocol.cc 94% 92% 96%
lib/src/CoE/EsiParser.cc 92% 95% 90%
lib/src/CoE/OD.cc 98% 98% 97%
lib/src/CoE/protocol.cc 93% 93% 94%
lib/src/CoE/CiA/DS402/StateMachine.cc 93% 94% 92%
lib/src/CoE/mailbox/request.cc 80% 84% 76%
lib/src/CoE/mailbox/response.cc 92% 97% 88%
lib/src/EoE/protocol.cc 0% 0% 0%

Minimum allowed coverage is 75%

Generated by 🐒 cobertura-action against dddc463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant