Nut/OS  4.10.3
API Reference
_NUTDEVICE Struct Reference

Device structure. More...

#include <device.h>

Collaboration diagram for _NUTDEVICE:

Data Fields

 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.

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

Link to the next device structure.

Definition at line 169 of file device.h.

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

Type of interface.

May be any of the following:


Definition at line 187 of file device.h.

Referenced by AceInit(), AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), MmCardMount(), NutDhcpIfConfig(), NutIpOutput(), NutNetIfAddMcastAddr(), NutNetIfConfig2(), NutNetIfDelMcastAddr(), SpiMmcMount(), and UartAvrInit().

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.

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

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.

Referenced by AceFlush(), AceInit(), AceInput(), AceIOCtl(), AceOutput(), AcePut(), AceRead(), AceSize(), AhdlcAt91IOCtl(), AhdlcAvrInit(), 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(), NutIgmpInput(), NutIpInput(), NutIpOutput(), NutNetIfAddMcastAddr(), NutNetIfConfig2(), NutNetIfDelMcastAddr(), NutNetIfSetup(), NutPppOutput(), NutRegisterSpiDevice(), NutTcpConnect(), NutUdpOutput(), PhatSectorFlush(), PhatSectorLoad(), PhatVolMount(), RawFsMount(), RxThread(), SJAInit(), SJAInput(), SJASetAccCode(), SJASetAccMask(), SJASetBaudrate(), Spi7segInit(), Spi7SegPush(), Spi7segPutc(), SpiAt45dCommand(), SpiAt45dInit(), SpiAt45dPageErase(), SpiAt45dPageRead(), SpiAt45dPageWrite(), SpiAt45dStatus(), SpiAt45dWaitReady(), SpiMmcBlockRead(), SpiMmcBlockWrite(), SpiMmcIOCtl(), SpiMmcMount(), UartAvrFlush(), UartAvrInit(), UartAvrInput(), UartAvrOutput(), UartAvrPut(), UartAvrRead(), UartAvrSize(), UFlashAttach(), UFlashDetach(), and upnp_Init().

Driver control block.

Points to a device specific information block.


Definition at line 216 of file device.h.

Referenced by AceFlush(), AceInit(), AceInput(), AceIOCtl(), AceOpen(), AceOutput(), AcePut(), AceRead(), AhdlcAt91Init(), AhdlcAt91IOCtl(), AhdlcAt91Put(), AhdlcAt91Read(), AhdlcAvrInit(), AhdlcAvrIOCtl(), AhdlcAvrPut(), AhdlcAvrRead(), AhdlcOutput(), AhdlcRx(), AllocFirstCluster(), AsixInit(), AsixOutput(), At91DevDebugOpen(), AtCanInit(), AtCanInput(), AtCanOutput(), CAN_Tx(), cs8900Init(), cs8900Output(), CSNicInit(), CSNicOutput(), CSNICrx(), DmInit(), DmOutput(), EmacInit(), EmacOutput(), EmacRxThread(), FeederThread(), GenCharSize(), IpcpClose(), IpcpLowerDown(), IpcpLowerUp(), IpcpOpen(), IpcpRxConfAck(), IpcpRxConfReq(), IpcpRxProtRej(), IpcpRxTermAck(), IpcpRxTermReq(), IpcpTxConfReq(), IsFixedRootDir(), LancInit(), LancOutput(), LcpClose(), LcpLowerDown(), LcpLowerUp(), LcpOpen(), LcpRxProtRej(), LcpTxConfReq(), LcpTxProtRej(), NicInit(), NicOutput(), NicRx(), NicRxAsix(), NicRxLanc(), NutBlockDeviceIOCtl(), NutBlockDeviceOpen(), NutBlockDeviceRead(), NutBlockDeviceWrite(), NutBlockDeviceWrite_P(), 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(), RawFsFileRead(), RawFsFileWrite(), RawFsMount(), RawFsUnmount(), RxThread(), Sc16is752UsartProcessChannelInterrupt(), SJAInit(), SJAInput(), SJAOutput(), Spi7segDot(), Spi7segInit(), Spi7SegPush(), Spi7segPutc(), SpiAt45dInit(), SpiAt45dPageErase(), SpiAt45dPageRead(), SpiAt45dPages(), SpiAt45dPageSize(), SpiAt45dPageWrite(), SpiMmcBlockRead(), SpiMmcBlockWrite(), SpiMmcIOCtl(), SpiMmcMount(), TermInit(), TermIOCtl(), TermOpen(), UartAvrFlush(), UartAvrInit(), UartAvrInput(), UartAvrIOCtl(), UartAvrOpen(), UartAvrPut(), UartAvrRead(), UFlashFormat(), UsartClose(), UsartInit(), UsartIOCtl(), UsartOpen(), UsartRead(), UsartSize(), VsCodecBeep(), VsCodecClose(), VsCodecIOCtl(), VsCodecOpen(), VsCodecRead(), VsCodecReg(), VsCodecWaitReady(), VsCodecWrite(), VsDecoderBufferInit(), VsDecoderSetBass(), VsDecoderSetVolume(), wlandrv_IOCTL(), wlandrv_PutPacket(), and WlanInit().

Driver initialization routine.

This routine is called during device registration.

Definition at line 223 of file device.h.

Referenced by NutInit(), and NutRegisterDevice().

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

Read from device.

Definition at line 235 of file device.h.

Referenced by _read(), and PhatSectorRead().

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

Write to device.

Definition at line 240 of file device.h.

Referenced by _write().

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

Write to device.

Definition at line 246 of file device.h.

Referenced by _write_P().

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

Open a device or file.

Definition at line 252 of file device.h.

Referenced by _open(), and NutInit().

Close a device or file.

Definition at line 257 of file device.h.

Referenced by _close().

Request file size.

Definition at line 262 of file device.h.

Referenced by _filelength().

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