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

📄 _fs_fclose.c

📁 keil arm flash fs 最新版 在Keil arm下使用
💻 C
字号:
/*----------------------------------------------------------------------------
 *      R T L  -  F l a s h   F i l e   S y s t e m
 *----------------------------------------------------------------------------
 *      Name:    _FS_FCLOSE.C 
 *      Purpose: Low level File Close Function
 *      Rev.:    V3.22
 *----------------------------------------------------------------------------
 *      This code is part of the RealView Run-Time Library.
 *      Copyright (c) 2004-2008 KEIL - An ARM Company. All rights reserved.
 *---------------------------------------------------------------------------*/

#include "File_Config.h"

/*--------------------------- __fclose --------------------------------------*/

int __fclose (int handle) {
   /* Low level file close function. */
   FALLOC alloc;
   IOB *fcb;

   fcb = &_iob[handle];
   if (fcb->drive == DRV_MCARD) {
      /* Close a file opened on Flash Card. */
      if (fcb->flags & _IOWRT) {
         fat_close_write (fcb);
      }
      goto x;
   }
   if ((fcb->flags & _IOWRT) && (fcb->flags & _IOWALLOC)) {
      /* Write File Allocation Information to Flash */
      alloc.end    = fcb->_fbot;
      alloc.fileID = fcb->fileID;
      alloc.index  = fcb->_fidx;
      fs_WriteBlock (((DEVCONF *)fcb->DevCfg)[fcb->_fblock].bStart + fcb->_ftop,
                      &alloc, sizeof (FALLOC), fcb);
   }
x: fcb->fileID = 0;
   fcb->flags  = 0;
   return (0);
}

/*----------------------------------------------------------------------------
 * end of file
 *---------------------------------------------------------------------------*/

⌨️ 快捷键说明

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