_NUTDEVICE Struct Reference
[Device Management]

Collaboration diagram for _NUTDEVICE:

Collaboration graph
[legend]

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.

Definition at line 151 of file device.h.


Data Fields

NUTDEVICEdev_next
 Link to the next device structure.
char dev_name [9]
 Unique device name.
u_char dev_type
 Type of interface.
uptr_t dev_base
 Hardware base address.
u_char 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.

Field Documentation

NUTDEVICE* _NUTDEVICE::dev_next

Link to the next device structure.

Definition at line 156 of file device.h.

Referenced by MmCardMount(), NutDeviceLookup(), NutIpOutput(), and NutRegisterDevice().

char _NUTDEVICE::dev_name[9]

Unique device name.

Definition at line 161 of file device.h.

Referenced by cs8900Init(), CSNicInit(), DebugInit(), DebugWrite(), MmCardMount(), NicInit(), NutDeviceLookup(), NutNetIfSetup(), and NutRegisterDevice().

u_char _NUTDEVICE::dev_type

Type of interface.

May be any of the following:

Definition at line 174 of file device.h.

Referenced by AceInit(), AhdlcAvrIOCtl(), MmCardMount(), NutDhcpIfConfig(), NutIpOutput(), NutNetIfConfig2(), and UartAvrInit().

uptr_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 182 of file device.h.

Referenced by AceInit(), AceIOCtl(), AceOutput(), AhdlcAvrClose(), AhdlcAvrInit(), AhdlcAvrIOCtl(), AhdlcAvrOpen(), AhdlcAvrPut(), cs8900Init(), CSNicInit(), NutRegisterDevice(), SJAInit(), UartAvrInit(), UartAvrIOCtl(), and UartAvrOutput().

u_char _NUTDEVICE::dev_irq

Interrupt registration number.

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

Definition at line 189 of file device.h.

Referenced by AceInit(), NutRegisterDevice(), and UartAvrInit().

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 196 of file device.h.

Referenced by AceFlush(), AceInit(), AceInput(), AceIOCtl(), AceOutput(), AcePut(), AceRead(), AceSize(), AhdlcAvrIOCtl(), AhdlcRx(), AtCanInput(), AtCanSetAccCode(), AtCanSetAccMask(), AtCanSetBaudrate(), CAN_RxAvail(), CAN_RxFrame(), CAN_SetFilter(), CAN_SetRxTimeout(), CAN_SetSpeed(), CAN_TryRxFrame(), CAN_TryTxFrame(), CAN_TxFrame(), CAN_TxFree(), cs8900Init(), CSNicInit(), CSNICrx(), EmacRxThread(), MmCardIOCtl(), MmCardMount(), MmCardUnmount(), NicInit(), NicRx(), NicRxAsix(), NicRxLanc(), NutArpCacheQuery(), NutArpCacheUpdate(), NutArpInput(), NutArpOutput(), NutDhcpClient(), NutDhcpIfConfig(), NutEtherOutput(), NutIpInput(), NutIpOutput(), NutNetIfConfig2(), NutNetIfSetup(), NutPppOutput(), NutTcpConnect(), NutUdpOutput(), PhatSectorFlush(), PhatSectorLoad(), PhatVolMount(), RxThread(), SJAInit(), SJAInput(), SJASetAccCode(), SJASetAccMask(), SJASetBaudrate(), UartAvrFlush(), UartAvrInit(), UartAvrInput(), UartAvrOutput(), UartAvrPut(), UartAvrRead(), and UartAvrSize().

void* _NUTDEVICE::dev_dcb

Driver control block.

Points to a device specific information block.

Examples:
canbus/candemo.c, and pppc/pppc.c.

Definition at line 203 of file device.h.

Referenced by AceFlush(), AceInit(), AceInput(), AceIOCtl(), AceOpen(), AceOutput(), AcePut(), AceRead(), AhdlcAvrInit(), AhdlcAvrIOCtl(), AhdlcAvrPut(), AhdlcAvrRead(), AhdlcOutput(), AhdlcRx(), AllocFirstCluster(), AsixInit(), AsixOutput(), AtCanInit(), AtCanInput(), AtCanOutput(), CAN_Tx(), cs8900Init(), cs8900Output(), CSNicInit(), CSNicOutput(), CSNICrx(), DmInit(), DmOutput(), EmacInit(), EmacOutput(), EmacRxThread(), GenCharSize(), IpcpClose(), IpcpLowerDown(), IpcpLowerUp(), IpcpOpen(), IpcpRxConfAck(), IpcpRxConfReq(), IpcpRxProtRej(), IpcpRxTermAck(), IpcpRxTermReq(), IpcpTxConfReq(), IsFixedRootDir(), LancInit(), LancOutput(), LcpClose(), LcpLowerDown(), LcpLowerUp(), LcpOpen(), LcpResetOptions(), LcpRxProtRej(), LcpTxConfReq(), LcpTxProtRej(), main(), NicInit(), NicOutput(), NicRx(), NicRxAsix(), NicRxLanc(), NutIpcpInput(), NutLcpInput(), NutNetIfConfig2(), NutPppInput(), NutPppOutput(), NutPppSm(), PapRxAuthAck(), PapRxAuthNak(), PapTxAuthReq(), Phat12GetClusterLink(), Phat12ReleaseChain(), Phat12SetClusterLink(), Phat16GetClusterLink(), Phat16ReleaseChain(), Phat16SetClusterLink(), Phat32GetClusterLink(), Phat32ReleaseChain(), Phat32SetClusterLink(), PhatClusterSector(), PhatDirCreate(), PhatDirEntryUpdate(), PhatDirOpen(), PhatDirReleaseChain(), PhatFilePosSet(), PhatFileRead(), PhatFileWrite(), PhatSectorFlush(), PhatSectorLoad(), PhatVolMount(), PhatVolUnmount(), RxThread(), SJAInit(), SJAInput(), SJAOutput(), TermInit(), TermIOCtl(), TermOpen(), UartAvrFlush(), UartAvrInit(), UartAvrInput(), UartAvrIOCtl(), UartAvrOpen(), UartAvrPut(), UartAvrRead(), UsartClose(), UsartInit(), UsartIOCtl(), UsartOpen(), UsartRead(), UsartSize(), wlandrv_IOCTL(), wlandrv_PutPacket(), and WlanInit().

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

Driver initialization routine.

This routine is called during device registration.

Referenced by NutRegisterDevice().

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

Driver control function.

Used to modify or query device specific settings.

Referenced by _ioctl(), _seek(), _tell(), AhdlcRx(), closedir(), MmCardMount(), opendir(), PhatSectorRead(), PhatVolMount(), readdir(), rename(), and stat().

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

Read from device.

Referenced by _read(), and PhatSectorRead().

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

Write to device.

Referenced by _write().

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

Write to device.

Referenced by _write_P().

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

Open a device or file.

Referenced by _open().

int(* _NUTDEVICE::dev_close)(NUTFILE *)

Close a device or file.

Referenced by _close().

long(* _NUTDEVICE::dev_size)(NUTFILE *)

Request file size.

Referenced by _filelength().


The documentation for this struct was generated from the following file:
© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/