|
PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
| CDevNode () | |
| ~CDevNode () override=default | |
| int | open (cdev::file_t *handlep) override |
| Handle an open of the device. More... | |
| int | close (cdev::file_t *handlep) override |
| Handle a close of the device. More... | |
| ssize_t | write (cdev::file_t *handlep, const char *buffer, size_t buflen) override |
| Perform a write to the device. More... | |
| ssize_t | read (cdev::file_t *handlep, char *buffer, size_t buflen) override |
| Perform a read from the device. More... | |
Public Member Functions inherited from cdev::CDev | |
| CDev (const char *devname) | |
| Constructor. More... | |
| CDev (const CDev &)=delete | |
| CDev & | operator= (const CDev &)=delete |
| CDev (CDev &&)=delete | |
| CDev & | operator= (CDev &&)=delete |
| virtual | ~CDev () |
| virtual int | init () |
| virtual off_t | seek (file_t *filep, off_t offset, int whence) |
| Perform a logical seek operation on the device. More... | |
| virtual int | ioctl (file_t *filep, int cmd, unsigned long arg) |
| Perform an ioctl operation on the device. More... | |
| virtual int | poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup) |
| Perform a poll setup/teardown operation. More... | |
| const char * | get_devname () const |
| Get the device name. More... | |
Private Attributes | |
| bool | _is_open_for_write |
| size_t | _write_offset |
| char | _buf [1000] |
Additional Inherited Members | |
Protected Member Functions inherited from cdev::CDev | |
| virtual pollevent_t | poll_state (file_t *filep) |
| Check the current state of the device for poll events from the perspective of the file. More... | |
| virtual void | poll_notify (pollevent_t events) |
| Report new poll events. More... | |
| virtual void | poll_notify_one (px4_pollfd_struct_t *fds, pollevent_t events) |
| Internal implementation of poll_notify. More... | |
| virtual int | open_first (file_t *filep) |
| Notification of the first open. More... | |
| virtual int | close_last (file_t *filep) |
| Notification of the last close. More... | |
| virtual int | register_class_devname (const char *class_devname) |
| Register a class device name, automatically adding device class instance suffix if need be. More... | |
| virtual int | unregister_class_devname (const char *class_devname, unsigned class_instance) |
| Register a class device name, automatically adding device class instance suffix if need be. More... | |
| void | lock () |
| Take the driver lock. More... | |
| void | unlock () |
| Release the driver lock. More... | |
| int | unregister_driver_and_memory () |
| First, unregisters the driver. More... | |
Protected Attributes inherited from cdev::CDev | |
| px4_sem_t | _lock |
| lock to protect access to all class members (also for derived classes) More... | |
Static Protected Attributes inherited from cdev::CDev | |
| static const px4_file_operations_t | fops = {} |
| Pointer to the default cdev file operations table; useful for registering clone devices etc. More... | |
Definition at line 101 of file cdevtest_example.cpp.
|
inline |
Definition at line 104 of file cdevtest_example.cpp.
References read(), and write().
|
overridedefault |
|
overridevirtual |
Handle a close of the device.
This function is called for every close of the device. The default implementation maintains _open_count and returns OK as long as it is not zero.
| filep | Pointer to the NuttX file structure. |
Reimplemented from cdev::CDev.
Definition at line 144 of file cdevtest_example.cpp.
References cdev::file_t::f_oflags, and cdev::file_t::f_priv.
|
overridevirtual |
Handle an open of the device.
This function is called for every open of the device. The default implementation maintains _open_count and always returns OK.
| filep | Pointer to the NuttX file structure. |
Reimplemented from cdev::CDev.
Definition at line 121 of file cdevtest_example.cpp.
References cdev::file_t::f_oflags, cdev::file_t::f_priv, and PrivData::PrivData().
|
overridevirtual |
Perform a read from the device.
The default implementation returns -ENOSYS.
| filep | Pointer to the NuttX file structure. |
| buffer | Pointer to the buffer into which data should be placed. |
| buflen | The number of bytes to be read. |
Reimplemented from cdev::CDev.
Definition at line 171 of file cdevtest_example.cpp.
References _buf, PrivData::_read_offset, and cdev::file_t::f_priv.
|
overridevirtual |
Perform a write to the device.
The default implementation returns -ENOSYS.
| filep | Pointer to the NuttX file structure. |
| buffer | Pointer to the buffer from which data should be read. |
| buflen | The number of bytes to be written. |
Reimplemented from cdev::CDev.
Definition at line 158 of file cdevtest_example.cpp.
References _buf.
|
private |
Definition at line 118 of file cdevtest_example.cpp.
|
private |
Definition at line 116 of file cdevtest_example.cpp.
|
private |
Definition at line 117 of file cdevtest_example.cpp.