Collaboration diagram for Generic Character Device:
|
Extensively commented source code of a Nut/OS character device driver. It doesn't drive any specific device, but can be used as a template when adding new device drivers.
Data Structures | |
| struct | DEVDCB |
| Device driver's private data structure. More... | |
Defines | |
| #define | GENDEV_SPORT 0x100 |
| #define | GENDEV_DPORT 0x104 |
| #define | GENDEV_SIGNAL sig_INTERRUPT1 |
Functions | |
| int | GenCharWrite_P (NUTFILE *fp, PGM_P buffer, int len) |
| Write program data to the device. | |
| long | GenCharSize (NUTFILE *fp) |
| Retrieves the number of characters in input buffer. | |
Variables | |
| NUTDEVICE | devGenChar |
| Device information structure. | |
|
||||||||||||||||
|
Write program data to the device. Similar to GenCharWrite() except that the data is located in program memory. This function is called by the low level output routines of the C runtime library, using the _NUTDEVICE::dev_write_P entry, which is available on Harvard architectures only. The function may block the calling thread.
|
|
|
Retrieves the number of characters in input buffer. This function is called by the low level size routine of the C runtime library, using the _NUTDEVICE::dev_size entry.
|
|
|
Initial value: {
0,
{'g', 'e', 'n', 'c', 'h', 'a', 'r', 0, 0},
IFTYP_CHAR,
0,
0,
0,
&devdcb,
GenCharInit,
GenCharIOCtl,
GenCharRead,
GenCharWrite,
GenCharWrite_P,
GenCharOpen,
GenCharClose,
GenCharSize
}
|