Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
protocol.h File Reference

SCMI protocol generic functions and structures. More...

#include <zephyr/device.h>
#include <zephyr/drivers/firmware/scmi/util.h>
#include <stdint.h>
#include <errno.h>

Go to the source code of this file.

Data Structures

struct  scmi_protocol
 SCMI protocol structure. More...
 
struct  scmi_message
 SCMI message structure. More...
 

Macros

#define SCMI_MESSAGE_HDR_MAKE(id, type, proto, token)
 Build an SCMI message header.
 

Enumerations

enum  scmi_message_type { SCMI_COMMAND = 0x0 , SCMI_DELAYED_REPLY = 0x2 , SCMI_NOTIFICATION = 0x3 }
 SCMI message type. More...
 
enum  scmi_status_code {
  SCMI_SUCCESS = 0 , SCMI_NOT_SUPPORTED = -1 , SCMI_INVALID_PARAMETERS = -2 , SCMI_DENIED = -3 ,
  SCMI_NOT_FOUND = -4 , SCMI_OUT_OF_RANGE = -5 , SCMI_BUSY = -6 , SCMI_COMMS_ERROR = -7 ,
  SCMI_GENERIC_ERROR = -8 , SCMI_HARDWARE_ERROR = -9 , SCMI_PROTOCOL_ERROR = -10 , SCMI_IN_USE = -11
}
 SCMI status codes. More...
 

Functions

int scmi_status_to_errno (int scmi_status)
 Convert an SCMI status code to its Linux equivalent (if possible)
 
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.
 

Detailed Description

SCMI protocol generic functions and structures.

Macro Definition Documentation

◆ SCMI_MESSAGE_HDR_MAKE

#define SCMI_MESSAGE_HDR_MAKE ( id,
type,
proto,
token )
Value:
(SCMI_FIELD_MAKE(id, GENMASK(7, 0), 0) | \
SCMI_FIELD_MAKE(type, GENMASK(1, 0), 8) | \
SCMI_FIELD_MAKE(proto, GENMASK(7, 0), 10) | \
SCMI_FIELD_MAKE(token, GENMASK(9, 0), 18))
#define SCMI_FIELD_MAKE(x, mask, shift)
Create an SCMI message field.
Definition util.h:264
#define GENMASK(h, l)
Create a contiguous bitmask starting at bit position l and ending at position h.
Definition util.h:79

Build an SCMI message header.

Builds an SCMI message header based on the fields that make it up.

Parameters
idmessage ID
typemessage type
protoprotocol ID
tokenmessage token

Enumeration Type Documentation

◆ scmi_message_type

SCMI message type.

Enumerator
SCMI_COMMAND 

command message

SCMI_DELAYED_REPLY 

delayed reply message

SCMI_NOTIFICATION 

notification message

◆ scmi_status_code

SCMI status codes.

Enumerator
SCMI_SUCCESS 
SCMI_NOT_SUPPORTED 
SCMI_INVALID_PARAMETERS 
SCMI_DENIED 
SCMI_NOT_FOUND 
SCMI_OUT_OF_RANGE 
SCMI_BUSY 
SCMI_COMMS_ERROR 
SCMI_GENERIC_ERROR 
SCMI_HARDWARE_ERROR 
SCMI_PROTOCOL_ERROR 
SCMI_IN_USE 

Function Documentation

◆ 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.

Blocking function used to send an SCMI message over a given channel and wait for its reply

Parameters
protopointer to SCMI protocol
msgpointer to SCMI message to send
replypointer to SCMI message in which the reply is to be written
Return values
0if successful
negativeerrno if failure

◆ scmi_status_to_errno()

int scmi_status_to_errno ( int scmi_status)

Convert an SCMI status code to its Linux equivalent (if possible)

Parameters
scmi_statusSCMI status code as shown in enum scmi_status_code
Return values
Linuxequivalent status code