Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9c56996 in mainline


Ignore:
Timestamp:
2013-02-14T21:22:17Z (9 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master
Children:
63b2be8
Parents:
c0948aaa
Message:

Add some sanity checks

Location:
kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mach/beaglebone/beaglebone.c

    rc0948aaa r9c56996  
    9898            AM335x_CTRL_MODULE_SIZE, PAGE_NOT_CACHEABLE);
    9999
     100        ASSERT(bbone.irc_addr != NULL);
     101        ASSERT(bbone.cm_per_addr != NULL);
     102        ASSERT(bbone.cm_dpll_addr != NULL);
     103        ASSERT(bbone.ctrl_module != NULL);
     104
    100105        /* Initialize the interrupt controller */
    101106        am335x_irc_init(bbone.irc_addr);
     
    118123{
    119124        unsigned sysclk_freq;
     125        int rc;
    120126
    121127        /* Initialize the IRQ */
     
    141147                printf("system clock running at %u hz\n", sysclk_freq);
    142148
    143         am335x_timer_init(&bbone.timer, DMTIMER2, HZ, sysclk_freq);
     149        rc = am335x_timer_init(&bbone.timer, DMTIMER2, HZ, sysclk_freq);
     150        if (rc != EOK) {
     151                printf("Timer initialization failed\n");
     152                return;
     153        }
    144154        /* Enable the interrupt */
    145155        am335x_irc_enable(bbone.irc_addr, AM335x_DMTIMER2_IRQ);
  • kernel/genarch/include/drivers/am335x/timer.h

    rc0948aaa r9c56996  
    8585} am335x_timer_t;
    8686
    87 extern void am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id,
     87extern int am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id,
    8888    unsigned hz, unsigned srcclk_hz);
    8989extern void am335x_timer_intr_ack(am335x_timer_t *timer);
  • 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.