
Dear Magnus,
In message 59b21cf20905282322s60c91890w73eeb443c25a0963@mail.gmail.com you wrote:
+static void *mxc_nand_memcpy(void *dest, void *source, size_t size) +{
- uint32_t *s = source, *d = dest;
- size >>= 2;
- while (size--)
*d++ = *s++;
- return dest;
+}
Why do we need this "special" function here? Why cannot we use plain standard memcpy() instead?
Because the nand flash controller can only handle 32 bit read/write operations, any other size will cause an abort (or something like that).
I see. I would find it helpful if this was mentioned in a comment; eventually it should also be reflected in the function name. How about memcpy32() or memcpy_aligned32() or similar?
While we are at alignment - what happens if the parameters "source" and "dest" are not 32 bit aligned?
Maybe we should even move this function into common code?
Best regards,
Wolfgang Denk