Altera_Forum
Honored Contributor
12 years agoperipheral I/O transfer using unconventional data types
Hi,
This thread picks up from a previously posted one, here (http://www.alteraforum.com/forum/showthread.php?t=41971). I began a new thread, as the previous one had gotten a bit off topic. While I've already been given some very good suggestions, I'm still a little confused on transfer to and from peripherals, when unconventional data types are being used, i.e. ones which aren't necessarily base 2 and at least 8 bits in size. I have a large number of hardware components which I need to transfer data to, which are using values that are sometimes 3 bits in length, sometimes 7 bits, etc. I understand that bit fields are simply a poor option in the case of memory to peripheral transfers and, in general, are hardly suggested in any case due to portability issues. Per previous suggestions, defining macros for addressing the peripheral looks to be a good option for bypassing the HAL API and caching, when using the ldwio and stwio instructions. The previous thread pretty much answered the question of peripheral interface, so it looks like the problem is isolated to the application layer and how the data can be formatted in memory. I know that compiler optimization can be taken out of the equation, to some extent, using objects defined by the pre-processor, but it seems like inevitably, there's going to be some interaction with a data structure which is going to need bit field members and is going to be compiled. Because of the way the peripherals have been designed, it seems like I don't really have an option to include portability, but suggestions otherwise would be greatly appreciated.