Zephyr API
3.6.99
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
#ifndef _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_PROTOCOL_H_
13
#define _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_PROTOCOL_H_
14
15
#include <
zephyr/device.h
>
16
#include <
zephyr/drivers/firmware/scmi/util.h
>
17
#include <
stdint.h
>
18
#include <
errno.h
>
19
31
#define SCMI_MESSAGE_HDR_MAKE(id, type, proto, token) \
32
(SCMI_FIELD_MAKE(id, GENMASK(7, 0), 0) | \
33
SCMI_FIELD_MAKE(type, GENMASK(1, 0), 8) | \
34
SCMI_FIELD_MAKE(proto, GENMASK(7, 0), 10) | \
35
SCMI_FIELD_MAKE(token, GENMASK(9, 0), 18))
36
37
struct
scmi_channel
;
38
42
enum
scmi_message_type
{
44
SCMI_COMMAND
= 0x0,
46
SCMI_DELAYED_REPLY
= 0x2,
48
SCMI_NOTIFICATION
= 0x3,
49
};
50
54
enum
scmi_status_code
{
55
SCMI_SUCCESS
= 0,
56
SCMI_NOT_SUPPORTED
= -1,
57
SCMI_INVALID_PARAMETERS
= -2,
58
SCMI_DENIED
= -3,
59
SCMI_NOT_FOUND
= -4,
60
SCMI_OUT_OF_RANGE
= -5,
61
SCMI_BUSY
= -6,
62
SCMI_COMMS_ERROR
= -7,
63
SCMI_GENERIC_ERROR
= -8,
64
SCMI_HARDWARE_ERROR
= -9,
65
SCMI_PROTOCOL_ERROR
= -10,
66
SCMI_IN_USE
= -11,
67
};
68
74
struct
scmi_protocol
{
76
uint32_t
id
;
78
struct
scmi_channel
*
tx
;
80
const
struct
device
*
transport
;
82
void
*
data
;
83
};
84
90
struct
scmi_message
{
91
uint32_t
hdr
;
92
uint32_t
len
;
93
void
*
content
;
94
};
95
103
int
scmi_status_to_errno
(
int
scmi_status);
104
119
int
scmi_send_message
(
struct
scmi_protocol
*proto,
120
struct
scmi_message
*msg,
struct
scmi_message
*reply);
121
122
#endif
/* _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_PROTOCOL_H_ */
device.h
util.h
ARM SCMI utility header.
errno.h
System error numbers.
scmi_message_type
scmi_message_type
SCMI message type.
Definition
protocol.h:42
SCMI_NOTIFICATION
@ SCMI_NOTIFICATION
notification message
Definition
protocol.h:48
SCMI_DELAYED_REPLY
@ SCMI_DELAYED_REPLY
delayed reply message
Definition
protocol.h:46
SCMI_COMMAND
@ SCMI_COMMAND
command message
Definition
protocol.h:44
scmi_status_code
scmi_status_code
SCMI status codes.
Definition
protocol.h:54
SCMI_SUCCESS
@ SCMI_SUCCESS
Definition
protocol.h:55
SCMI_INVALID_PARAMETERS
@ SCMI_INVALID_PARAMETERS
Definition
protocol.h:57
SCMI_BUSY
@ SCMI_BUSY
Definition
protocol.h:61
SCMI_GENERIC_ERROR
@ SCMI_GENERIC_ERROR
Definition
protocol.h:63
SCMI_HARDWARE_ERROR
@ SCMI_HARDWARE_ERROR
Definition
protocol.h:64
SCMI_OUT_OF_RANGE
@ SCMI_OUT_OF_RANGE
Definition
protocol.h:60
SCMI_PROTOCOL_ERROR
@ SCMI_PROTOCOL_ERROR
Definition
protocol.h:65
SCMI_NOT_FOUND
@ SCMI_NOT_FOUND
Definition
protocol.h:59
SCMI_DENIED
@ SCMI_DENIED
Definition
protocol.h:58
SCMI_IN_USE
@ SCMI_IN_USE
Definition
protocol.h:66
SCMI_NOT_SUPPORTED
@ SCMI_NOT_SUPPORTED
Definition
protocol.h:56
SCMI_COMMS_ERROR
@ SCMI_COMMS_ERROR
Definition
protocol.h:62
scmi_send_message
int scmi_send_message(struct scmi_protocol *proto, struct scmi_message *msg, struct scmi_message *reply)
Send an SCMI message and wait for its reply.
scmi_status_to_errno
int scmi_status_to_errno(int scmi_status)
Convert an SCMI status code to its Linux equivalent (if possible)
stdint.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:403
scmi_channel
SCMI channel structure.
Definition
transport.h:45
scmi_message
SCMI message structure.
Definition
protocol.h:90
scmi_message::hdr
uint32_t hdr
Definition
protocol.h:91
scmi_message::len
uint32_t len
Definition
protocol.h:92
scmi_message::content
void * content
Definition
protocol.h:93
scmi_protocol
SCMI protocol structure.
Definition
protocol.h:74
scmi_protocol::transport
const struct device * transport
transport layer device
Definition
protocol.h:80
scmi_protocol::tx
struct scmi_channel * tx
TX channel.
Definition
protocol.h:78
scmi_protocol::data
void * data
protocol private data
Definition
protocol.h:82
scmi_protocol::id
uint32_t id
protocol ID
Definition
protocol.h:76
zephyr
drivers
firmware
scmi
protocol.h
Generated on Thu Nov 7 2024 15:54:19 for Zephyr API by
1.12.0