It's quite common to want to save or pass around pointers to a register structure without really needing to access any members, and to have a driver API that actually does all the work. Using tagged structures allows for forward declaration of a pointer type without actually needing to include the structure header and also eliminating the need for casts to/from void*. This would primarily be useful on the final Addrmap/regblock structure definition, as opposed to individual register field structs and unions.
E.g. in foo.h
typedef struct __attribute__ ((packed)) foo {
foo_REGA_t REGA;
foo_REGB_t REGB;
// ...
} foo_t;
In the public API header of the driver, you'd have functions defined using a pointer of the tagged type (e.g. void init_foo(struct foo *p_foo)), and SoC code that didn't need to know about the details of foo, but did know it's location could return struct foo * or could keep a table of such pointers, etc. without needing to include headers for absolutely everything. Enabling separation of private/public APIs can also allow for brevity in naming of macros and/or register structs/unions without the concern for name collision.
Obviously, this could be an optional output configuration.
It's quite common to want to save or pass around pointers to a register structure without really needing to access any members, and to have a driver API that actually does all the work. Using tagged structures allows for forward declaration of a pointer type without actually needing to include the structure header and also eliminating the need for casts to/from
void*. This would primarily be useful on the final Addrmap/regblock structure definition, as opposed to individual register field structs and unions.E.g. in foo.h
In the public API header of the driver, you'd have functions defined using a pointer of the tagged type (e.g.
void init_foo(struct foo *p_foo)), and SoC code that didn't need to know about the details of foo, but did know it's location could returnstruct foo *or could keep a table of such pointers, etc. without needing to include headers for absolutely everything. Enabling separation of private/public APIs can also allow for brevity in naming of macros and/or register structs/unions without the concern for name collision.Obviously, this could be an optional output configuration.