Ignore:
Timestamp:
May 29, 2013, 1:24:09 AM (11 years ago)
Author:
alain
Message:

Major evolution to support physical addresses larger than 32 bits.
The map.xml format has been modified: the vsegs associated to schedulers
are now explicitely defined and mapped in the page tables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/irq_handler.c

    r237 r238  
    1919#include <hwr_mapping.h>
    2020
    21 #if NB_TIMERS_MAX
    22 extern volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIMERS_MAX] ;
     21#if NB_TIM_CHANNELS
     22extern volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIM_CHANNELS] ;
    2323#endif
    2424
     
    3333//
    3434// There is one interrupt vector per processor (stored in the scheduler associated
    35 // to the processor. Each interrupt vector entry contains two 16 bits fields:
    36 // - isr_id : defines the type of ISR to be executed.
     35// to the processor. Each interrupt vector entry contains three bits fields:
     36// - isr_id     : defines the type of ISR to be executed.
     37// - type_id    : HWI if zero / PTI if non zero
    3738// - channel_id : defines the specific channel for multi-channels peripherals.
    3839//
     
    4041// a global index : channel_id = cluster_id * NB_CHANNELS_MAX + loc_id   
    4142///////////////////////////////////////////////////////////////////////////////////
    42 void _irq_demux() {
     43void _irq_demux()
     44{
    4345    unsigned int pid = _procid();
    4446    unsigned int irq_id;
    4547
    46 
    4748    // get the highest priority active IRQ index
    48     if (_icu_get_index( pid / NB_PROCS_MAX, pid % NB_PROCS_MAX, &irq_id)) {
     49    if (_icu_get_index( pid / NB_PROCS_MAX, pid % NB_PROCS_MAX, &irq_id))
     50    {
    4951        _get_lock(&_tty_put_lock);
    5052        _puts("\n[GIET ERROR] Strange... Wrong _icu_read in _irq_demux()\n");
     
    5254    }
    5355
    54 
    55     if (irq_id < 32) {
    56         // do nothing if no interrupt active
    57         unsigned int entry = _get_interrupt_vector_entry(irq_id);
    58         unsigned int isr_id = entry & 0x000000FF;
    59         unsigned int type_id = (entry >> 8) & 0x000000FF;
    60         unsigned int channel_id = (entry >> 16) & 0x0000FFFF;
     56    // do nothing if no interrupt active
     57    if (irq_id < 32)
     58    {
     59        static_scheduler_t* psched     = _get_sched();
     60        unsigned int        entry      = psched->interrupt_vector[irq_id];
     61        unsigned int        isr_id     = entry & 0x000000FF;
     62        unsigned int        type_id    = (entry >> 8) & 0x000000FF;
     63        unsigned int        channel_id = (entry >> 16) & 0x0000FFFF;
     64
    6165        if(type_id == 0) // HARD irq type
    6266        {
     
    7680}
    7781
    78 
    7982///////////////////////////////////////////////////////////////////////////////////
    8083//     _isr_default()
     
    8285// interrupt vector. It simply displays an error message on kernel TTY[0].
    8386///////////////////////////////////////////////////////////////////////////////////
    84 void _isr_default() {
     87void _isr_default()
     88{
    8589    _get_lock(&_tty_put_lock);
    8690    _puts("\n[GIET ERROR] Strange... Default ISR activated for processor ");
     
    96100// The multi_dma components can be distributed in the clusters.
    97101// The channel_id argument is the local DMA channel index.
    98 //     dma_global_id = cluster_id*NB_DMAS_MAX + channel_id
     102//     dma_global_id = cluster_id*NB_DMA_CHANNELS + channel_id
    99103// - The ISR saves the transfert status in _dma_status[dma_global_id].
    100104// - It acknowledges the interrupt to reinitialize the DMA controler.
    101105// - it resets the synchronisation variable _dma_busy[dma_global_id].
    102106///////////////////////////////////////////////////////////////////////////////////
    103 void _isr_dma(unsigned int channel_id) {
    104 #if NB_DMAS_MAX > 0
     107void _isr_dma(unsigned int channel_id)
     108{
     109#if NB_DMA_CHANNELS > 0
    105110    // compute cluster_id
    106111    unsigned int cluster_id = _procid() / NB_PROCS_MAX;
    107112
    108113    // compute dma_global_id
    109     unsigned int dma_global_id = cluster_id * NB_DMAS_MAX + channel_id;
     114    unsigned int dma_global_id = cluster_id * NB_DMA_CHANNELS + channel_id;
    110115
    111116    // save DMA channel status 
    112117    if (_dma_get_status(cluster_id, channel_id,
    113             (unsigned int *) &_dma_status[dma_global_id])) {
     118            (unsigned int *) &_dma_status[dma_global_id]))
     119    {
    114120        _get_lock(&_tty_put_lock);
    115121        _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n");
     
    119125
    120126    // reset DMA channel irq
    121     if (_dma_reset_irq(cluster_id, channel_id)) {
     127    if (_dma_reset_irq(cluster_id, channel_id))
     128    {
    122129        _get_lock(&_tty_put_lock);
    123130        _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n");
     
    128135    // release DMA channel
    129136    _dma_done[dma_global_id] = 1;
     137
    130138#else
    131     _puts("[GIET ERROR] NB_DMAS_MAX is set to zero\n");
    132 
     139    _get_lock(&_tty_put_lock);
     140    _puts("[GIET ERROR] NB_DMA_CHANNELS is set to zero\n");
     141    _release_lock(&_tty_put_lock);
    133142#endif
    134143}
     
    140149// - It sets the _ioc_done variable to signal completion.
    141150///////////////////////////////////////////////////////////////////////////////////
    142 void _isr_ioc() {
     151void _isr_ioc()
     152{
    143153    // save status & reset IRQ
    144     if (_ioc_get_status((unsigned int *) &_ioc_status )) {
     154    if (_ioc_get_status((unsigned int *) &_ioc_status ))
     155    {
    145156        _get_lock(&_tty_put_lock);
    146157        _puts("[GIET ERROR] bad access to IOC status detected by _isr_ioc\n");
     
    161172// in a vci_multi_timer component, or in a vci_xicu component.
    162173// The timer_id argument is the user timer local index.
    163 //     timer_globa_id = cluster_id*(NB_TIMERS_MAX) + timer_id
     174//     timer_globa_id = cluster_id*(NB_TIM_CHANNELS) + timer_id
    164175// The ISR acknowledges the IRQ and registers the event in the proper entry
    165176// of the _timer_event[] array, and a log message is displayed on kernel terminal.
    166177///////////////////////////////////////////////////////////////////////////////////
    167 void _isr_timer(unsigned int timer_id) {
     178void _isr_timer(unsigned int timer_id)
     179{
    168180    // compute cluster_id
    169181    unsigned int cluster_id = _procid() / NB_PROCS_MAX;
    170182
    171183    // aknowledge IRQ
    172     if (_timer_reset_irq( cluster_id, timer_id)) {
     184    if (_timer_reset_irq( cluster_id, timer_id))
     185    {
    173186        _get_lock(&_tty_put_lock);
    174187        _puts("[GIET ERROR] illegal timer index detected by _isr_timer\n");
     
    177190    }
    178191
    179 #if NB_TIMERS_MAX
     192#if NB_TIM_CHANNELS
    180193    // register the event
    181     unsigned int timer_global_id = cluster_id * NB_TIMERS_MAX + timer_id;
     194    unsigned int timer_global_id = cluster_id * NB_TIM_CHANNELS + timer_id;
    182195    _user_timer_event[timer_global_id] = 1;
    183196#endif
     
    207220// A character is lost if the buffer is full when the ISR is executed.
    208221///////////////////////////////////////////////////////////////////////////////////
    209 void _isr_tty(unsigned int tty_id) {
     222void _isr_tty(unsigned int tty_id)
     223{
    210224    // save character and reset IRQ
    211     if (_tty_get_char( tty_id, (unsigned char *) &_tty_get_buf[tty_id])) {
     225    if (_tty_get_char( tty_id, (unsigned char *) &_tty_get_buf[tty_id]))
     226    {
    212227        _get_lock(&_tty_put_lock);
    213228        _puts("[GIET ERROR] illegal tty index detected by _isr_tty\n");
     
    229244// The ISR acknowledges the IRQ and calls the _ctx_switch() function.
    230245/////////////////////////////////////////////////////////////////////////////////////
    231 void _isr_switch( unsigned int timer_id) {
     246void _isr_switch( unsigned int timer_id)
     247{
    232248    // get cluster index and proc local index
    233249    unsigned int cluster_id = _procid() / NB_PROCS_MAX;
    234250
    235251    // acknowledge IRQ
    236     if (_timer_reset_irq(cluster_id, timer_id)) {
     252    if (_timer_reset_irq(cluster_id, timer_id))
     253    {
    237254        _get_lock(&_tty_put_lock);
    238255        _puts("[GIET ERROR] illegal proc index detected by _isr_switch\n");
Note: See TracChangeset for help on using the changeset viewer.