[Linux-stm32] [PATCH v2 0/4] Introduce the Counter character device interface
William Breathitt Gray
vilhelm.gray at gmail.com
Tue Jun 2 15:46:26 UTC 2020
On Tue, Jun 02, 2020 at 10:18:07AM -0500, David Lechner wrote:
> On 5/31/20 12:14 PM, William Breathitt Gray wrote:
> > Yielding the following /dev/counter0 memory layout:
> >
> > +------------+-----------------+------------+-------------------+
> > | Byte 0 | Byte 1 - Byte 8 | Byte 9 | Byte 10 - Byte 17 |
> > +------------+-----------------+------------+-------------------+
> > | Boundary 0 | Count 0 | Boundary 1 | Count 1 |
> > +------------+-----------------+------------+-------------------+
>
> A potential pitfall with this sort of packing is that some platforms
> do not support unaligned access, so data would have to be "unpacked"
> before it could be used.
Since the user defines the format of this data, they could reorganize it
to a more streamline alignment; for example:
# echo "C0 C1 C0E0 C1E0" > counter0/chrdev_format
Yielding the following /dev/counter0 memory layout instead:
+-----------------+------------------+------------+------------+
| Byte 0 - Byte 7 | Byte 8 - Byte 15 | Byte 16 | Byte 17 |
+-----------------+------------------+------------+------------+
| Count 0 | Count 1 | Boundary 0 | Boundary 1 |
+-----------------+------------------+------------+------------+
In the future, we could also define a padding argument to give users
more control over the exact offsets:
# echo "C0E0 P7 C0 C1E0 P7 C1" > counter0/chrdev_format
Yielding the following /dev/counter0 memory layout instead:
+------------+-----------------+------------------+------------+
| Byte 0 | Byte 1 - Byte 7 | Byte 8 - Byte 15 | Byte 16 |
+------------+-----------------+------------------+------------+
| Boundary 0 | Padding | Count 0 | Boundary 1 |
+------------+-----------------+------------------+------------+
+-------------------+-------------------+
| Byte 17 - Byte 23 | Byte 24 - Byte 31 |
+-------------------+-------------------+
| Padding | Count 1 |
+-------------------+-------------------+
I not sure it's best to introduce padding support with this patchset
given how much is already changing, but I don't anticipate packing
alignment to be something difficult to support in the future with this
interface.
William Breathitt Gray
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://st-md-mailman.stormreply.com/pipermail/linux-stm32/attachments/20200602/071e0df5/attachment.sig>
More information about the Linux-stm32
mailing list