MCUXpresso SDK API Reference Manual  Rev. 1
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MIPI DSI Driver

Overview

The MCUXpresso SDK provides a peripheral driver for the MIPI DSI

The MIPI DSI driver supports both video mode and command mode. For both modes, first call DSI_Init and DSI_InitDphy to initialize the module and enable the D-PHY. The DSI driver provides function DSI_GetDphyDefaultConfig to help with the D-PHY timing parameter calculation. With the input txHsBitClk frequency and txEscClk frequency, the function can generate the timing parameters based on the D-PHY specification. The user can use the parameter directly, or change them according to the special device.
For the command mode, DSI driver provides polling method and interrupt method for the data transfer. At the same time, there are also small functional APIs so that user can construct them for their special purpose.
When the peripheral is configured through command mode, the video mode can be started by DSI_SetDpiConfig.

Data Structures

struct  dsi_config_t
 MIPI DSI controller configuration. More...
 
struct  dsi_dpi_config_t
 MIPI DSI controller DPI interface configuration. More...
 
struct  dsi_dphy_config_t
 MIPI DSI D-PHY configuration. More...
 
struct  dsi_transfer_t
 Structure for the data transfer. More...
 
struct  dsi_handle_t
 MIPI DSI transfer handle structure. More...
 

Typedefs

typedef void(* dsi_callback_t )(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, status_t status, void *userData)
 MIPI DSI callback for finished transfer. More...
 

Enumerations

enum  _dsi_status {
  kStatus_DSI_Busy = MAKE_STATUS(kStatusGroup_MIPI_DSI, 0),
  kStatus_DSI_RxDataError = MAKE_STATUS(kStatusGroup_MIPI_DSI, 1),
  kStatus_DSI_ErrorReportReceived = MAKE_STATUS(kStatusGroup_MIPI_DSI, 2),
  kStatus_DSI_NotSupported = MAKE_STATUS(kStatusGroup_MIPI_DSI, 3)
}
 Error codes for the MIPI DSI driver. More...
 
enum  dsi_dpi_color_coding_t {
  kDSI_Dpi16BitConfig1 = 0U,
  kDSI_Dpi16BitConfig2 = 1U,
  kDSI_Dpi16BitConfig3 = 2U,
  kDSI_Dpi18BitConfig1 = 3U,
  kDSI_Dpi18BitConfig2 = 4U,
  kDSI_Dpi24Bit = 5U
}
 MIPI DPI interface color coding. More...
 
enum  dsi_dpi_pixel_packet_t {
  kDSI_PixelPacket16Bit = 0U,
  kDSI_PixelPacket18Bit = 1U,
  kDSI_PixelPacket18BitLoosely = 2U,
  kDSI_PixelPacket24Bit = 3U
}
 MIPI DSI pixel packet type send through DPI interface. More...
 
enum  _dsi_dpi_polarity_flag {
  kDSI_DpiVsyncActiveLow = 0U,
  kDSI_DpiHsyncActiveLow = 0U,
  kDSI_DpiVsyncActiveHigh = (1U << 0U),
  kDSI_DpiHsyncActiveHigh = (1U << 1U)
}
 DPI signal polarity. More...
 
enum  dsi_dpi_video_mode_t {
  kDSI_DpiNonBurstWithSyncPulse = 0U,
  kDSI_DpiNonBurstWithSyncEvent = 1U,
  kDSI_DpiBurst = 2U
}
 DPI video mode. More...
 
enum  dsi_dpi_bllp_mode_t {
  kDSI_DpiBllpLowPower,
  kDSI_DpiBllpBlanking,
  kDSI_DpiBllpNull
}
 Behavior in BLLP (Blanking or Low-Power Interval). More...
 
enum  _dsi_apb_status {
  kDSI_ApbNotIdle = (1U << 0U),
  kDSI_ApbTxDone = (1U << 1U),
  kDSI_ApbRxControl = (1U << 2U),
  kDSI_ApbTxOverflow = (1U << 3U),
  kDSI_ApbTxUnderflow = (1U << 4U),
  kDSI_ApbRxOverflow = (1U << 5U),
  kDSI_ApbRxUnderflow = (1U << 6U),
  kDSI_ApbRxHeaderReceived = (1U << 7U),
  kDSI_ApbRxPacketReceived = (1U << 8U)
}
 Status of APB to packet interface. More...
 
enum  _dsi_rx_error_status {
  kDSI_RxErrorEccOneBit = (1U << 0U),
  kDSI_RxErrorEccMultiBit = (1U << 1U),
  kDSI_RxErrorCrc = (1U << 7U),
  kDSI_RxErrorHtxTo = (1U << 8U),
  kDSI_RxErrorLrxTo = (1U << 9U),
  kDSI_RxErrorBtaTo = (1U << 10U)
}
 Host receive error status. More...
 
enum  _dsi_host_status {
  kDSI_HostSoTError = (1U << 0U),
  kDSI_HostSoTSyncError = (1U << 1U),
  kDSI_HostEoTSyncError = (1U << 2U),
  kDSI_HostEscEntryCmdError = (1U << 3U),
  kDSI_HostLpTxSyncError = (1U << 4U),
  kDSI_HostPeriphToError = (1U << 5U),
  kDSI_HostFalseControlError = (1U << 6U),
  kDSI_HostContentionDetected = (1U << 7U),
  kDSI_HostEccErrorOneBit = (1U << 8U),
  kDSI_HostEccErrorMultiBit = (1U << 9U),
  kDSI_HostChecksumError = (1U << 10U),
  kDSI_HostInvalidDataType = (1U << 11U),
  kDSI_HostInvalidVcId = (1U << 12U),
  kDSI_HostInvalidTxLength = (1U << 13U),
  kDSI_HostProtocalViolation = (1U << 15U),
  kDSI_HostResetTriggerReceived = (1U << 16U),
  kDSI_HostTearTriggerReceived = (1U << 17U),
  kDSI_HostAckTriggerReceived = (1U << 18U)
}
 DSI host controller status (status_out) More...
 
