MHEG  17.9.0
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
Enumerations | Functions
stb_nvm.h File Reference

File System types. More...

#include "techtype.h"

Go to the source code of this file.

Enumerations

enum  E_STB_DSK_FILE_MODE { FILE_MODE_READ, FILE_MODE_WRITE, FILE_MODE_OVERWRITE }
 
enum  E_STB_DSK_FILE_POSITION { FILE_POSITION_START, FILE_POSITION_END, FILE_POSITION_CURRENT }
 
enum  E_STB_DIR_ENTRY_TYPE { DIR_ENTRY_FILE, DIR_ENTRY_DIRECTORY, DIR_ENTRY_OTHER }
 

Functions

BOOLEAN STB_NVMFileSize (U8BIT *filename, U32BIT *filesize)
 Returns the size in KB of the given file. More...
 
void * STB_NVMOpenFile (U8BIT *name, E_STB_DSK_FILE_MODE mode)
 Opens an existing file or creates a new one. More...
 
void STB_NVMCloseFile (void *file)
 Flushes and closes an open file. More...
 
U32BIT STB_NVMReadFile (void *file, U8BIT *data, U32BIT size)
 Reads data from an open file. More...
 
U32BIT STB_NVMWriteFile (void *file, U8BIT *data, U32BIT size)
 Writes data to an open file. More...
 
BOOLEAN STB_NVMDeleteFile (U8BIT *filename)
 Deletes the file. More...
 
void * STB_NVMOpenDirectory (U8BIT *dir_name)
 Opens a directory in order to read the entries. More...
 
BOOLEAN STB_NVMReadDirectory (void *dir, U8BIT *filename, U16BIT filename_len, E_STB_DIR_ENTRY_TYPE *entry_type)
 Reads the next entry from the directory, returning the name of the entry and the type of the entry. More...
 
void STB_NVMCloseDirectory (void *dir)
 Closes the directory for reading. More...
 
BOOLEAN STB_NVMMoveFile (U8BIT *oldname, U8BIT *newname)
 Move/Rename a file or a directory. The original name and the new name may contain a path - the last element being the name. More...
 

Detailed Description

File System types.

Date
03/02/2014
Author
Adam Sturtridge

Function Documentation

void STB_NVMCloseDirectory ( void *  dir)

Closes the directory for reading.

Parameters
dir- directory handle
void STB_NVMCloseFile ( void *  file)

Flushes and closes an open file.

Parameters
file- The file handle
BOOLEAN STB_NVMDeleteFile ( U8BIT *  filename)

Deletes the file.

Parameters
filename- pathname of the file to be deleted
Return values
TRUEif successful, FALSE otherwise
BOOLEAN STB_NVMFileSize ( U8BIT *  filename,
U32BIT *  filesize 
)

Returns the size in KB of the given file.

Parameters
filename- name of the file in the nvm
filesize- returned value giving the file size in KB
Returns
TRUE if the file exists, FALSE otherwise
BOOLEAN STB_NVMMoveFile ( U8BIT *  oldname,
U8BIT *  newname 
)

Move/Rename a file or a directory. The original name and the new name may contain a path - the last element being the name.

Parameters
oldnameOriginal location name
newnameNew location name
Returns
TRUE - success
void* STB_NVMOpenDirectory ( U8BIT *  dir_name)

Opens a directory in order to read the entries.

Parameters
dir_name- name of the directory to open
Returns
Handle to be used in all other operations, NULL if the open fails
void* STB_NVMOpenFile ( U8BIT *  name,
E_STB_DSK_FILE_MODE  mode 
)

Opens an existing file or creates a new one.

Parameters
name- The filename (including path). When the mode is FILE_MODE_OVERWRITE, the directories in the path will be created when they don't exist.
mode- The access mode
Returns
The file handle
BOOLEAN STB_NVMReadDirectory ( void *  dir,
U8BIT *  filename,
U16BIT  filename_len,
E_STB_DIR_ENTRY_TYPE *  entry_type 
)

Reads the next entry from the directory, returning the name of the entry and the type of the entry.

Parameters
dir- handle returned when the directory was opened
filename- array in which the name is returned
filename_len- size of the filename array
entry_type- type of entry
Returns
TRUE if and entry is read, FALSE otherwise which could indicate end of the directory
U32BIT STB_NVMReadFile ( void *  file,
U8BIT *  data,
U32BIT  size 
)

Reads data from an open file.

Parameters
[in]file- The file handle
[out]data- The caller's buffer
[in]size- Number of bytes to be read
Returns
Number of bytes successfully read
U32BIT STB_NVMWriteFile ( void *  file,
U8BIT *  data,
U32BIT  size 
)

Writes data to an open file.

Parameters
file- The file handle
data- Pointer to the data to be written
size- Number of bytes to write
Returns
Number of bytes successfully written