cachesync.c

来自「Sirf/Centrality公司GPS平台AtlasIII芯片AT640的Nb」· C语言 代码 · 共 50 行

C
50
字号
//
// Copyright (c) Centralty Communications Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Module Name:	CacheSync.c

Abstract:		  
-----------------------------------------------------------------------------*/

#include "cachesync.h"
#include "at4x0f.h"

DWORD dwCacheInfo;

// drain the post-write FIFO of the RISK interface
__inline void DrainPostWriteFIFO(void)
{
	int t;

	// drain the 1st post-write FIFO
	RISCINT_FIFO_FLUSH = 3; // flush & auto-flush enable
	// drain the 2nd post-write FIFO, move pointer to the 1st FIFO
	RISCINT_FIFO_FLUSH = 3; // flush & auto-flush enable
	// wait
	for (t = 10000; t && !(RISCINT_FIFO_FLUSH & 0x04); t--);
	if (t == 0)
	{
		//NandDbgPutString("flush post-write fifo timeout!\r\n");
	}
}

void CacheRangeFlush(PVOID pAddr, DWORD dwLen, DWORD dwFlag)
{
	DWORD dwNormalizedAddress;
    DWORD dwNormalizedLength;

	dwNormalizedAddress = (DWORD) pAddr & ~(DCACHE_LINE_SIZE - 1);
	dwNormalizedLength = dwLen + ((DWORD) pAddr - dwNormalizedAddress);
	ARMFlushDCacheLines((void*) dwNormalizedAddress, dwNormalizedLength, DCACHE_LINE_SIZE);
	DrainPostWriteFIFO(); // drain post-write buffer
}

⌨️ 快捷键说明

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