enum  _dsi_interrupt {
  kDSI_InterruptGroup1ApbNotIdle = (1U << 0U),
  kDSI_InterruptGroup1ApbTxDone = (1U << 1U),
  kDSI_InterruptGroup1ApbRxControl = (1U << 2U),
  kDSI_InterruptGroup1ApbTxOverflow = (1U << 3U),
  kDSI_InterruptGroup1ApbTxUnderflow = (1U << 4U),
  kDSI_InterruptGroup1ApbRxOverflow = (1U << 5U),
  kDSI_InterruptGroup1ApbRxUnderflow = (1U << 6U),
  kDSI_InterruptGroup1ApbRxHeaderReceived = (1U << 7U),
  kDSI_InterruptGroup1ApbRxPacketReceived = (1U << 8U),
  kDSI_InterruptGroup1SoTError = (1U << 9U),
  kDSI_InterruptGroup1SoTSyncError = (1U << 10U),
  kDSI_InterruptGroup1EoTSyncError = (1U << 11U),
  kDSI_InterruptGroup1EscEntryCmdError = (1U << 12U),
  kDSI_InterruptGroup1LpTxSyncError = (1U << 13U),
  kDSI_InterruptGroup1PeriphToError = (1U << 14U),
  kDSI_InterruptGroup1FalseControlError = (1U << 15U),
  kDSI_InterruptGroup1ContentionDetected = (1U << 16U),
  kDSI_InterruptGroup1EccErrorOneBit = (1U << 17U),
  kDSI_InterruptGroup1EccErrorMultiBit = (1U << 18U),
  kDSI_InterruptGroup1ChecksumError = (1U << 19U),
  kDSI_InterruptGroup1InvalidDataType = (1U << 20U),
  kDSI_InterruptGroup1InvalidVcId = (1U << 21U),
  kDSI_InterruptGroup1InvalidTxLength = (1U << 22U),
  kDSI_InterruptGroup1ProtocalViolation = (1U << 24U),
  kDSI_InterruptGroup1ResetTriggerReceived = (1U << 25U),
  kDSI_InterruptGroup1TearTriggerReceived = (1U << 26U),
  kDSI_InterruptGroup1AckTriggerReceived = (1U << 27U),
  kDSI_InterruptGroup1BtaTo = (1U << 29U),
  kDSI_InterruptGroup1LrxTo = (1U << 30U),
  kDSI_InterruptGroup1HtxTo = (1U << 31U),
  kDSI_InterruptGroup2EccOneBit = (1U << 0U),
  kDSI_InterruptGroup2EccMultiBit = (1U << 1U),
  kDSI_InterruptGroup2CrcError = (1U << 2U)
}
 DSI interrupt. More...
 
enum  dsi_tx_data_type_t {
  kDSI_TxDataVsyncStart = 0x01U,
  kDSI_TxDataVsyncEnd = 0x11U,
  kDSI_TxDataHsyncStart = 0x21U,
  kDSI_TxDataHsyncEnd = 0x31U,
  kDSI_TxDataEoTp = 0x08U,
  kDSI_TxDataCmOff = 0x02U,
  kDSI_TxDataCmOn = 0x12U,
  kDSI_TxDataShutDownPeriph = 0x22U,
  kDSI_TxDataTurnOnPeriph = 0x32U,
  kDSI_TxDataGenShortWrNoParam = 0x03U,
  kDSI_TxDataGenShortWrOneParam = 0x13U,
  kDSI_TxDataGenShortWrTwoParam = 0x23U,
  kDSI_TxDataGenShortRdNoParam = 0x04U,
  kDSI_TxDataGenShortRdOneParam = 0x14U,
  kDSI_TxDataGenShortRdTwoParam = 0x24U,
  kDSI_TxDataDcsShortWrNoParam = 0x05U,
  kDSI_TxDataDcsShortWrOneParam = 0x15U,
  kDSI_TxDataDcsShortRdNoParam = 0x06U,
  kDSI_TxDataSetMaxReturnPktSize = 0x37U,
  kDSI_TxDataNull = 0x09U,
  kDSI_TxDataBlanking = 0x19U,
  kDSI_TxDataGenLongWr = 0x29U,
  kDSI_TxDataDcsLongWr = 0x39U,
  kDSI_TxDataLooselyPackedPixel20BitYCbCr = 0x0CU,
  kDSI_TxDataPackedPixel24BitYCbCr = 0x1CU,
  kDSI_TxDataPackedPixel16BitYCbCr = 0x2CU,
  kDSI_TxDataPackedPixel30BitRGB = 0x0DU,
  kDSI_TxDataPackedPixel36BitRGB = 0x1DU,
  kDSI_TxDataPackedPixel12BitYCrCb = 0x3DU,
  kDSI_TxDataPackedPixel16BitRGB = 0x0EU,
  kDSI_TxDataPackedPixel18BitRGB = 0x1EU,
  kDSI_TxDataLooselyPackedPixel18BitRGB = 0x2EU,
  kDSI_TxDataPackedPixel24BitRGB = 0x3EU
}
 DSI TX data type. More...
 
enum  dsi_rx_data_type_t {
  kDSI_RxDataAckAndErrorReport = 0x02U,
  kDSI_RxDataEoTp = 0x08U,
  kDSI_RxDataGenShortRdResponseOneByte = 0x11U,
  kDSI_RxDataGenShortRdResponseTwoByte = 0x12U,
  kDSI_RxDataGenLongRdResponse = 0x1AU,
  kDSI_RxDataDcsLongRdResponse = 0x1CU,
  kDSI_RxDataDcsShortRdResponseOneByte = 0x21U,
  kDSI_RxDataDcsShortRdResponseTwoByte = 0x22U
}
 DSI RX data type. More...
 
