vectorgrp / XCPlite

Simple implementation of the ASAM XCP on Ethernet protocol
MIT License
163 stars 88 forks source link

Why does XcpSetDaqListMode overwrites flags to be mode? #43

Closed f-zl closed 3 months ago

f-zl commented 10 months ago

I have a question about the function XcpSetDaqListMode in xcpLite.c in commit 0870237 (most recent commit in master). It has this line DaqListFlags(daq) = mode;, which overwrites the flags to be mode.

From the XCP specification (only have version 1.1 in hand), the mode in SET_DAQ_LIST_MODE is bit mask of ALTERNATING, DIRECTION, TIMESTAMP, PID_OFF. The line DaqListFlags(daq) = mode; will clear the bits like DAQ_FLAG_SELECTED and DAQ_FLAG_RUNNING when receiving a SET_DAQ_LIST_MODE command. Is this a bug? Thanks for reply.

RainerZ commented 10 months ago

Thanks. Yes, this is a bug. Unclean code. Unused bits from XCP version 1.2 reused for internal states. Conflict with new DTO_CTR bit in version 1.3. Possible side effect of clearing internal states, depending when SET_DAQ_LIST_MODE is sent. Should be fixed.

From: f-zl @.> Sent: Tuesday, November 7, 2023 8:57 AM To: vectorgrp/XCPlite @.> Cc: Subscribed @.***> Subject: [vectorgrp/XCPlite] Why does XcpSetDaqListMode overwrites flags to be mode? (Issue #43)

I have a question about the function XcpSetDaqListMode in xcpLite.c in commit 0870237https://github.com/vectorgrp/XCPlite/commit/087023732ba572d913309c887ab63224e3335c81 (most recent commit in master). It has this line DaqListFlags(daq) = mode;, which overwrites the flags to be mode.

From the XCP specification (only have verision 1.1 in hand), the mode in SET_DAQ_LIST_MODE is bit mask of ALTERNATING, DIRECTION, TIMESTAMP, PID_OFF. DaqListFlags(daq) = mode; will clear the other bits like DAQ_FLAG_SELECTED and DAQ_FLAG_RUNNING. Is this a bug? Thanks for reply.

— Reply to this email directly, view it on GitHubhttps://github.com/vectorgrp/XCPlite/issues/43, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABAJOU4XDDITI7MVJ4AQG3DYDHSTDAVCNFSM6AAAAAA7AXO4LWVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4DANZWGE4DGNI. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>