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

📄 sdmmc.c

📁 arm4 driver for freescale imx35
💻 C
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//------------------------------------------------------------------------------
//
//  File:  eth.c
//
//  This file implements bootloader functions related to SD/MMC download
//  
#include <eboot.h>
#include <sdfat.h>

//------------------------------------------------------------------------------
//
//  Static: g_ethState
//
//  This structure contains local state variables.
//
FILEINFO g_fnFileInfo;

//------------------------------------------------------------------------------
//
//  Function:  BLSDMMCDownload
//
//  This function initialize SD/MMC controller and file system
//
UINT32 BLSDMMCDownload(BOOT_CFG *pConfig, OAL_KITL_DEVICE *pBootDevices)
{
    if(!FATInitDisk()){
        return BL_ERROR;
    }
    if(!FATOpenFile(&g_fnFileInfo, pConfig->binName)){
        OALMSG(OAL_ERROR, (L"ERROR: cann't open image file'%S'\r\n", pConfig->binName));
        return BL_ERROR;
    }
    return BL_DOWNLOAD;
}

//------------------------------------------------------------------------------
//
//  Function:  BLSDMMCReadData
//
//  Read data from SD/MMC card through FAT file system
//
BOOL BLSDMMCReadData(DWORD cbData, LPBYTE pbData)
{
    if(FATReadFile(&g_fnFileInfo, pbData, cbData) != cbData){
        OALMSG(OAL_ERROR, (L"ERROR: read image data failure\r\n"));
        return FALSE;
    }
    else{
        return TRUE;
    }
}

⌨️ 快捷键说明

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