Пример #1
0
// =============================================================================
// hal_CameraReset(BOOL InReset)
// -----------------------------------------------------------------------------
/// Puts the Camera sensor in Reset or out of Reset.
/// 
/// @param InReset if true, put the external camera sensor in reset
// =============================================================================
PUBLIC VOID hal_CameraReset(BOOL InReset)
{
    if (g_halCameraConfig.camId == 0)
    {
        // Use sensor 0
        if (g_halCfg->camCfg.camRstRemap.gpioId == HAL_GPIO_NONE)
        {
            // Configures the Reset bit to the camera
            if (InReset)
            {
                hwp_camera->CMD_SET = CAMERA_RESET;
            }
            else
            {
                hwp_camera->CMD_CLR = CAMERA_RESET;
            }
        }
        else
        {
            // Use GPIO
            if ((g_halCameraConfig.rstActiveH && InReset) || ((!g_halCameraConfig.rstActiveH) && (!InReset)))
            {
                hal_GpioSet(g_halCfg->camCfg.camRstRemap);
            }
            else
            {
                hal_GpioClr(g_halCfg->camCfg.camRstRemap);
            }
        }
    }
    else
    {
        // Use sensor 1
        // Use GPIO
        if (g_halCfg->camCfg.cam1RstRemap.gpioId == HAL_GPIO_NONE)
        {
            // Configures the Reset bit to the camera
            if (InReset)
            {
                hwp_camera->CMD_SET = CAMERA_RESET;
            }
            else
            {
                hwp_camera->CMD_CLR = CAMERA_RESET;
            }
        }
        else
        {
            // Use GPIO
            if ((g_halCameraConfig.rstActiveH && InReset) || ((!g_halCameraConfig.rstActiveH) && (!InReset)))
            {
                hal_GpioSet(g_halCfg->camCfg.cam1RstRemap);
            }
            else
            {
                hal_GpioClr(g_halCfg->camCfg.cam1RstRemap);
            }
        }
    }
}
Пример #2
0
PUBLIC FMD_ERR_T fmd_Open(CONST TGT_FMD_CONFIG_T* fmdTgtCfg,
                          FMD_BAND_T band,
                          FMD_CALLBACK_T* callback,
                          FMD_INIT_T* initValues)
{
    UINT8 dacVol;
    UINT32 chan;
 
    // Check if already opened
    // -----------------------
    if (g_band != FMD_BAND_QTY)
    {
        return FMD_ERR_ALREADY_OPENED;
    }
    // Check the parameters and store them
    // -----------------------------------
    switch (band)
    {
        case FMD_BAND_US_EUROPE:
        case FMD_BAND_JAPAN:
        case FMD_BAND_WORLD:
        case FMD_BAND_EAST_EUROPE:
            g_band = band;
            break;
        default:
            // this chip has limited band support...
            return FMD_ERR_BAD_PARAMETER;
    }
    if (fmdTgtCfg == NULL)
    {
        g_band = FMD_BAND_QTY; // close marker
        return FMD_ERR_BAD_PARAMETER;
    }
    g_fmdConfig = fmdTgtCfg;
    g_callback = callback;
    // default : mute , stereo, no bass boost
    dacVol = 0;
    chan = 0;
    // set the required initial state
    // ------------------------------
    if (initValues != NULL)
    {
        // set given parameters 
        dacVol = g_fmdConfig->volumeVal[initValues->volume];
        chan = (initValues->freqKHz) ;
    }
     SXS_TRACE(TSTDOUT,"fmd_Open  chanfreqKHz:%d ",chan);

    // Sets the PowerDown
   
    if(g_fmdConfig->pinPdn.type==HAL_GPIO_TYPE_IO)
    {
        hal_GpioSetOut(g_fmdConfig->pinPdn.gpioId);
    }
    hal_GpioSet(g_fmdConfig->pinPdn);
   
 
#ifdef I2C_BASED_ON_GPIO
	   gpio_i2c_open();
#else
 //xiaoyifeng for atv
 //for IIC pull up
	 pmd_EnablePower(PMD_POWER_CAMERA,TRUE); 
 
	 g_atvdI2cBusId = tgt_GetAtvdConfig()->i2cBusId; 
	 hal_I2cOpen(g_atvdI2cBusId); 
#endif
#ifdef RDA5888_FM_26MCRYSTAL_ENABLE    
	{
		hal_SysAuxClkOut(TRUE);
	}
#endif

	RDA5888FM_Init();

//open 32k here
#ifdef RDA5888_32KFMMODE_ENALBE
#ifdef RDA5888_FM_26MCRYSTAL_ENABLE    
	{
		hal_SysAuxClkOut(FALSE);
	}
#endif
    {
        RDA_Open32KOnChip();
    }
#endif

     //set volume about dacVol
     if (dacVol == FMD_ANA_MUTE)
    {
         // fmd_Write(0x10,0xc500);  // close adac
    }
    else
    {
	   //fmd_Write(0x10,0x8500);  // open adac	
    }
  
  //  sxr_Sleep(10 MILLI_SECONDS);
   // fmd_FieldWrite(0x125, 0xff80, dacVol);

   // sxr_Sleep(50 MILLI_SECONDS);
    return FMD_ERR_NO;
}
Пример #3
0
PROTECTED VOID hal_KeyIrqHandler(UINT8 interruptId)
{
    // interrupt status
    UINT32 status;
    // Keys pressed a the time of the interrupt
    HAL_KEY_MATRIX_T scannedKeys;
    // On-Off key state at the time of the interrupt
    BOOL scannedOnOff;
    
    // Variables to store the state of the different keys
    HAL_KEY_MATRIX_T downKeys;
    HAL_KEY_MATRIX_T upKeys;
    HAL_KEY_MATRIX_T pressedKeys;
    BOOL ExpKeyDet = FALSE;

    status = hwp_keypad->KP_IRQ_CAUSE &
        (KEYPAD_KP_EVT0_IRQ_CAUSE|KEYPAD_KP_EVT1_IRQ_CAUSE|KEYPAD_KP_ITV_IRQ_CAUSE) ;

    // Clear IRQ
    hwp_keypad->KP_IRQ_CLR = KEYPAD_KP_IRQ_CLR;


    if ((status & KEYPAD_KP_EVT0_IRQ_CAUSE) || (status & KEYPAD_KP_ITV_IRQ_CAUSE))
    {
        hal_KeySingleScan(scannedKeys);
        if (scannedKeys[0] == COL0_PATTERN)
        {
            g_expKey[0] = 0;
            ExpKeyDet = TRUE;
        }
        else if (scannedKeys[0] == COL1_PATTERN)
        {
            g_expKey[0] = 1;
            ExpKeyDet = TRUE;
        }
        else if (scannedKeys[0] == COL2_PATTERN)
        {
            g_expKey[0] = 2;
            ExpKeyDet = TRUE;
        }
        else if (scannedKeys[0] == COL3_PATTERN)
        {
            g_expKey[0] = 3;
            ExpKeyDet = TRUE;
        }
        else if (scannedKeys[0] == COL4_PATTERN)
        {
            g_expKey[0] = 4;
            ExpKeyDet = TRUE;
        }
        else if (scannedKeys[0] == COL5_PATTERN)
        {
            g_expKey[0] = 5;
            ExpKeyDet = TRUE;
        }
        else
        {
            ExpKeyDet = FALSE;
        }
    }
    if (status & KEYPAD_KP_EVT1_IRQ_CAUSE)
    {
        if (g_ExpKeyPressed)
        {
            HAL_TRACE(HAL_IO_TRC, 0, "HAL_KEY: Key Up -> Finish Exp Key config");
            hwp_keypad->KP_CTRL = g_kpCtrlReg | KEYPAD_KP_ITV_TIME(g_kpItvReg) | KEYPAD_KP_DBN_TIME(g_kpdbReg);
            g_ItvTimeShort = FALSE;
            g_ExpKeyPressed = FALSE;
            g_kpItvCnt = 0;

            if (g_RowToDisable == 6)
            {
                g_RowToDisable = 7;
            }
            else
            {
                g_RowToDisable = 6;
            }

            hal_ExpKeyCallHandler(g_expKey, HAL_KEY_UP);
            // Reset KeyOut6 & 7 to '1'
            hal_GpioSet(g_keyOut6);
            hal_GpioSet(g_keyOut7);
        }
    }
    if (!ExpKeyDet)
    {
        // All keys are released
        if ((status & KEYPAD_KP_EVT1_IRQ_CAUSE) && g_eventOnUp)
        {
            pressedKeys[0] = 0;
            pressedKeys[1] = 0;
            scannedOnOff = FALSE;

            // All previously pressed keys are released
            hal_KeyCallHandler(g_previousKeys, HAL_KEY_UP);

            // on-off button
            if (g_previousOnOff)
            {
                g_keyIrqHandler(255, HAL_KEY_UP);
            }
            
            // Keep track of the pressed buttons.
            g_previousKeys[0] = pressedKeys[0];
            g_previousKeys[1] = pressedKeys[1];
            g_previousOnOff   = scannedOnOff;
        }

        else
        
        {
        // Key up or down
            if (status &  KEYPAD_KP_EVT0_IRQ_CAUSE)
            {
                
                hal_KeySingleScan(scannedKeys);
                scannedOnOff = hal_KeyOnOffStateGet();

                // Send the ***pressed events*** only if user requested it.
                if (g_eventOnPressed && NULL != g_keyIrqHandler)
                {
                    // Pressed key detection
                    // Those are the one previously pressed and still pressed now
                    pressedKeys[0] = (scannedKeys[0] & g_previousKeys[0]);
                    pressedKeys[1] = (scannedKeys[1] & g_previousKeys[1]);
                
                    hal_KeyCallHandler(pressedKeys, HAL_KEY_PRESSED);
                    // on-off button
                    if (g_previousOnOff & scannedOnOff)
                    {
                        g_keyIrqHandler(255, HAL_KEY_PRESSED);
                    }

                }
                
                // If the pressed buttons changed.
                if (scannedKeys[0] != g_previousKeys[0] ||
                    scannedKeys[1] != g_previousKeys[1] ||
                    scannedOnOff   != g_previousOnOff)
                {
                    // Send the ***down events*** only if user requested it.
                    if (g_eventOnDown && NULL != g_keyIrqHandler)
                    {
                        // Key that are now pressed but weren't before
                        downKeys[0] = scannedKeys[0] & ~g_previousKeys[0];
                        downKeys[1] = scannedKeys[1] & ~g_previousKeys[1];

                        // low and high keys
                        hal_KeyCallHandler(downKeys, HAL_KEY_DOWN);
                        
                        // on-off button
                        if (~g_previousOnOff & scannedOnOff)
                        {
                            g_keyIrqHandler(255, HAL_KEY_DOWN);
                        }
                    }

                    // Send the ***up events*** only if user requested it.
                    if (g_eventOnUp && NULL != g_keyIrqHandler)
                    {
                        // Keys that are now unpressed but were pressed before
                        upKeys[0] = ~scannedKeys[0] & g_previousKeys[0];
                        upKeys[1] = ~scannedKeys[1] & g_previousKeys[1];

                        // low and high keys
                        hal_KeyCallHandler(upKeys, HAL_KEY_UP);

                        // on-off key
                        if (g_previousOnOff & ~scannedOnOff)
                        {
                            g_keyIrqHandler(255, HAL_KEY_UP);
                        }
                    }

                    // Keep track of the pressed buttons.
                    g_previousKeys[0] = scannedKeys[0];
                    g_previousKeys[1] = scannedKeys[1];
                    g_previousOnOff   = scannedOnOff;
                }
            }
            else
            {
                // There are only already pressed keys 
                // still pressed, so no change in pressed keys
                // and no need for a new scan
                if ((status & KEYPAD_KP_ITV_IRQ_CAUSE) && g_eventOnPressed)
                {
                    hal_KeyCallHandler(g_previousKeys, HAL_KEY_PRESSED);
                    // on-off button
                    if (g_previousOnOff)
                    {
                        g_keyIrqHandler(255, HAL_KEY_PRESSED);
                    }
                }
            }
        }
    }
    else // Expand Key
    {
        if (status & KEYPAD_KP_EVT0_IRQ_CAUSE)
        {
            hwp_keypad->KP_CTRL = g_kpCtrlReg | KEYPAD_KP_ITV_TIME(0) | KEYPAD_KP_DBN_TIME(1);
            g_ItvTimeShort = TRUE;
            HAL_TRACE(HAL_IO_TRC, 0, "HAL_KEY: COL_DET");
            if (g_RowToDisable == 6)
            {
                hal_GpioClr(g_keyOut6);
            }
            else
            {
                hal_GpioClr(g_keyOut7);
            }
            g_ExpKeyPressed = TRUE;
        }
        if (status & KEYPAD_KP_ITV_IRQ_CAUSE)
        {
            if (g_ItvTimeShort)
            {
                hwp_keypad->KP_CTRL = g_kpCtrlReg | KEYPAD_KP_ITV_TIME(g_kpItvReg) | KEYPAD_KP_DBN_TIME(g_kpdbReg);
                g_ItvTimeShort=FALSE;
                if (g_RowToDisable == 6)
                {
                    // Row 6 is disabled, so exp key is on row 7
                    g_expKey[1] = 1;
                    HAL_TRACE(HAL_IO_TRC, 0, "HAL_KEY: Key Down 7");
                }
                else
                {
                    // Row 7 is disabled, so exp key is on row 6
                    g_expKey[1] = 0;
                    HAL_TRACE(HAL_IO_TRC, 0, "HAL_KEY: Key Down 6");
                }
                hal_ExpKeyCallHandler(g_expKey, HAL_KEY_DOWN);
            }
            else
            {
                if (g_RowToDisable == 6)
                {
                    // Row 6 is disabled, so exp key is on row 7
                    g_expKey[1] = 1;
                    HAL_TRACE(HAL_IO_TRC, 0, "HAL_KEY: Key Pressed 7");
                }
                else
                {
                    // Row 7 is disabled, so exp key is on row 6
                    g_expKey[1] = 0;
                    HAL_TRACE(HAL_IO_TRC, 0, "HAL_KEY: Key Pressed 6");
                }
                if (g_kpItvCnt)
                {
                    hal_ExpKeyCallHandler(g_expKey, HAL_KEY_PRESSED);
                }
                g_kpItvCnt++;
            }
        }
    }
}
Пример #4
0
// ============================================================================
// hal_KeyOpen
// ----------------------------------------------------------------------------
/// This function initializes the keypad driver. The configuration of the key
/// pins used is board dependent and is built in HAL through the 
/// #tgt_BoardConfig.halCfg structure.
///
/// @param debounceTime defines the time to wait for debounce, in number of 
/// 16384Hz steps. Boundaries applied to the possible values of this time, 
/// which are dependent on the board config, especially the number of
/// out line of the keypad: the value of this parameter must be chosen
/// between 5*Number of Enabled KeyOu and 1280*Number of Enabled
/// Please refer to the keypad documentation for 
/// details.
/// @param kpItvTime defines the interval time between the generation of IRQ
/// when one or more keys are being held down. It defines a multiple of the
/// debounce time.
// ============================================================================
PUBLIC VOID hal_KeyOpen(UINT16 debounceTime, UINT16 kpItvTime)
{
    CONST HAL_CFG_CONFIG_T* halCfg = g_halCfg;
    UINT32 keyOutMask = halCfg->keyOutMask | 0x1;
    UINT32 temp;
    UINT32 nbKeyOut = 0;
    // Debounce value to enter in the control reg
    UINT32 dbnTimeReg = 0;

    // Save current OnOff key status for power-on check (Otherwise 
    // we will have to wait the debounce time after enabling keypad.
    // See the last comments of this function)
    hal_KeyOnOffStateAtPowerOn();

    // Count the number of enabled keyout.
    temp = keyOutMask;
    while (temp != 0)
    {
        if (temp & 0x1)
        {
            nbKeyOut += 1;
        }
        temp = temp >>1;
    }
    

#ifdef TGT_WITH_EXPKEY
    g_ExpKeyCfg = tgt_GetExpKeyConfig();
    if (g_ExpKeyCfg->expKeyUsed)
    {
        g_keyOut6 = g_ExpKeyCfg->expKeyOut6;
        g_keyOut7 = g_ExpKeyCfg->expKeyOut7;
        if ((g_keyOut6.type == HAL_GPIO_TYPE_O) &&
            (g_keyOut7.type == HAL_GPIO_TYPE_O))
        {
            hal_GpioSet(g_keyOut6);
            hal_GpioSet(g_keyOut7);
        }
        else
        {
            HAL_ASSERT(FALSE, "Should Use GPO as KeyOut!");
        }
    }
#endif

    // Reset the event generation configuration.
    g_eventOnUp      = FALSE;
    g_eventOnPressed = FALSE;
    g_eventOnDown    = FALSE;
    g_keyIrqHandler  = NULL;
    
    // Initialize the previous state.
    g_previousKeys[0] = 0;
    g_previousKeys[1] = 0;
    g_previousOnOff   = hal_KeyOnOffStateGet();

    if(nbKeyOut != 0)
    {
        HAL_ASSERT(    (debounceTime >= 5 * nbKeyOut ) && (debounceTime <= 256*5*nbKeyOut),
                    "Improper debounce times used: %d", debounceTime);

        // Value to enter in the register bitfield
        // De-bounce time = (KP_DBN_TIME + 1) * SCAN_TIME,
        // SCAN_TIME = 0.3125 ms * Number of Enabled KeyOut (determined by KP_OUT_MASK).
        // For example, if KP_DBN_TIME = 7, KP_OUT_MASK = "111111", then
        // De-bounce time = (7+1)*0.3125*6=15 ms. The maximum debounce time is 480 ms.
        dbnTimeReg =  (debounceTime / (5 * nbKeyOut)) - 1;
    }
    else
    {
        dbnTimeReg =  (debounceTime) - 1;
    }

    // Ensure keypad runs out of its state machine
    // (Keypad might have been enabled at boot time)
    hwp_keypad->KP_CTRL = 0;
    // It needs 1 cycle of 16K clock to disable keypad
    hal_TimDelay(3);

    hwp_keypad->KP_CTRL = KEYPAD_KP_DBN_TIME(dbnTimeReg)
        | KEYPAD_KP_ITV_TIME(kpItvTime)
        | KEYPAD_KP_EN | KEYPAD_KP_IN_MASK(halCfg->keyInMask)
        | KEYPAD_KP_OUT_MASK(keyOutMask);

    // clear current IRQ
    hwp_keypad->KP_IRQ_CLR = KEYPAD_KP_IRQ_CLR;

    //g_halMapAccess.keypadPulseHandler = (void*)hal_KeyRemoteHandler;

#ifdef TGT_WITH_EXPKEY
    g_kpItvReg  = kpItvTime;
    g_kpdbReg   = dbnTimeReg;
    g_kpCtrlReg = KEYPAD_KP_ITV_IRQ_MASK
                | KEYPAD_KP_EVT1_IRQ_MASK
                | KEYPAD_KP_EVT0_IRQ_MASK | KEYPAD_KP_EN
                | KEYPAD_KP_IN_MASK(halCfg->keyInMask)
                | KEYPAD_KP_OUT_MASK(keyOutMask);
#endif

    // !!! CAUTION !!!
    // After keypad is enabled, the status of individual keys (including
    // OnOff key) will NOT be available until the debouce time elapses.
}
Пример #5
0
// ============================================================================
// lcddp_Blit16
// ----------------------------------------------------------------------------
/// This function provides the basic bit-block transfer capabilities. 
/// This function copies the data (such as characters/bmp) on the LCD directly
/// as a (rectangular) block. The data is drawn in the active window.
/// The buffer has to be properly aligned (@todo define properly 'properly')
///
/// @param pPixelData Pointer to the buffer holding the data to be displayed
/// as a block. The dimension of this block are the one of the #pDestRect 
/// parameter
/// @return #LCDD_ERR_NO, #LCDD_ERR_RESOURCE_BUSY or #LCDD_ERR_NOT_OPENED. 
// ============================================================================
PRIVATE LCDD_ERR_T lcddp_Blit16(CONST LCDD_FBW_T* frameBufferWin, UINT16 startX, UINT16 startY)
{
    LCDD_ASSERT((frameBufferWin->fb.width&1) == 0, "LCDD: FBW must have an even number "
            "of pixels per line. Odd support is possible at the price of a huge "
            "performance lost");
    // Active window coordinates.
    HAL_GOUDA_WINDOW_T inputWin;
    HAL_GOUDA_WINDOW_T activeWin;
    hal_HstSendEvent(0x88855516);
    UINT32 now = hal_TimGetUpTime();

    if (0 == lcdd_MutexGet())
    {
        return LCDD_ERR_RESOURCE_BUSY;
    }
    else
    {   
        if (g_lcddInSleep)
        {
            lcdd_MutexFree();
            return LCDD_ERR_NO;
        }

        // Set Input window
        inputWin.tlPX = frameBufferWin->roi.x;
        inputWin.brPX = frameBufferWin->roi.x + frameBufferWin->roi.width - 1;
        inputWin.tlPY = frameBufferWin->roi.y;
        inputWin.brPY = frameBufferWin->roi.y + frameBufferWin->roi.height - 1;

        // Set Active window
        activeWin.tlPX = startX;
        activeWin.brPX = startX + frameBufferWin->roi.width - 1;
        activeWin.tlPY = startY;
        activeWin.brPY = startY + frameBufferWin->roi.height - 1;

        // Check parameters
        // ROI must be within the screen boundary
        // ROI must be within the Frame buffer
        // Color format must be 16 bits
        BOOL badParam = FALSE;
        if (g_lcddRotate)
        {
            if (    (activeWin.tlPX >= LCDD_DISP_Y) ||
                    (activeWin.brPX >= LCDD_DISP_Y) ||
                    (activeWin.tlPY >= LCDD_DISP_X) ||
                    (activeWin.brPY >= LCDD_DISP_X)
               )
            {
                badParam = TRUE;
            }
        }
        else
        {
            if (    (activeWin.tlPX >= LCDD_DISP_X) ||
                    (activeWin.brPX >= LCDD_DISP_X) ||
                    (activeWin.tlPY >= LCDD_DISP_Y) ||
                    (activeWin.brPY >= LCDD_DISP_Y)
               )
            {
                badParam = TRUE;
            }
        }
        if (!badParam)
        {
            if (    (frameBufferWin->roi.width > frameBufferWin->fb.width) ||
                    (frameBufferWin->roi.height > frameBufferWin->fb.height) ||
                    (frameBufferWin->fb.colorFormat != LCDD_COLOR_FORMAT_RGB_565)
                )
            {
                badParam = TRUE;;
            }
        }
        if (badParam)
        {
            lcdd_MutexFree();  
            return LCDD_ERR_INVALID_PARAMETER;
        }
        // this will allow to keep LCDD interface for blit while using gouda
        // directly for configuring layers
        if (frameBufferWin->fb.buffer != NULL)
        {
            g_lcddAutoCloseLayer = FALSE;
            WriteCommand_Addr(0x2a);WriteCommand_Data(0x00);WriteCommand_Data(activeWin.tlPX);
            WriteCommand_Data(0x00);WriteCommand_Data(activeWin.brPX);
            WriteCommand_Addr(0x2b);WriteCommand_Data(0x00);WriteCommand_Data(activeWin.tlPY );
            WriteCommand_Data(0x00);WriteCommand_Data(activeWin.brPY);
           #if 0
       			LCM_WR_REG(0x0002,(hsa>>8)&0x00ff); // Column address start2
       			LCM_WR_REG(0x0003,hsa&0x00ff); // Column address start1
       			LCM_WR_REG(0x0004,(hea>>8)&0x00ff); // Column address end2
       			LCM_WR_REG(0x0005,hea&0x00ff); // Column address end1
       			LCM_WR_REG(0x0006,(vsa>>8)&0x00ff); // Row address start2
       			LCM_WR_REG(0x0007,vsa&0x00ff); // Row address start1
       			LCM_WR_REG(0x0008,(vea>>8)&0x00ff); // Row address end2
       			LCM_WR_REG(0x0009,vea&0x00ff); // Row address end1
           #endif
           WriteCommand_Addr(0x2c);
           hal_GpioSet(g_slcd_a0);
        }

          if (frameBufferWin->roi.width == frameBufferWin->fb.width)
          {
              // The source buffer and the roi have the same width, we can
              // do a single linear transfer
              lcdd_TransferData(frameBufferWin->fb.buffer+frameBufferWin->roi.y*frameBufferWin->roi.width
                      ,frameBufferWin->roi.width*frameBufferWin->roi.height,TRUE);
              hal_HstSendEvent(0x88855528);  

          }
          else
          {
              // The source buffer is wider than the roi 
              // we have to do a 2D transfer
              UINT16 curLine=0;
              UINT16 startLine = frameBufferWin->roi.y;
              UINT16 endLine = frameBufferWin->roi.y+frameBufferWin->roi.height-1;
              // Start at the base of the buffer
              // add the number of pixels corresponding to the start line
              // add the number of pixel corresponding to the startx
              UINT16* curBuf = frameBufferWin->fb.buffer
                  +(frameBufferWin->roi.y*frameBufferWin->fb.width)
                  +(frameBufferWin->roi.x);
                          
              for (curLine=startLine; curLine<=endLine; curLine++)
              {   

                  // transfer one line
                  if (curLine == endLine)
                  {
                      lcdd_TransferData(curBuf, frameBufferWin->roi.width, TRUE);hal_HstSendEvent(0x88855521);
                  }
                  else
                  {
                      lcdd_TransferData(curBuf, frameBufferWin->roi.width, FALSE);
                  }
                  // goto next line
                  curBuf+=frameBufferWin->fb.width;
              }
          }
         UINT32 now2 = hal_TimGetUpTime();
         SXS_TRACE(TSTDOUT, "lcd speed on frame %d ms ",(now2-now)*1000/16384);


        return LCDD_ERR_NO;
    }
Пример #6
0
// ============================================================================
// lcddp_BlitRoi2Win
// ----------------------------------------------------------------------------
// Private function to transfer data to the LCD
// ============================================================================
PRIVATE VOID lcddp_BlitRoi2Win(CONST HAL_GOUDA_WINDOW_T* pRoi, CONST HAL_GOUDA_WINDOW_T* pActiveWin, UINT16 bgColor)
{
    hal_HstSendEvent(0x88855509);
    HAL_GOUDA_LCD_CMD_T cmd[13];
    UINT32 j = 0,k =0;

    if(!((pRoi->tlPX < pRoi->brPX) && (pRoi->tlPY < pRoi->brPY)))
    {
        LCDD_TRACE(LCDD_WARN_TRC,0,"lcddp_BlitRoi2Win: Invalid Roi x:%d < %d, y:%d < %d",pRoi->tlPX, pRoi->brPX, pRoi->tlPY, pRoi->brPY);
        lcddp_GoudaBlitHandler();
        return;
    }

    // building set roi sequence:

#if 1
    if(g_lcddRotate)
    {
        //Window Horizontal RAM Address Start
        LCDD_BUILD_CMD_WR_REG(cmd,0,0x0050,pActiveWin->tlPY);
        //Window Horizontal RAM Address End
        LCDD_BUILD_CMD_WR_REG(cmd,2,0x0051,pActiveWin->brPY);
        //Window Vertical RAM Address Start
        LCDD_BUILD_CMD_WR_REG(cmd,4,0x0052,LCDD_DISP_Y-1-pActiveWin->brPX);
        //Window Vertical RAM Address End
        LCDD_BUILD_CMD_WR_REG(cmd,6,0x0053,LCDD_DISP_Y-1-pActiveWin->tlPX);

        //Start point
        LCDD_BUILD_CMD_WR_REG(cmd,8,0x0020,pActiveWin->tlPY);
        LCDD_BUILD_CMD_WR_REG(cmd,10,0x0021,LCDD_DISP_Y-1-pActiveWin->tlPX);
    }
    else
    {  hal_HstSendEvent(0x88855510);
        //Window Horizontal RAM Address Start
       // LCDD_BUILD_CMD_WR_REG(cmd,0,0x0050,pActiveWin->tlPX);
        WriteCommand_Addr(0x2a);WriteCommand_Data(0x00);WriteCommand_Data(pActiveWin->tlPX);
        WriteCommand_Data(0x00);WriteCommand_Data(pActiveWin->brPX);
        //Window Horizontal RAM Address End
       // LCDD_BUILD_CMD_WR_REG(cmd,2,0x0051,pActiveWin->brPX);
        //Window Vertical RAM Address Start
       // LCDD_BUILD_CMD_WR_REG(cmd,4,0x0052,pActiveWin->tlPY);
        //Window Vertical RAM Address End
       // LCDD_BUILD_CMD_WR_REG(cmd,6,0x0053,pActiveWin->brPY);
        WriteCommand_Addr(0x2b);WriteCommand_Data(0x00);WriteCommand_Data(pActiveWin->tlPY);
        WriteCommand_Data(0x00);WriteCommand_Data(pActiveWin->brPY);

        //Start point
      //  LCDD_BUILD_CMD_WR_REG(cmd,8,0x0020,pActiveWin->tlPX);
      //  LCDD_BUILD_CMD_WR_REG(cmd,10,0x0021,pActiveWin->tlPY);
    }
    k = ((pActiveWin->brPX-pActiveWin->tlPX)+1)*(1+(pActiveWin->brPY-pActiveWin->tlPY));
        hal_HstSendEvent(0x88855511);

    hal_HstSendEvent(k);

    // Send command after which the data we sent
    // are recognized as pixels.
     WriteCommand_Addr(0x2c);
     hal_GpioSet(g_slcd_a0);
  //   g_image[0]=0xf8 ;
 //    g_image[1]= 0x00;

     g_image[0]=(UINT8)((bgColor&0xff00)>>8);g_image[1]=(UINT8)(bgColor&0x00ff);   
     for( j =0; j<k; j++ ) 
     { 
      Write_Data_Image; // red 
     } 

      lcdd_MutexFree();
#else

    LCM_WR_REG(0x0050,pActiveWin->tlPX);//Window Horizontal RAM Address Start
    LCM_WR_REG(0x0051,pActiveWin->brPX);//Window Horizontal RAM Address End
    LCM_WR_REG(0x0052,pActiveWin->tlPY);//Window Vertical RAM Address Start
    LCM_WR_REG(0x0053,pActiveWin->brPY);//Window Vertical RAM Address End

    LCM_WR_REG(0x0020,pActiveWin->tlPX);
    LCM_WR_REG(0x0021,pActiveWin->tlPY);

    LCDD_BUILD_CMD_WR_CMD(cmd,0,0x0022);

    while(HAL_ERR_NO != hal_GoudaBlitRoi(pRoi, 1, cmd, lcddp_GoudaBlitHandler));
#endif
}