DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
Macros | Enumerations | Functions
stbhwdsk.h File Reference

Function prototypes for disk functions. More...

#include "techtype.h"

Go to the source code of this file.

Macros

#define INVALID_DISK_ID   0xffff
 

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

void STB_DSKInitialise (void)
 Initialise the hard disk component.
 
U16BIT STB_DSKGetNumDisks (void)
 Returns the number of disks currently detected. More...
 
U16BIT STB_DSKGetDiskIdByIndex (U16BIT index)
 Returns the id of the disk at the given index. More...
 
BOOLEAN STB_DSKIsRemoveable (U16BIT disk_id)
 Checks if the given disk is removeable. More...
 
BOOLEAN STB_DSKIsMounted (U16BIT disk_id)
 Checks if the given disk is mounted. More...
 
BOOLEAN STB_DSKMountDisk (U16BIT disk_id)
 Attempts to mount the given disk, if it isn't already mounted. More...
 
BOOLEAN STB_DSKUnmountDisk (U16BIT disk_id)
 Attempts to unmount the given disk, if it isn't already unmounted. More...
 
BOOLEAN STB_DSKGetDiskName (U16BIT disk_id, U8BIT *name, U16BIT name_len)
 Gets the name of a disk and copies it into the array provided. More...
 
void STB_DSKSetStandby (BOOLEAN state)
 Put all disks into or out of standby mode. More...
 
void * STB_DSKOpenFile (U16BIT disk_id, U8BIT *name, E_STB_DSK_FILE_MODE mode)
 Opens an existing file or creates a new one. More...
 
U32BIT STB_DSKReadFile (void *file, U8BIT *data, U32BIT size)
 Reads data from an open file. More...
 
U32BIT STB_DSKWriteFile (void *file, U8BIT *data, U32BIT size)
 Writes data to an open file. More...
 
BOOLEAN STB_DSKSeekFile (void *file, E_STB_DSK_FILE_POSITION position, S32BIT offset)
 Sets the read/write position of an open file. More...
 
BOOLEAN STB_DSKTellFile (void *file, U32BIT *offset)
 Gets the current position in an open file. More...
 
void STB_DSKCloseFile (void *file)
 Flushes and closes an open file. More...
 
BOOLEAN STB_DSKDeleteFile (U16BIT disk_id, U8BIT *filename)
 Deletes the file from the given disk. More...
 
BOOLEAN STB_DSKFileExists (U16BIT disk_id, U8BIT *filename)
 Checks whether a file/directory will the given name exists. More...
 
BOOLEAN STB_DSKFileSize (U16BIT disk_id, U8BIT *filename, U32BIT *filesize)
 Returns the size in KB of the given file. More...
 
void * STB_DSKOpenDirectory (U16BIT disk_id, U8BIT *dir_name)
 Opens a directory in order to read the entries. More...
 
