Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FileSystem
Functions | |
_i32 | sl_FsOpen (_u8 *pFileName, _u32 AccessModeAndMaxSize, _u32 *pToken, _i32 *pFileHandle) |
open file for read or write from/to storage device | |
_i16 | sl_FsClose (_i32 FileHdl, _u8 *pCeritificateFileName, _u8 *pSignature, _u32 SignatureLen) |
close file in storage device | |
_i32 | sl_FsRead (_i32 FileHdl, _u32 Offset, _u8 *pData, _u32 Len) |
Read block of data from a file in storage device. | |
_i32 | sl_FsWrite (_i32 FileHdl, _u32 Offset, _u8 *pData, _u32 Len) |
write block of data to a file in storage device | |
_i16 | sl_FsGetInfo (_u8 *pFileName, _u32 Token, SlFsFileInfo_t *pFsFileInfo) |
get info on a file | |
_i16 | sl_FsDel (_u8 *pFileName, _u32 Token) |
Delete specific file from a storage or all files from a storage (format) |
Function Documentation
_i16 sl_FsClose | ( | _i32 | FileHdl, |
_u8 * | pCeritificateFileName, | ||
_u8 * | pSignature, | ||
_u32 | SignatureLen | ||
) |
close file in storage device
- Parameters:
-
[in] FileHdl Pointer to the file (assigned from sl_FsOpen) [in] pCeritificateFileName Reserved for future use. Use NULL. [in] pSignature Reserved for future use. Use NULL. [in] SignatureLen Reserved for future use. Use 0.
- Returns:
- On success, zero is returned. On error, an error code is returned
- See also:
- sl_FsRead sl_FsWrite sl_FsOpen
- Note:
- Call the fs_Close with signature = 'A' signature len = 1 for activating an abort action
- Warning:
- Example:
sl_FsClose(FileHandle,0,0,0);
Definition at line 167 of file cc3100_fs.cpp.
_i16 sl_FsDel | ( | _u8 * | pFileName, |
_u32 | Token | ||
) |
Delete specific file from a storage or all files from a storage (format)
- Parameters:
-
[in] pFileName File Name [in] Token Reserved for future use. Use 0
- Returns:
- On success, zero is returned. On error, an error code is returned
- See also:
- Note:
- belongs to basic_api
- Warning:
- Example:
Status = sl_FsDel("FileName.html",0);
Definition at line 399 of file cc3100_fs.cpp.
_i16 sl_FsGetInfo | ( | _u8 * | pFileName, |
_u32 | Token, | ||
SlFsFileInfo_t * | pFsFileInfo | ||
) |
get info on a file
- Parameters:
-
[in] pFileName File name [in] Token Reserved for future use. Use 0 [out] pFsFileInfo Returns the File's Information: flags,file size, allocated size and Tokens
- Returns:
- On success, zero is returned. On error, an error code is returned
- See also:
- sl_FsOpen
- Note:
- belongs to basic_api
- Warning:
- Example:
Status = sl_FsGetInfo("FileName.html",0,&FsFileInfo);
Definition at line 358 of file cc3100_fs.cpp.
_i32 sl_FsOpen | ( | _u8 * | pFileName, |
_u32 | AccessModeAndMaxSize, | ||
_u32 * | pToken, | ||
_i32 * | pFileHandle | ||
) |
open file for read or write from/to storage device
- Parameters:
-
[in] pFileName File Name buffer pointer [in] AccessModeAndMaxSize Options: As described below [in] pToken Reserved for future use. Use NULL for this field [out] pFileHandle Pointing 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 steps (e.g. 3584,7680,117760)
Several access modes bits can be combined together from SlFileOpenFlags_e enum
- Returns:
- On success, zero is returned. On error, an error code is returned
- See also:
- sl_FsRead sl_FsWrite sl_FsClose
- Note:
- belongs to basic_api
- Warning:
- Example:
char* DeviceFileName = "MyFile.txt"; unsigned long MaxSize = 63 * 1024; //62.5K is max file size long DeviceFileHandle = -1; long RetVal; //negative retval is an error unsigned long Offset = 0; unsigned char InputBuffer[100]; // Create a file and write data. The file in this example is secured, without signature and with a fail safe commit RetVal = sl_FsOpen((unsigned char *)DeviceFileName, FS_MODE_OPEN_CREATE(MaxSize , _FS_FILE_OPEN_FLAG_NO_SIGNATURE_TEST | _FS_FILE_OPEN_FLAG_COMMIT ), NULL, &DeviceFileHandle); Offset = 0; //Preferred in secure file that the Offset and the length will be aligned to 16 bytes. RetVal = sl_FsWrite( DeviceFileHandle, Offset, (unsigned char *)"HelloWorld", strlen("HelloWorld")); RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0); // open the same file for read, using the Token we got from the creation procedure above RetVal = sl_FsOpen((unsigned char *)DeviceFileName, FS_MODE_OPEN_READ, NULL, &DeviceFileHandle); Offset = 0; RetVal = sl_FsRead( DeviceFileHandle, Offset, (unsigned char *)InputBuffer, strlen("HelloWorld")); RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
Definition at line 112 of file cc3100_fs.cpp.
_i32 sl_FsRead | ( | _i32 | FileHdl, |
_u32 | Offset, | ||
_u8 * | pData, | ||
_u32 | Len | ||
) |
Read block of data from a file in storage device.
- Parameters:
-
[in] FileHdl Pointer to the file (assigned from sl_FsOpen) [in] Offset Offset to specific read block [out] pData Pointer for the received data [in] Len Length 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);
Definition at line 214 of file cc3100_fs.cpp.
_i32 sl_FsWrite | ( | _i32 | FileHdl, |
_u32 | Offset, | ||
_u8 * | pData, | ||
_u32 | Len | ||
) |
write block of data to a file in storage device
- Parameters:
-
[in] FileHdl Pointer to the file (assigned from sl_FsOpen) [in] Offset Offset to specific block to be written [in] pData Pointer the transmitted data to the storage device [in] Len Length of the transmitted data
- Returns:
- On success, returns the number of written bytes. On error, an error code is returned
- See also:
- Note:
- belongs to basic_api
- Warning:
- Example:
Status = sl_FsWrite(FileHandle, 0, &buff[0], readSize);
Definition at line 285 of file cc3100_fs.cpp.
Generated on Tue Jul 12 2022 22:55:21 by
