Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
protocol.h
Go to the documentation of this file.
1/*
2 * Copyright 2024 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_PROTOCOL_H_
14#define _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_PROTOCOL_H_
15
22
23#include <zephyr/device.h>
25#include <stdint.h>
26#include <errno.h>
27
29#define SCMI_SHORT_NAME_MAX_SIZE 16
30
47#define SCMI_MESSAGE_HDR_MAKE(id, type, proto, token) \
48 (SCMI_FIELD_MAKE(id, GENMASK(7, 0), 0) | SCMI_FIELD_MAKE(type, GENMASK(1, 0), 8) | \
49 SCMI_FIELD_MAKE(proto, GENMASK(7, 0), 10) | SCMI_FIELD_MAKE(token, GENMASK(9, 0), 18))
50
51struct scmi_channel;
52
64
94
112
125 union {
128 struct {
133 };
134 };
135};
136
150
158int scmi_status_to_errno(int scmi_status);
159
180int scmi_send_message(struct scmi_protocol *proto, struct scmi_message *msg,
181 struct scmi_message *reply, bool use_polling);
182
192
202
213 uint32_t *attributes);
214
224
228
234
235#endif /* _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_PROTOCOL_H_ */
Header file for SCMI Utility Macros.
System error numbers.
scmi_message_type
SCMI message type.
Definition protocol.h:56
int scmi_protocol_message_attributes_get(struct scmi_protocol *proto, uint32_t message_id, uint32_t *attributes)
Get protocol message attributes.
scmi_status_code
SCMI status codes.
Definition protocol.h:68
int scmi_protocol_get_version(struct scmi_protocol *proto, uint32_t *version)
Get protocol version.
int scmi_protocol_attributes_get(struct scmi_protocol *proto, uint32_t *attributes)
Get protocol attributes.
int scmi_send_message(struct scmi_protocol *proto, struct scmi_message *msg, struct scmi_message *reply, bool use_polling)
Send an SCMI message and wait for its reply.
int scmi_protocol_version_negotiate(struct scmi_protocol *proto, uint32_t version)
Negotiate protocol version.
int scmi_status_to_errno(int scmi_status)
Convert an SCMI status code to its Linux equivalent (if possible).
@ SCMI_NOTIFICATION
Notification message.
Definition protocol.h:62
@ SCMI_DELAYED_REPLY
Delayed reply message.
Definition protocol.h:60
@ SCMI_COMMAND
Command message.
Definition protocol.h:58
@ SCMI_SUCCESS
Successful completion.
Definition protocol.h:70
@ SCMI_INVALID_PARAMETERS
One or more parameters are invalid.
Definition protocol.h:74
@ SCMI_BUSY
The platform is busy and cannot service the command.
Definition protocol.h:82
@ SCMI_GENERIC_ERROR
An unspecified error occurred.
Definition protocol.h:86
@ SCMI_HARDWARE_ERROR
A hardware error occurred.
Definition protocol.h:88
@ SCMI_OUT_OF_RANGE
A parameter or value is out of the supported range.
Definition protocol.h:80
@ SCMI_PROTOCOL_ERROR
A protocol error (e.g.
Definition protocol.h:90
@ SCMI_NOT_FOUND
The entity referenced by the command was not found.
Definition protocol.h:78
@ SCMI_DENIED
The caller is not permitted to perform the operation.
Definition protocol.h:76
@ SCMI_IN_USE
The resource is already in use.
Definition protocol.h:92
@ SCMI_NOT_SUPPORTED
The command is not supported.
Definition protocol.h:72
@ SCMI_COMMS_ERROR
A communication error occurred.
Definition protocol.h:84
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
SCMI channel structure.
Definition transport.h:52
SCMI message structure.
Definition protocol.h:142
uint32_t hdr
Message header (see SCMI_MESSAGE_HDR_MAKE).
Definition protocol.h:144
uint32_t len
Size in bytes of the data pointed to by content.
Definition protocol.h:146
void * content
Pointer to the message payload (parameters or return values).
Definition protocol.h:148
SCMI protocol version.
Definition protocol.h:123
uint16_t major
Major protocol revision.
Definition protocol.h:132
uint16_t minor
Minor protocol revision.
Definition protocol.h:130
uint32_t raw
Raw 32-bit protocol version value.
Definition protocol.h:127
SCMI protocol structure.
Definition protocol.h:100
uint32_t version
Protocol supported version.
Definition protocol.h:110
const struct device * transport
Transport layer device.
Definition protocol.h:106
struct scmi_channel * tx
TX channel.
Definition protocol.h:104
void * data
Protocol private data.
Definition protocol.h:108
uint32_t id
Protocol ID.
Definition protocol.h:102