ASF docs  3.1.3
Some important library documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
file.c File Reference
#include "conf_explorer.h"
#include "file.h"
#include "navigation.h"
#include <LIB_MEM>
#include <LIB_CTRLACCESS>
+ Include dependency graph for file.c:

Go to the source code of this file.

Functions

static void file_load_segment_value (Fs_file_segment _MEM_TYPE_SLOW_ *segment)
 This function stores the global segment variable in other variable.
bool file_ispresent (void)
 This function checks if a file is selected.
bool file_open (uint8_t fopen_mode)
 This function opens the selected file.
bool file_read (Fs_file_segment _MEM_TYPE_SLOW_ *segment)
 This function returns a segment (position & size) in a physical memory corresponding at the file.
uint16_t file_read_buf (uint8_t _MEM_TYPE_SLOW_ *buffer, uint16_t u16_buf_size)
 This function copys in a buffer the file data corresponding at the current position.
uint16_t file_getc (void)
 This function returns the next byte of file.
uint32_t file_getpos (void)
 This function returns the position in the file.
bool file_seek (uint32_t u32_pos, uint8_t u8_whence)
 This function changes the position in the file.
uint8_t file_bof (void)
 This function checks the beginning of file.
uint8_t file_eof (void)
 This function checks the end of file.
void file_flush (void)
 This function flushs the internal cache (file datas and file information)
void file_close (void)
 This function closes the file.

Variables

_MEM_TYPE_SLOW_ uint8_t fs_g_sector [FS_CACHE_SIZE]
 Use "FAT sector cache" to store a sector from a file (see file_putc(), file_getc(), file_read_buf(), file_write_buf())

Function Documentation

uint8_t file_bof ( void  )
Returns:
1 the position is at the beginning of file
0 the position isn't at the beginning of file
FFh error

Definition at line 714 of file file.c.

void file_close ( void  )

Definition at line 750 of file file.c.

uint8_t file_eof ( void  )
Returns:
1 the position is at the end of file
0 the position isn't at the end of file
FFh error

Definition at line 729 of file file.c.

void file_flush ( void  )

Definition at line 739 of file file.c.

uint16_t file_getc ( void  )
Returns:
The byte readed
EOF, in case of error or end of file

Definition at line 366 of file file.c.

uint32_t file_getpos ( void  )
Returns:
Position in file

Definition at line 635 of file file.c.

bool file_ispresent ( void  )
Returns:
true, a file is selected
false, otherwise

Definition at line 75 of file file.c.

static void file_load_segment_value ( Fs_file_segment _MEM_TYPE_SLOW_ *  segment)
static
Parameters:
segmentPointer on the variable to fill

Definition at line 150 of file file.c.

bool file_open ( uint8_t  fopen_mode)
Parameters:
fopen_modeoption to open the file :
FOPEN_MODE_R R access, flux pointer = 0, size not modify
FOPEN_MODE_R_PLUS R/W access, flux pointer = 0, size not modify
FOPEN_MODE_W W access, flux pointer = 0, size = 0
FOPEN_MODE_W_PLUS R/W access, flux pointer = 0, size = 0
FOPEN_MODE_APPEND W access, flux pointer = at the end, size not modify
Returns:
false in case of error, see global value "fs_g_status" for more detail
true otherwise

Definition at line 95 of file file.c.

bool file_read ( Fs_file_segment _MEM_TYPE_SLOW_ *  segment)
Parameters:
segmentPointer on the segment structure:
->u32_size_or_pos IN, shall contains maximum number of sector to read in file (0 = unlimited)
->u32_size_or_pos OUT, containt the segment size (unit sector)
->other IN, ignored
->other OUT, contains the segment position
Returns:
false in case of error, see global value "fs_g_status" for more detail
true otherwise
//! This routine is interesting to read a file via a DMA and avoid the file system decode
//! because this routine returns a physical memory segment without File System information.
//! Note: the file can be fragmented and you must call file_read() for each fragments.
//! 

Definition at line 175 of file file.c.

uint16_t file_read_buf ( uint8_t _MEM_TYPE_SLOW_ *  buffer,
uint16_t  u16_buf_size 
)
Parameters:
bufferbuffer to fill
u16_buf_sizebuffer size
Returns:
number of byte read
0, in case of error

Definition at line 252 of file file.c.

bool file_seek ( uint32_t  u32_pos,
uint8_t  u8_whence 
)
Parameters:
u32_posnumber of byte to seek
u8_whencedirection of seek
FS_SEEK_SET , start at the beginning and foward
FS_SEEK_END , start at the end of file and rewind
FS_SEEK_CUR_RE, start at the current position and rewind
FS_SEEK_CUR_FW, start at the current position and foward
Returns:
false in case of error, see global value "fs_g_status" for more detail
true otherwise

Definition at line 656 of file file.c.