DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbhwdsk.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
24 // pre-processor mechanism so multiple inclusions don't cause compilation error
25 
26 #ifndef _STBHWDSK_H
27 
28 #define _STBHWDSK_H
29 
30 #include "techtype.h"
31 
32 //---Constant and macro definitions for public use-----------------------------
33 
34 #define INVALID_DISK_ID 0xffff
35 
36 //---Enumerations for public use-----------------------------------------------
37 
38 typedef enum
39 {
40  FILE_MODE_READ,
41  FILE_MODE_WRITE,
42  FILE_MODE_OVERWRITE
43 } E_STB_DSK_FILE_MODE;
44 
45 typedef enum
46 {
47  FILE_POSITION_START,
48  FILE_POSITION_END,
49  FILE_POSITION_CURRENT
50 } E_STB_DSK_FILE_POSITION;
51 
52 typedef enum
53 {
54  DIR_ENTRY_FILE,
55  DIR_ENTRY_DIRECTORY,
56  DIR_ENTRY_OTHER
57 } E_STB_DIR_ENTRY_TYPE;
58 
59 
60 //---Global type defs for public use-------------------------------------------
61 
62 //---Global Function prototypes for public use---------------------------------
66 void STB_DSKInitialise(void);
67 
72 U16BIT STB_DSKGetNumDisks(void);
73 
79 U16BIT STB_DSKGetDiskIdByIndex(U16BIT index);
80 
86 BOOLEAN STB_DSKIsRemoveable(U16BIT disk_id);
87 
93 BOOLEAN STB_DSKIsMounted(U16BIT disk_id);
94 
100 BOOLEAN STB_DSKMountDisk(U16BIT disk_id);
101 
107 BOOLEAN STB_DSKUnmountDisk(U16BIT disk_id);
108 
116 BOOLEAN STB_DSKGetDiskName(U16BIT disk_id, U8BIT *name, U16BIT name_len);
117 
122 void STB_DSKSetStandby(BOOLEAN state);
123 
130 void* STB_DSKOpenFile(U16BIT disk_id, U8BIT *name, E_STB_DSK_FILE_MODE mode);
131 
139 U32BIT STB_DSKReadFile(void *file, U8BIT *data, U32BIT size);
140 
148 U32BIT STB_DSKWriteFile(void *file, U8BIT *data, U32BIT size);
149 
157 BOOLEAN STB_DSKSeekFile(void *file, E_STB_DSK_FILE_POSITION position, S32BIT offset);
158 
165 BOOLEAN STB_DSKTellFile(void *file, U32BIT *offset);
166 
171 void STB_DSKCloseFile(void *file);
172 
179 BOOLEAN STB_DSKDeleteFile(U16BIT disk_id, U8BIT *filename);
180 
187 BOOLEAN STB_DSKFileExists(U16BIT disk_id, U8BIT *filename);
188 
196 BOOLEAN STB_DSKFileSize(U16BIT disk_id, U8BIT *filename, U32BIT *filesize);
197 
204 void* STB_DSKOpenDirectory(U16BIT disk_id, U8BIT *dir_name);
205 
215 BOOLEAN STB_DSKReadDirectory(void *dir, U8BIT *filename, U16BIT filename_len,
216  E_STB_DIR_ENTRY_TYPE *entry_type);
217 
222 void STB_DSKCloseDirectory(void *dir);
223 
230 BOOLEAN STB_DSKCreateDirectory(U16BIT disk_id, U8BIT *dir_path);
231 
237 BOOLEAN STB_DSKDeleteDirectory(U16BIT disk_id, U8BIT *dir_name);
238 
249 BOOLEAN STB_DSKFullPathname(U16BIT disk_id, U8BIT *filename, U8BIT *pathname, U16BIT max_pathname_len);
250 
255 U32BIT STB_DSKGetSize(U16BIT disk_id);
256 
262 U32BIT STB_DSKGetUsed(U16BIT disk_id);
263 
268 void STB_DSKFormat(U16BIT disk_id);
269 
274 U8BIT STB_DSKGetFormatProgress(U16BIT disk_id);
275 
280 BOOLEAN STB_DSKIsFormatted(U16BIT disk_id);
281 
285 void STB_DSKRepair(U16BIT disk_id);
286 
291 U8BIT STB_DSKGetRepairProgress(U16BIT disk_id);
292 
297 BOOLEAN STB_DSKGetIntegrity(U16BIT disk_id);
298 
299 #endif // _STBHWDSK_H
300 
BOOLEAN STB_DSKGetIntegrity(U16BIT disk_id)
Returns a summary of the disk integrity.
U32BIT STB_DSKGetUsed(U16BIT disk_id)
Returns the amount of space used on the disk.
U8BIT STB_DSKGetFormatProgress(U16BIT disk_id)
Gets the progress of the format operation.
void * STB_DSKOpenFile(U16BIT disk_id, U8BIT *name, E_STB_DSK_FILE_MODE mode)
Opens an existing file or creates a new one.
BOOLEAN STB_DSKSeekFile(void *file, E_STB_DSK_FILE_POSITION position, S32BIT offset)
Sets the read/write position of an open file.
void * STB_DSKOpenDirectory(U16BIT disk_id, U8BIT *dir_name)
Opens a directory in order to read the entries.
BOOLEAN STB_DSKIsFormatted(U16BIT disk_id)
Queries whether the disk is formatted.
BOOLEAN STB_DSKUnmountDisk(U16BIT disk_id)
Attempts to unmount the given disk, if it isn't already unmounted.
U16BIT STB_DSKGetDiskIdByIndex(U16BIT index)
Returns the id of the disk at the given index.
BOOLEAN STB_DSKTellFile(void *file, U32BIT *offset)
Gets the current position in an open file.
void STB_DSKCloseFile(void *file)
Flushes and closes an open file.
BOOLEAN STB_DSKIsRemoveable(U16BIT disk_id)
Checks if the given disk is removeable.
BOOLEAN STB_DSKDeleteDirectory(U16BIT disk_id, U8BIT *dir_name)
Deletes a directory and all it contents, so use with care!
U16BIT STB_DSKGetNumDisks(void)
Returns the number of disks currently detected.
void STB_DSKCloseDirectory(void *dir)
Closes the directory for reading.
void STB_DSKInitialise(void)
Initialise the hard disk component.
U32BIT STB_DSKWriteFile(void *file, U8BIT *data, U32BIT size)
Writes data to an open file.
BOOLEAN STB_DSKFileSize(U16BIT disk_id, U8BIT *filename, U32BIT *filesize)
Returns the size in KB of the given file.
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...
BOOLEAN STB_DSKFileExists(U16BIT disk_id, U8BIT *filename)
Checks whether a file/directory will the given name exists.
U32BIT STB_DSKGetSize(U16BIT disk_id)
Returns the size (capacity) of the disk.
System Wide Global Technical Data Type Definitions.
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 a...
U32BIT STB_DSKReadFile(void *file, U8BIT *data, U32BIT size)
Reads data from an open file.
BOOLEAN STB_DSKDeleteFile(U16BIT disk_id, U8BIT *filename)
Deletes the file from the given disk.
U8BIT STB_DSKGetRepairProgress(U16BIT disk_id)
Gets the progress of the repair operation.
BOOLEAN STB_DSKCreateDirectory(U16BIT disk_id, U8BIT *dir_path)
Creates a directory with the given name.
void STB_DSKSetStandby(BOOLEAN state)
Put all disks into or out of standby mode.
void STB_DSKRepair(U16BIT disk_id)
Initiates a data repair of the hard disk. This may cause the disk to become unreadable.
BOOLEAN STB_DSKGetDiskName(U16BIT disk_id, U8BIT *name, U16BIT name_len)
Gets the name of a disk and copies it into the array provided.
BOOLEAN STB_DSKMountDisk(U16BIT disk_id)
Attempts to mount the given disk, if it isn't already mounted.
BOOLEAN STB_DSKIsMounted(U16BIT disk_id)
Checks if the given disk is mounted.
void STB_DSKFormat(U16BIT disk_id)
Initiates formatting and partitioning of the hard disk. This will erase all data on the disk! ...