Ignore:
Timestamp:
Mar 27, 2015, 11:43:48 AM (10 years ago)
Author:
alain
Message:

1) Introducing support for external IRQs dynamic routing.
2) Simplifying the _v2p_translate() function.
3) Removing the generic IOC driver (integrated in the FAT library).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r459 r528  
    88#include <ctx_handler.h>
    99#include <giet_config.h>
     10#include <hard_config.h>
    1011#include <utils.h>
    1112#include <tty0.h>
    1213#include <xcu_driver.h>
    1314
    14 ////////// defined in giet_kernel/switch.s file /////////
     15/////////////////////////////////////////////////////////////////////////////////
     16//     Extern variables and functions
     17/////////////////////////////////////////////////////////////////////////////////
     18
     19// defined in giet_kernel/switch.s file
    1520extern void _task_switch(unsigned int *, unsigned int *);
     21
     22// allocated in boot.c or kernel_init.c files
     23extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX];
     24
     25//////////////////////////////////
     26void _ctx_display( unsigned int x,
     27                   unsigned int y,
     28                   unsigned int p,
     29                   unsigned int ltid,
     30                   char*        string )
     31{
     32    static_scheduler_t* psched = _schedulers[x][y][p];
     33    _printf("\n########## task[%d,%d,%d,%d] context\n"
     34            " - CTX_EPC   = %x\n"
     35            " - CTX_PTAB  = %x\n"
     36            " - CTX_PTPR  = %x\n"
     37            " - CTX_VSID  = %x\n"
     38            " - CTX_SR    = %x\n"
     39            " - CTX_RA    = %x\n"
     40            " - CTX_SP    = %x\n"
     41            " - CTX_RUN   = %x\n"
     42            "########## %s\n",
     43            x , y , p , ltid ,
     44            psched->context[ltid][CTX_EPC_ID],
     45            psched->context[ltid][CTX_PTAB_ID],
     46            psched->context[ltid][CTX_PTPR_ID],
     47            psched->context[ltid][CTX_VSID_ID],
     48            psched->context[ltid][CTX_SR_ID],
     49            psched->context[ltid][CTX_RA_ID],
     50            psched->context[ltid][CTX_SP_ID],
     51            psched->context[ltid][CTX_RUN_ID],
     52            string );
     53}  // _ctx_display()
     54
    1655
    1756//////////////////
     
    4887
    4988    // launch "idle" task if no runable task
    50     if (found == 0)
    51     {
    52         next_task_id = IDLE_TASK_INDEX;
    53     }
     89    if (found == 0) next_task_id = IDLE_TASK_INDEX;
    5490
    5591#if GIET_DEBUG_SWITCH
    5692unsigned int x = cluster_xy >> Y_WIDTH;
    5793unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);
    58 
    59 _printf("\n[TASK SWITCH] (%d) -> (%d) on processor[%d,%d,%d] at cycle %d\n",
     94_printf("\n[DEBUG SWITCH] (%d) -> (%d) on processor[%d,%d,%d] at cycle %d\n",
    6095        curr_task_id, next_task_id, x, y , lpid, _get_proctime() );
    6196#endif
     
    66101        unsigned int* next_ctx_vaddr = &(psched->context[next_task_id][0]);
    67102
    68         // reset timer counter.
    69         // In all clusters, the first NB_PROCS_MAX
    70         // timers are system timers (TICK)
    71 
    72 #if USE_XCU
     103        // reset TICK timer counter.
    73104        _xcu_timer_reset_cpt( cluster_xy, lpid );
    74 #else
    75         _timer_reset_cpt( cluster_xy, lpid);
    76 #endif
    77105
    78106        // set current task index
     
    80108
    81109        // makes context switch
    82         _task_switch(curr_ctx_vaddr, next_ctx_vaddr);
     110        _task_switch( curr_ctx_vaddr , next_ctx_vaddr );
     111
    83112    }
    84113} //end _ctx_switch()
     114
    85115
    86116/////////////////
     
    110140
    111141        // warning message
    112         _puts("\n[GIET WARNING] Processor[");
    113         _putd( x );
    114         _puts(",");
    115         _putd( y );
    116         _puts(",");
    117         _putd( p );
    118         _puts("] still idle at cycle ");
    119         _putd( _get_proctime() );
    120         _puts("\n");
     142        _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %d",
     143                x , y , p , _get_proctime() );
    121144    }
    122145} // end ctx_idle()
Note: See TracChangeset for help on using the changeset viewer.