Software APIs
Data Structures | Macros | Typedefs | Enumerations | Functions
dif_pattgen.h File Reference

(937cb67)

Pattern Generator Device Interface Functions More...

#include <stdint.h>
#include "sw/device/lib/dif/dif_base.h"
#include "sw/device/lib/dif/autogen/dif_pattgen_autogen.h"

Go to the source code of this file.

Data Structures

struct  dif_pattgen_channel_config
 Runtime configuration for a Pattern Generator channel. More...
 

Macros

#define DIF_PATTGEN_CHANNEL_LIST(X)
 Helper X macro for defining enums and case statements related to Pattern Generator channels. More...
 
#define PATTGEN_CHANNEL_ENUM_INIT_(channel_)   kDifPattgenChannel##channel_ = channel_,
 Helper macro for defining a dif_pattgen_channel_t enumeration constant. More...
 

Typedefs

typedef enum dif_pattgen_channel dif_pattgen_channel_t
 A Pattern Generator channel.
 
typedef enum dif_pattgen_polarity dif_pattgen_polarity_t
 The polarity of a Pattern Generator channel.
 
typedef struct dif_pattgen_channel_config dif_pattgen_channel_config_t
 Runtime configuration for a Pattern Generator channel.
 

Enumerations

enum  dif_pattgen_channel
 A Pattern Generator channel.
 
enum  dif_pattgen_polarity {
  kDifPattgenPolarityLow = 0,
  kDifPattgenPolarityHigh = 1,
  kDifPattgenPolarityCount = 2
}
 The polarity of a Pattern Generator channel. More...
 

Functions

OT_WARN_UNUSED_RESULT dif_result_t dif_pattgen_configure_channel (const dif_pattgen_t *pattgen, dif_pattgen_channel_t channel, dif_pattgen_channel_config_t config)
 Configures a Pattern Generator channel. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_pattgen_channel_set_enabled (const dif_pattgen_t *pattgen, dif_pattgen_channel_t channel, dif_toggle_t enabled)
 Sets the enablement state of a Pattern Generator channel. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_pattgen_channel_get_enabled (const dif_pattgen_t *pattgen, dif_pattgen_channel_t channel, dif_toggle_t *is_enabled)
 Gets the enablement state of a Pattern Generator channel. More...
 

Detailed Description

Pattern Generator Device Interface Functions

Definition in file dif_pattgen.h.


Data Structure Documentation

◆ dif_pattgen_channel_config

struct dif_pattgen_channel_config

Runtime configuration for a Pattern Generator channel.

Definition at line 72 of file dif_pattgen.h.

Data Fields
uint32_t clock_divisor The I/O clock divisor that determines the frequency of channel's clock.

Specifically, the output clock frequency (f_pcl) is computed from the I/O clock frequency (f_io_clk):

       f_pcl = f_io_clk / (2 * (clock_divisor + 1))
bool inactive_level_pcl Inactive level of the clock signal.

This is the level of the PCL output when the pattgen is not actively sending data bits (i.e., when pattgen is disabled or all data bits have been sent).

bool inactive_level_pda Inactive level of the data signal.

This is the level of the PDA output when the pattgen is not actively sending data bits (i.e., when pattgen is disabled or all data bits have been sent).

uint16_t num_pattern_repetitions The number of times to repeat the pattern.

Valid range: [1, 1024]

dif_pattgen_polarity_t polarity The polarity of the channel.
uint8_t seed_pattern_length The length of the seed pattern.

Units: bits Valid range: [1, 64]

uint32_t seed_pattern_lower_word The lower 32-bits of the seed pattern.

Some bits may go unused depending on the value of seed_pattern_length.

uint32_t seed_pattern_upper_word The upper 32-bits of the seed pattern.

Some, or all, bits may go unused depending on the value of seed_pattern_length.

Macro Definition Documentation

◆ DIF_PATTGEN_CHANNEL_LIST

#define DIF_PATTGEN_CHANNEL_LIST (   X)
Value:
X(0) \
X(1)

Helper X macro for defining enums and case statements related to Pattern Generator channels.

If an additional channel is ever added to the hardware, this list can be updated.

Definition at line 29 of file dif_pattgen.h.

◆ PATTGEN_CHANNEL_ENUM_INIT_

#define PATTGEN_CHANNEL_ENUM_INIT_ (   channel_)    kDifPattgenChannel##channel_ = channel_,

Helper macro for defining a dif_pattgen_channel_t enumeration constant.

@channel_ Pattern Generator channel of the enumeration constant.

Definition at line 37 of file dif_pattgen.h.

Enumeration Type Documentation

◆ dif_pattgen_polarity

The polarity of a Pattern Generator channel.

Enumerator
kDifPattgenPolarityLow 

Low polarity indicates the output data signal (PDA) changes on a falling output clock (PCL) edge.

kDifPattgenPolarityHigh 

High polarity indicates the output data signal (PDA) changes on a rising output clock (PCL) edge.

kDifPattgenPolarityCount 

Number of polarity values, used for argument validation.

Definition at line 52 of file dif_pattgen.h.

Function Documentation

◆ dif_pattgen_channel_get_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_pattgen_channel_get_enabled ( const dif_pattgen_t pattgen,
dif_pattgen_channel_t  channel,
dif_toggle_t is_enabled 
)

Gets the enablement state of a Pattern Generator channel.

Parameters
pattgenA Pattern Generator handle.
channelThe channel to get the enablement state of.
[out]is_enabledThe enablement state of the channel.
Returns
The result of the operation.

Definition at line 124 of file dif_pattgen.c.

◆ dif_pattgen_channel_set_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_pattgen_channel_set_enabled ( const dif_pattgen_t pattgen,
dif_pattgen_channel_t  channel,
dif_toggle_t  enabled 
)

Sets the enablement state of a Pattern Generator channel.

Parameters
pattgenA Pattern Generator handle.
channelThe channel to set the enablement state of.
enabledThe enablement state to configure the channel in.
Returns
The result of the operation.

Definition at line 94 of file dif_pattgen.c.

◆ dif_pattgen_configure_channel()

OT_WARN_UNUSED_RESULT dif_result_t dif_pattgen_configure_channel ( const dif_pattgen_t pattgen,
dif_pattgen_channel_t  channel,
dif_pattgen_channel_config_t  config 
)

Configures a Pattern Generator channel.

This should be called once for each channel to be configured.

Since writes to channel configuration registers have no effect when the channel is enabled, this function will return kDifError if the channel is enabled.

Parameters
pattgenA Pattern Generator handle.
channelThe channel to configure.
configRuntime configuration parameters.
Returns
The result of the operation.

Definition at line 12 of file dif_pattgen.c.