source: trunk/libs/newlib/src/libgloss/sparc_leon/asm-leon/irq.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.8 KB
Line 
1/*
2 * Copyright (c) 2011 Aeroflex Gaisler
3 *
4 * BSD license:
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25
26#ifndef _LEON_CATCHIRQ_HANDLER_H_
27#define _LEON_CATCHIRQ_HANDLER_H_
28
29#include <asm-leon/leon.h>
30#include <asm-leon/queue.h>
31/*#include <sys/fsu_pthread_queue.h>*/
32#include <asm-leon/leoncompat.h>
33#include <asm-leon/leonstack.h>
34
35#ifndef __ASSEMBLER__
36
37struct pt_regs;
38typedef int (*irqhandler) (int, void *, struct leonbare_pt_regs *);
39
40struct irqaction
41{
42  irqhandler handler;
43  unsigned long flags;
44  void *dev_id;
45  struct irqaction *next;
46};
47#define INIT_IRQACTION { 0,0,0,0 }
48
49struct irqmp_type
50{
51  int *addr;
52  int eirq;
53};
54
55extern void chained_catch_interrupt (int irq, struct irqaction *a);
56extern int catch_interrupt (int func, int irq);
57
58typedef int (*schedulehandler) (struct leonbare_pt_regs *);
59extern schedulehandler schedule_callback;
60typedef int (*tickerhandler) (struct leonbare_pt_regs *);
61extern tickerhandler ticker_callback;
62extern int leonbare_hz;
63extern int nestcount;
64extern int no_inirq_check;
65extern unsigned long force_noalarm;
66
67extern void (*handler_irq_pre) (void);
68extern void (*handler_irq_post) (void);
69
70extern void leonbare_enable_traps (unsigned long old_flags);
71extern unsigned long leonbare_disable_traps ();
72extern void leonbare_flush_windows ();
73
74static inline void
75leonbare_enable_irq (int irq)
76{
77  unsigned int old, irqmask = 1 << irq;
78  old = leonbare_disable_traps ();
79  //---------------------
80  switch (LEONCOMPAT_VERSION)
81    {
82    case 3:
83    default:
84      LEON3_IrqCtrl_Regs->mask[0] = LEON3_IrqCtrl_Regs->mask[0] | irqmask;
85      break;
86    }
87  //---------------------
88  leonbare_enable_traps (old);
89}
90
91typedef int (*pendinghandler) (void *);
92struct pendingaction
93{
94  TAILQ_ENTRY (pendingaction) next;
95  pendinghandler handler;
96  void *arg;
97};
98
99#endif
100
101#endif
Note: See TracBrowser for help on using the repository browser.