SimpleLink Host Driver  0.0.5.1
 All Data Structures Functions Variables Groups
Fs

Functions

long sl_FsOpen (unsigned char *pFileName, unsigned long AccessModeAndMaxSize, unsigned long *pToken, long *pFileHandle)
 open file for read or write from/to storage device More...
 
int sl_FsClose (long FileHdl, unsigned char *pCeritificateFileName, unsigned char *pSignature, unsigned long SignatureLen)
 close file in storage device More...
 
long sl_FsRead (long FileHdl, unsigned long Offset, unsigned char *pData, unsigned long Len)
 read block of data from a file in storage device More...
 
long sl_FsWrite (long FileHdl, unsigned long Offset, unsigned char *pData, unsigned long Len)
 write block of data to a file in storage device More...
 
int sl_FsGetInfo (unsigned char *pFileName, unsigned long Token, SlFsFileInfo_t *pFsFileInfo)
 get info on a file More...
 
int sl_FsDel (unsigned char *pFileName, unsigned long Token)
 delete specific file from a storage or all files from a storage (format) More...
 

Detailed Description

Function Documentation

int sl_FsClose ( long  FileHdl,
unsigned char *  pCeritificateFileName,
unsigned char *  pSignature,
unsigned long  SignatureLen 
)

close file in storage device

Parameters
[in]FileHdlPointer to the file (assigned from sl_FsOpen)
[in]pCeritificateFileName,NULLterminated
[in]pSignature
[in]SignatureLen
Returns
On success, zero is returned. On error, negative is returned
See Also
sl_FsRead sl_FsWrite sl_FsOpen
Note
belongs to basic_api
Warning
Example:
sl_FsClose(FileHandle,0,0,0);
int sl_FsDel ( unsigned char *  pFileName,
unsigned long  Token 
)

delete specific file from a storage or all files from a storage (format)

Parameters
[in]pFileNameFile's Name
[in]TokenFile's token
Returns
On success, zero is returned. On error, negative is returned
See Also
Note
belongs to basic_api
Warning
Example:
Status = sl_FsDel("FileName.html",Token);
int sl_FsGetInfo ( unsigned char *  pFileName,
unsigned long  Token,
SlFsFileInfo_t pFsFileInfo 
)

get info on a file

Parameters
[in]pFileNameFile's name
[in]TokenFile's token
[out]pFsFileInfoReturns the File's Information: flags,file size, allocated size and Tokens
Returns
On success, zero is returned. On error, negative is returned
See Also
sl_FsOpen
Note
belongs to basic_api
Warning
Example:
Status = sl_FsGetInfo("FileName.html",Token,&FsFileInfo);
long sl_FsOpen ( unsigned char *  pFileName,
unsigned long  AccessModeAndMaxSize,
unsigned long *  pToken,
long *  pFileHandle 
)

open file for read or write from/to storage device

Parameters
[in]pFileNameFile Name buffer pointer
[in]AccessModeAndMaxSizeOptions: As described below
[in]pTokeninput Token for read, output Token for write
[out]pFileHandlePointing on the file and used for read and write commands to the file

AccessModeAndMaxSize possible input
FS_MODE_OPEN_READ - Read a file
FS_MODE_OPEN_WRITE - Open for write for an existing file
FS_MODE_OPEN_CREATE(maxSizeInBytes,accessModeFlags) - Open for creating a new file. Max file size is defined in bytes.
For optimal FS size, use max size in 4K-512 bytes (e.g. 3584,7680)
Several access modes can be combined together from SlFileOpenFlags_e

Returns
On success, zero is returned. On error, negative is returned
See Also
sl_FsRead sl_FsWrite sl_FsClose
Note
belongs to basic_api
Warning
This API is going to be modified on the next release
Example:
sl_FsOpen("FileName.html",FS_MODE_OPEN_CREATE(3584,_FS_FILE_OPEN_FLAG_COMMIT|_FS_FILE_PUBLIC_WRITE) ,NULL, &FileHandle);
sl_FsOpen("FileName.html",FS_MODE_OPEN_READ,NULL, &FileHandle);
long sl_FsRead ( long  FileHdl,
unsigned long  Offset,
unsigned char *  pData,
unsigned long  Len 
)

read block of data from a file in storage device

Parameters
[in]FileHdlPointer to the file (assigned from sl_FsOpen)
[in]OffsetOffset to specific read block
[out]pDataPointer for the received data
[in]LenLength of the received data
Returns
On success, returns the number of read bytes. On error, negative number is returned
See Also
sl_FsClose sl_FsWrite sl_FsOpen
Note
belongs to basic_api
Warning
Example:
Status = sl_FsRead(FileHandle, 0, &readBuff[0], readSize);
long sl_FsWrite ( long  FileHdl,
unsigned long  Offset,
unsigned char *  pData,
unsigned long  Len 
)

write block of data to a file in storage device

Parameters
[in]FileHdlPointer to the file (assigned from sl_FsOpen)
[in]OffsetOffset to specific block to be written
[in]pDataPointer the transmitted data to the storage device
[in]LenLength of the transmitted data
Returns
On success, returns the number of written bytes. On error, negative number is returned
See Also
Note
belongs to basic_api
Warning
Example:
Status = sl_FsWrite(FileHandle, 0, &buff[0], readSize);