Ignore:
Timestamp:
2013-02-14T21:22:17Z (11 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63b2be8
Parents:
c0948aaa
Message:

Add some sanity checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/am335x/timer.c

    rc0948aaa r9c56996  
    5252static const timer_regs_mmap_t regs_map[TIMERS_MAX] = {
    5353        { .base = AM335x_DMTIMER0_BASE_ADDRESS, .size = AM335x_DMTIMER0_SIZE },
    54         {0, 0},
     54        {0, 0}, /* DMTIMER1 is not supported by this driver */
    5555        { .base = AM335x_DMTIMER2_BASE_ADDRESS, .size = AM335x_DMTIMER2_SIZE },
    5656        { .base = AM335x_DMTIMER3_BASE_ADDRESS, .size = AM335x_DMTIMER3_SIZE },
     
    8383}
    8484
    85 void
     85int
    8686am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz,
    8787    unsigned srcclk_hz)
     
    9191
    9292        ASSERT(id < TIMERS_MAX);
     93        ASSERT(timer != NULL);
    9394
    9495        if (id == DMTIMER1_1MS)
    95                 return; /* Not supported yet */
     96                return ENOTSUP; /* Not supported yet */
    9697
    9798        base_addr = regs_map[id].base;
     
    99100
    100101        timer->regs = (void *) km_map(base_addr, size, PAGE_NOT_CACHEABLE);
     102        ASSERT(timer->regs != NULL);
     103
    101104        timer->id = id;
    102105
     
    130133        write_register_posted(timer, REG_TCRR, count);
    131134        write_register_posted(timer, REG_TLDR, count);
     135
     136        return EOK;
    132137}
    133138
Note: See TracChangeset for help on using the changeset viewer.