This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re cyg_io_init


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]