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

📄 _fs_fdelete.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_FDELETE.C 
 *      Purpose: Low level File Delete 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 <stdio.h>
#include <rt_sys.h>
#include <rt_misc.h>
#include "File_Config.h"

/*--------------------------- _fdelete --------------------------------------*/

int _fdelete (IOB *fcb) {
   /* Low level file delete function. */
   FALLOC fa;
   U32 i,bl,adr,invalid;

   invalid = ~fcb->InitVal;
   bl = fcb->_fblock;
   for (i = 0; i < fcb->NumSect; i++) {
      /* Search for file blocks identified with identification 'fileID' */
      adr = fs_adr_sig (bl, fcb);
      adr = fs_rd_sig (adr, &fa.end);
      if (fa.end != fcb->InitVal) {
         do {
            adr = fs_rd_alloc (adr, &fa);
            if ((fa.fileID & 0x7FFF) == fcb->fileID) {
               /* Clear the fileID & index values */
               fs_WriteBlock ((adr & ~1) + 12, &invalid, 4, fcb);
            }
         } while (fa.end != fcb->InitVal);

         /* Check if this Flash Block is all invalidated */
         if (fs_BlockInvalid (bl, fcb) == __TRUE) {
            /* All file blocks stored in this Flash Block are invalid */
            fs_InitBlock (bl, fcb);
         }
      }
      if (++bl == fcb->NumSect) {
         bl = 0;
      }
   }
   return (0);
}

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


⌨️ 快捷键说明

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