Please do not add more "return values" to any commands.
I would rather see all "return values" to be removed from commands.
Why?
Because these are a pain to implement on the host processor, you need to traverse back the RAM_CMD after executing the commands.
And even for the BT82x programming guide the given "C prototype" functions are still wrong, as it is difficult to describe what actually
needs to be done.
Commands for single execution like CMD_GETIMAGE are not an issue, still complicated to implement, but least not part of a display list.
Now commands for display list are a completely different story.
Single execution? Fine, works.
But a CMD_TEXT() that would allow to read back "return values" would be impossible to be used when transferring display lists by DMA.
Heck, it would even be impossible to use when using "burst-mode", aka you only send the address once followed by a whole bunch of commands.
There is no way to tell from where in the RAM_CMD to read when you transfer a buffer in order to not block the host controller from doing anything else
during SPI transfers.
And now we just got 16kiB of RAM_CMD and RAM_DL, actually using that with sending command by command is not really feasible.
At least not if the host controller is supposed to do anything else.
What then?
Registers!
Please provide a whole bunch of extra registers that the co-processor is writing to when executing commands.
The memory map of the BT820 reserves 6k or REG_CORE in two regions, this is room for over 1500 32 bit registers.
REG_LOADIMAGE_SOURCE
REG_LOADIMAGE_FORMAT
REG_TEXT_LINE_PIXEL
REG_TEXT_LINES
REG_BUTTON_LINE_PIXEL
REG_BUTTON_LINES
Hmm, ok, fine, with multiple commands one might need to execute the needed command outside of a real display list update, like this:
EVE_cmd_dlstart();
EVE_cmd_fillwidth(331);
EVE_cmd_text(50, 50, 31, EVE_OPT_FILL, "Please do some stuff here and there.\n\nAnd now do print something with a blank line above.");
EVE_execute_cmd();
lines = EVE_memRead16(REG_TEXT_LINES);
This would also provide the value before doing the actual display list.
Ok, sure, that defeats my argument for display lists as the return value could be ignored for buffered transfers and only used for separate commands.
But just reading a register still is more straighforward than for example what I had to implement for EVE_cmd_bitmap_transform():
spi_transmit_32(0UL);
EVE_cs_clear();
EVE_execute_cmd();
cmdoffset = EVE_memRead16(REG_CMD_WRITE);
cmdoffset -= 4U;
cmdoffset &= 0x0fffU;
ret_val = (uint16_t) EVE_memRead32(EVE_RAM_CMD + cmdoffset);
Yes, that spi_transmit_32(0UL); is part of this as you now have to transfer these "return values" in order to advance the FIFO pointer correctly.
With a modified CMD_BITMAP_TRANSFORM that makes the co-processor write to a register instead of RAM_CMD,
this would look like this:
EVE_cs_clear();
EVE_execute_cmd();
ret_val = EVE_memRead16(REG_BITMAP_TRANSFORM_RESULT);
And the co-processor likely would also need a few lines less when writing to a fixed memory location.
So, anyways, please, no more "return values".