Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
transport.h File Reference

Public APIs for the SCMI transport layer drivers. More...

#include <zephyr/device.h>
#include <zephyr/kernel.h>

Go to the source code of this file.

Data Structures

struct  scmi_channel
 SCMI channel structure. More...
 
struct  scmi_transport_api
 

Typedefs

typedef void(* scmi_channel_cb) (struct scmi_channel *chan)
 Callback function for message replies.
 

Functions

static struct scmi_channelscmi_transport_request_channel (const struct device *transport, uint32_t proto, bool tx)
 Request an SCMI channel dynamically.
 
static int scmi_transport_init (const struct device *transport)
 Perform initialization for the transport layer driver.
 
static int scmi_transport_setup_chan (const struct device *transport, struct scmi_channel *chan, bool tx)
 Setup an SCMI channel.
 
static int scmi_transport_send_message (const struct device *transport, struct scmi_channel *chan, struct scmi_message *msg)
 Send an SCMI channel.
 
static int scmi_transport_read_message (const struct device *transport, struct scmi_channel *chan, struct scmi_message *msg)
 Read an SCMI message.
 
static bool scmi_transport_channel_is_free (const struct device *transport, struct scmi_channel *chan)
 Check if an SCMI channel is free.
 
int scmi_core_transport_init (const struct device *transport)
 Perfrom SCMI core initialization.
 

Detailed Description

Public APIs for the SCMI transport layer drivers.

Typedef Documentation

◆ scmi_channel_cb

typedef void(* scmi_channel_cb) (struct scmi_channel *chan)

Callback function for message replies.

This function should be called by the transport layer driver whenever a reply to a previously sent message has been received. Its purpose is to notifying the SCMI core of the reply's arrival so that proper action can be taken.

Parameters
chanpointer to SCMI channel on which the reply arrived

Function Documentation

◆ scmi_core_transport_init()

int scmi_core_transport_init ( const struct device * transport)

Perfrom SCMI core initialization.

Parameters
transportpointer to the device structure for the transport layer
Return values
0if successful
negativeerrno code if failure

◆ scmi_transport_channel_is_free()

static bool scmi_transport_channel_is_free ( const struct device * transport,
struct scmi_channel * chan )
inlinestatic

Check if an SCMI channel is free.

Parameters
transportpointer to the device structure for the transport layer
chanpointer to SCMI channel the query is to be performed on
Return values
0if successful
negativeerrno code if failure

◆ scmi_transport_init()

static int scmi_transport_init ( const struct device * transport)
inlinestatic

Perform initialization for the transport layer driver.

The transport layer driver can't be initialized directly (i.e via a call to its init() function) during system initialization. This is because the macro used to define an SCMI transport places scmi_core_transport_init() in the init section instead of the driver's init() function. As such, scmi_core_transport_init() needs to call this function to perfrom transport layer driver initialization if required.

This operation is optional.

Parameters
transportpointer to the device structure for the transport layer
Return values
0if successful
negativeerrno code if failure

◆ scmi_transport_read_message()

static int scmi_transport_read_message ( const struct device * transport,
struct scmi_channel * chan,
struct scmi_message * msg )
inlinestatic

Read an SCMI message.

Parameters
transportpointer to the device structure for the transport layer
chanpointer to SCMI channel on which the message is to be read
msgpointer to message the caller wishes to read
Return values
0if successful
negativeerrno code if failure

◆ scmi_transport_request_channel()

static struct scmi_channel * scmi_transport_request_channel ( const struct device * transport,
uint32_t proto,
bool tx )
inlinestatic

Request an SCMI channel dynamically.

Whenever the SCMI transport layer driver doesn't support static channel allocation, the SCMI core will try to bind a channel to a protocol dynamically using this function. Note that no setup needs to be performed on the channel in this function as the core will also call the channel setup() function.

Parameters
transportpointer to the device structure for the transport layer
protoID of the protocol for which the core is requesting the channel
txtrue if the channel is TX, false if RX
Return values
pointerto SCMI channel that's to be bound to the protocol
NULLif operation was not successful

◆ scmi_transport_send_message()

static int scmi_transport_send_message ( const struct device * transport,
struct scmi_channel * chan,
struct scmi_message * msg )
inlinestatic

Send an SCMI channel.

Send an SCMI message using given SCMI channel. This function is not allowed to block.

Parameters
transportpointer to the device structure for the transport layer
chanpointer to SCMI channel on which the message is to be sent
msgpointer to message the caller wishes to send
Return values
0if successful
negativeerrno code if failure

◆ scmi_transport_setup_chan()

static int scmi_transport_setup_chan ( const struct device * transport,
struct scmi_channel * chan,
bool tx )
inlinestatic

Setup an SCMI channel.

Before being able to send/receive messages, an SCMI channel needs to be prepared, which is what this function does. If it returns successfully, an SCMI protocol will be able to use this channel to send/receive messages.

Parameters
transportpointer to the device structure for the transport layer
chanpointer to SCMI channel to be prepared
txtrue if the channel is TX, false if RX
Return values
0if successful
negativeerrno code if failure