Video and Vision Processing Suite Intel® FPGA IP User Guide

ID 683329
Date 4/04/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

20.5. Test Pattern Generator IP Software API

The IP includes software for run-time control. The IP does not fit any of the generic device models provided by the Nios II HAL and it exposes a set of dedicated accessors to the control and status registers. The IP driver structure inherits the base driver structure so all common methods defined in Video and Vision Processing IPs Software API are applicable.

Register definition header file: intel_vvp_tpg_regs.h

Include file: intel_vvp_tpg.h

Table 320.  Test Pattern Generator IP Software API
Name Description
intel_vvp_tpg_init Initialize the TPG instance
Intel_vvp_core_* .Accessors defined in Video and Vision Processing IPs Software Programming Model . Writable when Lite is on. Readable when Lite is off and Debug features is on.
intel_vvp_tpg_get_lite_mode Returns if Lite mode is on
intel_vvp_tpg_get_debug_enabled Returns if Lite mode is on
intel_vvp_tpg_get_num_patterns Returns the number of patterns available
intel_vvp_tpg_ctrl_in_enabled Returns if the control input is enabled
intel_vvp_tpg_get_bits_per_sample Returns the number of bits in a color sample
intel_vvp_tpg_get_pixels_in_parallel Returns the number of pixels processed in parallel per clock cycle
intel_vvp_tpg_get_pattern_data Returns pattern type and subsampling
intel_vvp_tpg_is_running Returns if the IP is producing data
intel_vvp_tpg_get_commit_status Returns if there are uncommitted writes
intel_vvp_tpg_get_status Reads the status register
intel_vvp_tpg_enable Starts/stops the IP
intel_vvp_tpg_is_enabled Returns if the IP is currently enabled
intel_vvp_tpg_set_pattern Select the current output pattern
intel_vvp_tpg_get_pattern Query the current output pattern
intel_vvp_tpg_get_fields_since_sequence_reset Returns the number of output fields generated since the sequence started
intel_vvp_tpg_set_pre_field_ctrl_pkts Number of packets from the control input to insert before each frame
intel_vvp_tpg_get_pre_field_ctrl_pkts Returns the number of control packets to insert before each frame
intel_vvp_tpg_set_post_field_ctrl_pkts Number of packets from the control input to insert after each frame
intel_vvp_tpg_get_post_field_ctrl_pkts Returns the number of control packets to insert after each frame
intel_vvp_tpg_set_bars_type Selects a type of color bars for the bar pattern
intel_vvp_tpg_get_bars_type Returns the current type of color bars
intel_vvp_tpg_set_colors Selects the color for the uniform pattern
intel_vvp_tpg_get_colors Returns the current uniform color
intel_vvp_tpg_commit_writes Commit all outstanding writes

enum eIntelVvpTpgPatternType

Members

kIntelVvpTpgBarsPattern – Bar pattern

kIntelVvpTpgUniformPattern – Uniform pattern

kIntelVvpTpgPathologicalPattern – Pattern that stresses SDI receiving equipment

kIntelVvpTpgInvalidPattern – Invalid pattern (used to indicate errors)

Description

Enumeration for the supported pattern types

enum eIntelVvpTpgPatternColor

Members

kIntelVvpTpgRgb – RGB 4:4:4

kIntelVvpTpgYcc444 – YCbCr/YUV 4:4:4

kIntelVvpTpgYcc422 – YCbCr/YUV 4:2:2

kIntelVvpTpgYcc420 – YCbCr/YUV 4:2:0

kIntelVvpTpgMono – Monochrome

kIntelVvpTpgInvalidColor – Invalid colorspace/subsampling (used to indicate errors)

Description

Enumeration for the supported color spaces and subsampling

enum eIntelVvpTpgBarsType

Members

kIntelVvpTpgColorBars – Standard color bars

kIntelVvpTpgGreyBars – Grey bars

kIntelVvpTpgBlackWhiteBars– Alternating black and white bars

