⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipu_adc.cpp

📁 Freescale ARM11系列CPU MX31的WINCE 5.0下的BSP
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// Set shape of the pointer.
//
// Parameters:
//      pMask
//          [in] Pointer to a mask containing the cursor shape.
//      pColorSurf
//          [in] Pointer to a surface specifying the colors to use for the
//               cursor.
//      xHot
//          [in] Horizontal location of the cursor's hot spot.
//      yHot
//          [in] Vertical location of the cursor's hot spot.
//      cx
//          [in] Width of the cursor.
//      cy
//          [in] Height of the cursor.
//
// Returns:
//      S_OK is successful; E_INVALIDARG is the input parameters are invalid.
//
//------------------------------------------------------------------------------
SCODE IPU_ADC::SetPointerShape(GPESurf *pMask,
                               GPESurf *pColorSurf,
                               int xHot,
                               int yHot,
                               int cx,
                               int cy)
{
#ifdef POINTER_ENABLE



    return S_OK;
#else
    // According to Macallan Manual -- If the platform uses a stylus or
    // a shell without a pointer, no cursor is necessary, and the GPE
    // pointer methods can return S_OK without doing any work.

    return S_OK;
#endif
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::MovePointer
//
// Move pointer
//
// Parameters:
//      x
//          [in] Horizontal screen location to move the cursor to. Applications
//               can pass a value of -1 to hide the cursor.
//      y
//          [in] Vertical screen location to move the cursor to.
//
// Returns:
//      S_OK if successful.
//
//------------------------------------------------------------------------------
SCODE IPU_ADC::MovePointer(int x, int y)
{
#ifdef POINTER_ENABLE


    return S_OK;
#else
    // According to Macallan Manual -- If the platform uses a stylus or a shell
    // without a pointer, no cursor is necessary, and the GPE pointer methods
    // can return S_OK without doing any work.

    return S_OK;
#endif
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::WaitForNotBusy
//
// Wait until the hardware is not busy.
//
// Parameters:
//
// Returns:
//
//------------------------------------------------------------------------------
void IPU_ADC::WaitForNotBusy()
{
    return;
}

//------------------------------------------------------------------------------
//
// Function: IPU_ADC::IsBusy
//
// Query if the hardware is busy
//
// Parameters:
//
// Returns:
//      TRUE if the hardware is busy; FALSE if it is not.
//
//------------------------------------------------------------------------------
int IPU_ADC::IsBusy()
{
    return FALSE;   // Never busy as there is no acceleration
}

void IPU_ADC::GetPhysicalVideoMemory(unsigned long *physicalMemoryBase,
                                     unsigned long *videoMemorySize)
{
    DEBUGMSG (GPE_ZONE_INIT, (TEXT("RGPEFlat::GetPhysicalVideoMemory\r\n")));

    *physicalMemoryBase = (unsigned long)m_pVirtualFrameBuffer;
    *videoMemorySize = m_nScreenWidth * m_nScreenHeight * 3;
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::AllocSurface
//
// Allocate a surface.
//
// Parameters:
//      ppSurf
//          [out] Pointer to the memory allocated by the GPE::AllocSurface method.
//      width
//          [in] Width, in pixels, of the surface to allocate.
//      height
//          [in] Height, in pixels, of the surface to allocate.
//      format
//          [in] Format of the surface.
//      surfaceFlags
//          [in] One of the flags GPE_REQUIRE_VIDEO_MEMORY or
//               GPE_PREFER_VIDEO_MEMORY, which specify where to allocate the
//               memory
//
// Returns:
//      S_OK if successful.
//
//------------------------------------------------------------------------------
SCODE IPU_ADC::AllocSurface(GPESurf **ppSurf,
                            int width,
                            int height,
                            EGPEFormat format,
                            int surfaceFlags)
{
    DEBUGMSG(GPE_ZONE_CREATE, (TEXT("+%s()\r\n"), __WFUNCTION__));

    if (surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY) {
        // Can't allocate video-memory surfaces in the IPU_ADC environment
        return E_OUTOFMEMORY;
    }

    // Allocate from system memory
    DEBUGMSG(GPE_ZONE_CREATE,
             (TEXT("Creating a GPESurf in system memory. EGPEFormat = %d\r\n"),
             (int)format ));

    *ppSurf = new GPESurf(width, height, format);

    if(*ppSurf) {
        // check we allocated bits succesfully
        if( !((*ppSurf)->Buffer()) ) {
            delete *ppSurf; // and then return E_OUTOFMEMORY
        } else {
            return S_OK;
        }
    }

    DEBUGMSG(GPE_ZONE_CREATE, (TEXT("-%s()\r\n"), __WFUNCTION__));
    return E_OUTOFMEMORY;
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::Line
//
// Draw line.
//
// Parameters:
//      pLineParms
//          [in] Pointer to a GPELineParms structure containing parameters for
//               the line.
//      phase
//          [in] one of the following table values
//                  gpeSingle
//                  gpePrepare
//                  gpeContinue
//                  gpeComplete
//
// Returns:
//      S_OK if successful.
//
//------------------------------------------------------------------------------
SCODE IPU_ADC::Line(GPELineParms *pLineParms, EGPEPhase phase)
{
    DEBUGMSG(GPE_ZONE_LINE, (TEXT("+%s()\r\n"), __WFUNCTION__));

    if( phase == gpeSingle || phase == gpePrepare )
    {
        pLineParms->pLine = EmulatedLine;
    }

    DEBUGMSG(GPE_ZONE_LINE, (TEXT("-%s()\r\n"), __WFUNCTION__));
    return S_OK;
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::ContrastControl
//
// Sorfware contrast control method
//
// Parameters:
//      cmd
//          [in] contrast control command, is one of:
//                  CONTRAST_CMD_GET - gets the current contrast setting;
//                  CONTRAST_CMD_SET - sets the new contrast setting;
//                  CONTRAST_CMD_INCREASE - increases the current contrast setting;
//                  CONTRAST_CMD_DECREASE - increases the current contrast setting;
//                  CONTRAST_CMD_DEFAULT - Applies the default contrast setting.
//                                         The parm member is ignored;
//                  CONTRAST_CMD_MAX - Applies the maximum contrast setting.
//
//      pValue
//          [in/out] Device dependent contrast value. If Cmd == CONTRAST_CMD_SET,
//                   pValue points to the new contrast setting. For all other
//                   cases, it points to the location to store the new contrast
//                   setting.  This parameter may not be NULL.
// Returns:
//      TRUE if successful.
//
//------------------------------------------------------------------------------
BOOL IPU_ADC::ContrastControl(ULONG cmd, ULONG *pValue)
{
    BOOL bRet = FALSE;
    ULONG currentContrast;

    if (pValue == NULL)
    {
        DEBUGMSG(GPE_ZONE_ERROR,
                 (TEXT("%s(): Invalid Parameter!\r\n"), __WFUNCTION__));
        return FALSE;
    }

    currentContrast = EXTREG32(&g_pIPU->SDC_CUR_BLINK_PWM_CTRL,
                               CSP_BITFMASK(IPU_SDC_CUR_BLINK_PWM_CTRL_PWM),
                               IPU_SDC_CUR_BLINK_PWM_CTRL_PWM_LSH);

    switch (cmd)
    {
        case CONTRAST_CMD_GET:
            *pValue = currentContrast;
            bRet = TRUE;
            break;

        case CONTRAST_CMD_SET:
            if (*pValue <LCD_CONTRAST_MIN || *pValue>LCD_CONTRAST_MAX) {
                DEBUGMSG(GPE_ZONE_ERROR,
                         (TEXT("%s(): Invalid Parameter %d!\r\n"),
                         __WFUNCTION__, *pValue));
                return FALSE;
            } else {
                bRet=TRUE;
            }
            break;

        case CONTRAST_CMD_INCREASE:
            currentContrast += LCD_CONTRAST_STEP;
            if (currentContrast > LCD_CONTRAST_MAX) {
                currentContrast = LCD_CONTRAST_MAX;
            }
            *pValue = currentContrast;
            bRet = TRUE;
            break;

        case CONTRAST_CMD_DECREASE:
            currentContrast -= LCD_CONTRAST_STEP;
            if (currentContrast < LCD_CONTRAST_MIN) {
                currentContrast = LCD_CONTRAST_MIN;
            }
            *pValue = currentContrast;
            bRet  =  TRUE;
            break;

        case CONTRAST_CMD_DEFAULT:
            *pValue = LCD_CONTRAST_DEFAULT;
            bRet = TRUE;
            break;

        case CONTRAST_CMD_MAX:
            *pValue = LCD_CONTRAST_MAX;
            bRet = TRUE;
            break;

        default:
            // bad command
            break;
    }

    return bRet;
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::PowerHandler
//
// This function handles POWER_UP and POWER_DOWN notifications.
//
// Parameters:
//      bOff
//          [in] If TRUE, power down the device, otherwise power on the device.
//
// Returns:
//      None.
//
//------------------------------------------------------------------------------
VOID IPU_ADC::PowerHandler(BOOL bOff)
{
    if (bOff)
    {
        DisableADC();
    }
    else
    {
        InitializeADC(width, height, bpp);
        EnableADC();
    }
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::InVBlank
//
// Chech if it is in VBlank period.
//
// Parameters:
//
// Returns:
//     TRUE if it is in VBlank period.
//
//------------------------------------------------------------------------------
int IPU_ADC::InVBlank()
{
    // Never in vertical blank since this is not a CRT display.
    return FALSE;
}

//------------------------------------------------------------------------------
//
// Function: IPU_ADC::SetPalette
//
// Set palette
//
// Parameters:
//      src
//          [in] Array of PALETTEENTRY.
//      firstEntry
//          [in] First entry in the array.
//      numEntries
//          [in] Number of the entries.
//
// Returns:
//      S_OK if successful.
//
//------------------------------------------------------------------------------
SCODE IPU_ADC::SetPalette(const PALETTEENTRY *src,
                           unsigned short firstEntry,
                           unsigned short numEntries)
{
    // This function shouldn't be called.  We are using 24 bpp, no palette is
    // used.  This function must be included bacause it is a virtual method in
    // class GPE.
    return S_OK;
}


//------------------------------------------------------------------------------
//
// Function: IPU_ADC::DrvEscape
//
// This method retrieves information from a device that is not available in a
// device-independent DDI. This function operates the same as on Windows-based
// desktop platforms, but Windows CE does not support the DrvDrawEscape function.
// DrvEscape is used for retrieving information from a device that is not
// available in a device-independent device driver interface; the particular
// query depends on the value of the iEsc parameter.
//
// Parameters:
//      pso
//          [in] Pointer to a SURFOBJ structure that describes the surface to

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -