Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
devtab.h File Reference
#include <sys/types.h>

Go to the source code of this file.

Classes

struct  devops_t
 Device operations pointer structure. More...
 
struct  devtab_t
 Device tab structure. More...
 
struct  node_t
 Node information. More...
 
struct  file_t
 File information. More...
 

Macros

#define __string(_x)   #_x
 Helper macro to turn a symbol into a string.
 
#define __xstring(_x)   __string(_x)
 Helper macro to turn a symbol into a string.
 
#define DEVOPS(_label, _open, _close, _read, _write, _ioctl)
 Device operations instance.
 
#define TABLE_ENTRY(_name)
 Table entry.
 
#define DEVTAB_ENTRY(_label, _name, _init, _devops, _priv)
 Device Table entry instance.
 

Typedefs

typedef struct file file_t
 Information about a currently open file.
 
typedef struct node node_t
 Information about an entry in the filesystem (usually a device node).
 

Variables

devtab_t DEVTAB []
 Linker generated device table.
 
devtab_t DEVTAB_END
 Linker generated device table end.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This file represents a newlib stub for device drivers.

Todo:
: is this dead code?
Author
Stuart W. Baker
Date
27 December 2012

Definition in file devtab.h.

Macro Definition Documentation

◆ __string

#define __string (   _x)    #_x

Helper macro to turn a symbol into a string.

Definition at line 99 of file devtab.h.

◆ __xstring

#define __xstring (   _x)    __string(_x)

Helper macro to turn a symbol into a string.

Definition at line 101 of file devtab.h.

◆ DEVOPS

#define DEVOPS (   _label,
  _open,
  _close,
  _read,
  _write,
  _ioctl 
)
Value:
devops_t _label = \
{ \
_open, \
_close, \
_read, \
_write, \
_ioctl \
};
Device operations pointer structure.
Definition devtab.h:51

Device operations instance.

Parameters
_labelunique label for instance
_openopen method
_closeclose method
_readread method
_writewrite method
_ioctlioctl method

Definition at line 111 of file devtab.h.

◆ DEVTAB_ENTRY

#define DEVTAB_ENTRY (   _label,
  _name,
  _init,
  _devops,
  _priv 
)
Value:
devtab_t _label TABLE_ENTRY(devtab) = \
{ \
_name, \
_init, \
_devops, \
_priv \
};
#define TABLE_ENTRY(_name)
Table entry.
Definition devtab.h:124
Device tab structure.
Definition devtab.h:67

Device Table entry instance.

Parameters
_labelunique label for entry
_name_name name of device
_initdevice initialization method
_devopsdevice operations
_privprivate data for use by device

Definition at line 135 of file devtab.h.

◆ TABLE_ENTRY

#define TABLE_ENTRY (   _name)
Value:
__attribute__((section((".device.table." __xstring(_name) ".data")))) \
__attribute__((used))
#define __xstring(_x)
Helper macro to turn a symbol into a string.
Definition devtab.h:101

Table entry.

Parameters
_nametable name for the entry

Definition at line 124 of file devtab.h.

Typedef Documentation

◆ file_t

typedef struct file file_t

Information about a currently open file.

Definition at line 43 of file devtab.h.

◆ node_t

typedef struct node node_t

Information about an entry in the filesystem (usually a device node).

Definition at line 46 of file devtab.h.