 Question:
There's a function called "memtrans" in mvp.h. It looks like: extern char
*memtrans(char *to, char *from, unsigned int length); If the "to " and
"from" pointer are declared as integer, an error is generated "[E140]
pointer argument disagrees with prototype", How could I do to get a integer to
integer transfer?
Answer: There's a fundamental
thing that you want to avoid if possible when using the memtrans function. Since the
memtrans function uses packet transfers, the TC expects you to pass it byte addresses, not
word addresses. If you want to pass it integer pointers instead, you can do that, but you
must have a good understanding of the effects of endianess. When you make a type cast in
C, the pointer is simply passed through- it doesn't know what endian you're in. Therefore,
in big endian mode the MS byte address is the same as the word address. However, in little
endian mode, the same byte address actually points to the fourth byte in the addressed
word. Therefore, as you can see, it isn't a good thing to necessarily try passing memtrans
an integer pointer. Fundamentally, the TC (and thus C80) is a byte aligned machine, not a
word aligned machine. |