Zephyr API Documentation 4.2.0-rc3
A Scalable Open Source RTOS
 4.2.0-rc3
PSI5 Interface

PSI5 Interface. More...

Data Structures

struct  psi5_frame
 PSI5 frame structure. More...

Typedefs

typedef void(* psi5_tx_callback_t) (const struct device *dev, uint8_t channel, int status, void *user_data)
 Defines the application callback handler function signature for sending.
typedef void(* psi5_rx_frame_callback_t) (const struct device *dev, uint8_t channel, uint32_t num_frame, void *user_data)
 Defines the application callback handler function signature for receiving frame.

Enumerations

enum  psi5_frame_type { PSI5_SERIAL_FRAME_4_BIT_ID , PSI5_SERIAL_FRAME_8_BIT_ID , PSI5_DATA_FRAME }
 PSI5 frame type. More...

Functions

int psi5_start_sync (const struct device *dev, uint8_t channel)
 Start the sync pulse generator on a specific channel.
int psi5_stop_sync (const struct device *dev, uint8_t channel)
 Stop the sync pulse generator on a specific channel.
int psi5_send (const struct device *dev, uint8_t channel, const uint64_t data, k_timeout_t timeout, psi5_tx_callback_t callback, void *user_data)
 Transmitting PSI5 data on a specific channel.
int psi5_register_callback (const struct device *dev, uint8_t channel, struct psi5_rx_callback_configs callback_configs)
 Add a callback function to handle messages received for a specific channel.

Detailed Description

PSI5 Interface.

Since
4.2
Version
0.1.0

Typedef Documentation

◆ psi5_rx_frame_callback_t

typedef void(* psi5_rx_frame_callback_t) (const struct device *dev, uint8_t channel, uint32_t num_frame, void *user_data)

#include <zephyr/drivers/psi5/psi5.h>

Defines the application callback handler function signature for receiving frame.

Parameters
devPointer to the device structure for the driver instance.
channelThe hardware channel of the driver instance.
num_frameNumber of received frame.
user_dataUser data provided when receiving frame.

◆ psi5_tx_callback_t

typedef void(* psi5_tx_callback_t) (const struct device *dev, uint8_t channel, int status, void *user_data)

#include <zephyr/drivers/psi5/psi5.h>

Defines the application callback handler function signature for sending.

Parameters
devPointer to the device structure for the driver instance.
channelThe hardware channel of the driver instance.
statusPSI5 status (0: transmission completed successfully, -EIO: transmission error occurred).
user_dataUser data provided when the frame was sent.

Enumeration Type Documentation

◆ psi5_frame_type

#include <zephyr/drivers/psi5/psi5.h>

PSI5 frame type.

Enumerator
PSI5_SERIAL_FRAME_4_BIT_ID 

Serial message frame with 4-bit message ID.

PSI5_SERIAL_FRAME_8_BIT_ID 

Serial message frame with 8-bit message ID.

PSI5_DATA_FRAME 

Data frame.

Function Documentation

◆ psi5_register_callback()

int psi5_register_callback ( const struct device * dev,
uint8_t channel,
struct psi5_rx_callback_configs callback_configs )

#include <zephyr/drivers/psi5/psi5.h>

Add a callback function to handle messages received for a specific channel.

The callback must be registered before the sync pulse generator started when the channel is configured to synchronous mode.

Parameters
devPointer to the device structure for the driver instance.
channelThe hardware channel of the driver instance.
callback_configsThe callback configurations.
Return values
0successful.
-EINVALinvalid channel.

◆ psi5_send()

int psi5_send ( const struct device * dev,
uint8_t channel,
const uint64_t data,
k_timeout_t timeout,
psi5_tx_callback_t callback,
void * user_data )

#include <zephyr/drivers/psi5/psi5.h>

Transmitting PSI5 data on a specific channel.

The channel must be configured to synchronous mode and can only begin transmission after the sync pulse generator has started.

Parameters
devPointer to the device structure for the driver instance.
channelThe hardware channel of the driver instance.
dataPSI5 data to transmit.
timeoutTimeout waiting for ready to transmit new data.
callbackOptional callback for when the frame was sent or a transmission error occurred. If NULL, this function is blocking until frame is sent.
user_dataUser data to pass to callback function.
Return values
0successful.
-EINVALinvalid channel.
-ENOTSUPunsupported parameter was passed to the function.
-ENETDOWNstopped state.
-EIOgeneral transmit error occurred.
-EAGAINtimeout.

◆ psi5_start_sync()

int psi5_start_sync ( const struct device * dev,
uint8_t channel )

#include <zephyr/drivers/psi5/psi5.h>

Start the sync pulse generator on a specific channel.

Parameters
devPointer to the device structure for the driver instance.
channelThe hardware channel of the driver instance.
Return values
0successful.
-EINVALinvalid channel.
-EALREADYdevice is already started.
-EIOgeneral input/output error, failed to start device.

◆ psi5_stop_sync()

int psi5_stop_sync ( const struct device * dev,
uint8_t channel )

#include <zephyr/drivers/psi5/psi5.h>

Stop the sync pulse generator on a specific channel.

Parameters
devPointer to the device structure for the driver instance.
channelThe hardware channel of the driver instance.
Return values
0successful.
-EINVALinvalid channel.
-EALREADYdevice is already started.
-EIOgeneral input/output error, failed to stop device.