2019-04-12 11:05:15 -05:00
|
|
|
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
|
|
|
|
/*
|
|
|
|
* This file is provided under a dual BSD/GPLv2 license. When using or
|
|
|
|
* redistributing this file, you may do so under either license.
|
|
|
|
*
|
2024-05-03 09:03:59 -05:00
|
|
|
* Copyright(c) 2018 Intel Corporation
|
2019-04-12 11:05:15 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__
|
|
|
|
#define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__
|
|
|
|
|
ASoC: SOF: use __u32 instead of uint32_t in uapi headers
When CONFIG_UAPI_HEADER_TEST=y, exported headers are compile-tested to
make sure they can be included from user-space.
Currently, header.h and fw.h are excluded from the test coverage.
To make them join the compile-test, we need to fix the build errors
attached below.
For a case like this, we decided to use __u{8,16,32,64} variable types
in this discussion:
https://lkml.org/lkml/2019/6/5/18
Build log:
CC usr/include/sound/sof/header.h.s
CC usr/include/sound/sof/fw.h.s
In file included from <command-line>:32:0:
./usr/include/sound/sof/header.h:19:2: error: unknown type name ‘uint32_t’
uint32_t magic; /**< 'S', 'O', 'F', '\0' */
^~~~~~~~
./usr/include/sound/sof/header.h:20:2: error: unknown type name ‘uint32_t’
uint32_t type; /**< component specific type */
^~~~~~~~
./usr/include/sound/sof/header.h:21:2: error: unknown type name ‘uint32_t’
uint32_t size; /**< size in bytes of data excl. this struct */
^~~~~~~~
./usr/include/sound/sof/header.h:22:2: error: unknown type name ‘uint32_t’
uint32_t abi; /**< SOF ABI version */
^~~~~~~~
./usr/include/sound/sof/header.h:23:2: error: unknown type name ‘uint32_t’
uint32_t reserved[4]; /**< reserved for future use */
^~~~~~~~
./usr/include/sound/sof/header.h:24:2: error: unknown type name ‘uint32_t’
uint32_t data[0]; /**< Component data - opaque to core */
^~~~~~~~
In file included from <command-line>:32:0:
./usr/include/sound/sof/fw.h:49:2: error: unknown type name ‘uint32_t’
uint32_t size; /* bytes minus this header */
^~~~~~~~
./usr/include/sound/sof/fw.h:50:2: error: unknown type name ‘uint32_t’
uint32_t offset; /* offset from base */
^~~~~~~~
./usr/include/sound/sof/fw.h:64:2: error: unknown type name ‘uint32_t’
uint32_t size; /* bytes minus this header */
^~~~~~~~
./usr/include/sound/sof/fw.h:65:2: error: unknown type name ‘uint32_t’
uint32_t num_blocks; /* number of blocks */
^~~~~~~~
./usr/include/sound/sof/fw.h:73:2: error: unknown type name ‘uint32_t’
uint32_t file_size; /* size of file minus this header */
^~~~~~~~
./usr/include/sound/sof/fw.h:74:2: error: unknown type name ‘uint32_t’
uint32_t num_modules; /* number of modules */
^~~~~~~~
./usr/include/sound/sof/fw.h:75:2: error: unknown type name ‘uint32_t’
uint32_t abi; /* version of header format */
^~~~~~~~
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Link: https://lore.kernel.org/r/20190721142308.30306-1-yamada.masahiro@socionext.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-21 23:23:08 +09:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
2023-03-13 13:03:40 +02:00
|
|
|
/**
|
|
|
|
* struct sof_abi_hdr - Header for all non IPC ABI data.
|
2023-03-13 13:03:41 +02:00
|
|
|
* @magic: Magic number for validation
|
|
|
|
* for IPC3 data: 0x00464F53 ('S', 'O', 'F', '\0')
|
|
|
|
* for IPC4 data: 0x34464F53 ('S', 'O', 'F', '4')
|
|
|
|
* @type: module specific parameter
|
|
|
|
* for IPC3: Component specific type
|
|
|
|
* for IPC4: parameter ID (param_id) of the data
|
2023-03-13 13:03:40 +02:00
|
|
|
* @size: The size in bytes of the data, excluding this struct
|
2023-03-13 13:03:41 +02:00
|
|
|
* @abi: SOF ABI version. The version is valid in scope of the 'magic', IPC3 and
|
|
|
|
* IPC4 ABI version numbers have no relationship.
|
2023-03-13 13:03:40 +02:00
|
|
|
* @reserved: Reserved for future use
|
|
|
|
* @data: Component data - opaque to core
|
2019-04-12 11:05:15 -05:00
|
|
|
*
|
|
|
|
* Identifies data type, size and ABI.
|
|
|
|
* Used by any bespoke component data structures or binary blobs.
|
|
|
|
*/
|
|
|
|
struct sof_abi_hdr {
|
2023-03-13 13:03:40 +02:00
|
|
|
__u32 magic;
|
|
|
|
__u32 type;
|
|
|
|
__u32 size;
|
|
|
|
__u32 abi;
|
|
|
|
__u32 reserved[4];
|
|
|
|
__u32 data[];
|
2019-04-12 11:05:15 -05:00
|
|
|
} __packed;
|
|
|
|
|
2022-06-08 20:26:39 -07:00
|
|
|
#define SOF_MANIFEST_DATA_TYPE_NHLT 1
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct sof_manifest_tlv - SOF manifest TLV data
|
|
|
|
* @type: type of data
|
|
|
|
* @size: data size (not including the size of this struct)
|
|
|
|
* @data: payload data
|
|
|
|
*/
|
|
|
|
struct sof_manifest_tlv {
|
|
|
|
__le32 type;
|
|
|
|
__le32 size;
|
|
|
|
__u8 data[];
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct sof_manifest - SOF topology manifest
|
|
|
|
* @abi_major: Major ABI version
|
|
|
|
* @abi_minor: Minor ABI version
|
|
|
|
* @abi_patch: ABI patch
|
|
|
|
* @count: count of tlv items
|
|
|
|
* @items: consecutive variable size tlv items
|
|
|
|
*/
|
|
|
|
struct sof_manifest {
|
|
|
|
__le16 abi_major;
|
|
|
|
__le16 abi_minor;
|
|
|
|
__le16 abi_patch;
|
|
|
|
__le16 count;
|
|
|
|
struct sof_manifest_tlv items[];
|
|
|
|
};
|
|
|
|
|
2019-04-12 11:05:15 -05:00
|
|
|
#endif
|