kIntelVvpTpgInvalidBars – Invalid bar pattern (used to indicate errors)

Description

Enumeration for the supported color bar patterns

struct intel_vvp_tpg_pattern

Members

eIntelVvpTpgPatternType type – the configured type for the pattern

eIntelVvpTpgPatternColor color – The configured color space for the pattern

Description

Structure used to return the compile-time configuration for a given test pattern

intel_vvp_tpg_init

Prototype
 int intel_vvp_tpg_init(intel_vvp_tpg_instance *instance, intel_vvp_core_base base);
Description

Initializes a TPG instance. The initialization stops early if the vendor ID or product ID read at the base address are not a match or if the register map version is not supported. Otherwise, the function proceeds to read and store the IP compile-time parameterization. The instance will not be fully initialized and should not be used further by the application if returning a non-zero error code.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

base – base address of the register map

Returns

kIntelVvpCoreOk (0) in case of success, a negative error code in case of error

kIntelVvpCoreVidErr if the vendor id of the core is not the IntelFPGA vendor ID (0x6AF7).

kIntelVvpCorePidErr if the product_id does not match with the TPG product ID

kIntelVvpCoreInstanceErr if the instance is a null pointer

kIntelVvpTpgRegMapVersionErr if the register map is not supported

intel_vvp_tpg_get_lite_mode

Prototype
 bool intel_vvp_tpg_get_lite_mode(intel_vvp_tpg_instance *instance);
Description

Returns the value of the LITE_MODE register. The instance must be a valid intel_vvp_tpg_instance fully initialized

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

true if the IP is parameterized in lite mode

intel_vvp_tpg_get_debug_enabled

Prototype
 int intel_vvp_tpg_get_debug_enabled(intel_vvp_tpg_instance *instance);
Description

Returns the value of the DEBUG_ENABLED register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

true if the IP is parameterized with debug features enabled

intel_vvp_tpg_get_num_patterns

Prototype
 uint8_t intel_vvp_tpg_get_num_patterns(intel_vvp_tpg_instance* instance);
Description

Returns the value of the NUM_PATTERNS register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

The number of patterns available

intel_vvp_tpg_ctrl_in_enabled

Prototype

bool intel_vvp_tpg_ctrl_in_enabled(intel_vvp_tpg_instance* instance);

Description

Returns the value of the CTRL_IN_ENABLED register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

true if the IP is configured with a control input to inserts control packets before and after each output fields

intel_vvp_tpg_get_bits_per_sample

Prototype
 uint8_t intel_vvp_tpg_get_bits_per_sample(intel_vvp_tpg_instance* instance);
Description

Returns the value of the BPS register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

The compile-time bps parameter

intel_vvp_tpg_get_pixels_in_parallel

Prototype
 uint8_t intel_vvp_tpg_get_pixels_in_parallel(intel_vvp_tpg_instance* instance);
Description

Returns the value of the PIP register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

The compile-time pixels in parallel parameter. This is the number of pixels generated per clock cycle.

intel_vvp_tpg_get_pattern_data

Prototype
 int intel_vvp_tpg_get_pattern_data(intel_vvp_tpg_instance* instance, uint8_t pattern, intel_vvp_tpg_pattern* pattern_data);
Description

Returns the pattern configuration for a given pattern. The instance must be a valid intel_vvp_tpg_instance fully initialized. The selected pattern must be valid and pattern_data must point to a valid memory location to store the result.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

pattern – a valid pattern in the range [0..intel_vvp_get_num_patterns(instance)-1]

pattern_data – valid memory location for a intel_vvp_tpg_pattern structure

Returns

kIntelVvpCoreOk (0) in case of succes, a negative error code in case of error

kIntelVvpCoreInstanceErr if the instance is null

kIntelVvpTpgPatternNumErr if the pattern is out-of-range

kIntelVvpCoreNullPtrErr if pattern_data is null

