• PUDN用户
    了解作者
  • C/C++
    开发工具
  • 46KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 9
    下载次数
  • 2010-03-18 21:35
    上传日期
[struts+hibernateOA.rar] - the procedures used to achieve the Apache struts oa office system, a partial function, has ye in the above experiments, compilation of language, the process is transferred links. :) [slaa281a.zip] - TI s MSP430 connection with the SD Card Drivers test version [multi-ice-ddd.tar.gz] - in Linux and multi-ice connectivity, used to debug the Linux source code [at91sam7s64mp3.rar] - atmelsam7s64 do mp3 decoding of the source [Mp3.rar] - mp3 decoder detailed algorithm flow, as well as the mp3 file format specific introduction [Program-Keil.rar] - arm7 lpc2132+ VS1003+ sdcard produced MP3 in KEIL3 under this program to compile
sadqwe.rar
  • src_minimal
  • tff.c
    57.3KB
  • tff.i
    69.9KB
  • vs1001.i
    13.9KB
  • vs1001.c
    6.7KB
  • mmc.h
    4.9KB
  • types.h
    1.7KB
  • vs1001.h
    4.2KB
  • tff.h
    10.4KB
  • mmc.i
    25.4KB
内容介绍
/*----------------------------------------------------------------------------/ / FatFs - Tiny FAT file system module R0.06 (C)ChaN, 2008 /-----------------------------------------------------------------------------/ / The FatFs module is an experimenal project to implement FAT file system to / cheap microcontrollers. This is a free software and is opened for education, / research and development under license policy of following trems. / / Copyright (C) 2008, ChaN, all right reserved. / / * The FatFs module is a free software and there is no warranty. / * You can use, modify and/or redistribute it for personal, non-profit or / commercial use without any restriction under your responsibility. / * Redistributions of source code must retain the above copyright notice. / /-----------------------------------------------------------------------------/ / Feb 26,'06 R0.00 Prototype. / / Apr 29,'06 R0.01 First stable version. / / Jun 01,'06 R0.02 Added FAT12 support. / Removed unbuffered mode. / Fixed a problem on small (<32M) patition. / Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM). / / Sep 22,'06 R0.03 Added f_rename(). / Changed option _FS_MINIMUM to _FS_MINIMIZE. / Dec 09,'06 R0.03a Improved cluster scan algolithm to write files fast. / / Feb 04,'07 R0.04 Added FAT32 supprt. / Changed some interfaces incidental to FatFs. / Changed f_mountdrv() to f_mount(). / Apr 01,'07 R0.04a Added a capability of extending file size to f_lseek(). / Added minimization level 3. / Fixed a problem in FAT32 support. / May 05,'07 R0.04b Added a configuration option _USE_NTFLAG. / Added FSInfo support. / Fixed some problems corresponds to FAT32 support. / Fixed DBCS name can result FR_INVALID_NAME. / Fixed short seek (<= csize) collapses the file object. / / Aug 25,'07 R0.05 Changed arguments of f_read() and f_write(). / Feb 03,'08 R0.05a Added f_truncate() and f_utime(). / Fixed off by one error at FAT sub-type determination. / Fixed btr in f_read() can be mistruncated. / Fixed cached sector is not flushed when create and close / without write. / / Apr 01,'08 R0.06 Added f_forward(), fputc(), fputs(), fprintf() and fgets(). / Improved performance of f_lseek() on moving to the same / or following cluster. /---------------------------------------------------------------------------- */ #include <mega128.h> #include <stdio.h> #include <string.h> #include "tff.h" /* Tiny-FatFs declarations */ #include "diskio.h" /* Include file for user provided disk functions */ static FATFS *FatFs; /* Pointer to the file system objects (logical drive) */ static WORD fsid; /* File system mount ID */ /*------------------------------------------------------------------------- Module Private Functions -------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/ /* Change window offset */ /*-----------------------------------------------------------------------*/ static BOOL move_window ( /* TRUE: successful, FALSE: failed */ DWORD sector /* Sector number to make apperance in the FatFs->win */ ) /* Move to zero only writes back dirty window */ { DWORD wsect; FATFS *fs = FatFs; wsect = fs->winsect; if (wsect != sector) { /* Changed current window */ #if !_FS_READONLY BYTE n; if (fs->winflag) { /* Write back dirty window if needed */ if (disk_write(0, fs->win, wsect, 1) != RES_OK) return FALSE; fs->winflag = 0; if (wsect < (fs->fatbase + fs->sects_fat)) { /* In FAT area */ for (n = fs->n_fats; n >= 2; n--) { /* Refrect the change to all FAT copies */ wsect += fs->sects_fat; disk_write(0, fs->win, wsect, 1); } } } #endif if (sector) { if (disk_read(0, fs->win, sector, 1) != RES_OK) return FALSE; fs->winsect = sector; } } return TRUE; } DWORD get_fattime () { return 1; } /*-----------------------------------------------------------------------*/ /* Clean-up cached data */ /*-----------------------------------------------------------------------*/ #if !_FS_READONLY static FRESULT sync (void) /* FR_OK: successful, FR_RW_ERROR: failed */ { FATFS *fs = FatFs; fs->winflag = 1; if (!move_window(0)) return FR_RW_ERROR; #if _USE_FSINFO /* Update FSInfo sector if needed */ if (fs->fs_type == FS_FAT32 && fs->fsi_flag) { fs->winsect = 0; memset(fs->win, 0, 512U); ST_WORD(&fs->win[BS_55AA], 0xAA55); ST_DWORD(&fs->win[FSI_LeadSig], 0x41615252); ST_DWORD(&fs->win[FSI_StrucSig], 0x61417272); ST_DWORD(&fs->win[FSI_Free_Count], fs->free_clust); ST_DWORD(&fs->win[FSI_Nxt_Free], fs->last_clust); disk_write(0, fs->win, fs->fsi_sector, 1); fs->fsi_flag = 0; } #endif /* Make sure that no pending write process in the physical drive */ if (disk_ioctl(0, CTRL_SYNC, NULL) != RES_OK) return FR_RW_ERROR; return FR_OK; } #endif /*-----------------------------------------------------------------------*/ /* Get a cluster status */ /*-----------------------------------------------------------------------*/ static CLUST get_cluster ( /* 0,>=2: successful, 1: failed */ CLUST clust /* Cluster# to get the link information */ ) { WORD wc, bc; DWORD fatsect; FATFS *fs = FatFs; if (clust >= 2 && clust < fs->max_clust) { /* Valid cluster# */ fatsect = fs->fatbase; switch (fs->fs_type) { case FS_FAT12 : bc = (WORD)clust * 3 / 2; if (!move_window(fatsect + bc / 512U)) break; wc = fs->win[bc % 512U]; bc++; if (!move_window(fatsect + bc / 512U)) break; wc |= (WORD)fs->win[bc % 512U] << 8; return (clust & 1) ? (wc >> 4) : (wc & 0xFFF); case FS_FAT16 : if (!move_window(fatsect + clust / 256)) break; return LD_WORD(&fs->win[((WORD)clust * 2) % 512U]); #if _FAT32 case FS_FAT32 : if (!move_window(fatsect + clust / 128)) break; return LD_DWORD(&fs->win[((WORD)clust * 4) % 512U]) & 0x0FFFFFFF; #endif } } return 1; /* Out of cluster range, or an error occured */ } /*-----------------------------------------------------------------------*/ /* Change a cluster status */ /*-----------------------------------------------------------------------*/ #if !_FS_READONLY static BOOL put_cluster ( /* TRUE: successful, FALSE: failed */ CLUST clust, /* Cluster# to change (must be 2 to fs->max_clust-1) */ CLUST val /* New value to mark the cluster */ ) { WORD bc; BYTE *p; DWORD fatsect; FATFS *fs = FatFs; fatsect = fs->fatbase; switch (fs->fs_type) { case FS_FAT12 : bc = (WORD)clust * 3 / 2; if (!move_window(fatsect + bc / 512U)) return FALSE; p = &fs->win[bc % 512U]; *p = (clust & 1) ? ((*p & 0x0F) | ((BYTE)val << 4)) : (BYTE)val; bc++; fs->winflag = 1; if (!move_window(fatsect + bc / 512U)) return FALSE; p = &fs->win[bc % 512U]; *p = (clust & 1) ? (BYTE)(val >> 4) : ((*p & 0xF0) | ((BYTE)(val >> 8) & 0x0F)); break; case FS_FAT16 : if (!move_window(fatsect + clust / 256)) return FALSE; ST_WORD(&fs->win[((WORD)clust * 2) % 512U], (WORD)val); break; #if _FAT32 case FS_FAT32 : if (!move_window(fatsect + clust / 128)) return FALSE; ST_DWORD(&fs->win[((WORD)clust * 4) % 512U], val); break; #endif default : return FALSE; } fs->winflag = 1; return TRUE; } #endif /* !_FS_READONL
评论
    相关推荐