Driver

The DisplayPort IP requires a processor to setup the core.

This can be any processor. A DisplayPort driver (prt_dp_drv) is provided for this task.

Api

This section provides information about the driver API.

prt_dp_set_base

description: Sets the DisplayPort peripheral base address.

void prt_dp_set_base (prt_dp_ds_struct *dp, uint32_t base);

parameters:

dp - pointer to DP peripheral

base - base address

returns:

none

prt_dp_set_cb

void prt_dp_set_cb (prt_dp_ds_struct *dp, prt_dp_cb_type cb_type, void *cb_handler);

description: Sets the DisplayPort call back handlers.

syntax: void prt_dp_set_cb (prt_dp_ds_struct *dp, prt_dp_cb_type cb_type, void *cb_handler);

parameters:

dp - pointer to DP peripheral

cb_type - call back type

PRT_DP_CB_HPD - Hot Plug Detect

PRT_DP_CB_STA - Status

PRT_DP_CB_TRN - Link training

PRT_DP_CB_PHY_RST - PHY reset during link training (DPRX)

PRT_DP_CB_PHY_RATE - Link rate change

PRT_DP_CB_PHY_VAP - Link voltage and pre-emphasis change

PRT_DP_CB_LNK - Link

PRT_DP_CB_VID - Video

PRT_DP_CB_MSA - Main stream attributes

cb_handler - pointer to call back handler

returns:

none

prt_dp_rom_init

description: Loads the DisplayPort IP ROM code.

Syntax: void prt_dp_rom_init (prt_dp_ds_struct *dp, uint32_t len, uint8_t *rom);

parameters:

dp - pointer to DP peripheral

len - length of ROM code

rom - pointer to ROM code

returns:

none

prt_dp_ram_init

description: Loads the DisplayPort IP RAM code.

syntax: void prt_dp_ram_init (prt_dp_ds_struct *dp, uint32_t len, uint8_t *ram);

parameters:

dp - pointer to DP peripheral

len - length of RAM code

ram - pointer to RAM code

returns:

none

prt_dp_init

description: Initialize the DisplayPort IP.

syntax: void prt_dp_init (prt_dp_ds_struct *dp, uint8_t id);

parameters:

dp - pointer to DP peripheral

id - DP peripheral identifier

returns:

none

prt_dp_ping

description: Checks if the DisplayPort IP is alive.

