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

📄 bsppp.cpp

📁 mx27 f14v2 源代码。包括ADS板上诸多驱动的源码。
💻 CPP
字号:
//
// Copyright (C) 2004-2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------
//
// File: bsppp.c
//
// Provides BSP-specific configuration routines for the Post-Processing.
//
//------------------------------------------------------------------------------
#include "bsp.h"

//------------------------------------------------------------------------------
// External Functions

//------------------------------------------------------------------------------
// External Variables

//------------------------------------------------------------------------------
// Defines

//------------------------------------------------------------------------------
// Types

//------------------------------------------------------------------------------
// Global Variables

//------------------------------------------------------------------------------
// Local Variables
static PBSP_ARGS g_pDriverGlobal;

//------------------------------------------------------------------------------
// Local Functions

//------------------------------------------------------------------------------
//
// Function: BSPPpAlloc
//
// This function is for BSP-specific allocation.
//
// Parameters:
//      None.
//
// Returns:
//      TRUE if successful; FALSE if failed.
//
//------------------------------------------------------------------------------
BOOL BSPPpAlloc()
{
    PHYSICAL_ADDRESS phyAddr;
    
    phyAddr.QuadPart = IMAGE_SHARE_ARGS_RAM_PA_START;
    g_pDriverGlobal = (PBSP_ARGS)MmMapIoSpace(phyAddr, 
        sizeof(BSP_ARGS), FALSE);
    if (g_pDriverGlobal == NULL) {
        // Error messages will be printed in CSP
        return FALSE;
    }

    return TRUE;
}

//------------------------------------------------------------------------------
//
// Function: BSPPpDealloc
//
// This function is for BSP-specific deallocation.
//
// Parameters:
//      None.
//
// Returns:
//      None.
//
//------------------------------------------------------------------------------
void BSPPpDealloc()
{
    if (g_pDriverGlobal != NULL) {
        MmUnmapIoSpace(g_pDriverGlobal, sizeof(BSP_ARGS));
        g_pDriverGlobal =   NULL;
    }
}

//------------------------------------------------------------------------------
//
// Function: BSPPpSetClockGatingMode
//
// This function enable or disable eMMA clock.
//
// Parameters:
//      bEnable
//          [in] Boolean indicates enable or disable.
//
// Returns:
//      TRUE if successful; FALSE if failed.
//
//------------------------------------------------------------------------------
BOOL BSPPpSetClockGatingMode(BOOL bEnable)
{
    if (bEnable) 
    {
        if (g_pDriverGlobal->emma.usingStatus == 0)
        {
            // Enable eMMA clock        
            DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_EMMA, 
                DDK_CLOCK_GATE_MODE_ENABLE);
            DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_HCLK_EMMA, 
                DDK_CLOCK_GATE_MODE_ENABLE);
        }
        else
        {
            if (g_pDriverGlobal->emma.usingStatus & EMMA_PP_USING_FLAG)
            {
                // Probably already used by someone
                return FALSE;
            }
        }

        // Set PP using status
        g_pDriverGlobal->emma.usingStatus |= EMMA_PP_USING_FLAG;

    }
    else
    {
        if ((g_pDriverGlobal->emma.usingStatus & (~EMMA_PP_USING_FLAG)) == 0)
        {
            // Disable eMMA clock
            DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_EMMA, 
                DDK_CLOCK_GATE_MODE_DISABLE);
            DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_HCLK_EMMA, 
                DDK_CLOCK_GATE_MODE_DISABLE);
        }
            
        // Clear PP using status
        g_pDriverGlobal->emma.usingStatus &= ~EMMA_PP_USING_FLAG;
    }

    return TRUE;
}

//------------------------------------------------------------------------------
//
// Function: BSPSetPpBufferThreadPriority
//
// This function sets the thread priority for the post-processing buffer.
// worker thread.
//
// Parameters:
//      None.
//
// Returns:
//      None.
//
//------------------------------------------------------------------------------
void BSPSetPpBufferThreadPriority()
{
    CeSetThreadPriority(GetCurrentThread(), 100);
    return;
}

//------------------------------------------------------------------------------
//
// Function: BSPSetPpIntrThreadPriority
//
// This function sets the thread priority for the post-processor.
//
// Parameters:
//      None.
//
// Returns:
//      None.
//
//------------------------------------------------------------------------------
void BSPSetPpIntrThreadPriority()
{
    CeSetThreadPriority(GetCurrentThread(), 100);
    return;
}

⌨️ 快捷键说明

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