Skip to content

Make each OSDP context control one channel exclusively #281

@sidcha

Description

@sidcha

In the vast majority of real deployments, a CP controls multiple PDs over a single shared RS-485 bus — one physical wire, one channel, N devices. The protocol is strictly polled and serialized: the CP talks to exactly one PD at a time, waits for its reply, then moves to the next.

Despite this, libosdp allocates channel state and a TX staging buffer once per PD. On a system with 8 PDs on one bus, that's 8 copies of the same channel handle and 8 × 512 = 4 KB of TX staging buffers — when only one is ever in use at any moment. On constrained embedded targets (the primary deployment environment for OSDP), this is straightforward waste.

There is also a shared-channel arbitration mechanism built on top of this (channel_lock[], PD_FLAG_CHN_SHARED, cp_channel_acquire/release) to coordinate which per-PD channel copy was "active" at any time — complexity introduced solely to work around the duplicated ownership (see #276).

Metadata

Metadata

Assignees

Labels

EnhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions