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

📄 _fs_flushbuf.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_FLUSHBUF.C 
 *      Purpose: Low level File Flush Buffer 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"

/*--------------------------- __flushbuf ------------------------------------*/

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

   fcb = &_iob[handle];
   if (!(fcb->flags & _IOWRT)) {
      /* File not opened for write */
      fcb->flags |= _IOERR;
      return (-1);
   }
   if (fcb->drive == DRV_MCARD) {
      return (0);
   }
   if (fcb->flags & _IOWALLOC) {
      /* buffer present and buffered I/O requested */
      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);
      /* Always write on 4-byte boundaries. */
      fcb->_ftop -= sizeof (FALLOC);
      fcb->_fbot = (fcb->_fbot + 3) & ~3;
      fcb->flags &= ~_IOWALLOC;
   }
   return (0);
}

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

⌨️ 快捷键说明

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