Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Mmc_Fat_Get_Swap_File
284
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
function Mmc_Fat_Get_Swap_File(sectors_cnt: longint; var filename
string[11]; file_attr : byte) : dword;
Returns
- Number of the start sector for the newly created swap file, if there was enough 
free space on the MMC/SD card to create file of required size. 
0
- otherwise. 
Description
This function is used to create a swap file of predefined name and size on the
MMC/SD media. If a file with specified name already exists on the media,
search for consecutive sectors will ignore sectors occupied by this file. There-
fore, it is recommended to erase such file if it already exists before calling this
function. If it is not erased and there is still enough space for a new swap file,
this function will delete it after allocating new memory space for a new swap file. 
The purpose of the swap file is to make reading and writing to MMC/SD media
as fast as possible, by using the Mmc_Read_Sector() and Mmc_Write_Sector()
functions directly, without potentially damaging the FAT system. The swap file
can be considered as a "window" on the media where the user can freely
write/read data. Its main purpose in the mikroPascal's library is to be used for
fast data acquisition; when the time-critical acquisition has finished, the data
can be re-written into a "normal" file, and formatted in the most suitable way. 
Parameters:
sectors_cnt
: number of consecutive sectors that user wants the swap file to have. 
filename
: name of the file that should be assigned for file operations. File 
name should be in DOS 8.3 (file_name.extension) format. The file name and 
extension will be automatically padded with spaces by the library if they have 
less than length required (i.e. "mikro.tx" -> "mikro .tx "), so the user does not 
have to take care of that. The file name and extension are case insensitive. 
The library will convert them to proper case automatically, so the user does not 
have to take care of that. 
Also, in order to keep backward compatibility with the first version of this 
library, file names can be entered as UPPERCASE string of 11 bytes in length 
with no dot character between file name and extension (i.e. "MIKROELETXT" -
> MIKROELE.TXT). In this case the last 3 characters of the string are consid-
ered to be file extension.
file_attr
: file creation and attributs flags. Each bit corresponds to the appro- 
priate file attribut: