source: soft/giet_vm/giet_kernel/irq_handler.h @ 440

Last change on this file since 440 was 440, checked in by alain, 10 years ago

Introducing dynamic allocation of peripheral channels (NIC, TTY, CMA, TIM)
Intoducing a kernel function for all system calls: No more direct call
to the peripheral drivers.

  • Property svn:executable set to *
File size: 4.2 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : irq_handler.h
3// Date     : 01/04/2012
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7// The irq_handler.c and irq_handler.h files are part of the GIET-VM nano-kernel.
8// They contain the code of the _irq_demux() function that access the XICU or
9// ICU component (Interupt Controler Unit), and the various ISRs (Interrupt
10// Service Routine) associated to the various ISR types.
11///////////////////////////////////////////////////////////////////////////////////
12
13#ifndef _IRQ_HANDLER_H
14#define _IRQ_HANDLER_H
15
16////////////////////////////////////////////////////////////////////////////////
17// This enum must be kept consistent with the values defined in the
18// xml_driver.c and irq_handler.c files (for display)
19///////////////////////////////////////////////////////////////////////////////
20
21enum isr_type_t
22{
23    ISR_DEFAULT = 0,
24    ISR_TICK    = 1,
25    ISR_TTY_RX  = 2,
26    ISR_TTY_TX  = 3,
27    ISR_BDV     = 4,
28    ISR_TIMER   = 5,
29    ISR_WAKUP   = 6,
30    ISR_NIC_RX  = 7,
31    ISR_NIC_TX  = 8,
32    ISR_CMA     = 9,
33    ISR_MMC     = 10,
34    ISR_DMA     = 11,
35    ISR_SPI     = 12,
36};
37
38///////////////////////////////////////////////////////////////////////////////////
39//    irq_handler functions
40///////////////////////////////////////////////////////////////////////////////////
41
42///////////////////////////////////////////////////////////////////////////////////
43// This function access the ICU or XICU component (Interrupt Controler Unit)
44// to get the interrupt vector entry. There is one ICU or XICU component per
45// cluster, and this component can support up to NB_PROCS_MAX output IRQs.
46// It returns the highest priority active interrupt index (smaller
47// indexes have the highest priority).
48// Any value larger than 31 means "no active interrupt", and no ISR is executed.
49//
50// There is three interrupt vectors per processor (stored in the processor's
51// scheduler) for the three HWI, PTI, and WTI interrupts types.
52// Each interrupt vector entry contains three bits fields:
53// - isr_id     bits[15:0]  : defines the type of ISR to be executed.
54// - channel_id bits[30:16] : defines the channel for multi-channels peripherals.
55// - valid      bit 31      : valid interrupt vector entry
56// If the peripheral is replicated in clusters, the channel_id is
57// a global index : channel_id = cluster_id * NB_CHANNELS_MAX + loc_id   
58///////////////////////////////////////////////////////////////////////////////////
59extern void _irq_demux();
60
61///////////////////////////////////////////////////////////////////////////////////
62// This default ISR is called  when the interrupt handler is called,
63// and there is no active IRQ. It simply displays a warning message on TTY[0].
64///////////////////////////////////////////////////////////////////////////////////
65extern void _isr_default();
66
67///////////////////////////////////////////////////////////////////////////////////
68// This ISR can only be executed after a WTI (IPI) to force a context switch
69// on a remote processor. The context switch is only executed if the current task
70// is the IDLE_TASK, or if the value written in the mailbox is non zero.
71///////////////////////////////////////////////////////////////////////////////////
72extern void _isr_wakup( unsigned int irq_type,
73                        unsigned int irq_id,
74                        unsigned int channel );
75
76/////////////////////////////////////////////////////////////////////////////////////
77// This ISR is in charge of context switch, and handles the IRQs generated by
78// the "system" timers. It can be PTI in case of XCU, or it can be HWI generated
79// by an external timer in case of ICU.
80// The ISR acknowledges the IRQ, and calls the _ctx_switch() function.
81/////////////////////////////////////////////////////////////////////////////////////
82extern void _isr_tick( unsigned int irq_type,
83                       unsigned int irq_id,
84                       unsigned int channel );
85
86#endif
87
88// Local Variables:
89// tab-width: 4
90// c-basic-offset: 4
91// c-file-offsets:((innamespace . 0)(inline-open . 0))
92// indent-tabs-mode: nil
93// End:
94// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
95
Note: See TracBrowser for help on using the repository browser.