Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
NonBlockNode Class Referenceabstract

Node information for a device node in the filesystem that has support for nonblocking mode via Notifiable pointers for reading and writing. More...

#include <Devtab.hxx>

Inheritance diagram for NonBlockNode:
Node Device FileIO Can MbedAsyncUSBSerial BenchmarkCan LpcCan MCP2515Can MbedCanDriver Stm32Can TCAN4550Can TCAN4550Can TivaCan

Protected Member Functions

 NonBlockNode (const char *name)
 Constructor.
 
virtual bool has_rx_buffer_data ()=0
 Called under a critical section.
 
virtual bool has_tx_buffer_space ()=0
 Called under a critical section.
 
int ioctl (File *file, unsigned long int key, unsigned long data) OVERRIDE
 Request an ioctl transaction.
 
- Protected Member Functions inherited from Node
 Node (const char *name)
 Constructor.
 
virtual ~Node ()
 Destructor.
 
virtual void enable ()=0
 This will be called once when reference-count goes from 0 to positive.
 
virtual void disable ()=0
 This will be called when reference count goes from non-zero to 0.
 
virtual void flush_buffers ()=0
 Instructs the device driver to drop all TX and RX queues.
 
int open (File *, const char *, int, int) OVERRIDE
 Open method.
 
int close (File *) OVERRIDE
 Close method.
 
virtual int fstat (File *file, struct stat *stat) override
 Get the status information of a file or device.
 
- Protected Member Functions inherited from FileIO
 FileIO (const char *name)
 Constructor.
 
virtual ~FileIO ()
 Destructor.
 
virtual ssize_t read (File *file, void *buf, size_t count)=0
 Read from a file or device.
 
virtual ssize_t write (File *file, const void *buf, size_t count)=0
 Write to a file or device.
 
virtual off_t lseek (File *f, off_t offset, int whence)
 Seek method.
 
virtual int fcntl (File *file, int cmd, unsigned long data)
 Manipulate a file descriptor.
 
virtual bool select (File *file, int mode)
 Device select method.
 

Protected Attributes

NotifiablereadableNotify_
 This will be notified if the device has data avilable for read.
 
NotifiablewritableNotify_
 This will be notified if the device has buffer avilable for write.
 
- Protected Attributes inherited from Node
OSMutex lock_
 protects internal structures.
 
mode_t mode_
 File open mode, such as O_NONBLOCK.
 
unsigned int references_
 number of open references
 
- Protected Attributes inherited from FileIO
const char * name
 device name
 

Additional Inherited Members

- Public Member Functions inherited from Device
 Device (const char *name)
 Constructor.
 
virtual ~Device ()
 Destructor.
 
- Static Public Member Functions inherited from Device
static int open (struct _reent *reent, const char *path, int flags, int mode)
 Open a file or device.
 
static int close (struct _reent *reent, int fd)
 Close a file or device.
 
static int stat (struct _reent *reent, const char *path, struct stat *stat)
 Get the status information of a file or device.
 
static int select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, long long timeout)
 POSIX select().
 
static void select_clear ()
 Clears the current thread's select bits.
 
- Static Public Member Functions inherited from FileIO
static ssize_t read (struct _reent *reent, int fd, void *buf, size_t count)
 Read from a file or device.
 
static ssize_t write (struct _reent *reent, int fd, const void *buf, size_t count)
 Write to a file or device.
 
static _off_t lseek (struct _reent *reent, int fd, _off_t offset, int whence)
 Change the offset index of a file or device.
 
static int fstat (struct _reent *reent, int fd, struct stat *stat)
 Get the status information of a file or device.
 
static int ioctl (int fd, unsigned long int key, unsigned long data)
 Request and ioctl transaction.
 
static int fcntl (int fd, int cmd, unsigned long data)
 Manipulate a file descriptor.
 
static bool is_device (int fd)
 Test if the file descriptor belongs to a device.
 
- Static Protected Member Functions inherited from Device
static void select_insert (SelectInfo *info)
 Add client to list of clients needing woken.
 
static void select_wakeup (SelectInfo *info)
 Wakeup the list of clients needing woken.
 
static void select_wakeup_from_isr (SelectInfo *info, int *woken)
 Wakeup the list of clients needing woken.
 
- Static Protected Member Functions inherited from FileIO
static int fd_alloc (void)
 Allocate a free file descriptor.
 
static void fd_free (int fd)
 Free up a file descriptor.
 
static Filefile_lookup (int fd)
 Looks up a reference to a File corresponding to a given file descriptor.
 
static int fd_lookup (File *file)
 Looks up a file descriptor corresponding to a given File reference.
 
- Static Protected Attributes inherited from FileIO
static const unsigned int numOpenFiles = 20
 
static File files []
 File descriptor pool.
 
static OSMutex mutex
 mutual exclusion for fileio
 

Detailed Description

Node information for a device node in the filesystem that has support for nonblocking mode via Notifiable pointers for reading and writing.

Definition at line 610 of file Devtab.hxx.

Constructor & Destructor Documentation

◆ NonBlockNode()

NonBlockNode::NonBlockNode ( const char *  name)
inlineprotected

Constructor.

Parameters
nameis the name of this device node in the filesystem.

Definition at line 615 of file Devtab.hxx.

Member Function Documentation

◆ has_rx_buffer_data()

virtual bool NonBlockNode::has_rx_buffer_data ( )
protectedpure virtual

Called under a critical section.

Returns
true if a read would not block right now.

Implemented in Can, and MbedAsyncUSBSerial.

◆ has_tx_buffer_space()

virtual bool NonBlockNode::has_tx_buffer_space ( )
protectedpure virtual

Called under a critical section.

Returns
true if a write would not block right now.

Implemented in Can, and MbedAsyncUSBSerial.

◆ ioctl()

int NonBlockNode::ioctl ( File file,
unsigned long int  key,
unsigned long  data 
)
protectedvirtual

Request an ioctl transaction.

Parameters
filefile reference for this device
keyioctl key
datakey data
filefile reference for this device
nodenode reference for this device
keyioctl key
datakey data

Reimplemented from FileIO.

Reimplemented in TCAN4550Can, TCAN4550Can, Stm32Can, and TivaCan.

Definition at line 83 of file freertos_drivers/common/Node.cxx.

Member Data Documentation

◆ readableNotify_

Notifiable* NonBlockNode::readableNotify_
protected

This will be notified if the device has data avilable for read.

Definition at line 635 of file Devtab.hxx.

◆ writableNotify_

Notifiable* NonBlockNode::writableNotify_
protected

This will be notified if the device has buffer avilable for write.

Definition at line 637 of file Devtab.hxx.


The documentation for this class was generated from the following files: