_NUTDEVICE Struct Reference
[Device I/O]

#include <device.h>


Detailed Description

Device structure.

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.


Data Fields

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


Field Documentation

uintptr_t _NUTDEVICE::dev_base

Hardware base address.

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

void* _NUTDEVICE::dev_dcb

Driver control block.

Points to a device specific information block.

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.

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.

uint8_t _NUTDEVICE::dev_irq

Interrupt registration number.

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

uint8_t _NUTDEVICE::dev_type

Type of interface.

May be any of the following:


Generated on Wed Apr 29 11:12:32 2009 for BTnut System Software by doxygen 1.5.1