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

📄 msapi_flash.c

📁 mstar 776 开发的车载dvd
💻 C
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (¨MStar Confidential Information〃) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//
/// @file msAPI_Flash.h
/// @brief API for Flash
/// @author MStar Semiconductor, Inc.
///
////////////////////////////////////////////////////////////////////////////////

#define MSAPI_FLASH_C

/******************************************************************************/
/*                              Header Files                                  */
/******************************************************************************/
// C Library
#include <stdio.h>

// Global Layer
#include "sysinfo.h"

// Driver Layer
#include "DrvFlash.h"

// API Layer
#include "msAPI_Flash.h"


/******************************************************************************/
/*                                 Macro                                      */
/******************************************************************************/
#define APIFLASH_DBG(y) //y

/******************************************************************************/
/*                                 Local                                      */
/******************************************************************************/

/******************************************************************************/
/*                               Functions                                    */
/******************************************************************************/

/********************************************************************************/
/// API to write data to flash
/// @param -u32FlashAddr \b IN: Starting address in flash to write
/// @param -u32size \b IN: Total size to write
/// @param -pdat \b IN: Pointer to the data buffer which is going to be written to flash
/// @par Function Actions:
/********************************************************************************/
BOOLEAN msAPI_Flash_Write(U32 u32FlashAddr, U32 u32size, U8* pdat)
{
    return MDrv_Flash_Write(u32FlashAddr, u32size, pdat);
}

/********************************************************************************/
/// API to set flash write protected
/********************************************************************************/
BOOLEAN msAPI_Flash_WriteProtect(BOOLEAN bEnable)
{
    return MDrv_Flash_WriteProtect(bEnable);
}

/********************************************************************************/
/// API to erase data from flash
/// @param -u32start \b IN : Starting sector in flash to Erase
/// @param -u32end \b IN : End sector in flash to Erase
/********************************************************************************/
BOOLEAN msAPI_Flash_EraseSector(U32 u32start, U32 u32end)
{
    return MDrv_Flash_Erase(u32start, u32end, TRUE);
}

/********************************************************************************/
/// API to read data from flash
/// @param -u32addr \b IN : Starting address in flash to Read
/// @param -u32size \b IN : Total size to Read
/// @param -pdat \b IN : Pointer to return data buffer
/********************************************************************************/
BOOLEAN msAPI_Flash_Read(U32 u32addr, U32 u32size, U8* pdat)
{
    return MDrv_Flash_Read(u32addr, u32size, pdat);
}

/********************************************************************************/
/// API to get the fixed block size (in bytes) used for erase
/********************************************************************************/
U32 msAPI_Flash_GetBlockSize(void)
{
    //return MDrv_Flash_GetEraseBlockSize();
    return SERFLASH_BLOCK_SIZE;
}

/********************************************************************************/
/// API to get the sector size (in bytes)
/********************************************************************************/
U32 msAPI_Flash_GetSectorSize(void)
{
    return SERFLASH_SECTOR_SIZE;
}

#undef MSAPI_FLASH_C

⌨️ 快捷键说明

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