BOOLEAN STB_DSKReadDirectory (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_DSKCloseDirectory (void *dir)
 Closes the directory for reading. More...
 
BOOLEAN STB_DSKCreateDirectory (U16BIT disk_id, U8BIT *dir_path)
 Creates a directory with the given name. More...
 
BOOLEAN STB_DSKDeleteDirectory (U16BIT disk_id, U8BIT *dir_name)
 Deletes a directory and all it contents, so use with care! More...
 
BOOLEAN STB_DSKFullPathname (U16BIT disk_id, U8BIT *filename, U8BIT *pathname, U16BIT max_pathname_len)
 Copies the full pathname for the given filename, including the mount directory, to the given string array. More...
 
U32BIT STB_DSKGetSize (U16BIT disk_id)
 Returns the size (capacity) of the disk. More...
 
U32BIT STB_DSKGetUsed (U16BIT disk_id)
 Returns the amount of space used on the disk. More...
 
void STB_DSKFormat (U16BIT disk_id)
 Initiates formatting and partitioning of the hard disk. This will erase all data on the disk!
 
U8BIT STB_DSKGetFormatProgress (U16BIT disk_id)
 Gets the progress of the format operation. More...
 
BOOLEAN STB_DSKIsFormatted (U16BIT disk_id)
 Queries whether the disk is formatted. More...
 
void STB_DSKRepair (U16BIT disk_id)
 Initiates a data repair of the hard disk. This may cause the disk to become unreadable.
 
U8BIT STB_DSKGetRepairProgress (U16BIT disk_id)
 Gets the progress of the repair operation. More...
 
BOOLEAN STB_DSKGetIntegrity (U16BIT disk_id)
 Returns a summary of the disk integrity. More...
 

Detailed Description

Function prototypes for disk functions.

Date
20/08/2003

Function Documentation

void STB_DSKCloseDirectory ( void *  dir)

Closes the directory for reading.

Parameters
dirdirectory handle
void STB_DSKCloseFile ( void *  file)

Flushes and closes an open file.

Parameters
fileThe file handle
BOOLEAN STB_DSKCreateDirectory ( U16BIT  disk_id,
U8BIT *  dir_path 
)

Creates a directory with the given name.

Parameters
disk_iddisk on which the directory is to be created
dir_namename of the directory to be created
Returns
TRUE is the directory is successfully created
BOOLEAN STB_DSKDeleteDirectory ( U16BIT  disk_id,
U8BIT *  dir_name 
)

Deletes a directory and all it contents, so use with care!

Parameters
disk_iddisk
dir_namename of the directory to be deleted
BOOLEAN STB_DSKDeleteFile ( U16BIT  disk_id,
U8BIT *  filename 
)

Deletes the file from the given disk.

Parameters
disk_iddisk ID
filenamepathname on the disk of the file to be deleted
Returns
TRUE if successful, FALSE otherwise
BOOLEAN STB_DSKFileExists ( U16BIT  disk_id,
U8BIT *  filename 
)

Checks whether a file/directory will the given name exists.

Parameters
disk_iddisk ID
filenamepathname on the disk of the file
Returns
TRUE if exists, FALSE otherwise
BOOLEAN STB_DSKFileSize ( U16BIT  disk_id,
U8BIT *  filename,
U32BIT *  filesize 
)

Returns the size in KB of the given file.

Parameters
disk_iddisk on which the file exists
filenamename of the file on disk
filesizereturned value giving the file size in KB
Returns
TRUE if the file exists, FALSE otherwise
BOOLEAN STB_DSKFullPathname ( U16BIT  disk_id,
U8BIT *  filename,
U8BIT *  pathname,
U16BIT  max_pathname_len 
)

Copies the full pathname for the given filename, including the mount directory, to the given string array.

Parameters
disk_iddisk
filenamename of the file on the disk
pathnamearray into which the full pathname will be copied
max_pathname_lensize of the pathname array
Returns
TRUE if the disk is valid exists and is mounted and the destination string is long enough to take the full pathname
U16BIT STB_DSKGetDiskIdByIndex ( U16BIT  index)

Returns the id of the disk at the given index.

Parameters
indexzero based index
Returns
Disk id, 0 if no disk found
BOOLEAN STB_DSKGetDiskName ( U16BIT  disk_id,
U8BIT *  name,
U16BIT  name_len 
)

Gets the name of a disk and copies it into the array provided.

Parameters
disk_idID of the disk
namearray of U8BIT into which the name will be copied
name_lenmax number of characters in the name
Returns
TRUE if the disk is found, FALSE otherwise
U8BIT STB_DSKGetFormatProgress ( U16BIT  disk_id)

Gets the progress of the format operation.

Returns
The progress as percent complete
BOOLEAN STB_DSKGetIntegrity ( U16BIT  disk_id)

Returns a summary of the disk integrity.

Returns
TRUE if disk integrity ok
U16BIT STB_DSKGetNumDisks ( void  )

Returns the number of disks currently detected.

Returns
Number of disks
U8BIT STB_DSKGetRepairProgress ( U16BIT  disk_id)

Gets the progress of the repair operation.

Returns
The progress as percent complete
U32BIT STB_DSKGetSize ( U16BIT  disk_id)

Returns the size (capacity) of the disk.

Returns
The size of the disk in kilobytes
U32BIT STB_DSKGetUsed ( U16BIT  disk_id)

Returns the amount of space used on the disk.

Parameters
disk_idID of the disk
Returns
Space used in kilobytes
BOOLEAN STB_DSKIsFormatted ( U16BIT  disk_id)

Queries whether the disk is formatted.

Returns
FALSE unformatted
BOOLEAN STB_DSKIsMounted ( U16BIT  disk_id)

Checks if the given disk is mounted.

Parameters
disk_idID of the disk to be checked
Returns
TRUE if the disk is mounted, FALSE otherwise
BOOLEAN STB_DSKIsRemoveable ( U16BIT  disk_id)

Checks if the given disk is removeable.

Parameters
disk_idID of the disk to be checked
Returns
TRUE if the disk is removeable, FALSE otherwise
BOOLEAN STB_DSKMountDisk ( U16BIT  disk_id)

Attempts to mount the given disk, if it isn't already mounted.

Parameters
disk_idID of the disk to be mounted
Returns
TRUE if the disk is mounted, FALSE otherwise
void* STB_DSKOpenDirectory ( U16BIT  disk_id,
U8BIT *  dir_name 
)

Opens a directory in order to read the entries.

Parameters
disk_iddisk containing to the directory to be read
dir_namename of the directory to open
Returns
Handle to be used in all other operations, NULL if the open fails
void* STB_DSKOpenFile ( U16BIT  disk_id,
U8BIT *  name,
E_STB_DSK_FILE_MODE  mode 
)

Opens an existing file or creates a new one.

Parameters
nameThe filename (including path)
modeThe access mode
Returns
The file handle
BOOLEAN STB_DSKReadDirectory ( 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
dirhandle returned when the directory was opened
filenamearray in which the name is returned
filename_lensize of the filename array
entry_typetype of entry
Returns
TRUE if and entry is read, FALSE otherwise which could indicate end of the directory
U32BIT STB_DSKReadFile ( void *  file,
U8BIT *  data,
U32BIT  size 
)

Reads data from an open file.

Parameters
fileThe file handle
dataThe caller's buffer
sizeNumber of bytes to be read
Returns
Number of bytes successfully read
BOOLEAN STB_DSKSeekFile ( void *  file,
E_STB_DSK_FILE_POSITION  position,
S32BIT  offset 
)

Sets the read/write position of an open file.

Parameters
fileThe file handle
positionPosition to move relative to, i.e. start,end,current
offsetWhere to move to relative to position
Returns
TRUE success, FALSE otherwise
void STB_DSKSetStandby ( BOOLEAN  state)

Put all disks into or out of standby mode.

Parameters
statestandby mode, TRUE=Standby FALSE=On
BOOLEAN STB_DSKTellFile ( void *  file,
U32BIT *  offset 
)

Gets the current position in an open file.

Parameters
fileThe file handle
offsetVariable to contain result (byte position in file)
Returns
TRUE on success
BOOLEAN STB_DSKUnmountDisk ( U16BIT  disk_id)

Attempts to unmount the given disk, if it isn't already unmounted.

Parameters
disk_idID of the disk to be unmounted
Returns
TRUE if the disk is unmounted, FALSE otherwise
U32BIT STB_DSKWriteFile ( void *  file,
U8BIT *  data,
U32BIT  size 
)

Writes data to an open file.

Parameters
fileThe file handle
dataPointer to the data to be written
sizeNumber of bytes to write
Returns
Number of bytes successfully written