enum  _dsi_transfer_flags {
  kDSI_TransferUseHighSpeed = (1U << 0U),
  kDSI_TransferPerformBTA = (1U << 1U)
}
 DSI transfer control flags. More...
 

Driver version

#define FSL_MIPI_DSI_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 Version 2.0.0.
 

MIPI_DSI host initialization.

void DSI_Init (MIPI_DSI_HOST_Type *base, const dsi_config_t *config)
 Initializes an MIPI DSI host with the user configuration. More...
 
void DSI_Deinit (MIPI_DSI_HOST_Type *base)
 Deinitializes an MIPI DSI host. More...
 
void DSI_GetDefaultConfig (dsi_config_t *config)
 Get the default configuration to initialize the MIPI DSI host. More...
 

DPI interface

void DSI_SetDpiConfig (MIPI_DSI_HOST_Type *base, const dsi_dpi_config_t *config, uint8_t numLanes, uint32_t dpiPixelClkFreq_Hz, uint32_t dsiHsBitClkFreq_Hz)
 Configure the DPI interface core. More...
 

D-PHY configuration.

uint32_t DSI_InitDphy (MIPI_DSI_HOST_Type *base, const dsi_dphy_config_t *config, uint32_t refClkFreq_Hz)
 Initializes the D-PHY. More...
 
void DSI_DeinitDphy (MIPI_DSI_HOST_Type *base)
 Deinitializes the D-PHY. More...
 
void DSI_GetDphyDefaultConfig (dsi_dphy_config_t *config, uint32_t txHsBitClk_Hz, uint32_t txEscClk_Hz)
 Get the default D-PHY configuration. More...
 

Interrupts

static void DSI_EnableInterrupts (MIPI_DSI_HOST_Type *base, uint32_t intGroup1, uint32_t intGroup2)
 Enable the interrupts. More...
 
static void DSI_DisableInterrupts (MIPI_DSI_HOST_Type *base, uint32_t intGroup1, uint32_t intGroup2)
 Disable the interrupts. More...
 
static void DSI_GetAndClearInterruptStatus (MIPI_DSI_HOST_Type *base, uint32_t *intGroup1, uint32_t *intGroup2)
 Get and clear the interrupt status. More...
 

MIPI DSI APB

void DSI_SetApbPacketControl (MIPI_DSI_HOST_Type *base, uint16_t wordCount, uint8_t virtualChannel, dsi_tx_data_type_t dataType, uint8_t flags)
 Configure the APB packet to send. More...
 
void DSI_WriteApbTxPayload (MIPI_DSI_HOST_Type *base, const uint8_t *payload, uint16_t payloadSize)
 Fill the long APB packet payload. More...
 
void DSI_ReadApbRxPayload (MIPI_DSI_HOST_Type *base, uint8_t *payload, uint16_t payloadSize)
 Read the long APB packet payload. More...
 
static void DSI_SendApbPacket (MIPI_DSI_HOST_Type *base)
 Trigger the controller to send out APB packet. More...
 
static uint32_t DSI_GetApbStatus (MIPI_DSI_HOST_Type *base)
 Get the APB status. More...
 
static uint32_t DSI_GetRxErrorStatus (MIPI_DSI_HOST_Type *base)
 Get the error status during data transfer. More...
 
static uint8_t DSI_GetEccRxErrorPosition (uint32_t rxErrorStatus)
 Get the one-bit RX ECC error position. More...
 
static uint32_t DSI_GetAndClearHostStatus (MIPI_DSI_HOST_Type *base)
 Get and clear the DSI host status. More...
 
static uint32_t DSI_GetRxPacketHeader (MIPI_DSI_HOST_Type *base)
 Get the RX packet header. More...
 
static dsi_rx_data_type_t DSI_GetRxPacketType (uint32_t rxPktHeader)
 Extract the RX packet type from the packet header. More...
 
static uint16_t DSI_GetRxPacketWordCount (uint32_t rxPktHeader)
 Extract the RX packet word count from the packet header. More...
 
static uint8_t DSI_GetRxPacketVirtualChannel (uint32_t rxPktHeader)
 Extract the RX packet virtual channel from the packet header. More...
 
status_t DSI_TransferBlocking (MIPI_DSI_HOST_Type *base, dsi_transfer_t *xfer)
 APB data transfer using blocking method. More...
 

Transactional

status_t DSI_TransferCreateHandle (MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, dsi_callback_t callback, void *userData)
 Create the MIPI DSI handle. More...
 
status_t DSI_TransferNonBlocking (MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, dsi_transfer_t *xfer)
 APB data transfer using interrupt method. More...
 
void DSI_TransferAbort (MIPI_DSI_HOST_Type *base, dsi_handle_t *handle)
 Abort current APB data transfer. More...
 
void DSI_TransferHandleIRQ (MIPI_DSI_HOST_Type *base, dsi_handle_t *handle)
 Interrupt handler for the DSI. More...
 

Data Structure Documentation

struct dsi_config_t

Data Fields

uint8_t numLanes
 Number of lanes. More...
 
bool enableNonContinuousHsClk
 In enabled, the high speed clock will enter low power mode between transmissions. More...
 
bool enableTxUlps
 Enable the TX ULPS. More...
 
bool autoInsertEoTp
 Insert an EoTp short package when switching from HS to LP. More...
 
uint8_t numExtraEoTp
 How many extra EoTp to send after the end of a packet. More...
 
uint32_t htxTo_ByteClk
 HS TX timeout count (HTX_TO) in byte clock. More...
 
uint32_t lrxHostTo_ByteClk
 LP RX host timeout count (LRX-H_TO) in byte clock. More...
 
uint32_t btaTo_ByteClk
 Bus turn around timeout count (TA_TO) in byte clock. More...
 

Field Documentation

