/*----------------------------------------------------------------------------/ / FatFs - FAT file system module R0.08 (C)ChaN, 2010 /-----------------------------------------------------------------------------/ / FatFs module is a generic FAT file system module for small embedded systems. / This is a free software that opened for education, research and commercial / developments under license policy of following terms. / / Copyright (C) 2010, ChaN, all right reserved. / / * The FatFs module is a free software and there is NO WARRANTY. / * No restriction on use. You can use, modify and redistribute it for / personal, non-profit or commercial products 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) partition. / 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 11,'06 R0.03a Improved cluster scan algorithm to write files fast. / Fixed f_mkdir() creates incorrect directory on FAT32. / / Feb 04,'07 R0.04 Supported multiple drive system. / Changed some interfaces for multiple drive system. / Changed f_mountdrv() to f_mount(). / Added f_mkfs(). / Apr 01,'07 R0.04a Supported multiple partitions on a physical drive. / Added a capability of extending file size to f_lseek(). / Added minimization level 3. / Fixed an endian sensitive code in f_mkfs(). / May 05,'07 R0.04b Added a configuration option _USE_NTFLAG. / Added FSInfo 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(), f_write() and f_mkfs(). / Fixed f_mkfs() on FAT32 creates incorrect FSInfo. / Fixed f_mkdir() on FAT32 creates incorrect directory. / 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 mis-truncated. / Fixed cached sector is not flushed when create and close / without write. / / Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets(). / Improved performance of f_lseek() on moving to the same / or following cluster. / / Apr 01,'09 R0.07 Merged Tiny-FatFs as a buffer configuration option. / Added long file name support. / Added multiple code page support. / Added re-entrancy for multitask operation. / Added auto cluster size selection to f_mkfs(). / Added rewind option to f_readdir(). / Changed result code of critical errors. / Renamed string functions to avoid name collision. / Apr 14,'09 R0.07a Separated out OS dependent code on reentrant cfg. / Added multiple sector size support. / Jun 21,'09 R0.07c Fixed f_unlink() can return FR_OK on error. / Fixed wrong cache control in f_lseek(). / Added relative path feature. / Added f_chdir() and f_chdrive(). / Added proper case conversion to extended char. / Nov 03,'09 R0.07e Separated out configuration options from ff.h to ffconf.h. / Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH. / Fixed name matching error on the 13 char boundary. / Added a configuration option, _LFN_UNICODE. / Changed f_readdir() to return the SFN with always upper / case on non-LFN cfg. / / May 15,'10 R0.08 Added a memory configuration option. (_USE_LFN) / Added file lock feature. (_FS_SHARE) / Added fast seek feature. (_USE_FASTSEEK) / Changed some types on the API, XCHAR->TCHAR. / Changed fname member in the FILINFO structure on Unicode cfg. / String functions support UTF-8 encoding files on Unicode cfg. /---------------------------------------------------------------------------*/ #include "ff.h" /* FatFs configurations and declarations */ #include "diskio.h" /* Declarations of low level disk I/O functions */ /*-------------------------------------------------------------------------- Module Private Definitions ---------------------------------------------------------------------------*/ #if _FATFS != 8085 #error Wrong include file (ff.h). #endif /* FAT sub-type boundaries */ /* Note that the FAT spec by Microsoft says 4085 but Windows works with 4087! */ #define MIN_FAT16 4086 /* Minimum number of clusters for FAT16 */ #define MIN_FAT32 65526 /* Minimum number of clusters for FAT32 */ /* Definitions corresponds to multiple sector size */ #if _MAX_SS == 512 /* Single sector size */ #define SS(fs) 512U #elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */ #define SS(fs) ((fs)->ssize) #else #error Wrong sector size. #endif /* Re-entrancy related */ #if _FS_REENTRANT #if _USE_LFN == 1 #error Static LFN work area must not be used in re-entrant configuration. #endif #define ENTER_FF(fs) { if (!lock_fs(fs)) return FR_TIMEOUT; } #define LEAVE_FF(fs, res) { unlock_fs(fs, res); return res; } #else #define ENTER_FF(fs) #define LEAVE_FF(fs, res) return res #endif #define ABORT(fs, res) { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); } /* Character code support macros */ #define IsUpper(c) (((c)>='A')&&((c)<='Z')) #define IsLower(c) (((c)>='a')&&((c)<='z')) #define IsDigit(c) (((c)>='0')&&((c)<='9')) #if _DF1S /* Code page is DBCS */ #ifdef _DF2S /* Two 1st byte areas */ #define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E)) #else /* One 1st byte area */ #define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) #endif #ifdef _DS3S /* Three 2nd byte areas */ #define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E)) #else /* Two 2nd byte areas */ #define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE
/*
LUFA Library
Copyright (C) Dean Camera, 2017.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief LUFA Library Configuration Header File
*
* This header file is used to configure LUFA's compile time options,
* as an alternative to the compile time constants supplied through
* a makefile.
*
* For information on what each token does, refer to the LUFA
* manual section "Summary of Compile Tokens".
*/
#ifndef _LUFA_CONFIG_H_
#define _LUFA_CONFIG_H_
#if (ARCH == ARCH_AVR8)
/* Non-USB Related Configuration Tokens: */
// #define DISABLE_TERMINAL_CODES
/* USB Class Driver Related Tokens: */
// #define HID_HOST_BOOT_PROTOCOL_ONLY
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
// #define HID_MAX_COLLECTIONS {Insert Value Here}
// #define HID_MAX_REPORTITEMS {Insert Value Here}
// #define HID_MAX_REPORT_IDS {Insert Value Here}
// #define NO_CLASS_DRIVER_AUTOFLUSH
/* General USB Driver Related Tokens: */
// #define ORDERED_EP_CONFIG
#define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
#define USB_DEVICE_ONLY
// #define USB_HOST_ONLY
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
// #define NO_LIMITED_CONTROLLER_CONNECT
// #define NO_SOF_EVENTS
/* USB Device Mode Driver Related Tokens: */
// #define USE_RAM_DESCRIPTORS
#define USE_FLASH_DESCRIPTORS
// #define USE_EEPROM_DESCRIPTORS
// #define NO_INTERNAL_SERIAL
#define FIXED_CONTROL_ENDPOINT_SIZE 8
#define DEVICE_STATE_AS_GPIOR 0
#define FIXED_NUM_CONFIGURATIONS 1
// #define CONTROL_ONLY_DEVICE
// #define INTERRUPT_CONTROL_ENDPOINT
// #define NO_DEVICE_REMOTE_WAKEUP
// #define NO_DEVICE_SELF_POWER
/* USB Host Mode Driver Related Tokens: */
// #define HOST_STATE_AS_GPIOR {Insert Value Here}
// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
// #define NO_AUTO_VBUS_MANAGEMENT
// #define INVERTED_VBUS_ENABLE_LINE
#else
#error Unsupported architecture for this LUFA configuration file.
#endif
#endif