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