📄 nfc.cpp
字号:
//------------------------------------------------------------------------------
//
// Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved
// THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
// BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
// Freescale Semiconductor, Inc.
//
//------------------------------------------------------------------------------
#include "bsp.h"
//-----------------------------------------------------------------------------
// External Functions
//-----------------------------------------------------------------------------
// External Variables
extern "C" PCSP_NANDFC_REGS g_pNFC;
//-----------------------------------------------------------------------------
// Defines
//-----------------------------------------------------------------------------
// Types
//-----------------------------------------------------------------------------
// Global Variables
//-----------------------------------------------------------------------------
// Local Variables
//-----------------------------------------------------------------------------
// Local Functions
//-----------------------------------------------------------------------------
//
// Function: NFCAlloc
//
// This function maps the NFC peripheral, configures interupts, and
// configures NFC DMA support.
//
// Parameters:
// None.
//
// Returns:
// Returns TRUE on success. Returns FALSE on failure.
//
//-----------------------------------------------------------------------------
BOOL NFCAlloc(VOID)
{
// Map peripheral physical address to virtual address
g_pNFC = (PCSP_NANDFC_REGS) OALPAtoUA(CSP_BASE_REG_PA_NANDFC);
// Check if virtual mapping failed
if (g_pNFC == NULL)
{
OALMSG(1, (_T("NFCAlloc: MmMapIoSpace failed!\r\n")));
return FALSE;
}
return TRUE;
}
//-----------------------------------------------------------------------------
//
// Function: NFCWait
//
// This functions waits for the pending NANDFC opeation to complete.
//
// Parameters:
// bPoll
// [in] - Ignored. Bootloader always polls for completion.
//
// Returns:
// None.
//
//-----------------------------------------------------------------------------
VOID NFCWait(BOOL bPoll)
{
while (!(INREG16(&g_pNFC->NAND_FLASH_CONFIG2) & CSP_BITFMASK(NANDFC_NAND_FLASH_CONFIG2_INT)));
// Clear the NANDFC interrupt
CLRREG16(&g_pNFC->NAND_FLASH_CONFIG2,
CSP_BITFMASK(NANDFC_NAND_FLASH_CONFIG2_INT));
}
//-----------------------------------------------------------------------------
//
// Function: NFCSetClock
//
// This enables/disable clocks for the NANDFC.
//
// Parameters:
// None.
//
// Returns:
// Returns TRUE on success. Returns FALSE on failure.
//
//-----------------------------------------------------------------------------
BOOL NFCSetClock(BOOL bEnabled)
{
// Bootloader does not use clock gating, just return success
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -