UUID API

Location: include/sof/lib/uuid.h

group uuid_api

UUID API specification.

Defines

UUID_SIZE

UUID is 16 bytes long.

UUID_NAME_MAX_LEN

UUID name string max length in bytes, including null termination.

_UUID_INIT(va, vb, vc, d0, d1, d2, d3, d4, d5, d6, d7)
_UUID(uuid_name)
_RT_UUID(uuid_name)
_DEF_UUID(entity_name, uuid_name, initializer)
SOF_DEFINE_UUID(entity_name, uuid_name, va, vb, vc, vd0, vd1, vd2, vd3, vd4, vd5, vd6, vd7)

Declares runtime UUID (aaaaaaaa-bbbb-cccc-d0d1-d2d3d4d5d6d7) and name.

UUID value from variables declared with this macro are accessible in runtime code - to dereference use SOF_RT_UUID()

Parameters:
  • entity_name – Name of the object pinted by the software tools.

  • uuid_name – Uuid symbol name used with SOF_UUID() and SOF_RT_UUID().

  • va – aaaaaaaa value.

  • vb – bbbb value.

  • vc – cccc value.

  • vd0 – d0 value (note how d0 and d1 are grouped in formatted uuid)

  • vd1 – d1 value.

  • vd2 – d2 value.

  • vd3 – d3 value.

  • vd4 – d4 value.

  • vd5 – d5 value.

  • vd6 – d6 value.

  • vd7 – d7 value.

SOF_DEFINE_REG_UUID(name)

Defines UUID sourced from the fixed SOF registry.

As for SOF_DEFINE_UUID(), but the ID value is sourced by name from the uuid-registry.txt file distributed with the source tree. The string name field will be identical with the name passed (which is passed as a symbol!), runtime symbol (e.g. the “uuid_name” argument to SOF_DEFINE_UUID()) will be the same, postfixed with a “_uuid”.

Parameters:
  • name – Name of the UUID, must match an entry in uuid-registry.txt

SOF_UUID(uuid_name)

Creates local unique 32-bit representation of UUID structure.

In Zephyr builds, this has the same address as the result of SOF_RT_UUID, but has type of “struct sof_uuid *” and not “struct

sof_uid_record *”

Parameters:
  • uuid_name – UUID symbol name declared with DECLARE_SOF_UUID() or DECLARE_SOF_RT_UUID().

SOF_RT_UUID(uuid_name)

Dereference unique 32-bit representation of UUID structure in runtime.

Parameters:
  • uuid_name – UUID symbol name declared with DECLARE_SOF_RT_UUID().

struct sof_uuid
#include <uuid.h>

UUID (Universally Unique IDentifier) structure.

Use DECLARE_SOF_UUID() to assigned UUID to the fw part (component implementation, dai implementation, …).

Use SOF_UUID() to store an address of declared UUID.

See existing implementation of components and dais for examples how to UUIDs are declared and assigned to the drivers to provide identification of the source for their log entries.

UUID for a new component may be generated with uuidgen Linux tool, part of the util-linux package.

FIXME: this struct scheme has an endianness bug. On BE systems, the same initialier for the a/b/c fields will produce different memory layout than on LE systems. Within C code, that’s fine, but when compared with external representations (c.f. topology) that pass UUIDs as a linear array of bytes, only one endianness will work. If SOF ever ships on a BE system all use of sof_uuid will need to be modified to byte swap the a/b/c values.

Public Members

uint32_t a
uint16_t b
uint16_t c
uint8_t d[8]
struct sof_uuid_entry
#include <uuid.h>

Connects UUID with component description.

Declaration of this structure should be done by DECLARE_SOF_UUID(), then declaration will be part of .static_uuids section and SMEX tool use it during ldc file creation.

Public Members

struct sof_uuid id
const char name[UUID_NAME_MAX_LEN]