syntax: uint8_t prt_dp_ping (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns true when the peripheral is running.

prt_dp_set_lnk_max_rate

description: Sets the maximum supported rate.

syntax: void prt_dp_set_lnk_max_rate (prt_dp_ds_struct *dp, uint8_t rate);

parameters:

dp - pointer to DP peripheral

rate - maximum link rate

PRT_DP_PHY_LINERATE_1620 - RBR (1.62 Gbps)

PRT_DP_PHY_LINERATE_2700 - HBR (2.7 Gbps)

PRT_DP_PHY_LINERATE_5400 - HBR2 (5.4 Gbps)

PRT_DP_PHY_LINERATE_8100 - HBR3 (8.1 Gbps)

returns:

none

prt_dp_set_lnk_max_lanes

description: Sets the maximum supported lanes.

syntax: void prt_dp_set_lnk_max_lanes (prt_dp_ds_struct *dp, uint8_t lanes);

parameters:

dp - pointer to DP peripheral

rate - maximum link rate

PRT_DP_PHY_LINERATE_1620 - RBR (1.62 Gbps)

PRT_DP_PHY_LINERATE_2700 - HBR (2.7 Gbps)

PRT_DP_PHY_LINERATE_5400 - HBR2 (5.4 Gbps)

PRT_DP_PHY_LINERATE_8100 - HBR3 (8.1 Gbps)

returns:

none

prt_dp_cfg

description: Configures the DisplayPort IP.

syntax: uint8_t prt_dp_cfg (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

none

prt_dp_sta

description: Reads the DisplayPort IP status.

syntax: void prt_dp_sta (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

none

prt_dptx_msa_set

description: Sets the Main Stream Attributes (MSA)

syntax: uint8_t prt_dptx_msa_set (prt_dp_ds_struct *dp, prt_dp_tp_struct *tp, uint8_t stream);

parameters:

dp - pointer to DP peripheral

tp - pointer to timing parameters

stream - stream number (0 or 1)

returns:

Returns true when the video is started, else false.

prt_dp_vid_str

description: Starts the video stream.

syntax: uint8_t prt_dp_vid_str (prt_dp_ds_struct *dp, uint8_t stream);

parameters:

dp - pointer to DP peripheral

tp - pointer to timing parameters

stream - stream number (0 or 1)

returns:

Returns true when the video is started, else false.

prt_dp_vid_stp

description: Stops the video stream.

syntax: uint8_t prt_dp_vid_stp (prt_dp_ds_struct *dp, uint8_t stream);

parameters:

dp - pointer to DP peripheral

stream - stream number (0 or 1)

stream - stream number (0 or 1)

returns:

Returns true when the video is started, else false.

prt_dp_hpd_get

description: Gets HPD status.

syntax: uint8_t prt_dp_hpd_get (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

PRT_DP_HPD_UNPLUG - HPD deasserted

stream - stream number (0 or 1)

PRT_DP_HPD_PLUG - HPD asserted

PRT_DP_HPD_IRQ - HPD interrupt

prt_dp_get_phy_rate

description: Gets requested PHY linerate.

syntax: uint8_t prt_dp_get_phy_rate (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

PRT_DP_PHY_LINERATE_1620 - 1.62 Gbps

PRT_DP_PHY_LINERATE_2700 - 2.7 Gbps

PRT_DP_PHY_LINERATE_5400 - 5.4 Gbps

PRT_DP_PHY_LINERATE_8100 - 8.1 Gbps

prt_dp_get_phy_volt

description: Gets requested PHY voltage level.

syntax: uint8_t prt_dp_get_phy_volt (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

0 - 400 mV

1 - 600 mV

2 - 800 mV

3 - 1200 mV

prt_dp_get_phy_pre

description: Gets requested PHY preamble level.

syntax: uint8_t prt_dp_get_phy_volt (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

0 - 0 dB

1 - 3.5 dB

2 - 6.0 dB

3 - 9.5 dB

prt_dprx_phy_rst_ack

description: Acknowledge the driver that the PHY reset has been completed.

syntax: void prt_dprx_phy_rst_ack (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

none

prt_dp_lnk_req_ok

description: Informs the driver that the requested line rate and/or voltage and preamble levels has been set

syntax: void prt_dp_lnk_req_ok (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

none

prt_dprx_get_trn_tps

description: Gets current training pattern

syntax: uint8_t prt_dprx_get_trn_tps (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

0 - None

1 - TPS 1

2 - TPS 2

3 - TPS 3

4 - TPS 4

prt_dp_is_trn_pass

description: Check if the link training passed.

syntax: uint8_t prt_dp_is_trn_pass (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns true when the trainig passed, else false.

prt_dp_is_lnk_up

description: Check if the link is up.

syntax: uint8_t prt_dp_is_lnk_up (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns true when the trainig passed, else false.

prt_dp_get_lnk_act_lanes

description: Gets number of active lanes.

syntax: uint8_t prt_dp_is_lnk_up (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

1, 2 or 4

prt_dp_get_lnk_act_rate

description: Gets active line rate

syntax: uint8_t prt_dp_get_lnk_act_rate (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

PRT_DP_PHY_LINERATE_1620 - 1.62 Gbps

PRT_DP_PHY_LINERATE_2700 - 2.7 Gbps

PRT_DP_PHY_LINERATE_5400 - 5.4 Gbps

PRT_DP_PHY_LINERATE_8100 - 8.1 Gbps

prt_dp_get_lnk_act_rate

description: Gets active line rate

syntax: uint8_t prt_dp_get_lnk_act_rate (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

PRT_DP_PHY_LINERATE_1620 - 1.62 Gbps

PRT_DP_PHY_LINERATE_2700 - 2.7 Gbps

PRT_DP_PHY_LINERATE_5400 - 5.4 Gbps

PRT_DP_PHY_LINERATE_8100 - 8.1 Gbps

prt_dp_get_lnk_reason

description: Gets reason why the link went down.

syntax: uint8_t prt_dp_get_lnk_reason (prt_dp_ds_struct *dp, uint8_t stream);

parameters:

dp - pointer to DP peripheral

stream - stream number (0 or 1)

PRT_DP_LNK_DOWN_PHY - No video clock

PRT_DP_LNK_DOWN_CLK - Link went down

PRT_DP_LNK_DOWN_CDR - CDR loss of lock

PRT_DP_LNK_DOWN_SCRM - Scrambler loss of lock

PRT_DP_LNK_DOWN_TRN - Training error

PRT_DP_LNK_DOWN_VID - Video error

PRT_DP_LNK_DOWN_HPD - HPD

PRT_DP_LNK_DOWN_IDLE - Link idle

PRT_DP_LNK_DOWN_TO - Time out (evaluation)

prt_dp_is_vid_up

description: Check if the video stream is up.

syntax: uint8_t prt_dp_is_vid_up (prt_dp_ds_struct *dp, uint8_t stream);

parameters:

dp - pointer to DP peripheral

stream - stream number (0 or 1)

returns:

Returns true when the video is up, else false.

prt_dp_get_vid_reason

description: Gets reason why the video stream went down.

syntax: uint8_t prt_dp_get_vid_reason (prt_dp_ds_struct *dp, uint8_t stream);

parameters:

dp - pointer to DP peripheral

stream - stream number (0 or 1)

returns:

PRT_DP_VID_DOWN_CLK - No video clock

PRT_DP_VID_DOWN_LNK - Link went down

PRT_DP_VID_DOWN_ERR - Error

PRT_DP_VID_DOWN_IDLE - Video idle

prt_dprx_hpd

description: Sets DPRX HPD.

syntax: uint8_t prt_dprx_tp_get (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

hpd - hot plug state

PRT_DP_HPD_UNPLUG - HPD deassert

PRT_DP_HPD_PLUG - HPD assert

PRT_DP_HPD_IRQ - HPD interrupt

returns:

Returns true when successful, else false.

prt_dprx_tp_get

description: Gets DPRX timing parameters.

syntax: prt_dp_tp_struct prt_dprx_tp_get (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

pointer to timing parameters

prt_dprx_edid_wr

description: Write EDID data.

syntax: uint8_t prt_dprx_edid_wr (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns true when successful, else false.

DPCD

prt_dp_dpcd_adr_get

description: Get DPCD address.

syntax: uint32_t prt_dp_dpcd_adr_get (prt_dp_ds_struct *dp)

parameters:

dp - pointer to DP peripheral

returns:

Returns DPCD address.

prt_dp_dpcd_len_get

description: Get DPCD length..

syntax: uint8_t prt_dp_dpcd_len_get (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns DPCD length.

prt_dp_dpcd_dat_get

description: Get DPCD data.

syntax: uint8_t prt_dp_dpcd_dat_get (prt_dp_ds_struct *dp, uint8_t idx);

parameters:

dp - pointer to DP peripheral

idx - index (0 - 15 bytes)

Returns DPCD length.

returns:

Returns DPCD data.

prt_dp_dpcd_dat_set

description: Get DPCD data.

syntax: uint8_t prt_dp_dpcd_dat_get (prt_dp_ds_struct *dp, uint8_t idx);

parameters:

dp - pointer to DP peripheral

idx - index (0 - 15 bytes)

dat - data

returns:

None

prt_dp_dpcd_cmd_is_wr

description: This function returns true if the DPCD command is write.

syntax: uint8_t prt_dp_dpcd_cmd_is_wr (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns true when DPCD command is write, else false

prt_dp_dpcd_cmd_is_rd

description: This function returns true if the DPCD command is read.

syntax: uint8_t prt_dp_dpcd_cmd_is_rd (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

Returns true when DPCD command is read, else false

prt_dptx_dpcd_wr

description: Write DPCD data.

syntax: uint8_t prt_dptx_dpcd_wr (prt_dp_ds_struct *dp, uint32_t adr, uint8_t len, uint8_t *dat);

parameters:

dp - pointer to DP peripheral

adr - DPCD address

len - DPCD length (1 - 16 bytes)

dat - pointer to DPCD data

returns:

returns true when successful, else false.

prt_dptx_dpcd_rd

description: Read DPCD data.

syntax: uint8_t prt_dptx_dpcd_rd (prt_dp_ds_struct *dp, uint32_t adr, uint8_t len, uint8_t *dat);

parameters:

dp - pointer to DP peripheral

adr - DPCD address

len - DPCD length (1 - 16 bytes)

dat - pointer to DPCD data

returns:

Returns true when successful, else false.

prt_dprx_dpcd_blk_set

description: The function sets the address of the DPCD block. There are in total 16 blocks

syntax: uint8_t prt_dprx_dpcd_blk_set (prt_dp_ds_struct *dp, uint8_t idx, unit32_t adr);

parameters:

dp - pointer to DP peripheral

idx - index (0 - 15)

adr - DPCD base address

dat - pointer to DPCD data

returns:

Returns true when successful, else false.

prt_dprx_dpcd_ack

description: The function replies with an acknowledge after the DPCD callback is called

syntax: void prt_dprx_dpcd_ack (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

none

prt_dprx_dpcd_ack

description: The function replies with a not acknowledge after the DPCD callback is called

syntax: void prt_dprx_dpcd_ack (prt_dp_ds_struct *dp);

parameters:

dp - pointer to DP peripheral

returns:

none

Callbacks

The callback functions are used by the driver to signal the application about an event.

functions are registered using the prt_dp_set_cb function.

The diagram show the DP states and the callbacks.

img

Figure 1: DP callbacks