uint8_t dsi_config_t::numLanes
bool dsi_config_t::enableNonContinuousHsClk
bool dsi_config_t::enableTxUlps
bool dsi_config_t::autoInsertEoTp
uint8_t dsi_config_t::numExtraEoTp
uint32_t dsi_config_t::htxTo_ByteClk
uint32_t dsi_config_t::lrxHostTo_ByteClk
uint32_t dsi_config_t::btaTo_ByteClk
struct dsi_dpi_config_t

Data Fields

uint16_t pixelPayloadSize
 Maximum number of pixels that should be sent as one DSI packet. More...
 
dsi_dpi_color_coding_t dpiColorCoding
 DPI color coding. More...
 
dsi_dpi_pixel_packet_t pixelPacket
 Pixel packet format. More...
 
dsi_dpi_video_mode_t videoMode
 Video mode. More...
 
dsi_dpi_bllp_mode_t bllpMode
 Behavior in BLLP. More...
 
uint8_t polarityFlags
 OR'ed value of _dsi_dpi_polarity_flag controls signal polarity. More...
 
uint16_t hfp
 Horizontal front porch, in dpi pixel clock. More...
 
uint16_t hbp
 Horizontal back porch, in dpi pixel clock. More...
 
uint16_t hsw
 Horizontal sync width, in dpi pixel clock. More...
 
uint8_t vfp
 Number of lines in vertical front porch. More...
 
uint8_t vbp
 Number of lines in vertical back porch. More...
 
uint16_t panelHeight
 Line number in vertical active area. More...
 
uint8_t virtualChannel
 Virtual channel. More...
 

Field Documentation

uint16_t dsi_dpi_config_t::pixelPayloadSize

Recommended that the line size (in pixels) is evenly divisible by this parameter.

dsi_dpi_color_coding_t dsi_dpi_config_t::dpiColorCoding
dsi_dpi_pixel_packet_t dsi_dpi_config_t::pixelPacket
dsi_dpi_video_mode_t dsi_dpi_config_t::videoMode
dsi_dpi_bllp_mode_t dsi_dpi_config_t::bllpMode
uint8_t dsi_dpi_config_t::polarityFlags
uint16_t dsi_dpi_config_t::hfp
uint16_t dsi_dpi_config_t::hbp
uint16_t dsi_dpi_config_t::hsw
uint8_t dsi_dpi_config_t::vfp
uint8_t dsi_dpi_config_t::vbp
uint16_t dsi_dpi_config_t::panelHeight
uint8_t dsi_dpi_config_t::virtualChannel
struct dsi_dphy_config_t

Data Fields

uint32_t txHsBitClk_Hz
 The generated HS TX bit clock in Hz. More...
 
uint8_t tClkPre_ByteClk
 TCLK-PRE in byte clock. More...
 
uint8_t tClkPost_ByteClk
 TCLK-POST in byte clock. More...
 
uint8_t tHsExit_ByteClk
 THS-EXIT in byte clock. More...
 
uint32_t tWakeup_EscClk
 Number of clk_esc clock periods to keep a clock or data lane in Mark-1 state after exiting ULPS. More...
 
uint8_t tHsPrepare_HalfEscClk
 THS-PREPARE in clk_esc/2. More...
 
uint8_t tClkPrepare_HalfEscClk
 TCLK-PREPARE in clk_esc/2. More...
 
uint8_t tHsZero_ByteClk
 THS-ZERO in clk_byte. More...
 
uint8_t tClkZero_ByteClk
 TCLK-ZERO in clk_byte. More...
 
uint8_t tHsTrail_ByteClk
 THS-TRAIL in clk_byte. More...
 
uint8_t tClkTrail_ByteClk
 TCLK-TRAIL in clk_byte. More...
 

Field Documentation

uint32_t dsi_dphy_config_t::txHsBitClk_Hz
uint8_t dsi_dphy_config_t::tClkPre_ByteClk

Set how long the controller will wait after enabling clock lane for HS before enabling data lanes for HS.

uint8_t dsi_dphy_config_t::tClkPost_ByteClk

Set how long the controller will wait before putting clock lane into LP mode after data lanes detected in stop state.

uint8_t dsi_dphy_config_t::tHsExit_ByteClk

Set how long the controller will wait after the clock lane has been put into LP mode before enabling clock lane for HS again.

uint32_t dsi_dphy_config_t::tWakeup_EscClk
uint8_t dsi_dphy_config_t::tHsPrepare_HalfEscClk

Set how long to drive the LP-00 state before HS transmissions, available values are 2, 3, 4, 5.

uint8_t dsi_dphy_config_t::tClkPrepare_HalfEscClk

Set how long to drive the LP-00 state before HS transmissions, available values are 2, 3.

uint8_t dsi_dphy_config_t::tHsZero_ByteClk

Set how long that controller drives data lane HS-0 state before transmit the Sync sequence. Available values are 6, 7, ..., 37.

uint8_t dsi_dphy_config_t::tClkZero_ByteClk

Set how long that controller drives clock lane HS-0 state before transmit the Sync sequence. Available values are 3, 4, ..., 66.

uint8_t dsi_dphy_config_t::tHsTrail_ByteClk

Set the time of the flipped differential state after last payload data bit of HS transmission burst. Available values are 0, 1, ..., 15.

uint8_t dsi_dphy_config_t::tClkTrail_ByteClk

Set the time of the flipped differential state after last payload data bit of HS transmission burst. Available values are 0, 1, ..., 15.

struct dsi_transfer_t

Data Fields

uint8_t virtualChannel
 Virtual channel. More...
 
dsi_tx_data_type_t txDataType
 TX data type. More...
 
uint8_t flags
 Flags to control the transfer, see _dsi_transfer_flags. More...
 
const uint8_t * txData
 The TX data buffer. More...
 
uint8_t * rxData
 The TX data buffer. More...
 
uint16_t txDataSize
 Size of the TX data. More...
 
uint16_t rxDataSize
 Size of the RX data. More...
 

Field Documentation

