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

📄 mfcmemory.c

📁 SAMSUNG S3C6410 CPU BSP for winmobile6
💻 C
字号:
/*
 * Project Name MFC DRIVER
 * Copyright  2007 Samsung Electronics Co, Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information
 * of Samsung Electronics  ("Confidential Information").
 * you shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Samsung Electronics
 *
 * This source file is for setting physical memory.
 *
 * @name MFC DRIVER MODULE Module (MfcMemory.c)
 * @author Jiun, Yu(jiun.yu@samsung.com)
 * @date 03-28-07
 */

#include <windows.h>
#include <DrvLib.h>
#include "LogMsg.h"

void *Phy2Vir_AddrMapping(unsigned int phy_addr, int mem_size)
{
    void *mappedAddr = NULL;

    mappedAddr = DrvLib_MapIoSpace(phy_addr, mem_size, FALSE);
    if (mappedAddr == NULL)
    {
        RETAILMSG(1, (L"[MFC:ERR] Phy2Vir_AddrMapping() : Mapping Failed [PA:0x%08x]\n\r", phy_addr));
    }

    return mappedAddr;
}

void *Mem_Alloc(unsigned int size)
{
    void    *alloc_mem;

    alloc_mem = (void *) malloc(size);
    if (alloc_mem == NULL) {
        LOG_MSG(LOG_ERROR, "Mem_Alloc", "memory allocation failed!\r\n");
        return NULL;
    }

    return alloc_mem;
}

void Mem_Free(void *addr)
{
    free(addr);
}

void *Mem_Cpy(void *dst, const void *src, int size)
{
    return memcpy(dst, src, size);
}

int   Mem_Set(void *dst, int value, int size)
{
    memset(dst, value, size);

    return value;
}

int Copy_From_User(void *to, const void *from, unsigned long n)
{
    return (int)memcpy(to, from, n);
}

int Copy_To_User(void *to, const void *from, unsigned long n)
{
    return (int)memcpy(to, from, n);
}

⌨️ 快捷键说明

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