DPI_STATUS DPI_DisableClk() { #define DPI_TIMEOUT 500 // 500 ms DPI_REG_EN en = DPI_REG->DPI_EN; unsigned int dpi_timeout_cnt = 0; unsigned int reg; en.EN = 0; OUTREG32(&DPI_REG->DPI_EN, AS_UINT32(&en)); // wait for DPI back to idle while (dpi_timeout_cnt < DPI_TIMEOUT) { reg = AS_UINT32(&DPI_REG->STATUS); if (0x0 == (reg & 0x10000)) { break; } mdelay(1); dpi_timeout_cnt++; } if (DPI_TIMEOUT <= dpi_timeout_cnt) { ASSERT(0); } printk("[DISP] cnt:%d \n", dpi_timeout_cnt); return DPI_STATUS_OK; }
DPI_STATUS DPI_Init_PLL(unsigned int mipi_pll_clk_ref,unsigned int mipi_pll_clk_div1,unsigned int mipi_pll_clk_div2) { #if 1 MIPITX_CFG0_REG con0 = DSI_PHY_REG_DPI->MIPITX_CON0; MIPITX_CFG1_REG con1 = DSI_PHY_REG_DPI->MIPITX_CON1; #ifdef DPI_MIPI_API enable_mipi(MT65XX_MIPI_TX, "DPI"); #endif #ifdef BUILD_UBOOT OUTREG16(0xc2080858, 0x8000); OUTREG16(0xc20a3824, 0x4008); MASKREG16(0xc20a380c, 0x000c, 0x0000); //default value is 0x7008, but should be 0x7000 #else OUTREG16(0xf2080858, 0x8000); //?? OUTREG16(0xf20a3824, 0x4008); MASKREG16(0xf20a380c, 0x000c, 0x0000); //default value is 0x7008, but should be 0x7000 #endif MASKREG16(PLL_SOURCE, 0x0010, 0x0010); // con1.RG_PLL_DIV1 = mipi_pll_clk_div1; con1.RG_PLL_DIV2 = mipi_pll_clk_div2; con0.PLL_CLKR_EN = 1; con0.PLL_EN = 1; con0.RG_DPI_EN = 1; // Set to DSI_PHY_REG OUTREG32(&DSI_PHY_REG_DPI->MIPITX_CON0, AS_UINT32(&con0)); OUTREG32(&DSI_PHY_REG_DPI->MIPITX_CON1, AS_UINT32(&con1)); #endif return DPI_STATUS_OK; }
DPI_STATUS DPI_ConfigBG(bool enable, int BG_W, int GB_H) { if(enable = false) { DPI_REG_CNTL pol = DPI_REG->CNTL; pol.DPI_BG_EN = 0; OUTREG32(&DPI_REG->CNTL, AS_UINT32(&pol)); return DPI_STATUS_OK; } DPI_REG_CNTL pol = DPI_REG->CNTL; pol.DPI_BG_EN = 1; if((BG_W == 0) || (GB_H == 0)) pol.DPI_BG_EN = 0; OUTREG32(&DPI_REG->CNTL, AS_UINT32(&pol)); DPI_REG_BG_HCNTL pol2 = DPI_REG->BG_HCNTL; pol2.BG_RIGHT = BG_W/2; pol2.BG_LEFT = BG_W/2; OUTREG32(&DPI_REG->BG_HCNTL, AS_UINT32(&pol2)); DPI_REG_BG_VCNTL pol3 = DPI_REG->BG_VCNTL; pol3.BG_BOT = GB_H/2; pol3.BG_TOP = GB_H/2; OUTREG32(&DPI_REG->BG_VCNTL, AS_UINT32(&pol3)); DPI_REG_BG_COLOR pol4 = DPI_REG->BG_COLOR; pol4.BG_B = 0; pol4.BG_G = 0; pol4.BG_R = 0; OUTREG32(&DPI_REG->BG_COLOR, AS_UINT32(&pol4)); return DPI_STATUS_OK; }
void DSI_lane0_ULP_mode(bool enter) { DSI_PHY_LD0CON_REG tmp_reg1; tmp_reg1=DSI_REG->DSI_PHY_LD0CON; if(enter) { // suspend tmp_reg1.L0_HS_TX_EN=0; OUTREG32(&DSI_REG->DSI_PHY_LD0CON, AS_UINT32(&tmp_reg1)); lcm_mdelay(1); tmp_reg1.L0_ULPM_EN=1; OUTREG32(&DSI_REG->DSI_PHY_LD0CON, AS_UINT32(&tmp_reg1)); lcm_mdelay(1); } else { // resume tmp_reg1.L0_ULPM_EN=0; OUTREG32(&DSI_REG->DSI_PHY_LD0CON, AS_UINT32(&tmp_reg1)); lcm_mdelay(1); tmp_reg1.L0_WAKEUP_EN=1; OUTREG32(&DSI_REG->DSI_PHY_LD0CON, AS_UINT32(&tmp_reg1)); lcm_mdelay(1); tmp_reg1.L0_WAKEUP_EN=0; OUTREG32(&DSI_REG->DSI_PHY_LD0CON, AS_UINT32(&tmp_reg1)); lcm_mdelay(1); } }
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn) { DPI_REG_CNTL cntl; if (isDpiPoweredOn) { _BackupDPIRegisters(); } else { _ResetBackupedDPIRegisterValues(); } DPI_PowerOn(); // Always enable frame shift protection and recovery cntl = DPI_REG->CNTL; cntl.FS_PROT_EN = 1; cntl.FS_RC_EN = 1; // Enable adaptive FIFO high/low threshold control cntl.ADP_EN = 1; OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl)); // Config ultra high threshold water mark { DPI_REG_FIFO_TH th = DPI_REG->FIFO_TH; th.LOW = 512; th.HIGH = 512; OUTREG32(&DPI_REG->FIFO_TH, AS_UINT32(&th)); DPI_REG->FIFO_INC.FIFO_TH_INC = 8; DPI_REG->FIFO_INC.FIFO_TH_DEC = 8; } #if ENABLE_DPI_INTERRUPT if (request_irq(MT_DPI_IRQ_ID, _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0) { DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); return DPI_STATUS_ERROR; } // init_waitqueue_head(&_vsync_wait_queue_dpi); { DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE; enInt.FIFO_EMPTY = 1; enInt.FIFO_FULL = 0; enInt.OUT_EMPTY = 0; enInt.CNT_OVERFLOW = 0; enInt.LINE_ERR = 0; enInt.VSYNC = 1; OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt)); } #endif #ifndef BUILD_UBOOT init_waitqueue_head(&_vsync_wait_queue_dpi); #endif OUTREG32(&DPI_REG->GMC_CNTL, 0x41); LCD_W2M_NeedLimiteSpeed(TRUE); return DPI_STATUS_OK; }
TVC_STATUS TVC_CommitChanges(BOOL blocking) { if (_tvcContext.srcFormatSizeDirty) { _WaitForRegUpdated(); // Config Source Format { TVC_REG_CON CON = TVC_REG->CONTROL; CON.DATA_FMT = _tvcContext.srcFormat; OUTREG32(&TVC_REG->CONTROL, AS_UINT32(&CON)); } // Config Source Size OUTREG32(&TVC_REG->SRC_WIDTH, _tvcContext.srcSize.width); OUTREG32(&TVC_REG->SRC_HEIGHT, _tvcContext.srcSize.height); // Config Line Pitch { TVC_REG_LINE_OFFSET OFFSET = TVC_REG->LINE_OFFSET; OFFSET.LINE_OFFSET = (TVC_YUV420_BLK == _tvcContext.srcFormat) ? (_tvcContext.srcSize.width * 1) : (_tvcContext.srcSize.width * 2); OUTREG32(&TVC_REG->LINE_OFFSET, AS_UINT32(&OFFSET)); } // Config Target Size _ConfigTarSize(); // Config Full Display Region _ConfigFullDisplayRegion(); // Config check line num, for MTKYUV the min is 4, for others the min is 1 if (_tvcContext.srcFormat == TVC_YUV420_BLK) { TVC_REG->CHECK_LINE = 4; } else { TVC_REG->CHECK_LINE = 1; } _tvcContext.srcFormatSizeDirty = FALSE; } // Commit the Register Changes { TVC_REG_UPDATE update = TVC_REG->REG_UPDATE; update.REG_RDY = 1; OUTREG32(&TVC_REG->REG_UPDATE, AS_UINT32(&update)); } if (blocking) { _WaitForRegUpdated(); } return TVC_STATUS_OK; }
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn) { DPI_REG_CNTL cntl; if (isDpiPoweredOn) { _BackupDPIRegisters(); // s_isDpiPowerOn = TRUE; } else { _ResetBackupedDPIRegisterValues(); // DPI_PowerOn(); } DPI_PowerOn(); // Always enable frame shift protection and recovery cntl = DPI_REG->CNTL; cntl.FS_PROT_EN = 1; cntl.FS_RC_EN = 1; // Enable adaptive FIFO high/low threshold control cntl.ADP_EN = 1; OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl)); // Config ultra high threshold water mark { DPI_REG_FIFO_TH th = DPI_REG->FIFO_TH; th.LOW = 64; th.HIGH = 128; OUTREG32(&DPI_REG->FIFO_TH, AS_UINT32(&th)); DPI_REG->FIFO_INC = 8; } #if ENABLE_DPI_INTERRUPT if (request_irq(MT6573_DPI_IRQ_LINE, _DPI_InterruptHandler, 0, MTKFB_DRIVER, NULL) < 0) { printk("[DPI][ERROR] fail to request DPI irq\n"); return DPI_STATUS_ERROR; } { DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE; enInt.FIFO_EMPTY = 1; enInt.VSYNC = 1; OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt)); } #endif return DPI_STATUS_OK; }
void TVC_ConfigSize(unsigned int src_width, unsigned int src_height, unsigned int tar_width, unsigned int tar_height) { _SIZE tarSize = {0}; TV_INFO("src %d, %d, tar %d, %d\n", src_width, src_height, tar_width, tar_height); //src size if (_tvcContext.srcSize.width != src_width || _tvcContext.srcSize.height != src_height) { _tvcContext.srcSize.width = src_width; _tvcContext.srcSize.height = src_height; _tvcContext.srcFormatSizeDirty = TRUE; } // Config Source Size OUTREG32(&TVC_REG->SRC_WIDTH, _tvcContext.srcSize.width); OUTREG32(&TVC_REG->SRC_HEIGHT, _tvcContext.srcSize.height); // Config Line Pitch { TVC_REG_LINE_OFFSET OFFSET = TVC_REG->LINE_OFFSET; OFFSET.LINE_OFFSET = (TVC_YUV420_BLK == _tvcContext.srcFormat || TVC_YUV420_PLANAR == _tvcContext.srcFormat) ? (_tvcContext.srcSize.width * 1) : (_tvcContext.srcSize.width * 2); OUTREG32(&TVC_REG->LINE_OFFSET, AS_UINT32(&OFFSET)); } //tar size tarSize.width = tar_width; tarSize.height = tar_height; _SetTarSize(tar_width, tar_height); _tvcContext.tarSize = tarSize; _SetResizCoeff(_tvcContext.srcSize, tarSize); _ConfigFullDisplayRegion(); { TVC_REG_UPDATE update = TVC_REG->REG_UPDATE; update.REG_RDY = 1; OUTREG32(&TVC_REG->REG_UPDATE, AS_UINT32(&update)); } }
DPI_STATUS DPI_ConfigHsync(DPI_POLARITY polarity, UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch) { DPI_REG_TGEN_HPORCH hporch = DPI_REG->TGEN_HPORCH; hporch.HBP = backPorch; hporch.HFP = frontPorch; OUTREG32(&DPI_REG->TGEN_HWIDTH, AS_UINT32(&pulseWidth)); OUTREG32(&DPI_REG->TGEN_HPORCH, AS_UINT32(&hporch)); return DPI_STATUS_OK; }
DPI_STATUS DPI_ConfigVsync(DPI_POLARITY polarity, UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch) { DPI_REG_TGEN_VPORCH vporch = DPI_REG->TGEN_VPORCH; vporch.VBP = backPorch; vporch.VFP = frontPorch; OUTREG32(&DPI_REG->TGEN_VWIDTH, AS_UINT32(&pulseWidth)); OUTREG32(&DPI_REG->TGEN_VPORCH, AS_UINT32(&vporch)); return DPI_STATUS_OK; }
static TVC_STATUS _SetDisplayRegion(UINT32 startPixel, UINT32 startLine, UINT32 stopPixel, UINT32 stopLine) { TVC_REG_POINT START = TVC_REG->START_POINT; TVC_REG_POINT STOP = TVC_REG->STOP_POINT; START.PIXEL = startPixel; START.LINE = startLine; STOP.PIXEL = stopPixel; STOP.LINE = stopLine; OUTREG32(&TVC_REG->START_POINT, AS_UINT32(&START)); OUTREG32(&TVC_REG->STOP_POINT, AS_UINT32(&STOP)); return TVC_STATUS_OK; }
DPI_STATUS DPI_FBEnable(DPI_FB_ID id, BOOL enable) { DPI_REG_CNTL cntl = DPI_REG->CNTL; switch (id) { case DPI_FB_0: // do nothing break; case DPI_FB_1: cntl.FB1_EN = enable ? 1 : 0; break; case DPI_FB_2: cntl.FB2_EN = enable ? 1 : 0; break; default: ASSERT(0); } OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl)); return DPI_STATUS_OK; }
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn) { _BackupDPIRegisters(); DPI_PowerOn(); #if 0 // gpio setting OUTREG32(0xf0005000 + 0xCC4, 0x0000000f); OUTREG32(0xf0005000 + 0xB18, 0x00000ff0); OUTREG32(0xf0005000 + 0xB14, 0x00000660); OUTREG32(0xf0005000 + 0xB28, 0x000000ff); OUTREG32(0xf0005000 + 0xB24, 0x00000066); #endif #if ENABLE_DPI_INTERRUPT if (request_irq(MT_DISP_DPI0_IRQ_ID, _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0) { DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); return DPI_STATUS_ERROR; } { DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE; enInt.VSYNC = 1; OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt)); } #endif ///LCD_W2M_NeedLimiteSpeed(TRUE); return DPI_STATUS_OK; }
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn) { //DPI_REG_CNTL cntl; //DPI_REG_EMBSYNC_SETTING embsync; if (isDpiPoweredOn) { DPI_BackupRegisters(); } else { _ResetBackupedDPIRegisterValues(); } DPI_PowerOn(); #if ENABLE_DPI_INTERRUPT if (request_irq(MT_DISP_DPI_IRQ_ID, _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0) { DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); return DPI_STATUS_ERROR; } { DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE; enInt.VSYNC = 1; OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt)); } #endif LCD_W2M_NeedLimiteSpeed(TRUE); return DPI_STATUS_OK; }
static irqreturn_t _DPI_InterruptHandler(int irq, void *dev_id) { static int counter = 0; DPI_REG_INTERRUPT status = DPI_REG->INT_STATUS; MMProfileLogEx(DDP_MMP_Events.ROT_IRQ, MMProfileFlagPulse, AS_UINT32(&status), 0); // if (status.FIFO_EMPTY) ++ counter; OUTREG32(&DPI_REG->INT_STATUS, 0); if(status.VSYNC) { if(dpiIntCallback) dpiIntCallback(DISP_DPI_VSYNC_INT); #ifndef BUILD_UBOOT if(wait_dpi_vsync){ if(-1 != hrtimer_try_to_cancel(&hrtimer_vsync_dpi)){ dpi_vsync = true; // hrtimer_try_to_cancel(&hrtimer_vsync_dpi); wake_up_interruptible(&_vsync_wait_queue_dpi); } } #endif } if (status.VSYNC && counter) { DISP_LOG_PRINT(ANDROID_LOG_ERROR, "DPI", "[Error] DPI FIFO is empty, " "received %d times interrupt !!!\n", counter); counter = 0; } _DPI_LogRefreshRate(status); OUTREG32(&DPI_REG->INT_STATUS, 0); return IRQ_HANDLED; }
void DSI_clk_HS_mode(bool enter) { DSI_PHY_LCCON_REG tmp_reg1 = DSI_REG->DSI_PHY_LCCON; if(enter && !DSI_clk_HS_state()) { tmp_reg1.LC_HS_TX_EN=1; OUTREG32(&DSI_REG->DSI_PHY_LCCON, AS_UINT32(&tmp_reg1)); //lcm_mdelay(1); } else if (!enter && DSI_clk_HS_state()) { tmp_reg1.LC_HS_TX_EN=0; OUTREG32(&DSI_REG->DSI_PHY_LCCON, AS_UINT32(&tmp_reg1)); //lcm_mdelay(1); } }
static TVC_STATUS _SetResizCoeff(_SIZE src, _SIZE tar) { TVC_REG_RESIDUAL resdual = {0}; UINT32 hratio, vratio; UINT32 src_accu = 1; // assume FINE_RSZ_CFG.SAEN == 1 if ((src_accu) && (tar.width < src.width)) { hratio = ((tar.width - 1) << 20) / (src.width - 1); } else { hratio = (src.width << 20) / tar.width; } if ((src_accu) && (tar.height < src.height)) { vratio = ((tar.height - 1) << 20) / (src.height - 1); } else { vratio = (src.height << 20) / tar.height; } resdual.H_RESIDUAL = src.width % tar.width; resdual.V_RESIDUAL = src.height % tar.height; OUTREG32(&TVC_REG->HRATIO, hratio); OUTREG32(&TVC_REG->VRATIO, vratio); OUTREG32(&TVC_REG->RESIDUAL, AS_UINT32(&resdual)); return TVC_STATUS_OK; }
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn) { if (isDpiPoweredOn) { _BackupDPIRegisters(); } else { _ResetBackupedDPIRegisterValues(); } DPI_PowerOn(); #if ENABLE_DPI_INTERRUPT if (request_irq(MT65XX_DPI_IRQ_ID, _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0) { DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); return DPI_STATUS_ERROR; } { DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE; enInt.VSYNC = 1; OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt)); } #endif return DPI_STATUS_OK; }
TVC_STATUS TVC_Disable(void) { TV_INFO("\n"); if (_tvcContext.isTvcEnabled == false) { TV_WARNING("TVC is disabled, but disable again\n"); return TVC_STATUS_OK; } _tvcContext.isTvcEnabled = false; OUTREG32(&TVC_REG->ENABLE, 0); { TVC_REG_UPDATE update = TVC_REG->REG_UPDATE; update.REG_RDY = 1; OUTREG32(&TVC_REG->REG_UPDATE, AS_UINT32(&update)); } _WaitForRegUpdated(); _FreeInternalSRAM(); return TVC_STATUS_OK; }
static void dump_lcd_layer_info(void) { #ifndef MT65XX_NEW_DISP unsigned int roi_ctl = AS_UINT32(&LCD_REG->WROI_CONTROL); unsigned int i = 0; DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "------------------------------------------\n" "[mtkfb] dump lcd layer information\n" "------------------------------------------\n"); for (i = 0; i < 6; ++ i) { unsigned int layer_en = is_layer_enable(roi_ctl, i); DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "Layer[%d] is %s\n", i, layer_en ? "enabled" : "disabled"); if (!layer_en) continue; DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", " size : %d x %d\n", LCD_REG->LAYER[i].SIZE.WIDTH, LCD_REG->LAYER[i].SIZE.HEIGHT); DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", " offset : (%d, %d)\n", LCD_REG->LAYER[i].OFFSET.X, LCD_REG->LAYER[i].OFFSET.Y); DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", " format : %s\n", narrate_lcd_layer_format(LCD_REG->LAYER[i].CONTROL.CLRDPT)); DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", " dlink : %d\n", (AS_UINT32(&LCD_REG->WROI_DC) >> (31 - i)) & 0x1); } DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "\n"); #else LCD_DumpLayer(); #endif }
DPI_STATUS DPI1_DisableClk() { DPI_REG_EN en = DPI1_REG->DPI_EN; en.EN = 0; OUTREG32(&DPI1_REG->DPI_EN, AS_UINT32(&en)); return DPI_STATUS_OK; }
DPI_STATUS DPI_FBSetFormat(DPI_FB_FORMAT format) { DPI_REG_CNTL cntl = DPI_REG->CNTL; cntl.PXL_FMT = format; OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl)); return DPI_STATUS_OK; }
void DPI_EnableIrq(void) { #if ENABLE_DPI_INTERRUPT DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE; enInt.VSYNC = 1; OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt)); #endif }
TVE_STATUS TVE_EnableColorBar(BOOL enable) { TVE_REG_MODE mode = TVE_REG->MODE; mode.CBON = enable ? 1 : 0; OUTREG32(&TVE_REG->MODE, AS_UINT32(&mode)); return TVE_STATUS_OK; }
DPI_STATUS DPI_ConfigDataEnable(DPI_POLARITY polarity) { DPI_REG_CLKCNTL pol = DPI_REG->CLK_CNTL; pol.DE_POL = (DPI_POLARITY_FALLING == polarity) ? 1 : 0; OUTREG32(&DPI_REG->CLK_CNTL, AS_UINT32(&pol)); return DPI_STATUS_OK; }
DPI_STATUS DPI_EnableClk() { ///DPI_EnableColorBar(); DPI_REG_EN en = DPI_REG->DPI_EN; en.EN = 1; OUTREG32(&DPI_REG->DPI_EN, AS_UINT32(&en)); return DPI_STATUS_OK; }
DPI_STATUS DPI_FBSyncFlipWithLCD(BOOL enable) { DPI_REG_CNTL cntl = DPI_REG->CNTL; cntl.FB_CHK_EN = enable ? 1 : 0; OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl)); return DPI_STATUS_OK; }
DPI_STATUS DPI1_ConfigDataEnable(DPI_POLARITY polarity) { DPI_REG_TGEN_POL pol = DPI1_REG->TGEN_POL; pol.DE_POL = (DPI_POLARITY_FALLING == polarity) ? 1 : 0; OUTREG32(&DPI1_REG->TGEN_POL, AS_UINT32(&pol)); return DPI_STATUS_OK; }
DPI_STATUS DPI1_ConfigHsync(DPI_POLARITY polarity, UINT32 pulseWidth, UINT32 backPorch, UINT32 frontPorch) { DPI_REG_TGEN_HPORCH hporch = DPI1_REG->TGEN_HPORCH; DPI_REG_TGEN_POL pol = DPI1_REG->TGEN_POL; pol.HSYNC_POL = (DPI_POLARITY_FALLING == polarity) ? 1 : 0; //DPI1_REG->TGEN_HWIDTH = pulseWidth; OUTREG32(&DPI1_REG->TGEN_HWIDTH,pulseWidth); hporch.HBP = backPorch; hporch.HFP = frontPorch; OUTREG32(&DPI1_REG->TGEN_POL, AS_UINT32(&pol)); OUTREG32(&DPI1_REG->TGEN_HPORCH, AS_UINT32(&hporch)); return DPI_STATUS_OK; }
DPI_STATUS DPI_ConfigDualEdge(bool enable) { DPI_REG_CLKCNTL ctrl = DPI_REG->CLK_CNTL; ctrl.DUAL_EDGE_SEL = enable; OUTREG32(&DPI_REG->CLK_CNTL, AS_UINT32(&ctrl)); return DPI_STATUS_OK; }