On 11/20/25 12:51 PM, klemen dovrtel wrote:
*(rtapi_u32*)(pci_device.ptr_bar2 + 0x0000) = 0x11111111; nanosleep
(&ts_dtLong, NULL);
*(rtapi_u32*)(pci_device.ptr_bar2 + 0x0004) = 0x22222222;
Using '*(rtapi_u32 *)(ptr + 0) = xyz' several times may not result in
what you expect. The compiler sees multiple references to the same
address(es) and may opt to cache the result(s). These addresses are
actually volatile targets and must be declared as such.
Maybe you should try:
volatile rtapi_u32 *addr0 = (volatile rtapi_u32 *)(pci_device.ptr_bar2 +
0x0000);
volatile rtapi_u32 *addr4 = (volatile rtapi_u32 *)(pci_device.ptr_bar2 +
0x0004);
// Write
*addr0 = 0x11111111;
*addr4 = 0x22222222;
// Read
rtapi_print_msg(RTAPI_MSG_INFO, "rd offs 0: %08x.\n", *addr0);
rtapi_print_msg(RTAPI_MSG_INFO, "rd offs 4: %08x.\n", *addr4);
// Write
*addr0 = 0x33333333;
*addr4 = 0x44444444;
// Read
rtapi_print_msg(RTAPI_MSG_INFO, "rd offs 0: %08x.\n", *addr0);
rtapi_print_msg(RTAPI_MSG_INFO, "rd offs 4: %08x.\n", *addr4);
... etc ...
--
Greetings Bertho
(disclaimers are disclaimed)
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers