|
|
|
|
|
|
|
|
|
|
|
|
|
|
void inline transfer(void *buf, size_t count) { |
|
|
void inline transfer(void *buf, size_t count) { |
|
|
#if 0 |
|
|
#if 0 |
|
|
// Ethernet library fails if this is used. Why? |
|
|
|
|
|
|
|
|
// TODO: byte order still needs work to match SPISettings |
|
|
if (__builtin_constant_p(count)) { |
|
|
if (__builtin_constant_p(count)) { |
|
|
if (count < 1) return; |
|
|
if (count < 1) return; |
|
|
if (((count & 3) == 0) && (((uint32_t)buf & 3) == 0)) { |
|
|
if (((count & 3) == 0) && (((uint32_t)buf & 3) == 0)) { |
|
|
// size is multiple of 4 and buffer is 32 bit aligned |
|
|
// size is multiple of 4 and buffer is 32 bit aligned |
|
|
transfer32(buf, buf, count); |
|
|
|
|
|
|
|
|
transfer32(buf, buf, count >> 2); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (((count & 1) == 0) && (((uint32_t)buf & 1) == 0)) { |
|
|
if (((count & 1) == 0) && (((uint32_t)buf & 1) == 0)) { |
|
|
// size is multiple of 2 and buffer is 16 bit aligned |
|
|
// size is multiple of 2 and buffer is 16 bit aligned |
|
|
transfer16(buf, buf, count); |
|
|
|
|
|
|
|
|
transfer16(buf, buf, count >> 1); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |