AES-128 Encryption (aes128)
AES-128 symmetric encryption/decryption supporting ECB, CBC, and CTR block cipher modes.
AES-256 Encryption (aes256)
AES-256 symmetric encryption/decryption supporting ECB, CBC, and CTR block cipher modes.
Arctangent Lookup Table (atantab)
Inverse trigonometric function module based on a precomputed lookup table, providing both integer and floating-point precision. It is the inverse counterpart of the forward Cosine Lookup Table (costab), sharing the same 16-bit fixed-point angle convention, so results can be fed straight back into isin()/icos().
Backoff Strategy (backoff)
Exponential backoff with random jitter retry delay calculation module, used for scenarios such as network requests and device reconnection that require progressively increasing retry intervals.
Base64 Codec (base64)
Base64 encoding and decoding per RFC 4648.
BCD Encoding (bcd)
Conversion interface between BCD (Binary-Coded Decimal) and binary, used for interacting with hardware such as RTC chips that use BCD encoding.
Biquad Filter (biquad)
Biquadratic IIR filter, supporting 8 common filter types, used for frequency response shaping in audio and signal processing.
Breathing Light (breathing)
Breathing light brightness calculation module, returns the corresponding brightness value based on the current time, simulating the natural fade-in and fade-out effect of breathing.
Byte Order Conversion (byteorder)
Conversion interface between CPU byte order and little-endian/big-endian formats, used for cross-platform scenarios such as protocol parsing and file format handling.
Character Set Conversion (charset)
Unicode character set conversion supporting UTF-8, UCS-4, UTF-16 inter-conversion and character width calculation.
Complex Number (complex)
Single-precision floating-point complex number arithmetic for DSP.
Cosine Lookup Table (costab)
Trigonometric function module based on a precomputed lookup table, providing both integer and floating-point precision, using 16-bit fixed-point angle representation with zero floating-point operation overhead.
CRC-16 Checksum (crc16)
CRC-16 cyclic redundancy check, using the CRC-16/XMODEM algorithm standard. Chainable by feeding the previous CRC output as the initial value.
CRC-32 Checksum (crc32)
CRC-32 cyclic redundancy check, using the CRC-32 (ISO 3309) algorithm standard. Chainable by feeding the previous CRC output as the initial value.
CRC-8 Checksum (crc8)
CRC-8 cyclic redundancy check, using the CRC-8/SMBUS algorithm standard. Chainable by feeding the previous CRC output as the initial value.
Device Tree (dtree)
Device tree node abstraction layer for reading configuration from JSON-based device tree data. Primary interface for drivers to read configuration from default.json.
Integer Division (div)
Software integer division routines for platforms lacking hardware divide instructions (e.g., some ARM cores).
Dynamic Buffer (db)
Dynamic byte buffer for automatic capacity expansion management of binary data. Capacity grows by powers of 2, suitable for scenarios such as protocol parsing and data assembly.
Dynamic String (ds)
Dynamic string library providing auto-expanding string operations including append, insert, delete, find, replace, split, and more.
Easing Function (easing)
Easing animation module based on cubic Bezier curves, implementing various acceleration and deceleration effects by defining curve control points.
ECDSA Signature (ecdsa256)
Elliptic Curve Digital Signature Algorithm and ECDH key exchange using secp256r1 curve.
EWMA Filter (ewma)
Exponentially Weighted Moving Average filter, a single-pole low-pass filter that smooths values by blending new samples with the previous average.
Fast Fourier Transform (fft)
Fast Fourier Transform computing forward and inverse DFT on power-of-two sized data, using precomputed lookup tables and bit-reversal permutation.
Ring Buffer FIFO (fifo)
Lock-free circular ring buffer FIFO with two API levels: unlocked fifo (caller manages synchronization) and locked fifo (internal mutex). Supports raw byte streams and length-prefixed packets.
Hash Map (hmap)
Hash-based key-value mapping table, supporting automatic resize, key sorting, thread safety, and callback notifications.
Hex Dump (hexdump)
Outputs memory data in the classic hex dump format, 16 bytes per line, including address, hexadecimal values, and ASCII characters.
Init / Exit Calls (initcall)
libx/initcall.h and libx/initcall.c provide XSTAR's init/exit call mechanism. Instead of registering initialization code in a central function, a module simply declares an init function with the xxxinitcall(fn) macro; the linker automatically collects it into a per-level section, and xstarinit() invokes all of them at fixed points during boot. The exit phase is symmetric — xstarexit() calls the functions registered with xxxexitcall(fn) in the reverse order of init.
Integer Square Root (sqrti)
Integer square root computation without floating-point operations, suitable for embedded platforms without an FPU.
Interleaver (interleaver)
Data interleaving and deinterleaving module based on pseudo-random permutation. By reordering byte order, consecutive burst errors are scattered into random errors, improving anti-burst interference capability when used with error correction codes (e.g., Reed-Solomon).
JSON Parser (json)
JSON parser that parses JSON text into a tree of jsonvaluet nodes, supporting all standard JSON types (object, array, integer, double, string, boolean, null).
Kalman Filter (kalman)
Single-variable linear Kalman filter implementing predict-update cycle with configurable state transition, observation, process noise, and measurement noise parameters.
Key Filter (keyfilter)
Key filter, based on a state machine that converts raw press/release events into high-level key semantics (click, double-click, long press, repeat).
KOBJ Virtual Filesystem (kobj)
This document details XSTAR's KOBJ (Kernel Object) virtual filesystem, including data structures, API interfaces, and usage examples.
LRU Cache (lru)
Least Recently Used cache backed by hash table + doubly-linked list, evicting least recently used items when capacity is exceeded. Supports eviction callback. Accessed items are automatically promoted to the head of the list.
Mean Filter (mean)
Sliding window mean filter that performs moving average on a data stream to smooth noise. O(1) update complexity.
Median Filter (median)
Sliding window median filter that computes the median of a data stream, effectively filtering impulse noise (spikes). O(n) update complexity.
Path Utility (path)
Filesystem path manipulation utilities: classify absolute/relative paths, extract basename, dirname, and file extension.
Publish-Subscribe System (psub)
XSTAR's Publish-Subscribe mechanism enables loosely coupled communication between modules. Publishers send messages on a topic, and callbacks subscribed to that topic are automatically invoked. Publishers and subscribers are unaware of each other.
QR Code Generator (qrcgen)
QR Code generator supporting versions 1-40, four error correction levels, and eight mask patterns.
Queue (queue)
General-purpose FIFO queue built on listheadt, with custom cleanup callback support. Not thread-safe; the caller is responsible for ensuring consistency in concurrent scenarios.
Red-Black Tree (rbtree)
Red-Black Tree, self-balancing BST following Linux kernel style. Supports plain and cached roots (O(1) min lookup), and post-order traversal for safe deletion.
RC4 Cipher (rc4)
RC4 symmetric stream cipher, encrypts/decrypts data in-place. Encryption and decryption use the same operation: applying the same key a second time restores the original plaintext.
Reed-Solomon Error Correction (rs)
Forward Error Correction (FEC) module based on the Reed-Solomon algorithm. Adds parity symbols to data, allowing the receiver to automatically detect and correct transmission errors. Suitable for data protection over unreliable channels.
SHA-1 Hash (sha1)
SHA-1 secure hash algorithm, 160-bit digest computation. Supports one-shot and streaming interfaces.
SHA-256 Hash (sha256)
SHA-256 secure hash algorithm, 256-bit digest computation. Supports one-shot and streaming interfaces.
Simple Argument Parser (sarg)
A lightweight command-line argument parser with zero allocation and no external dependencies. It splits arguments into two kinds — options and positional arguments — and provides presence checks, value access, typed parsing, validity checks, and iteration.
Sorted List (slist)
A sorted key-value list based on a doubly linked list. Each node carries a string key and a user data pointer, supporting sorting by key.
Spring Animation (spring)
An animation module based on a physical spring model. It simulates spring motion through tension and friction parameters, producing natural bounce effects.
String Hash (shash)
A string hash function based on the djb2 algorithm, used for hash table key calculation and switch-based string matching, among other scenarios.
Touchscreen Filter (tsfilter)
A touchscreen coordinate filter that applies median debouncing + mean smoothing + affine calibration to raw touch data, outputting stable screen coordinates.
Unaligned Access (unaligned)
Safely read or write multi-byte values from unaligned memory addresses, avoiding alignment exceptions on certain architectures.
URI Parser (uri)
A URI string parsing module that splits a URI into its constituent components.
UUID Generator (uuid)
Generate UUID strings conforming to RFC 4122 version 4.
Virtual Machine Encryption (vmcrypt)
A data encryption/decryption module based on a custom virtual machine. It transforms an input buffer by executing a bytecode program, enabling customizable encryption and decryption logic. The separation of bytecode and data allows the encryption algorithm to be replaced at any time without recompilation.
Window Function (winfunc)
Signal processing window functions for reducing spectral leakage in FFT analysis.
Common Macros (xdef)
libx/xdef.h provides the global, foundational macro definitions and helper utilities used throughout XSTAR, including common size constants, boolean/null pointer definitions, container and offset calculations, branch prediction hints, static assertions, math helpers, and bit-scanning inline functions. The header is platform-independent and may be included by any source file.
YUV Color Conversion (yuv)
YUV to RGB color space conversion module, supporting both BT.601 and BT.709 standards, using integer arithmetic to avoid floating-point dependencies.