GitHub

Docs / API reference / syn_api.h

syn_api.hv0.1.0

<synaptic/syn_api.h> is the primary header for application developers — the single include that pulls in every SynapticOS module: syn_mem.h, syn_model.h, syn_infer.h, syn_prof.h, syn_hal_npu.h, and syn_hal_dsp.h. It also conditionally includes syn_ipc.h when CONFIG_SYNAPTIC_DUAL_CORE is set and syn_model_ota.h when CONFIG_SYNAPTIC_OTA is set. On top of the includes it defines the runtime version macros and the three lifecycle entry points.

Types & constants

NameValueDescription
SYNAPTIC_VERSION_MAJOR0Major component of the SynapticOS version.
SYNAPTIC_VERSION_MINOR5Minor component of the SynapticOS version.
SYNAPTIC_VERSION_PATCH0Patch component of the SynapticOS version.
SYNAPTIC_VERSION_STRING"0.5.0"Full version as a null-terminated string; also what syn_version() returns. The version macros are the one part of the frozen header that moves — bumped once per release.

Functions

SignatureDescription
int syn_init(void)Initializes the SynapticOS runtime. Must be called once at startup before any other syn_* function. Brings up the tensor arena, HAL drivers, model registry, and inference scheduler. Returns 0 on success, negative errno on failure; -EALREADY if the runtime is already initialized.
int syn_shutdown(void)Shuts down the runtime: cancels pending jobs, unloads models, and releases resources. Returns 0 on success, negative errno on failure; -EPERM if the runtime was never initialized.
const char *syn_version(void)Returns the null-terminated runtime version string (e.g. "0.5.0").

Usage

The opening of the hello_inference sample — one include, one call to syn_init(), and the runtime is ready:

c
#include <zephyr/kernel.h>
#include <synaptic/syn_api.h>

int main(void)
{
    int ret;

    printk("=== SynapticOS %s ===\n", syn_version());

    /* Initialize runtime: arena, NPU HAL, DSP HAL, profiling */
    ret = syn_init();
    if (ret != 0) {
        printk("syn_init() failed: %d\n", ret);
        return ret;
    }

    /* ... register models, allocate tensors, run inference ... */

    return syn_shutdown();
}

Notes

  • Implementation status: fully implemented in v0.1.0 (src/core/syn_init.c).
  • Initialization order: syn_init() runs a fixed sequence — tensor arena, NPU HAL, DSP HAL, profiling. A DSP HAL failure is non-fatal: the runtime logs a warning and continues without DSP acceleration. A profiling init failure is likewise a warning only.
  • Arena ownership: syn_init() owns a statically allocated arena of CONFIG_SYNAPTIC_TENSOR_ARENA_SIZE bytes (16-byte aligned) and passes it to syn_mem_init(). Applications normally never call syn_mem_init() themselves — see syn_mem.h.
  • Threading: call syn_init() and syn_shutdown() from a single context; the double-init guard is a simple flag, not a lock.
  • Conditional modules: syn_ipc.h and syn_model_ota.h are only pulled in when their Kconfig options are enabled — see the Kconfig reference.