diff options
author | Kevin | 2014-11-15 11:48:36 +0800 |
---|---|---|
committer | Kevin | 2014-11-15 11:48:36 +0800 |
commit | d04075478d378d9e15f3e1abfd14b0bd124077d4 (patch) | |
tree | 733dd964582f388b9e3e367c249946cd32a2851f /cpu/arm920t/wmt/mem.c | |
download | FOSSEE-netbook-uboot-source-d04075478d378d9e15f3e1abfd14b0bd124077d4.tar.gz FOSSEE-netbook-uboot-source-d04075478d378d9e15f3e1abfd14b0bd124077d4.tar.bz2 FOSSEE-netbook-uboot-source-d04075478d378d9e15f3e1abfd14b0bd124077d4.zip |
init commit via android 4.4 uboot
Diffstat (limited to 'cpu/arm920t/wmt/mem.c')
-rwxr-xr-x | cpu/arm920t/wmt/mem.c | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/cpu/arm920t/wmt/mem.c b/cpu/arm920t/wmt/mem.c new file mode 100755 index 0000000..dbeadad --- /dev/null +++ b/cpu/arm920t/wmt/mem.c @@ -0,0 +1,113 @@ +/*++ +Copyright (c) 2010 WonderMedia Technologies, Inc. + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. You +should have received a copy of the GNU General Public License along with this +program. If not, see http://www.gnu.org/licenses/>. + +WonderMedia Technologies, Inc. +10F, 529, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C. +--*/ + + +/*#ifndef _GLOBAL_H_ +#include "global.h" +#endif +#ifndef _EXTVARS_H_ +#include "extvars.h" +#endif*/ + +#if !defined(__TMACRO_H__) +#include "tmacro.h" +#endif +#if !defined(__MEM_H__) +#include "mem.h" +#endif +#include <malloc.h> +#include "macif.h" + +/*--------------------- Static Definitions -------------------------*/ + +/*--------------------- Static Classes ----------------------------*/ + +/*--------------------- Static Variables --------------------------*/ +extern PVOID g_pvBufferIndex; + +/*--------------------- Static Functions --------------------------*/ + +/*--------------------- Export Variables --------------------------*/ + +/*--------------------- Export Functions --------------------------*/ + +VOID +MEMvAlign( + PSAllocMap pamMem, + UINT uBoundary + ) +{ + ULONG ulAlignmentOffset = 0; + + if ((pamMem->dwRawVAddr % uBoundary) != 0) + ulAlignmentOffset = uBoundary - (pamMem->dwRawVAddr % uBoundary); + pamMem->dwVAddr = pamMem->dwRawVAddr + ulAlignmentOffset; + pamMem->dwPAddr = LODWORD(pamMem->qwRawPAddr) + ulAlignmentOffset; +} + +/*PVOID +MEMvAllocate( + UINT uCount + ) +{ + PVOID pvMemAddr; + + pvMemAddr = g_pvBufferIndex; + g_pvBufferIndex += uCount; + + return pvMemAddr; +}*/ + +VOID +MEMvAllocateShared( + PSAllocMap pamMem + ) +{ + if (!g_bInit) + pamMem->dwRawVAddr = (DWORD)mALLOc((size_t)pamMem->dwRawSize * (size_t)sizeof(BYTE)); + + /* If allocation failed, virtual/phisical address == NULL */ + if ((PVOID)pamMem->dwRawVAddr == NULL) { + LODWORD(pamMem->qwRawPAddr) = 0; + HIDWORD(pamMem->qwRawPAddr) = 0; + return; + } else + memset((PVOID)pamMem->dwRawVAddr, 0, (size_t)pamMem->dwRawSize * (size_t)sizeof(BYTE)); + + LODWORD(pamMem->qwRawPAddr) = pamMem->dwRawVAddr; + HIDWORD(pamMem->qwRawPAddr) = 0; +} + +VOID +MEMvCopy( + PVOID pvDst, + PVOID pvSrc, + UINT uCount + ) +{ + memcpy(pvDst, pvSrc, uCount); +} + +VOID +MEMvSet( + PVOID pvDst, + BYTE byPattern, + UINT uCount + ) +{ + memset(pvDst, byPattern, uCount); +} |