uint8_t dsi_transfer_t::virtualChannel
dsi_tx_data_type_t dsi_transfer_t::txDataType
uint8_t dsi_transfer_t::flags
const uint8_t* dsi_transfer_t::txData
uint8_t* dsi_transfer_t::rxData
uint16_t dsi_transfer_t::txDataSize
uint16_t dsi_transfer_t::rxDataSize
struct _dsi_handle

MIPI DSI transfer handle.

Data Fields

volatile bool isBusy
 MIPI DSI is busy with APB data transfer. More...
 
dsi_transfer_t xfer
 Transfer information. More...
 
dsi_callback_t callback
 DSI callback.
 
void * userData
 Callback parameter.
 

Field Documentation

volatile bool dsi_handle_t::isBusy
dsi_transfer_t dsi_handle_t::xfer

Typedef Documentation

typedef void(* dsi_callback_t)(MIPI_DSI_HOST_Type *base, dsi_handle_t *handle, status_t status, void *userData)

When transfer finished, one of these status values will be passed to the user:

Enumeration Type Documentation

Enumerator
kStatus_DSI_Busy 

DSI is busy.

kStatus_DSI_RxDataError 

Read data error.

kStatus_DSI_ErrorReportReceived 

Error report package received.

kStatus_DSI_NotSupported 

The transfer type not supported.

Enumerator
kDSI_Dpi16BitConfig1 

16-bit configuration 1.

RGB565: XXXXXXXX_RRRRRGGG_GGGBBBBB.

kDSI_Dpi16BitConfig2 

16-bit configuration 2.

RGB565: XXXRRRRR_XXGGGGGG_XXXBBBBB.

kDSI_Dpi16BitConfig3 

16-bit configuration 3.

RGB565: XXRRRRRX_XXGGGGGG_XXBBBBBX.

kDSI_Dpi18BitConfig1 

18-bit configuration 1.

RGB666: XXXXXXRR_RRRRGGGG_GGBBBBBB.

kDSI_Dpi18BitConfig2 

18-bit configuration 2.

RGB666: XXRRRRRR_XXGGGGGG_XXBBBBBB.

kDSI_Dpi24Bit 

24-bit.

Enumerator
kDSI_PixelPacket16Bit 

16 bit RGB565.

kDSI_PixelPacket18Bit 

18 bit RGB666 packed.

kDSI_PixelPacket18BitLoosely 

18 bit RGB666 loosely packed into three bytes.

kDSI_PixelPacket24Bit 

24 bit RGB888, each pixel uses three bytes.

Enumerator
kDSI_DpiVsyncActiveLow 

VSYNC active low.

kDSI_DpiHsyncActiveLow 

HSYNC active low.

kDSI_DpiVsyncActiveHigh 

VSYNC active high.

kDSI_DpiHsyncActiveHigh 

HSYNC active high.

Enumerator
kDSI_DpiNonBurstWithSyncPulse 

Non-Burst mode with Sync Pulses.

kDSI_DpiNonBurstWithSyncEvent 

Non-Burst mode with Sync Events.

kDSI_DpiBurst 

Burst mode.

Enumerator
kDSI_DpiBllpLowPower 

LP mode used in BLLP periods.

kDSI_DpiBllpBlanking 

Blanking packets used in BLLP periods.

kDSI_DpiBllpNull 

Null packets used in BLLP periods.

Enumerator
kDSI_ApbNotIdle 

State machine not idle.

kDSI_ApbTxDone 

Tx packet done.

kDSI_ApbRxControl 

DPHY direction 0 - tx had control, 1 - rx has control.

kDSI_ApbTxOverflow 

TX fifo overflow.

kDSI_ApbTxUnderflow 

TX fifo underflow.

kDSI_ApbRxOverflow 

RX fifo overflow.

kDSI_ApbRxUnderflow 

RX fifo underflow.

kDSI_ApbRxHeaderReceived 

RX packet header has been received.

kDSI_ApbRxPacketReceived 

All RX packet payload data has been received.

Enumerator
kDSI_RxErrorEccOneBit 

ECC single bit error detected.

kDSI_RxErrorEccMultiBit 

ECC multi bit error detected.

kDSI_RxErrorCrc 

CRC error detected.

kDSI_RxErrorHtxTo 

High Speed forward TX timeout detected.

kDSI_RxErrorLrxTo 

Reverse Low power data receive timeout detected.

kDSI_RxErrorBtaTo 

BTA timeout detected.

Enumerator
kDSI_HostSoTError 

SoT error from peripheral error report.

kDSI_HostSoTSyncError 

SoT Sync error from peripheral error report.

kDSI_HostEoTSyncError 

EoT Sync error from peripheral error report.

kDSI_HostEscEntryCmdError 

Escape Mode Entry Command Error from peripheral error report.

kDSI_HostLpTxSyncError 

Low-power transmit Sync Error from peripheral error report.

kDSI_HostPeriphToError 

Peripheral timeout error from peripheral error report.

kDSI_HostFalseControlError 

False control error from peripheral error report.

kDSI_HostContentionDetected 

Contention detected from peripheral error report.

kDSI_HostEccErrorOneBit 

Single bit ECC error (corrected) from peripheral error report.

kDSI_HostEccErrorMultiBit 

Multi bit ECC error (not corrected) from peripheral error report.

kDSI_HostChecksumError 

Checksum error from peripheral error report.

kDSI_HostInvalidDataType 

DSI data type not recognized.

kDSI_HostInvalidVcId 

DSI VC ID invalid.

kDSI_HostInvalidTxLength 

Invalid transmission length.

kDSI_HostProtocalViolation 

DSI protocal violation.

kDSI_HostResetTriggerReceived 

Reset trigger received.

kDSI_HostTearTriggerReceived 

Tear effect trigger receive.

kDSI_HostAckTriggerReceived 

Acknowledge trigger message received.

Enumerator
kDSI_InterruptGroup1ApbNotIdle 

State machine not idle.

kDSI_InterruptGroup1ApbTxDone 

Tx packet done.