Upon successful return, pattern_data is filled with the configuration for the selected pattern. This includes the pattern type (eIntelVvpTpgPatternType) and the colorspace/subsampling (eIntelVvpTpgPatternColor)

intel_vvp_tpg_is_running

Prototype
 bool intel_vvp_tpg_is_running(intel_vvp_tpg_instance* instance);
Description

Reads and returns the running bit of the STATUS register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

True is the TPG is currently generating an output field, false when disabled and/or between two fields

intel_vvp_tpg_get_commit_status

Prototype
 bool intel_vvp_tpg_get_commit_status(intel_vvp_tpg_instance* instance);
Description

Reads and returns the commit pending bit of the STATUS register. The instance must be a valid intel_vvp_tpg_instance fully initialized and configured in full mode.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

True is the TPG is configured in full mode and if the agent interface contains uncommitted writes.

intel_vvp_tpg_get_status

Prototype
 uint8_t intel_vvp_tpg_get_status(intel_vvp_tpg_instance* instance);
Description

Reads and returns the STATUS register. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

The value read from the status register

intel_vvp_tpg_enable

Prototype

int intel_vvp_tpg_enable(intel_vvp_tpg_instance* instance, bool enable);

Description

Starts the TPG IP. The instance must be a valid intel_vvp_tpg_instance fully initialized.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

enable – true to start the IP and generate fields, false to stop/pause the IP after the current field

Returns

kIntelVvpCoreOk (0) in case of success, negative error code otherwise kIntelVvpCoreInstanceErr if the instance is null

intel_vvp_tpg_is_enabled

Prototype
 bool intel_vvp_tpg_is_enabled(intel_vvp_tpg_instance* instance);
Description

Returns if the TPG IP is started or paused. The instance must be a valid intel_vvp_tpg_instance fully initialized. The state cannot be checked if debug is not enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

true is the IP is enabled and in debug mode, false otherwise

intel_vvp_tpg_set_pattern

Prototype
 int intel_vvp_tpg_set_pattern(intel_vvp_tpg_instance* instance, uint8_t pattern);
Description

Select/change the output test pattern. intel_vvp_tpg_instance must be valid and fully initialized. The pattern must be valid.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

pattern – A valid pattern configured at compile-time in the range [0..intel_vvp_get_num_patterns(instance)-1]

Returns

kIntelVvpCoreOk (0) in case of success, negative error code otherwise kIntelVvpCoreInstanceErr if the instance is null

kIntelVvpTpgPatternNumErr if the pattern is out of range

intel_vvp_tpg_get_pattern

Prototype
 uint8_t intel_vvp_tpg_get_pattern(intel_vvp_tpg_instance* instance);
Description

Returns the selected test pattern. The instance must be a valid intel_vvp_tpg_instance fully initialized. The pattern cannot be retrieved if debug is not enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

the current selected pattern or error code 255 it the instance is invalid or debug disabled

intel_vvp_tpg_get_fields_since_sequence_reset

Prototype
 uint32_t intel_vvp_tpg_get_fields_since_sequence_reset(intel_vvp_tpg_instance* instance)
Description

Read and returns the FIELD_COUNT register. The field counter is automatically reset when the pattern changes or the image specifications change (after a write to the image info area). The value may remain undefined after a reset until the first field of the new sequence is sent.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

the field counter value

intel_vvp_tpg_set_pre_field_ctrl_pkts

Prototype
 int intel_vvp_tpg_set_pre_field_ctrl_pkts(intel_vvp_tpg_instance* instance, uint32_t pkt_count);
Description

Sets the number of control packets to read and propagate from the ctrl_in input interface before each output field is generated and sent. The instance must be a valid intel_vvp_tpg_instance fully initialized, configured in full mode and the input control interface enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

pkt_count – Number of control packets to propagate before each output field

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise

intel_vvp_tpg_get_pre_field_ctrl_pkts

Prototype
 uint32_t intel_vvp_tpg_get_pre_field_ctrl_pkts(intel_vvp_tpg_instance* instance);
Description

