-
-
Couldn't load subscription status.
- Fork 9
Open
Description
Currently, individual TRB types are defined as transparent wrappers of [u32;4] with some impls.
However speaking about their union types, there are Allowed types which I feel inconvenient for several reasons:
Allowedtypes are not transparently[u32;4], so we can't directly push that type into a ring.- Several methods shared among all TRB types, such as extracting raw
[u32;4]block or set/clear cycle bits,
are implemented inAllowedtypes by matching discriminator arms.
Although I didn't benchmark, this seems quite redundant to me. This possibly is a bottleneck given that the actual methods perform simple enough tasks like setting a bit or return the block itself. - Since this crate doesn't have a Event Ring Segment Table Entry type, I had to build it in my own. (I'll open another issue for this)
For that entry type, we need a method which takes a Event Ring buffer reference and convert it into an entry.
What would be the type of that buffer argument? Definitely not&[Allowed], and&[[u32;4]]seems a little bit unclear.
Is it okay that an allocated buffer has the type &[[u32;4]]?
If not, I suggest to add a transparent wrapper for [u32; 4], say pub struct Block(pub(crate) [u32; 4]);, and define some methods like set/clear cycle bits on it.
Then the ERST Entry type will accept &[Block] type buffers, and concrete TRB types would wrap Block rather than raw [u32; 4]. (e.g. pub struct NoOp(Block); instead of pub struct NoOp([u32;4]);)
Metadata
Metadata
Assignees
Labels
No labels