[En-Nut-Discussion] Device driver
Zachary
psilva at opensoftware-br.com
Sun Nov 5 17:47:11 CET 2006
Hi all,
I am having problem with NutRegisterDevice, when trying to register
devXflash, made by Michael Fischer.
The test below fail because (*dev->dev_init)(dev) have value of 0xFFFF.
if(dev->dev_init == 0 || (*dev->dev_init)(dev) == 0 ) {
dev->dev_next = nutDeviceList;
nutDeviceList = dev;
rc = 0;
}
The NETDEVICE structure is :
NUTDEVICE devXflash = {
0, /*!< Pointer to next device. */
{'X', 'F', 'L', 'A', 'S', 'H', 0, 0, 0}, /*!< Unique device name.
*/
IFTYP_STREAM, /*!< Type of device. Obsolete. */
0, /*!< Base address. Unused. */
0, /*!< First interrupt number. Unused. */
0, /*!< Interface control block. Unused. */
0, /*!< Driver control block. Unused. */
XflashInit, /*!< Driver initialization routine. Not supported.
*/
0, /*!< Driver specific control function. Not
supported. */
XflashRead, /*!< Read data from a file. */
XflashWrite, /*!< Write data to a file. */
#ifdef __HARVARD_ARCH__
XflashWrite_P, /*!< Write data from program space to a file. */
#endif
XflashOpen, /*!< Open a file. */
XflashClose, /*!< Close a file. */
XflashSize /*!< Return file size. */
};
I do not know what to do because I am new to NUT/OS, so ask if somebody may
help me? or point me to a document that explain device driver register in
detail, any advice will be welcome.
Another doubt I have is, why the test is about this pointer is NULL to
register a device? I don't understant why it is this way.
if(dev->dev_init == 0 || (*dev->dev_init)(dev) == 0 ) {
regards
/Zach
More information about the En-Nut-Discussion
mailing list