NUTDEVICE Struct Reference
[Device Management]

Device structure. More...


Data Fields

NUTDEVICE * dev_next
 Link to the next device structure.
char dev_name [9]
 Unique device name.
uint8_t dev_type
 Type of interface.
uintptr_t dev_base
 Hardware base address.
uint8_t dev_irq
 Interrupt registration number.
void * dev_icb
 Interface control block.
void * dev_dcb
 Driver control block.
int(* dev_init )(NUTDEVICE *)
 Driver initialization routine.
int(* dev_ioctl )(NUTDEVICE *, int, void *)
 Driver control function.
int(* dev_read )(NUTFILE *, void *, int)
 Read from device.
int(* dev_write )(NUTFILE *, CONST void *, int)
 Write to device.
int(* dev_write_P )(NUTFILE *, PGM_P, int)
 Write to device.
NUTFILE *(* dev_open )(NUTDEVICE *, CONST char *, int, int)
 Open a device or file.
int(* dev_close )(NUTFILE *)
 Close a device or file.
long(* dev_size )(NUTFILE *)
 Request file size.


Detailed Description

Device structure.

Device structure type.

Each device driver provides a global variable of this type. Applications use NutRegisterDevice() to bind the device driver to the application code. Except this call, applications refer to device drivers by the name of the device when using standard C functions like _open() or fopen().

More than one device driver may be available for the same hardware device. Typically these drivers provide the same name for the device and applications must not refer to more than one device driver with the same name.

Definition at line 164 of file device.h.


Field Documentation

NUTDEVICE* NUTDEVICE::dev_next

Link to the next device structure.

Definition at line 169 of file device.h.

char NUTDEVICE::dev_name[9]

Unique device name.

Definition at line 174 of file device.h.

uint8_t NUTDEVICE::dev_type

Type of interface.

May be any of the following:

  • IFTYP_RAM
  • IFTYP_ROM
  • IFTYP_STREAM
  • IFTYP_NET
  • IFTYP_TCPSOCK
  • IFTYP_CHAR

Definition at line 187 of file device.h.

uintptr_t NUTDEVICE::dev_base

Hardware base address.

Will be set by calling NutRegisterDevice(). On some device drivers this address may be fixed.

Definition at line 195 of file device.h.

uint8_t NUTDEVICE::dev_irq

Interrupt registration number.

Will be set by calling NutRegisterDevice(). On some device drivers the interrupt may be fixed.

Definition at line 202 of file device.h.

void* NUTDEVICE::dev_icb

Interface control block.

With stream devices, this points to the IFSTREAM structure and with network devices this is a pointer to the IFNET structure.

Definition at line 209 of file device.h.

void* NUTDEVICE::dev_dcb

Driver control block.

Points to a device specific information block.

Definition at line 216 of file device.h.

int(* NUTDEVICE::dev_init)(NUTDEVICE *)

Driver initialization routine.

This routine is called during device registration.

int(* NUTDEVICE::dev_ioctl)(NUTDEVICE *, int, void *)

Driver control function.

Used to modify or query device specific settings.

int(* NUTDEVICE::dev_read)(NUTFILE *, void *, int)

Read from device.

int(* NUTDEVICE::dev_write)(NUTFILE *, CONST void *, int)

Write to device.

int(* NUTDEVICE::dev_write_P)(NUTFILE *, PGM_P, int)

Write to device.

NUTFILE*(* NUTDEVICE::dev_open)(NUTDEVICE *, CONST char *, int, int)

Open a device or file.

int(* NUTDEVICE::dev_close)(NUTFILE *)

Close a device or file.

long(* NUTDEVICE::dev_size)(NUTFILE *)

Request file size.


The documentation for this struct was generated from the following file:

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/