Ignore:
Timestamp:
Jun 10, 2014, 12:33:23 PM (10 years ago)
Author:
alain
Message:

All drivers have been modified to use only the information
contained in the hard_config.h file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/tim_driver.c

    r295 r320  
    1919//
    2020// The NB_PROCS_MAX and NB_TIM_CHANNELS values must be defined in hard_config.h file.
    21 /////////////////////////////////////////////////////////////////////////////////////
     21//
    2222// The virtual base address of the segment associated to a channel is:
    23 //
    24 //     seg_tim_base + cluster_xy * vseg_cluster_increment + TIMER_SPAN * timer_id
    25 //
    26 // The seg_tim_base and vseg_cluster_increment values must be defined
    27 // in the giet_vsegs.ld file.
     23//     SEG_TIM_BASE + cluster_xy * VSEG_CLUSTER_INCREMENT + TIMER_SPAN * timer_id
     24//
     25// The SEG_TIM_BASE and VSEG_CLUSTER_INCREMENT must be defined in hard_config.h.
    2826/////////////////////////////////////////////////////////////////////////////////////
    2927
     
    3331#include <tty_driver.h>
    3432#include <utils.h>
     33
     34#if !defined(SEG_TIM_BASE)
     35# error: You must define SEG_TIM_BASE in the hard_config.h file
     36#endif
     37
     38#if !defined(VSEG_CLUSTER_INCREMENT)
     39# error: You must define VSEG_CLUSTER_INCREMENT in the hard_config.h file
     40#endif
    3541
    3642#if !defined(X_SIZE)
     
    9298    }
    9399
    94     unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    95                                   (cluster_xy * (unsigned int)&vseg_cluster_increment));
     100    unsigned int* timer_address = (unsigned int *) ( SEG_TIM_BASE +
     101                                  (cluster_xy * VSEG_CLUSTER_INCREMENT) );
    96102
    97103    timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period;
     
    123129    }
    124130
    125     unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    126                                   (cluster_xy * (unsigned int)&vseg_cluster_increment));
     131    unsigned int* timer_address = (unsigned int *) ( SEG_TIM_BASE +
     132                                  (cluster_xy * VSEG_CLUSTER_INCREMENT) );
    127133
    128134    timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0;
     
    155161    }
    156162
    157     unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    158                                    (cluster_xy * (unsigned int)&vseg_cluster_increment));
     163    unsigned int* timer_address = (unsigned int *) ( SEG_TIM_BASE +
     164                                  (cluster_xy * VSEG_CLUSTER_INCREMENT) );
    159165
    160166    timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0;
     
    189195
    190196    // We suppose that the TIMER_MODE register value is 0x3
    191     unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    192                                    (cluster_xy * (unsigned int)&vseg_cluster_increment));
     197    unsigned int* timer_address = (unsigned int *) ( SEG_TIM_BASE +
     198                                  (cluster_xy * VSEG_CLUSTER_INCREMENT) );
    193199
    194200    unsigned int period = timer_address[local_id * TIMER_SPAN + TIMER_PERIOD];
Note: See TracChangeset for help on using the changeset viewer.