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... | |
Pattern Generator Device Interface Functions
Definition in file dif_pattgen.h.
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 |
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 |
#define DIF_PATTGEN_CHANNEL_LIST | ( | X | ) |
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.
#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.
enum dif_pattgen_polarity |
The polarity of a Pattern Generator channel.
Definition at line 52 of file dif_pattgen.h.
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.
pattgen | A Pattern Generator handle. | |
channel | The channel to get the enablement state of. | |
[out] | is_enabled | The enablement state of the channel. |
Definition at line 124 of file dif_pattgen.c.
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.
pattgen | A Pattern Generator handle. |
channel | The channel to set the enablement state of. |
enabled | The enablement state to configure the channel in. |
Definition at line 94 of file dif_pattgen.c.
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.
pattgen | A Pattern Generator handle. |
channel | The channel to configure. |
config | Runtime configuration parameters. |
Definition at line 12 of file dif_pattgen.c.