xref: /aosp_15_r20/external/arm-trusted-firmware/include/export/README (revision 54fd6939e177f8ff529b10183254802c76df6d08)
1*54fd6939SJiyong ParkAll headers under include/export/ are export headers that are intended for
2*54fd6939SJiyong Parkinclusion in third-party code which needs to interact with TF-A data structures
3*54fd6939SJiyong Parkor interfaces. They must follow these special rules:
4*54fd6939SJiyong Park
5*54fd6939SJiyong Park- Header guards should start with ARM_TRUSTED_FIRMWARE_ to reduce clash risk.
6*54fd6939SJiyong Park
7*54fd6939SJiyong Park- All definitions should be sufficiently namespaced (e.g. with BL_ or TF_) to
8*54fd6939SJiyong Park  make name clashes with third-party code unlikely.
9*54fd6939SJiyong Park
10*54fd6939SJiyong Park- They must not #include any headers except other export headers, and those
11*54fd6939SJiyong Park  includes must use relative paths with "../double_quotes.h" notation.
12*54fd6939SJiyong Park
13*54fd6939SJiyong Park- They must not rely on any type definitions other that <stdint.h> types defined
14*54fd6939SJiyong Park  in the ISO C standard (i.e. uint64_t is fine, but not u_register_t). They
15*54fd6939SJiyong Park  should still not #include <stdint.h>. Instead, wrapper headers including
16*54fd6939SJiyong Park  export headers need to ensure that they #include <stdint.h> earlier in their
17*54fd6939SJiyong Park  include order.
18*54fd6939SJiyong Park
19*54fd6939SJiyong Park- They must not rely on any macro definitions other than those which are
20*54fd6939SJiyong Park  pre-defined by all common compilers (e.g. __ASSEMBLER__ or __aarch64__).
21*54fd6939SJiyong Park
22*54fd6939SJiyong Park- They must only contain macro, type and structure definitions, no prototypes.
23*54fd6939SJiyong Park
24*54fd6939SJiyong Park- They should avoid using integer types with architecture-dependent widths
25*54fd6939SJiyong Park  (e.g. long, uintptr_t, pointer types) where possible. (Some existing export
26*54fd6939SJiyong Park  headers are violating this for now.)
27*54fd6939SJiyong Park
28*54fd6939SJiyong Park- Their names should always end in "_exp.h".
29*54fd6939SJiyong Park
30*54fd6939SJiyong Park- Normal TF-A code should never include export headers directly. Instead, it
31*54fd6939SJiyong Park  should include a wrapper header that ensures the export header is included in
32*54fd6939SJiyong Park  the right manner. (The wrapper header for include/export/x/y/z_exp.h should
33*54fd6939SJiyong Park  normally be placed at include/x/y/z.h.)
34