The ioread[8|16|32|64]() and iowrite[8|16|32|64]() APIs can work upon small data quantums ranging from 1 to 8 bytes only. But what if we'd like to read or write a few dozen or a few hundred bytes? You can always encode these APIs in a loop. However, the kernel, anticipating exactly this, provides helper routines that are more efficient, that internally use a tight assembly loop. These are the so-called repeating versions of the MMIO APIs:
- For reading, we have the ioread[8|16|32|64]_rep() set of APIs.
- For writing, we have the iowrite[8|16|32|64]_rep() set of APIs.
Let's look at the signature for one of them; that is, an 8-bit repeating read. The remaining reads are completely analogous:
#include <linux/io.h>
void ioread8_rep(const volatile void __iomem *addr, void *buffer, unsigned int count);
This will read count bytes from the source address, addr (an MMIO location), into the (kernel-space...