Changeset 275


Ignore:
Timestamp:
Jan 21, 2014, 7:20:06 PM (11 years ago)
Author:
cfuguet
Message:
  • Adding volatile attribute for pointers used to address memory mapped hardware registers.
  • Removing the activation of interruptions before the execution of the ctx_switch function on the ioc_access function. This is to avoid been interrupted during the modification of task context variables.
Location:
soft/giet_vm
Files:
4 edited

Legend:

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

    r263 r275  
    276276#endif
    277277
    278     // SYNC request for channel descriptor
    279     _memc_sync( desc_paddr, 32 );
     278    if ( USE_IOB )
     279    {
     280        // SYNC request for channel descriptor
     281        _memc_sync( desc_paddr, 32 );
     282    }
    280283
    281284    // CMA channel activation
  • soft/giet_vm/giet_drivers/ioc_driver.c

    r263 r275  
    155155    }
    156156
    157     unsigned int * ioc_address = (unsigned int *) &seg_ioc_base ;
     157    volatile unsigned int * ioc_address = (unsigned int *) &seg_ioc_base ;
    158158
    159159    unsigned int length = count << 9;  // count * 512 bytes
     
    358358        else             ioc_address[BLOCK_DEVICE_OP] = BLOCK_DEVICE_READ;
    359359
    360         // Exit critical section
    361         _it_enable();
    362 
    363360        // deschedule task
    364361        _ctx_switch();                     
  • soft/giet_vm/giet_drivers/xcu_driver.c

    r271 r275  
    7272
    7373#if USE_XICU
    74     unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    75                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
     74    volatile unsigned int* xcu_address =
     75        (unsigned int *) ((unsigned int)&seg_xcu_base +
     76        (cluster_xy * (unsigned int)&vseg_cluster_increment));
     77
    7678    unsigned int func;
    7779    if      (irq_type == IRQ_TYPE_PTI) func = XICU_MSK_PTI_ENABLE;
     
    109111
    110112#if USE_XICU
    111     unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    112                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
     113    volatile unsigned int* xcu_address =
     114        (unsigned int *) ((unsigned int)&seg_xcu_base +
     115        (cluster_xy * (unsigned int)&vseg_cluster_increment));
    113116
    114117    unsigned int prio = xcu_address[XICU_REG(XICU_PRIO, proc_id)];
     
    151154
    152155#if USE_XICU
    153     unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    154                                  (cluster_xy * (unsigned int)&vseg_cluster_increment));
     156    volatile unsigned int* xcu_address =
     157        (unsigned int *) ((unsigned int)&seg_xcu_base +
     158        (cluster_xy * (unsigned int)&vseg_cluster_increment));
     159
    155160    xcu_address[XICU_REG(XICU_WTI_REG, proc_id)] = wdata;
    156161    return 0;
     
    180185
    181186#if USE_XICU
    182     unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    183                                 (cluster_xy * (unsigned int)&vseg_cluster_increment));
     187    volatile unsigned int* xcu_address =
     188        (unsigned int *) ((unsigned int)&seg_xcu_base +
     189        (cluster_xy * (unsigned int)&vseg_cluster_increment));
     190
    184191    xcu_address[XICU_REG(XICU_PTI_PER, pti_index)] = period;
    185192    return 0;
     
    208215
    209216#if USE_XICU
    210     unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
    211                                  (cluster_xy * (unsigned int)&vseg_cluster_increment));
     217    volatile unsigned int * xcu_address =
     218        (unsigned int *) ((unsigned int)&seg_xcu_base +
     219        (cluster_xy * (unsigned int)&vseg_cluster_increment));
     220
    212221    xcu_address[XICU_REG(XICU_PTI_PER, pti_index)] = 0;
    213222    return 0;
     
    271280
    272281#if USE_XICU
    273     unsigned int * xcu_address = (unsigned int *) ((unsigned int) &seg_xcu_base +
    274                                  (cluster_xy * (unsigned int)&vseg_cluster_increment));
     282    volatile unsigned int * xcu_address =
     283        (unsigned int *) ((unsigned int) &seg_xcu_base +
     284        (cluster_xy * (unsigned int)&vseg_cluster_increment));
    275285
    276286    unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, pti_index)];
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r271 r275  
    108108    if (curr_task_id != next_task_id)
    109109    {
     110#if GIET_DEBUG_SWITCH
     111_tty_get_lock( 0 );
     112_puts("\n[GIET DEBUG] Context switch for processor ");
     113_putd(_get_procid());
     114_puts(" at cycle ");
     115_putd(_get_proctime());
     116_puts("\n");
     117_puts(" - tasks        = ");
     118_putd(tasks);
     119_puts("\n");
     120_puts(" - curr_task_id = ");
     121_putd( curr_task_id );
     122_puts("\n");
     123_puts(" - next_task_id = ");
     124_putd(next_task_id);
     125_puts("\n");
     126_tty_release_lock(  0 );
     127#endif
     128
    110129        unsigned int* curr_ctx_vaddr = &(psched->context[curr_task_id][0]);
    111130        unsigned int* next_ctx_vaddr = &(psched->context[next_task_id][0]);
     
    113132        unsigned int local_id = procid % NB_PROCS_MAX;
    114133        unsigned int cluster_id = procid / NB_PROCS_MAX;
    115 
    116         // set current task index
    117         psched->current = next_task_id;
    118134
    119135        // reset timer counter
     
    124140#endif
    125141
     142        // set current task index
     143        psched->current = next_task_id;
     144
    126145        // makes context switch
    127146        _task_switch(curr_ctx_vaddr, next_ctx_vaddr);
    128 
    129 #if GIET_DEBUG_SWITCH
    130 _tty_get_lock( 0 );
    131 _puts("\n[GIET DEBUG] Context switch for processor ");
    132 _putd(_get_procid());
    133 _puts(" at cycle ");
    134 _putd(_get_proctime());
    135 _puts("\n");
    136 _puts(" - tasks        = ");
    137 _putd(tasks);
    138 _puts("\n");
    139 _puts(" - curr_task_id = ");
    140 _putd( curr_task_id );
    141 _puts("\n");
    142 _puts(" - next_task_id = ");
    143 _putd(next_task_id);
    144 _puts("\n");
    145 _tty_release_lock(  0 );
    146 #endif
    147 
    148147    }
    149148} //end _ctx_switch()
     
    157156    while(1)
    158157    {
     158#if GIET_IDLE_TASK_VERBOSITY == 1
     159        _tty_get_lock( 0 );
     160        _puts("\n[GIET WARNING] Processor ");
     161        _putd(_get_procid());
     162        _puts(" idle at cycle ");
     163        _putd(_get_proctime());
     164        _puts("\n");
     165        _tty_release_lock( 0 );
     166#endif
     167
    159168        asm volatile(
    160169                "move   $3,   %0              \n"
     
    167176                : "$3" );
    168177
    169 #if GIET_IDLE_TASK_VERBOSITY == 1
    170         _tty_get_lock( 0 );
    171         _puts("\n[GIET WARNING] Processor ");
    172         _putd(_get_procid());
    173         _puts(" idle at cycle ");
    174         _putd(_get_proctime());
    175         _puts("\n");
    176         _tty_release_lock( 0 );
    177 #endif
    178 
    179178         count = GIET_IDLE_TASK_PERIOD;
    180179    }
Note: See TracChangeset for help on using the changeset viewer.