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.
  • syntax: void prt_dp_set_base (prt_dp_ds_struct *dp, uint32_t base);
  • parameters:
    • dppointer to DP peripheral
    • basebase address
  • returns: none

prt_dp_set_cb

  • 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:
    • dppointer to DP peripheral
    • cb_typecall back type
      • PRT_DP_CB_HPDHot Plug Detect
      • PRT_DP_CB_STAStatus
      • PRT_DP_CB_TRNLink training
      • PRT_DP_CB_PHY_CTLPHY control (DPRX)
      • PRT_DP_CB_PHY_RSTPHY reset during link training (DPRX)
      • PRT_DP_CB_PHY_RATELink rate change
      • PRT_DP_CB_PHY_VAPLink voltage and pre-emphasis change
      • PRT_DP_CB_LNKLink
      • PRT_DP_CB_VIDVideo
      • PRT_DP_CB_MSAMain stream attributes (DPRX)
      • PRT_DP_CB_DPCDDPCD (DPRX)
      • PRT_DP_CB_DBGDebug
    • cb_handlerpointer 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:
    • dppointer to DP peripheral
    • lenlength of ROM code
    • rompointer 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:
    • dppointer to DP peripheral
    • lenlength of RAM code
    • rampointer 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:
    • dppointer to DP peripheral
    • idDP 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:
    • dppointer to DP peripheral
  • 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:
    • dppointer to DP peripheral
    • ratemaximum link rate
      • PRT_DP_PHY_LINERATE_1620RBR (1.62 Gbps)
      • PRT_DP_PHY_LINERATE_2700HBR (2.7 Gbps)
      • PRT_DP_PHY_LINERATE_5400HBR2 (5.4 Gbps)
      • PRT_DP_PHY_LINERATE_8100HBR3 (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:
    • dppointer to DP peripheral
    • lanesmaximum lanes (1, 2 or 4)
  • returns: none

prt_dp_cfg

  • description: Configures the DisplayPort IP.
  • syntax: uint8_t prt_dp_cfg (prt_dp_ds_struct *dp);
  • parameters:
    • dppointer 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:
    • dppointer 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:
    • dppointer to DP peripheral
    • tppointer to timing parameters
    • streamstream number (0 or 1)
  • returns: true when ok, ekse false.

prt_dp_vid_str

  • description: Starts the video stream.
  • syntax: prt_dp_vid_str (prt_dp_ds_struct *dp, uint8_t stream);
  • parameters:
    • dppointer to DP peripheral
    • streamstream number (0 or 1)
  • 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:
    • dppointer to DP peripheral
    • streamstream number (0 or 1)
  • returns: true when the video is stopped, else false.

prt_dp_hpd_get

  • description: Gets HPD status.
  • syntax: uint8_t prt_dp_hpd_get (prt_dp_ds_struct *dp);
  • parameters:
    • dppointer to DP peripheral
  • returns:
    • PRT_DP_HPD_UNPLUG HPD deasserted
    • 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:
    • dppointer 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:
    • dppointer 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:
    • dppointer 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:
    • dppointer 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:
    • dppointer 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:
    • dppointer to DP peripheral
  • returns:
    • 0 None
    • 1 TPS1
    • 2 TPS2
    • 3 TPS3
    • 4 TPS4

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:
    • dppointer to DP peripheral
  • returns: true when the training 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:
    • dppointer to DP peripheral
  • returns: true when the link is up, 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:
    • dppointer 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:
    • dppointer 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:
    • dppointer to DP peripheral
    • streamstream number (0 or 1)
  • returns:
    • PRT_DP_LNK_DOWN_PHY Link went down
    • PRT_DP_LNK_DOWN_CLK No link clock
    • 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:
    • dppointer to DP peripheral
    • streamstream number (0 or 1)
  • 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:
    • dppointer to DP peripheral
    • streamstream 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:
    • dppointer to DP peripheral
    • hpdhot plug state
      • PRT_DP_HPD_UNPLUGHPD deassert
      • PRT_DP_HPD_PLUGHPD assert
      • PRT_DP_HPD_IRQHPD interrupt
  • returns: none

prt_dprx_tp_get

  • description: Gets DPRX timing parameters.
  • syntax: prt_dp_tp_struct prt_dprx_tp_get (prt_dp_ds_struct *dp);
  • parameters:
    • dppointer to DP peripheral
  • returns: pointer to timing parameters

prt_dptx_edid_rd

  • description: Read EDID data from DP sink.
  • syntax: uint8_t prt_dptx_edid_rd (prt_dp_ds_struct *dp, uint16_t adr, uint16_t len, uint8_t *dat);
  • parameters:
    • dppointer to DP peripheral
    • adrbase address
    • lenlength
    • datpointer to data buffer
  • returns: true when successful, else false.

prt_dprx_edid_wr

  • description: Write EDID data to policy maker.
  • syntax: uint8_t prt_dprx_edid_wr (prt_dp_ds_struct *dp, uint16_t len, uint8_t *dat);
  • parameters:
    • dppointer to DP peripheral
    • lenlength
    • datpointer to data buffer
  • returns: true when successful, else false.

prt_dp_dpcd_adr_get

  • description: Get DPCD address.
  • syntax: uint32_t prt_dp_dpcd_adr_get (prt_dp_ds_struct *dp)
  • parameters:
    • dppointer to DP peripheral
  • 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:
    • dppointer to DP peripheral
  • 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:
    • dppointer to DP peripheral
    • idxindex (0 - 15 bytes)
  • returns: DPCD data.

prt_dp_dpcd_dat_set

  • description: Set DPCD data.
  • syntax: void prt_dp_dpcd_dat_get (prt_dp_ds_struct *dp, uint8_t idx);
  • parameters:
    • dppointer to DP peripheral
    • idxindex (0 - 15 bytes)
    • datdata
  • returns: None

prt_dp_dpcd_cmd_is_wr

  • description: This function returns true if the DPCD command is a write.
  • syntax: uint8_t prt_dp_dpcd_cmd_is_wr (prt_dp_ds_struct *dp);
  • parameters:
    • dppointer to DP peripheral
  • returns: true when DPCD command is a write, else false.

prt_dp_dpcd_cmd_is_rd

  • description: This function returns true if the DPCD command is a read.
  • syntax: uint8_t prt_dp_dpcd_cmd_is_rd (prt_dp_ds_struct *dp);
  • parameters:
    • dppointer to DP peripheral
  • returns: true when DPCD command is a 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:
    • dppointer to DP peripheral
    • adrDPCD address
    • lenDPCD length (1 - 16 bytes)
    • datpointer to DPCD data
  • 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:
    • dppointer to DP peripheral
    • adrDPCD address
    • lenDPCD length (1 - 16 bytes)
    • datpointer to DPCD data
  • 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:
    • dppointer to DP peripheral
    • idxindex (0 - 15)
    • adrDPCD base address
    • datpointer to DPCD data
  • 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:
    • dppointer 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_nack (prt_dp_ds_struct *dp);
  • parameters:
    • dppointer 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 shows the DP states and the callbacks.

DP callbacks

Figure 1: DP callbacks

dptx_hpd_cb

description: The function is called when a DPTX HPD event occured.

dprx_phy_rst_cb

description: The function is called during the link training and can be used to reset the PHY.

dprx_phy_rate_cb

description: The function is called when the policy maker is requesting a new line rate.

dprx_phy_vap_cb

description: The function is called when the policy maker is requesting to update the voltage swing and preamble levels.

dp_trn_cb

description: The function is called when the training status is updated.

dp_lnk_cb

description: The function is called when the link status is updated.

dp_vid_cb

description: The function is called when the video stream status is updated.

dprx_msa_cb

description: The function is called when the DPRX received updated main stream attributes.

dprx_dpcd_cb

description: The function is called when the DPRX received a DPCD command.

×