Repository navigation
Conversation
… and make it 64-bit clean.
|
|
||
| // If we can queue the read, do so | ||
| int (*readfn)(hm2_lowlevel_io_t *, rtapi_u32, void *, int); | ||
| readfn = hm2->llio->queue_read ? hm2->llio->queue_read : hm2->llio->read; |
There was a problem hiding this comment.
Can queue_read ever be NULL here? If I read hm2_register() right, it installs dummy_queue_read() when the llio has none, and that falls back to ->read. Then a plain hm2->llio->queue_read(...) would cover both cases.
|
|
||
| // The previous read should be resolved when we get here. | ||
| // Update the pin with the previous round's value. | ||
| hal_set_uint(hm2->raw->hal.pin.read_data, hm2->raw->valread); |
There was a problem hiding this comment.
Would a hm2_raw_process_read() called from hm2_read() after hm2_finish_read(), like hm2_tp_pwmgen_process_read(), be the hook for the resolved read? It would put the value on read_data in the same cycle, and read_data would always match the current read_address instead of the previous one. The "one thread cycle" note in the man page could then go.
| // If we can queue the write, do so | ||
| int (*writefn)(hm2_lowlevel_io_t *, rtapi_u32, const void *, int); | ||
| int queue = hal_get_bool(hm2->raw->hal.pin.write_queued); | ||
| writefn = queue && hm2->llio->queue_write ? hm2->llio->queue_write : hm2->llio->write; |
There was a problem hiding this comment.
hm2_raw_write() runs just before hm2_finish_write(), which sends the queue, and queue_write falls back to dummy_queue_write() when the llio has none. Is there a case where a queued write behaves differently from an immediate one? If not, could it always queue and drop the write_queued pin?
Fixes #4933.
The hostmot2 raw interface has several problems as noted in #4933. All problems have been fixed and it also adds the ability to do the writes using the queue function, which prevents it from messing with the thread timing. Storage for the transfers is now located in the hm2_raw_t structure that is persistent when the raw interface is enabled.
The update includes the changes to make it HAL 64-bit interface clean. It should be noted that register addresses are always 16 bit (enforced by truncation) and data is always 32-bit (truncated on HAL read and zero extended on HAL write).