Ignore:
Timestamp:
Dec 19, 2013, 9:36:48 AM (11 years ago)
Author:
alain
Message:

Introducing support for TSAR fixed format cluster index (cluster_xy)
We have now 4 parameters defined in map.xml:

  • X_WIDTH, Y_WIDTH define the fixed format (typically X_WIDTH = 4 / Y_WIDTH = 4)
  • X_SIZE, Y_SIZE define the actual TSAR 2D mesh variable size (from 1 to 16)
File:
1 edited

Legend:

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

    r258 r263  
    1616// - "user" timers : requested by the task in the mapping_info data structure.
    1717//   For each user timer, the timer_id is stored in the context of the task.
    18 // The global index is cluster_id * (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id
     18// The global index is cluster_xy * (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id
    1919//
    2020// The NB_PROCS_MAX and NB_TIM_CHANNELS values must be defined in the
     
    2525// The virtual base address of the segment associated to a channel is:
    2626//
    27 //     seg_tim_base + cluster_id * vseg_cluster_increment + TIMER_SPAN * timer_id
     27//     seg_tim_base + cluster_xy * vseg_cluster_increment + TIMER_SPAN * timer_id
    2828//
    2929// The seg_tim_base and vseg_cluster_increment values must be defined
     
    3535#include <utils.h>
    3636
    37 #if !defined(NB_CLUSTERS)
    38 # error: You must define NB_CLUSTERS in the hard_config.h file
     37#if !defined(X_SIZE)
     38# error: You must define X_SIZE in the hard_config.h file
    3939#endif
    4040
    41 #if (NB_CLUSTERS > 256)
    42 # error: NB_CLUSTERS cannot be larger than 256!
     41#if !defined(Y_SIZE)
     42# error: You must define X_SIZE in the hard_config.h file
     43#endif
     44
     45#if !defined(X_WIDTH)
     46# error: You must define X_WIDTH in the hard_config.h file
     47#endif
     48
     49#if !defined(Y_WIDTH)
     50# error: You must define X_WIDTH in the hard_config.h file
    4351#endif
    4452
    4553#if !defined(NB_PROCS_MAX)
    4654# error: You must define NB_PROCS_MAX in the hard_config.h file
    47 #endif
    48 
    49 #if (NB_PROCS_MAX > 8)
    50 # error: NB_PROCS_MAX cannot be larger than 8!
    5155#endif
    5256
     
    5963#endif
    6064
    61 #if !defined( USE_XICU )
    62 # error: You must define USE_XICU in the hard_config.h file
    63 #endif
    64 
    6565///////////////////  Timer global variables ////////////////////////////////////////
    6666
     
    6868
    6969#if (NB_TIM_CHANNELS > 0)
    70 in_unckdata volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIM_CHANNELS]
    71                             = { [0 ... ((NB_CLUSTERS * NB_TIM_CHANNELS) - 1)] = 0 };
     70in_unckdata volatile unsigned char _user_timer_event[X_SIZE*Y_SIZE*NB_TIM_CHANNELS]
     71                            = { [0 ... ((X_SIZE*Y_SIZE*NB_TIM_CHANNELS) - 1)] = 0 };
    7272#endif
    7373
     
    8080// Returns 0 if success, > 0 if error.
    8181//////////////////////////////////////////////////////////////////////////////
    82 unsigned int _timer_start( unsigned int cluster_id,
     82unsigned int _timer_start( unsigned int cluster_xy,
    8383                           unsigned int local_id,
    8484                           unsigned int period)
    8585{
    8686    // parameters checking
    87     if (cluster_id >= NB_CLUSTERS)    return 1;
     87    unsigned int x = cluster_xy >> Y_WIDTH;
     88    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     89    if (x >= X_SIZE)                  return 1;
     90    if (y >= Y_SIZE)                  return 1;
    8891    if (local_id >= NB_TIM_CHANNELS)  return 1;
    8992
    9093    unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    91                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
     94                                  (cluster_xy * (unsigned int)&vseg_cluster_increment));
    9295
    9396    timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period;
     
    102105// Returns 0 if success, > 0 if error.
    103106//////////////////////////////////////////////////////////////////////////////
    104 unsigned int _timer_stop( unsigned int cluster_id,
     107unsigned int _timer_stop( unsigned int cluster_xy,
    105108                          unsigned int local_id)
    106109{
    107110    // parameters checking
    108     if (cluster_id >= NB_CLUSTERS)    return 1;
     111    unsigned int x = cluster_xy >> Y_WIDTH;
     112    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     113    if (x >= X_SIZE)                  return 1;
     114    if (y >= Y_SIZE)                  return 1;
    109115    if (local_id >= NB_TIM_CHANNELS)  return 1;
    110116
    111117    unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    112                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
     118                                  (cluster_xy * (unsigned int)&vseg_cluster_increment));
    113119
    114120    timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0;
     
    124130// Returns 0 if success, > 0 if error.
    125131//////////////////////////////////////////////////////////////////////////////
    126 unsigned int _timer_reset_irq( unsigned int cluster_id,
     132unsigned int _timer_reset_irq( unsigned int cluster_xy,
    127133                               unsigned int local_id )
    128134{
    129135    // parameters checking
    130     if (cluster_id >= NB_CLUSTERS)    return 1;
     136    unsigned int x = cluster_xy >> Y_WIDTH;
     137    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     138    if (x >= X_SIZE)                  return 1;
     139    if (y >= Y_SIZE)                  return 1;
    131140    if (local_id >= NB_TIM_CHANNELS)  return 1;
    132141
    133142    unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    134                                    (cluster_id * (unsigned int)&vseg_cluster_increment));
     143                                   (cluster_xy * (unsigned int)&vseg_cluster_increment));
    135144
    136145    timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0;
     
    147156// This function is called during a context switch (user or preemptive)
    148157//////////////////////////////////////////////////////////////////////i//////
    149 unsigned int _timer_reset_cpt( unsigned int cluster_id,
     158unsigned int _timer_reset_cpt( unsigned int cluster_xy,
    150159                               unsigned int local_id)
    151160{
    152161    // parameters checking
    153     if (cluster_id >= NB_CLUSTERS)    return 1;
     162    unsigned int x = cluster_xy >> Y_WIDTH;
     163    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     164    if (x >= X_SIZE)                  return 1;
     165    if (y >= Y_SIZE)                  return 1;
    154166    if (local_id >= NB_TIM_CHANNELS)  return 1;
    155167
    156168    // We suppose that the TIMER_MODE register value is 0x3
    157169    unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
    158                                    (cluster_id * (unsigned int)&vseg_cluster_increment));
     170                                   (cluster_xy * (unsigned int)&vseg_cluster_increment));
    159171
    160172    unsigned int period = timer_address[local_id * TIMER_SPAN + TIMER_PERIOD];
Note: See TracChangeset for help on using the changeset viewer.