kDSI_InterruptGroup1ApbRxControl 

DPHY direction 0 - tx control, 1 - rx control.

kDSI_InterruptGroup1ApbTxOverflow 

TX fifo overflow.

kDSI_InterruptGroup1ApbTxUnderflow 

TX fifo underflow.

kDSI_InterruptGroup1ApbRxOverflow 

RX fifo overflow.

kDSI_InterruptGroup1ApbRxUnderflow 

RX fifo underflow.

kDSI_InterruptGroup1ApbRxHeaderReceived 

RX packet header has been received.

kDSI_InterruptGroup1ApbRxPacketReceived 

All RX packet payload data has been received.

kDSI_InterruptGroup1SoTError 

SoT error from peripheral error report.

kDSI_InterruptGroup1SoTSyncError 

SoT Sync error from peripheral error report.

kDSI_InterruptGroup1EoTSyncError 

EoT Sync error from peripheral error report.

kDSI_InterruptGroup1EscEntryCmdError 

Escape Mode Entry Command Error from peripheral error report.

kDSI_InterruptGroup1LpTxSyncError 

Low-power transmit Sync Error from peripheral error report.

kDSI_InterruptGroup1PeriphToError 

Peripheral timeout error from peripheral error report.

kDSI_InterruptGroup1FalseControlError 

False control error from peripheral error report.

kDSI_InterruptGroup1ContentionDetected 

Contention detected from peripheral error report.

kDSI_InterruptGroup1EccErrorOneBit 

Single bit ECC error (corrected) from peripheral error report.

kDSI_InterruptGroup1EccErrorMultiBit 

Multi bit ECC error (not corrected) from peripheral error report.

kDSI_InterruptGroup1ChecksumError 

Checksum error from peripheral error report.

kDSI_InterruptGroup1InvalidDataType 

DSI data type not recognized.

kDSI_InterruptGroup1InvalidVcId 

DSI VC ID invalid.

kDSI_InterruptGroup1InvalidTxLength 

Invalid transmission length.

kDSI_InterruptGroup1ProtocalViolation 

DSI protocal violation.

kDSI_InterruptGroup1ResetTriggerReceived 

Reset trigger received.

kDSI_InterruptGroup1TearTriggerReceived 

Tear effect trigger receive.

kDSI_InterruptGroup1AckTriggerReceived 

Acknowledge trigger message received.

kDSI_InterruptGroup1BtaTo 

Host BTA timeout.

kDSI_InterruptGroup1LrxTo 

Low power RX timeout.

kDSI_InterruptGroup1HtxTo 

High speed TX timeout.

kDSI_InterruptGroup2EccOneBit 

Sinle bit ECC error.

kDSI_InterruptGroup2EccMultiBit 

Multi bit ECC error.

kDSI_InterruptGroup2CrcError 

CRC error.

Enumerator
kDSI_TxDataVsyncStart 

V Sync start.

kDSI_TxDataVsyncEnd 

V Sync end.

kDSI_TxDataHsyncStart 

H Sync start.

kDSI_TxDataHsyncEnd 

H Sync end.

kDSI_TxDataEoTp 

End of transmission packet.

kDSI_TxDataCmOff 

Color mode off.

kDSI_TxDataCmOn 

Color mode on.

kDSI_TxDataShutDownPeriph 

Shut down peripheral.

kDSI_TxDataTurnOnPeriph 

Turn on peripheral.

kDSI_TxDataGenShortWrNoParam 

Generic Short WRITE, no parameters.

kDSI_TxDataGenShortWrOneParam 

Generic Short WRITE, one parameter.

kDSI_TxDataGenShortWrTwoParam 

Generic Short WRITE, two parameter.

kDSI_TxDataGenShortRdNoParam 

Generic Short READ, no parameters.

kDSI_TxDataGenShortRdOneParam 

Generic Short READ, one parameter.

kDSI_TxDataGenShortRdTwoParam 

Generic Short READ, two parameter.

kDSI_TxDataDcsShortWrNoParam 

DCS Short WRITE, no parameters.

kDSI_TxDataDcsShortWrOneParam 

DCS Short WRITE, one parameter.

kDSI_TxDataDcsShortRdNoParam 

DCS Short READ, no parameters.

kDSI_TxDataSetMaxReturnPktSize 

Set the Maximum Return Packet Size.

kDSI_TxDataNull 

Null Packet, no data.

kDSI_TxDataBlanking 

Blanking Packet, no data.

kDSI_TxDataGenLongWr 

Generic long write.

kDSI_TxDataDcsLongWr 

DCS Long Write/write_LUT Command Packet.

kDSI_TxDataLooselyPackedPixel20BitYCbCr 

Loosely Packed Pixel Stream, 20-bit YCbCr, 4:2:2 Format.

kDSI_TxDataPackedPixel24BitYCbCr 

Packed Pixel Stream, 24-bit YCbCr, 4:2:2 Format.

kDSI_TxDataPackedPixel16BitYCbCr 

Packed Pixel Stream, 16-bit YCbCr, 4:2:2 Format.

kDSI_TxDataPackedPixel30BitRGB 

Packed Pixel Stream, 30-bit RGB, 10-10-10 Format.

kDSI_TxDataPackedPixel36BitRGB 

Packed Pixel Stream, 36-bit RGB, 12-12-12 Format.

kDSI_TxDataPackedPixel12BitYCrCb 

Packed Pixel Stream, 12-bit YCbCr, 4:2:0 Format.

kDSI_TxDataPackedPixel16BitRGB 

Packed Pixel Stream, 16-bit RGB, 5-6-5 Format.

kDSI_TxDataPackedPixel18BitRGB 

Packed Pixel Stream, 18-bit RGB, 6-6-6 Format.

kDSI_TxDataLooselyPackedPixel18BitRGB 

Loosely Packed Pixel Stream, 18-bit RGB, 6-6-6 Format.

kDSI_TxDataPackedPixel24BitRGB 

