34#define SUPPORT_SL_R1_API
41#include <ti/drivers/net/wifi/simplelink.h>
48 if ((flags & O_ACCMODE) == O_RDWR)
59 if ((flags & O_ACCMODE) != O_RDONLY && !(flags & O_TRUNC))
65 if ((flags & O_CREAT) && (flags & O_EXCL))
71 if ((flags & O_CREAT) && (flags & O_ACCMODE) == O_RDONLY)
85 if ((((flags & O_ACCMODE) == O_WRONLY) && !
writeEnable) ||
98 result = sl_FsOpen((
const unsigned char *)path,
107 else if (flags & O_WRONLY)
109 result = sl_FsOpen((
const unsigned char *)path, SL_FS_WRITE,
115 result = sl_FsOpen((
const unsigned char *)path, SL_FS_READ,
126 case SL_ERROR_FS_INVALID_MAGIC_NUM:
127 sl_FsDel((
const unsigned char *)path, 0);
128 handle = sl_FsOpen((
const unsigned char *)path,
132 sl_FsClose(
handle,
nullptr,
nullptr, 0);
137 case SL_ERROR_FS_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY:
142 case SL_ERROR_FS_FILE_NOT_EXISTS:
151 sl_FsGetInfo((
const unsigned char *)path, 0, &info);
167 sl_FsClose(
handle,
nullptr,
nullptr, 0);
183 int32_t result = sl_FsWrite(
handle, index, (
unsigned char *)buf, len);
187 if ((index + result) >
size)
189 size = index + result;
206 if ((index + len) >
size)
211 int32_t result = sl_FsRead(
handle, index, (
unsigned char *)buf, len);
220 SlFsFileInfo_t fs_file_info;
221 int ret = sl_FsGetInfo((
const uint8_t*)
name, 0, &fs_file_info);
223 stat->st_size = fs_file_info.Len;
224 stat->st_blocks = fs_file_info.MaxSize / 512;
void SlCheckResult(int result, int expected)
Tests that a SimpleLink request has succeeded.
void SlCheckError(int result)
Tests that a SimpleLink request has succeeded (return >= 0).
int32_t handle
file handle
uint32_t size
size of file in bytes
int fstat(File *file, struct stat *stat) override
Get the status information of a file or device.
uint32_t maxSize
max size of file in bytes
int32_t maxSizeOnCreate
max size of file upon creation
ssize_t read(unsigned int index, void *buf, size_t len) override
Read from the CC32xxDeviceFile.
bool writeEnable
is the file open for write
ssize_t write(unsigned int index, const void *buf, size_t len) override
Write to the CC32xxDeviceFile.
int open(File *file, const char *path, int flags, int mode) override
Open a device.
void disable() OVERRIDE
function to disable device
const char * name
device name
virtual int fstat(File *file, struct stat *stat) override
Get the status information of a file or device.
unsigned int references_
number of open references
int open(File *, const char *, int, int) OVERRIDE
Open method.
OSMutex lock_
protects internal structures.
void unlock()
Unlock a mutex.
static int stat(struct _reent *reent, const char *path, struct stat *stat)
Get the status information of a file or device.
off_t offset
current offset within file