[6ac3d27] | 1 | /*
|
---|
| 2 | * Copyright (c) 2013 Jakub Klama
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @addtogroup genarch
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /**
|
---|
| 33 | * @file
|
---|
| 34 | * @brief Gaisler GRLIB interrupt controller driver.
|
---|
| 35 | */
|
---|
| 36 |
|
---|
| 37 | #ifndef KERN_GRLIB_IRQMP_H_
|
---|
| 38 | #define KERN_GRLIB_IRQMP_H_
|
---|
| 39 |
|
---|
| 40 | #include <typedefs.h>
|
---|
[36df4109] | 41 | #include <arch/arch.h>
|
---|
[6ac3d27] | 42 |
|
---|
[e47ed05] | 43 | #define GRLIB_IRQMP_MASK_OFFSET 0x40
|
---|
| 44 | #define GRLIB_IRQMP_FORCE_OFFSET 0x80
|
---|
[6ac3d27] | 45 |
|
---|
| 46 | /** IRQMP registers */
|
---|
| 47 | typedef struct {
|
---|
| 48 | uint32_t level;
|
---|
| 49 | uint32_t pending;
|
---|
| 50 | uint32_t force;
|
---|
| 51 | uint32_t clear;
|
---|
| 52 | uint32_t mp_status;
|
---|
| 53 | uint32_t broadcast;
|
---|
| 54 | } grlib_irqmp_regs_t;
|
---|
| 55 |
|
---|
| 56 | /** LEON3 interrupt assignments */
|
---|
| 57 | enum grlib_irq_source {
|
---|
[e47ed05] | 58 | GRLIB_INT_AHBERROR = 1,
|
---|
| 59 | GRLIB_INT_UART1 = 2,
|
---|
| 60 | GRLIB_INT_PCIDMA = 4,
|
---|
| 61 | GRLIB_INT_CAN = 5,
|
---|
| 62 | GRLIB_INT_TIMER0 = 6,
|
---|
| 63 | GRLIB_INT_TIMER1 = 7,
|
---|
| 64 | GRLIB_INT_TIMER2 = 8,
|
---|
| 65 | GRLIB_INT_TIMER3 = 9,
|
---|
| 66 | GRLIB_INT_ETHERNET = 14
|
---|
[6ac3d27] | 67 | };
|
---|
| 68 |
|
---|
| 69 | typedef struct {
|
---|
| 70 | grlib_irqmp_regs_t *regs;
|
---|
| 71 | } grlib_irqmp_t;
|
---|
| 72 |
|
---|
[4d2dba7] | 73 | extern void grlib_irqmp_init(grlib_irqmp_t *, bootinfo_t *);
|
---|
| 74 | extern int grlib_irqmp_inum_get(grlib_irqmp_t *);
|
---|
[e47ed05] | 75 | extern void grlib_irqmp_clear(grlib_irqmp_t *, unsigned int);
|
---|
| 76 | extern void grlib_irqmp_mask(grlib_irqmp_t *, unsigned int);
|
---|
| 77 | extern void grlib_irqmp_unmask(grlib_irqmp_t *, unsigned int);
|
---|
[6ac3d27] | 78 |
|
---|
| 79 | #endif
|
---|
| 80 |
|
---|
| 81 | /** @}
|
---|
| 82 | */
|
---|