Packed Pixel Stream, 24-bit RGB, 8-8-8 Format.

Enumerator
kDSI_RxDataAckAndErrorReport 

Acknowledge and Error Report.

kDSI_RxDataEoTp 

End of Transmission packet.

kDSI_RxDataGenShortRdResponseOneByte 

Generic Short READ Response, 1 byte returned.

kDSI_RxDataGenShortRdResponseTwoByte 

Generic Short READ Response, 2 byte returned.

kDSI_RxDataGenLongRdResponse 

Generic Long READ Response.

kDSI_RxDataDcsLongRdResponse 

DCS Long READ Response.

kDSI_RxDataDcsShortRdResponseOneByte 

DCS Short READ Response, 1 byte returned.

kDSI_RxDataDcsShortRdResponseTwoByte 

DCS Short READ Response, 2 byte returned.

Enumerator
kDSI_TransferUseHighSpeed 

Use high speed mode or not.

kDSI_TransferPerformBTA 

Perform BTA or not.

Function Documentation

void DSI_Init ( MIPI_DSI_HOST_Type *  base,
const dsi_config_t config 
)

This function initializes the MIPI DSI host with the configuration, it should be called first before other MIPI DSI driver functions.

Parameters
baseMIPI DSI host peripheral base address.
configPointer to a user-defined configuration structure.
void DSI_Deinit ( MIPI_DSI_HOST_Type *  base)

This function should be called after all bother MIPI DSI driver functions.

Parameters
baseMIPI DSI host peripheral base address.
void DSI_GetDefaultConfig ( dsi_config_t config)

The default value is:

config->numLanes = 4;
config->enableNonContinuousHsClk = false;
config->enableTxUlps = false;
config->autoInsertEoTp = true;
config->numExtraEoTp = 0;
config->htxTo_ByteClk = 0;
config->lrxHostTo_ByteClk = 0;
config->btaTo_ByteClk = 0;
Parameters
configPointer to a user-defined configuration structure.
void DSI_SetDpiConfig ( MIPI_DSI_HOST_Type *  base,
const dsi_dpi_config_t config,
uint8_t  numLanes,
uint32_t  dpiPixelClkFreq_Hz,
uint32_t  dsiHsBitClkFreq_Hz 
)

This function sets the DPI interface configuration, it should be used in video mode.

Parameters
baseMIPI DSI host peripheral base address.
configPointer to the DPI interface configuration.
numLanesLane number, should be same with the setting in dsi_dpi_config_t.
dpiPixelClkFreq_HzThe DPI pixel clock frequency in Hz.
dsiHsBitClkFreq_HzThe DSI high speed bit clock frequency in Hz. It is the same with DPHY PLL output.
uint32_t DSI_InitDphy ( MIPI_DSI_HOST_Type *  base,
const dsi_dphy_config_t config,
uint32_t  refClkFreq_Hz 
)

This function configures the D-PHY timing and setups the D-PHY PLL based on user configuration. The configuration structure could be got by the function DSI_GetDphyDefaultConfig.

Parameters
baseMIPI DSI host peripheral base address.
configPointer to the D-PHY configuration.
refClkFreq_HzThe REFCLK frequency in Hz.
Returns
The actual D-PHY PLL output frequency. If could not configure the PLL to the target frequency, the return value is 0.
void DSI_DeinitDphy ( MIPI_DSI_HOST_Type *  base)

Power down the D-PHY PLL and shut down D-PHY.

Parameters
baseMIPI DSI host peripheral base address.
void DSI_GetDphyDefaultConfig ( dsi_dphy_config_t config,
uint32_t  txHsBitClk_Hz,
uint32_t  txEscClk_Hz 
)

Gets the default D-PHY configuration, the timing parameters are set according to D-PHY specification. User could use the configuration directly, or change some parameters according to the special device.

Parameters
configPointer to the D-PHY configuration.
txHsBitClk_HzHigh speed bit clock in Hz.
txEscClk_HzEsc clock in Hz.
static void DSI_EnableInterrupts ( MIPI_DSI_HOST_Type *  base,
uint32_t  intGroup1,
uint32_t  intGroup2 
)
inlinestatic

The interrupts to enable are passed in as OR'ed mask value of _dsi_interrupt.

Parameters
baseMIPI DSI host peripheral base address.
intGroup1Interrupts to enable in group 1.
intGroup2Interrupts to enable in group 2.
static void DSI_DisableInterrupts ( MIPI_DSI_HOST_Type *  base,
uint32_t  intGroup1,
uint32_t  intGroup2 
)
inlinestatic

The interrupts to disable are passed in as OR'ed mask value of _dsi_interrupt.

Parameters
baseMIPI DSI host peripheral base address.
intGroup1Interrupts to disable in group 1.
intGroup2Interrupts to disable in group 2.
static void DSI_GetAndClearInterruptStatus ( MIPI_DSI_HOST_Type *  base,
uint32_t *  intGroup1,
uint32_t *  intGroup2 
)
inlinestatic
Parameters
baseMIPI DSI host peripheral base address.
intGroup1Group 1 interrupt status.
intGroup2Group 2 interrupt status.
void DSI_SetApbPacketControl ( MIPI_DSI_HOST_Type *  base,
uint16_t  wordCount,
uint8_t  virtualChannel,
dsi_tx_data_type_t  dataType,
uint8_t  flags 
)

This function configures the next APB packet transfer. After configuration, the packet transfer could be started with function DSI_SendApbPacket. If the packet is long packet, Use DSI_WriteApbTxPayload to fill the payload before start transfer.

Parameters
baseMIPI DSI host peripheral base address.
wordCountFor long packet, this is the byte count of the payload. For short packet, this is (data1 << 8) | data0.
virtualChannelVirtual channel.
dataTypeThe packet data type, (DI).
flagsThe transfer control flags, see _dsi_transfer_flags.
void DSI_WriteApbTxPayload ( MIPI_DSI_HOST_Type *  base,
const uint8_t *  payload,
uint16_t  payloadSize 
)