Reads and returns the number of control packets to read and propagate from the ctrl_in input interface before each output field is generated and sent. The instance must be a valid intel_vvp_tpg_instance fully initialized, configured in full mode with debug enabled and the input control interface enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

Number of control packets to propagate before each output field, 0 is returned if the instance does not support the feature or if debug is disabled

intel_vvp_tpg_set_post_field_ctrl_pkts

Prototype
 int intel_vvp_tpg_set_post_field_ctrl_pkts(intel_vvp_tpg_instance* instance, uint32_t pkt_count);
Description

Sets the number of control packets to read and propagate from the ctrl_in input interface after each output field is generated and sent. The instance must be a valid intel_vvp_tpg_instance fully initialized, configured in full mode and the input control interface enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

pkt_count – Number of control packets to propagate after each output field

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise

intel_vvp_tpg_get_post_field_ctrl_pkts

Prototype
 uint32_t intel_vvp_tpg_get_post_field_ctrl_pkts(intel_vvp_tpg_instance* instance);
Description

Reads and returns the number of control packets to read and propagate from the ctrl_in input interface after each output field is generated and sent. The instance must be a valid intel_vvp_tpg_instance fully initialized, configured in full mode with debug enabled and the input control interface enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

Number of control packets to propagate after each output field, 0 is returned if the instance does not support the feature or if debug is disabled

intel_vvp_tpg_set_bars_type

Prototype
 int intel_vvp_tpg_set_bars_type(intel_vvp_tpg_instance* instance, eIntelVvpTpgBarsType bar_type);
Description

Selects the type of color bars (black/white, grey, color) for patterns of type kIntelVvpTpgBarsPattern

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

bar_type – the type of color bars

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise

intel_vvp_tpg_get_bars_type

Prototype

eIntelVvpTpgBarsType intel_vvp_tpg_set_bars_type(intel_vvp_tpg_instance* instance)

Description

Read and returns the selected bar type for patterns of type kIntelVvpTpgBarsPattern. Instance must be valid and debug enabled

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

the selected bar type, kIntelVvpTpgInvalidBars in case of error

intel_vvp_tpg_set_colors

Prototype
 int intel_vvp_tpg_set_colors (intel_vvp_tpg_instance* instance, uint16_t color1, uint16_t color2, uint16_t color3);
Description

Selects the uniform color for patterns of type kIntelVvpTpgUniformPattern

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

color1, color2, color3 – the three new color sample values for the uniform pattern

The color samples must be in the range [0 .. (1 << intel_vvp_tpg_get_bits_per_sample(instance)) – 1]

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise

kIntelVvpCoreInstanceErr if the instance is invalid

kIntelVvpTpgC1Err/ kIntelVvpTpgC2Err/ kIntelVvpTpgC3Err if the color sample is out-of-range

intel_vvp_tpg_get_colors

Prototype
 int intel_vvp_tpg_get_colors(intel_vvp_tpg_instance* instance, uint16_t* color1, uint16_t* color2, uint16_t* color3)
Description

Reads and returns the selected color sample values for pattern of type kIntelVvpTpgUniformPattern. The instance must be a valid intel_vvp_tpg_instance with debug enabled. The three points that return values must point to valid memory locations containing uint16_t variables

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

color1, color2, color3 – three memory locations to store the returned color sample values

Returns

kIntelVvpCoreOk in case of success, negative error code otherwise

kIntelVvpCoreInstanceErr, invalid instance (null pointer or debug disabled)

kIntelVvpCoreNullPtrErr, one of the uint16_t pointer is the null pointer

intel_vvp_tpg_commit_writes

Prototype
 int intel_vvp_tpg_commit_writes(intel_vvp_tpg_instance* instance)
Description

Commits all pending writes before starting the next output field. The instance must be valid and parameterized in full mode.

Arguments

instance – pointer to the intel_vvp_tpg_instance software driver instance structure

Returns

kIntelVvpCoreOk (0) for success, negative error code otherwise