Char interface for lib_sdram?
Posted: Thu Apr 19, 2018 2:00 pm
Hi Guys,
I've been using lib_sdram extensively for quite some time now. I find that the API requiring unsigned int arrays for data transfer to be hard to use in most cases because most of the time my source or sink of data is a char array. I wrote some wrapper functions which wrap sdram_write and sdram_read to provide a char array interface. I don't particularly like it because of the buffer gymnastics that need to take place to convert to/from unsigned int/unsigned char.
Is there anything requiring the API to be unsigned ints? I was looking at the source code and my first instinct was that the majority of the code for reading and writing to/from sdram takes place in assembly and so everything has to be in words. However, the core data transfer code for lib_usb also takes place in assembly and that API provides interfaces for unsigned char arrays for data transfer. I did, however notice this comment in XUD_EpFuncs.S:
That leads me to believe that the API for lib_usb could have also been written for unsigned ints as well but the xC API implicitly "casts" the data arrays from unsigned chars to unsigned ints when it crosses the xC -> assembly barrier.
I guess the big question I'm asking is, if I were take on an effort to provide a "native" unsigned char interface for sdram_read and sdram_write, would that be feasible? Any impediments to keep in mind?
Thanks.
I've been using lib_sdram extensively for quite some time now. I find that the API requiring unsigned int arrays for data transfer to be hard to use in most cases because most of the time my source or sink of data is a char array. I wrote some wrapper functions which wrap sdram_write and sdram_read to provide a char array interface. I don't particularly like it because of the buffer gymnastics that need to take place to convert to/from unsigned int/unsigned char.
Is there anything requiring the API to be unsigned ints? I was looking at the source code and my first instinct was that the majority of the code for reading and writing to/from sdram takes place in assembly and so everything has to be in words. However, the core data transfer code for lib_usb also takes place in assembly and that API provides interfaces for unsigned char arrays for data transfer. I did, however notice this comment in XUD_EpFuncs.S:
Code: Select all
// Note: Assumes startIndex is word aligned
I guess the big question I'm asking is, if I were take on an effort to provide a "native" unsigned char interface for sdram_read and sdram_write, would that be feasible? Any impediments to keep in mind?
Thanks.