ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
platform.h File Reference

The platform contract: what the library asks of a target, in the library's own words. More...

#include "config/platform/compiler_directives.h"
#include "vendor/vendor_detect.h"
#include "config/platform/ns_contract.h"
#include "vendor/board_profiles/board_profile.h"
#include "config/platform/types.h"
#include "config/hardware_capabilities/hw_caps_en.h"
#include "config/hardware_capabilities/hw_caps_en_error.h"
#include "config/hardware_capabilities/hw_caps_prototypes.h"
#include "config/platform/platform_defines.h"
#include "config/platform/platform_prototypes.h"
#include "vendor/vendor_hal.h"
#include "config/platform/platform_error.h"

Go to the source code of this file.

Macros

#define PROTO_WORD_BITS   PROTOCORE_HW_WORD_BITS
 The target's natural register width, in bits.
 
#define PROTO_INDEX_BITS   32
 Bits in every offset, length and capacity the library declares (protocore_idx).
 
#define PROTO_SWAR_BITS   PROTO_WORD_BITS
 Bits in the lane carrier the byte-parallel scans and compares work in.
 

Detailed Description

The platform contract: what the library asks of a target, in the library's own words.

Nothing here names a vendor. The axis itself is resolved in vendor/vendor_detect.h, which then pulls in exactly one vendor/<vendor>/ header; this file states the questions that header has to answer and refuses the build, by name, for any it did not.

Two kinds of thing live here:

  • the capability questions (PROTOCORE_HAS_*): does this part carry the thing at all. Each is #ifndef, so a build states what it has by defining it, and an unanswered one is an #error rather than a silent 0.
  • the seams (protocore_platform_*): declared under the capability that answers whether the part carries the thing, so reaching for an absent one is a compile error, not a link-time surprise.

It is also the assembly point: the vendor axis, the board profile, the widths, the types built from them, the capability floors and questions, and the seams - in the one order each depends on the last. Nothing here includes a standard header; config/platform/types.h is the only file that does.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file platform.h.

Macro Definition Documentation

◆ PROTO_WORD_BITS

#define PROTO_WORD_BITS   PROTOCORE_HW_WORD_BITS

The target's natural register width, in bits.

What a value is carried in while it is being worked on. Arithmetic narrower than the register is not cheaper on any part in the target list - it costs the mask or sign-extend that keeps the unused half correct - so the library states the register once and narrows only at a boundary.

Definition at line 66 of file platform.h.

◆ PROTO_INDEX_BITS

#define PROTO_INDEX_BITS   32

Bits in every offset, length and capacity the library declares (protocore_idx).

Replaces size_t, whose width is inherited from the target's pointer and therefore differs between a device build and the host test that proves it - the same source emitting different index arithmetic in the two places it has to agree. 32 addresses far more than any pool reserved here; a target whose every buffer is under 64 KB may set 16.

Definition at line 78 of file platform.h.

◆ PROTO_SWAR_BITS

#define PROTO_SWAR_BITS   PROTO_WORD_BITS

Bits in the lane carrier the byte-parallel scans and compares work in.

Defaults to the register width, which is what makes the lane algebra worth doing: one word test answers for PROTO_SWAR_BITS/8 bytes at once. Set it lower only to model a narrower machine - a carrier WIDER than the register is synthesized from halves and is measurably slower than the width it decomposes into. 8 is legal and degenerates to one lane per word, which is the honest setting for a part with no wider register.

Definition at line 91 of file platform.h.