Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC32xxDeviceFile.hxx
Go to the documentation of this file.
1
34#ifndef _FREERTOS_DRIVERS_TI_CC32XXDEVICEFILE_HXX_
35#define _FREERTOS_DRIVERS_TI_CC32XXDEVICEFILE_HXX_
36
37#include "DeviceFile.hxx"
38
42{
43public:
49 CC32xxDeviceFile(const char *name, size_t max_size_on_create = 3000)
51 , handle(-1)
52 , size(0)
53 , maxSize(0)
54 , maxSizeOnCreate(max_size_on_create)
55 , writeEnable(false)
56 {
57 }
58
62 {
63 }
64
65protected:
75 ssize_t write(unsigned int index, const void *buf, size_t len) override;
76
83 ssize_t read(unsigned int index, void *buf, size_t len) override;
84
85private:
93 int open(File* file, const char *path, int flags, int mode) override;
94
95
101 int fstat(File* file, struct stat *stat) override;
102
103 void disable() OVERRIDE;
106 int32_t handle;
107
109 uint32_t size;
110
112 uint32_t maxSize;
113
116
119
123
125};
126
127#endif /* _FREERTOS_DRIVERS_TI_CC32XXDEVICEFILE_HXX_ */
128
Common base class for all CC32xxDeviceFile access.
int32_t handle
file handle
CC32xxDeviceFile(const char *name, size_t max_size_on_create=3000)
Constructor.
~CC32xxDeviceFile()
Destructor.
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
Base class for implementing block devices and other file drivers which can be seeked and addressed by...
const char * name
device name
Definition Devtab.hxx:266
#define OVERRIDE
Function attribute for virtual functions declaring that this funciton is overriding a funciton that s...
Definition macros.h:180
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
Definition macros.h:171
static int stat(struct _reent *reent, const char *path, struct stat *stat)
Get the status information of a file or device.
Definition Device.cxx:165
File information.
Definition Devtab.hxx:52