This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re cyg_io_init
- To: Ecos Mailing List <ecos-discuss at sources dot redhat dot com>
- Subject: [ECOS] Re cyg_io_init
- From: Carl van Schaik <carl at leg dot uct dot ac dot za>
- Date: Thu, 7 Sep 2000 13:22:01 +0200 (SAST)
I managed to get code to run by adding the line:
t = ((cyg_devtab_entry_t *)((unsigned char *)t+4));
inside the loop. The problems seems to be that each devtab structure is
getting a 0x00000000 inserted as the first item (or and offset of 4 is
being added for each devtab item)
I saw that the CYG_HAL_TABLE_BEGIN( __DEVTAB__, devtab );
macro is actually some inline assembler, why is this?
void
cyg_io_init(void)
{
static int _init = false;
cyg_devtab_entry_t *t;
if (_init) return;
for (t = &__DEVTAB__[0]; t != &__DEVTAB_END__; t++) {
t = ((cyg_devtab_entry_t *)((unsigned char *)t+4));
#ifdef CYGDBG_IO_INIT
diag_printf("Init device '%s'\n", t->name);
#endif
if (t->init(t)) {
t->status |= CYG_DEVTAB_STATUS_AVAIL;
} else {
// What to do if device init fails?
// Device not [currently] available
t->status &= ~CYG_DEVTAB_STATUS_AVAIL;
}
}
_init = true;
}
A
Carl van Schaik <carl@leg.uct.ac.za>
-----------------------------------------------------
Dept. Electrical Engineering, UCT
621 Menzies Building
University of Cape Town
Rondebosch
Western Cape
7700
South Africa
Tel: +27 21 650-3467
Fax: +27 21 650-3465