https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120559
--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
__attribute__((noinline)) void write_to_hw(uint32_t channel, uint32_t * ptr) {
while (1) {
hw_low_level_write(channel, (*ptr | (channel & 3)));
if (!hw_low_level_overflow(channel, 7)) {
break; // Exit loop if the hardware is ready
}
}
}
__attribute__((noinline)) void send_buffer(uint32_t channel, void *ptr,
uint32_t size) {
struct tx_buffer_entry *entry;
/* ... */
entry = get_buffer();
entry->data = ptr;
entry->size = size;
entry->state = 1; // Mark as used
/* ... */
write_to_hw(channel, (void *)(&entry));
}
and ...
#ifndef SET_REG_WORD
#define SET_REG_WORD(a, x) ((void)(*(volatile uint32_t *)(((uintptr_t)(a))) =
(uint32_t)(x)))
#endif
__attribute__((noinline)) void hw_low_level_write(uint32_t channel, uint32_t
value) {
SET_REG_WORD(REG_LOC, value);
// Write the value to the specified hardware channel
// This is a placeholder implementation
// Actual implementation would depend on the specific hardware
// and might involve memory-mapped I/O or other mechanisms.
}
uint32_t* vs tx_buffer_entry*