Ignore:
Timestamp:
Dec 19, 2013, 9:36:48 AM (10 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/xcu_driver.c

    r258 r263  
    1616// The virtual base address of the segment associated to the component is:
    1717//
    18 //      seg_xcu_base + cluster_id * vseg_cluster_increment
     18//      seg_xcu_base + cluster_xy * vseg_cluster_increment
    1919//
    2020// The seg_xcu_base and vseg_cluster_increment values must be defined
     
    2424#include <giet_config.h>
    2525#include <xcu_driver.h>
     26#include <tty_driver.h>
     27#include <mapping_info.h>
    2628#include <utils.h>
    2729
    28 #if !defined(NB_CLUSTERS)
    29 # error: You must define NB_CLUSTERS in the hard_config.h file
    30 #endif
    31 
    32 #if (NB_CLUSTERS > 256)
    33 # error: NB_CLUSTERS cannot be larger than 256!
     30#if !defined(X_SIZE)
     31# error: You must define X_SIZE in the hard_config.h file
     32#endif
     33
     34#if !defined(Y_SIZE)
     35# error: You must define X_SIZE in the hard_config.h file
     36#endif
     37
     38#if !defined(X_WIDTH)
     39# error: You must define X_WIDTH in the hard_config.h file
     40#endif
     41
     42#if !defined(Y_WIDTH)
     43# error: You must define X_WIDTH in the hard_config.h file
    3444#endif
    3545
    3646#if !defined(NB_PROCS_MAX)
    3747# error: You must define NB_PROCS_MAX in the hard_config.h file
    38 #endif
    39 
    40 #if (NB_PROCS_MAX > 8)
    41 # error: NB_PROCS_MAX cannot be larger than 8!
    4248#endif
    4349
     
    5359// Returns 0 if success, > 0 if error.
    5460////////////////////////////////////////////////////////////////////////////////
    55 unsigned int _xcu_set_mask( unsigned int cluster_id, unsigned int proc_id,
     61unsigned int _xcu_set_mask( unsigned int cluster_xy,
     62                            unsigned int proc_id,
    5663                            unsigned int value,
    57                             unsigned int is_PTI)
    58 {
    59     // parameters checking
    60     if (cluster_id >= NB_CLUSTERS) return 1;
    61     if (proc_id >= NB_PROCS_MAX)   return 1;
     64                            unsigned int irq_type )
     65{
     66    // parameters checking
     67    unsigned int x = cluster_xy >> Y_WIDTH;
     68    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     69    if (x >= X_SIZE)             return 1;
     70    if (y >= Y_SIZE)             return 1;
     71    if (proc_id >= NB_PROCS_MAX) return 1;
    6272
    6373#if USE_XICU
    6474    unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    65                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
    66     if (is_PTI)
    67         xcu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value;
    68     else
    69         xcu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value;
     75                                (cluster_xy * (unsigned int)&vseg_cluster_increment));
     76    unsigned int func;
     77    if      (irq_type == IRQ_TYPE_PTI) func = XICU_MSK_PTI_ENABLE;
     78    else if (irq_type == IRQ_TYPE_SWI) func = XICU_MSK_WTI_ENABLE;
     79    else                               func = XICU_MSK_HWI_ENABLE;
     80    xcu_address[XICU_REG(func,proc_id)] = value;
    7081    return 0;
    7182#else
     
    8697// Returns 0 if success, > 0 if error.
    8798////////////////////////////////////////////////////////////////////////////////
    88 unsigned int _xcu_get_index( unsigned int cluster_id,
     99unsigned int _xcu_get_index( unsigned int cluster_xy,
    89100                             unsigned int proc_id,
    90101                             unsigned int * buffer)
    91102{
    92103    // parameters checking
    93     if (cluster_id >= NB_CLUSTERS)  return 1;
    94     if (proc_id >= NB_PROCS_MAX)    return 1;
     104    unsigned int x = cluster_xy >> Y_WIDTH;
     105    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     106    if (x >= X_SIZE)             return 1;
     107    if (y >= Y_SIZE)             return 1;
     108    if (proc_id >= NB_PROCS_MAX) return 1;
    95109
    96110#if USE_XICU
    97111    unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    98                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     112                                (cluster_xy * (unsigned int)&vseg_cluster_increment));
    99113
    100114    unsigned int prio = xcu_address[XICU_REG(XICU_PRIO, proc_id)];
     
    125139// Returns 0 if success, > 0 if error.
    126140////////////////////////////////////////////////////////////////////////////////
    127 unsigned int _xcu_send_ipi( unsigned int cluster_id,
     141unsigned int _xcu_send_ipi( unsigned int cluster_xy,
    128142                            unsigned int proc_id,
    129143                            unsigned int wdata )
    130144{
    131145    // parameters checking
    132     if (cluster_id >= NB_CLUSTERS)  return 1;
    133     if (proc_id >= NB_PROCS_MAX)    return 1;
     146    unsigned int x = cluster_xy >> Y_WIDTH;
     147    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     148    if (x >= X_SIZE)             return 1;
     149    if (y >= Y_SIZE)             return 1;
     150    if (proc_id >= NB_PROCS_MAX) return 1;
    134151
    135152#if USE_XICU
    136153    unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    137                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
     154                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
    138155    xcu_address[XICU_REG(XICU_WTI_REG, proc_id)] = wdata;
    139156    return 0;
     
    152169// Returns 0 if success, > 0 if error.
    153170////////////////////////////////////////////////////////////////////////////////
    154 unsigned int _xcu_timer_start( unsigned int cluster_id,
    155                                unsigned int local_id,
     171unsigned int _xcu_timer_start( unsigned int cluster_xy,
     172                               unsigned int proc_id,
    156173                               unsigned int period )
    157174{
    158175    // parameters checking
    159     if (cluster_id >= NB_CLUSTERS)    return 1;
    160     if (local_id >= NB_TIM_CHANNELS)  return 1;
     176    unsigned int x = cluster_xy >> Y_WIDTH;
     177    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     178    if (x >= X_SIZE)             return 1;
     179    if (y >= Y_SIZE)             return 1;
     180    if (proc_id >= NB_PROCS_MAX) return 1;
    161181
    162182#if USE_XICU
    163183    unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    164                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
    165     xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = period;
     184                                (cluster_xy * (unsigned int)&vseg_cluster_increment));
     185    xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = period;
    166186    return 0;
    167187#else
     
    179199// Returns 0 if success, > 0 if error.
    180200//////////////////////////////////////////////////////////////////////////////
    181 unsigned int _xcu_timer_stop( unsigned int cluster_id,
    182                               unsigned int local_id)
    183 {
    184     // parameters checking
    185     if (cluster_id >= NB_CLUSTERS)    return 1;
    186     if (local_id >= NB_TIM_CHANNELS)  return 1;
     201unsigned int _xcu_timer_stop( unsigned int cluster_xy,
     202                              unsigned int proc_id)
     203{
     204    // parameters checking
     205    unsigned int x = cluster_xy >> Y_WIDTH;
     206    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     207    if (x >= X_SIZE)             return 1;
     208    if (y >= Y_SIZE)             return 1;
     209    if (proc_id >= NB_PROCS_MAX) return 1;
    187210
    188211#if USE_XICU
    189212    unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    190                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
    191     xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;
     213                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
     214    xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = 0;
    192215    return 0;
    193216#else
     
    207230// Returns 0 if success, > 0 if error.
    208231//////////////////////////////////////////////////////////////////////////////
    209 unsigned int _xcu_timer_reset_irq( unsigned int cluster_id,
    210                                    unsigned int local_id )
    211 {
    212     // parameters checking
    213     if (cluster_id >= NB_CLUSTERS)    return 1;
    214     if (local_id >= NB_TIM_CHANNELS)  return 1;
     232unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy,
     233                                   unsigned int proc_id )
     234{
     235    // parameters checking
     236    unsigned int x = cluster_xy >> Y_WIDTH;
     237    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     238    if (x >= X_SIZE)             return 1;
     239    if (y >= Y_SIZE)             return 1;
     240    if (proc_id >= NB_PROCS_MAX) return 1;
    215241
    216242#if USE_XICU
    217243    unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    218                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
    219 
    220     unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, local_id)];
     244                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
     245
     246    unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, proc_id)];
    221247    bloup++; // to avoid a warning
    222248    return 0;
     
    238264// This function is called during a context switch (user or preemptive)
    239265/////////////////////////////////////////////////////////////////////////////
    240 unsigned int _xcu_timer_reset_cpt( unsigned int cluster_id,
    241                                    unsigned int local_id )
    242 {
    243     // parameters checking
    244     if (cluster_id >= NB_CLUSTERS)   return 1;
    245     if (local_id >= NB_TIM_CHANNELS) return 1;
     266unsigned int _xcu_timer_reset_cpt( unsigned int cluster_xy,
     267                                   unsigned int proc_id )
     268{
     269    // parameters checking
     270    unsigned int x = cluster_xy >> Y_WIDTH;
     271    unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
     272    if (x >= X_SIZE)             return 1;
     273    if (y >= Y_SIZE)             return 1;
     274    if (proc_id >= NB_PROCS_MAX) return 1;
    246275
    247276#if USE_XICU
    248277    unsigned int * xcu_address = (unsigned int *) ((unsigned int) &seg_xcu_base +
    249                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
    250 
    251     unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, local_id)];
     278                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
     279
     280    unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, proc_id)];
    252281
    253282    // we write 0 first because if the timer is currently running,
    254283    // the corresponding timer counter is not reset
    255     xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;
    256     xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = period;
     284    xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = 0;
     285    xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = period;
    257286    return 0;
    258287#else
Note: See TracChangeset for help on using the changeset viewer.