Write the long packet payload to TX FIFO.

Parameters
baseMIPI DSI host peripheral base address.
payloadPointer to the payload.
payloadSizePayload size in byte.
void DSI_ReadApbRxPayload ( MIPI_DSI_HOST_Type *  base,
uint8_t *  payload,
uint16_t  payloadSize 
)

Read the long packet payload from RX FIFO. This function reads directly but does not check the RX FIFO status. Upper layer should make sure there are available data.

Parameters
baseMIPI DSI host peripheral base address.
payloadPointer to the payload.
payloadSizePayload size in byte.
static void DSI_SendApbPacket ( MIPI_DSI_HOST_Type *  base)
inlinestatic

Send the packet set by DSI_SetApbPacketControl.

Parameters
baseMIPI DSI host peripheral base address.
static uint32_t DSI_GetApbStatus ( MIPI_DSI_HOST_Type *  base)
inlinestatic

The return value is OR'ed value of _dsi_apb_status.

Parameters
baseMIPI DSI host peripheral base address.
Returns
The APB status.
static uint32_t DSI_GetRxErrorStatus ( MIPI_DSI_HOST_Type *  base)
inlinestatic

The return value is OR'ed value of _dsi_rx_error_status.

Parameters
baseMIPI DSI host peripheral base address.
Returns
The error status.
static uint8_t DSI_GetEccRxErrorPosition ( uint32_t  rxErrorStatus)
inlinestatic

When one-bit ECC RX error detected using DSI_GetRxErrorStatus, this function could be used to get the error bit position.

uint8_t eccErrorPos;
uint32_t rxErrorStatus = DSI_GetRxErrorStatus(MIPI_DSI);
if (kDSI_RxErrorEccOneBit & rxErrorStatus)
{
eccErrorPos = DSI_GetEccRxErrorPosition(rxErrorStatus);
}
Parameters
rxErrorStatusThe error status returned by DSI_GetRxErrorStatus.
Returns
The 1-bit ECC error position.
static uint32_t DSI_GetAndClearHostStatus ( MIPI_DSI_HOST_Type *  base)
inlinestatic

The host status are returned as mask value of _dsi_host_status.

Parameters
baseMIPI DSI host peripheral base address.
Returns
The DSI host status.
static uint32_t DSI_GetRxPacketHeader ( MIPI_DSI_HOST_Type *  base)
inlinestatic
Parameters
baseMIPI DSI host peripheral base address.
Returns
The RX packet header.
static dsi_rx_data_type_t DSI_GetRxPacketType ( uint32_t  rxPktHeader)
inlinestatic

Extract the RX packet type from the packet header get by DSI_GetRxPacketHeader.

Parameters
rxPktHeaderThe RX packet header get by DSI_GetRxPacketHeader.
Returns
The RX packet type.
static uint16_t DSI_GetRxPacketWordCount ( uint32_t  rxPktHeader)
inlinestatic

Extract the RX packet word count from the packet header get by DSI_GetRxPacketHeader.

Parameters
rxPktHeaderThe RX packet header get by DSI_GetRxPacketHeader.
Returns
For long packet, return the payload word count (byte). For short packet, return the (data0 << 8) | data1.
static uint8_t DSI_GetRxPacketVirtualChannel ( uint32_t  rxPktHeader)
inlinestatic

Extract the RX packet virtual channel from the packet header get by DSI_GetRxPacketHeader.

Parameters
rxPktHeaderThe RX packet header get by DSI_GetRxPacketHeader.
Returns
The virtual channel.
status_t DSI_TransferBlocking ( MIPI_DSI_HOST_Type *  base,
dsi_transfer_t xfer 
)

Perform APB data transfer using blocking method. This function waits until all data send or received, or timeout happens.

Parameters
baseMIPI DSI host peripheral base address.
xferPointer to the transfer structure.
Return values
kStatus_SuccessData transfer finished with no error.
kStatus_TimeoutTransfer failed because of timeout.
kStatus_DSI_RxDataErrorRX data error, user could use DSI_GetRxErrorStatus to check the error details.
kStatus_DSI_ErrorReportReceivedError Report packet received, user could use DSI_GetAndClearHostStatus to check the error report status.
kStatus_DSI_NotSupportedTransfer format not supported.
kStatus_DSI_FailTransfer failed for other reasons.
status_t DSI_TransferCreateHandle ( MIPI_DSI_HOST_Type *  base,
dsi_handle_t *  handle,
dsi_callback_t  callback,
void *  userData 
)

This function initializes the MIPI DSI handle which can be used for other transactional APIs.

Parameters
baseMIPI DSI host peripheral base address.
handleHandle pointer.
callbackCallback function.
userDataUser data.
status_t DSI_TransferNonBlocking ( MIPI_DSI_HOST_Type *  base,
dsi_handle_t *  handle,
dsi_transfer_t xfer 
)

Perform APB data transfer using interrupt method, when transfer finished, upper layer could be informed through callback function.

Parameters
baseMIPI DSI host peripheral base address.
handlepointer to dsi_handle_t structure which stores the transfer state.
xferPointer to the transfer structure.
Return values
kStatus_SuccessData transfer started successfully.
kStatus_DSI_BusyFailed to start transfer because DSI is busy with pervious transfer.
kStatus_DSI_NotSupportedTransfer format not supported.
void DSI_TransferAbort ( MIPI_DSI_HOST_Type *  base,
dsi_handle_t *  handle 
)
Parameters
baseMIPI DSI host peripheral base address.
handlepointer to dsi_handle_t structure which stores the transfer state.
void DSI_TransferHandleIRQ ( MIPI_DSI_HOST_Type *  base,
dsi_handle_t *  handle 
)
Parameters
baseMIPI DSI host peripheral base address.
handlepointer to dsi_handle_t structure which stores the transfer state.