2015-07-31 18:57:00 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Intel Corporation
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-07-31 18:57:00 +08:00
|
|
|
*/
|
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
#ifndef MVIC_H
|
|
|
|
#define MVIC_H
|
2015-07-31 18:57:00 +08:00
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
#include <arch/cpu.h>
|
2015-07-31 18:57:00 +08:00
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
/* Register defines. A lot of similarities to APIC, but not quite the same */
|
|
|
|
#define MVIC_TPR 0xFEE00080 /* Task priority register */
|
|
|
|
#define MVIC_PPR 0xFEE000A0 /* Process priority register */
|
|
|
|
#define MVIC_EOI 0xFEE000B0 /* End-of-interrupt register */
|
|
|
|
#define MVIC_SIVR 0xFEE000F0 /* Spurious interrupt vector register */
|
|
|
|
#define MVIC_ISR 0xFEE00110 /* In-service register */
|
|
|
|
#define MVIC_IRR 0xFEE00210 /* Interrupt request register */
|
|
|
|
#define MVIC_LVTTIMER 0xFEE00320 /* Local vector table timer register */
|
|
|
|
#define MVIC_ICR 0xFEE00380 /* Timer initial count register */
|
|
|
|
#define MVIC_CCR 0xFEE00390 /* Timer current count register */
|
|
|
|
#define MVIC_IOREGSEL 0xFEC00000 /* Register select (index) */
|
|
|
|
#define MVIC_IOWIN 0xFEC00010 /* Register windows (data) */
|
|
|
|
|
|
|
|
/* MVIC_LVTTIMER bits */
|
|
|
|
#define MVIC_LVTTIMER_MASK BIT(16)
|
|
|
|
#define MVIC_LVTTIMER_PERIODIC BIT(17)
|
2015-07-31 18:57:00 +08:00
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
/* MVIC_IOWIN bits */
|
|
|
|
#define MVIC_IOWIN_TRIGGER_LEVEL BIT(15)
|
|
|
|
#define MVIC_IOWIN_TRIGGER_EDGE 0
|
|
|
|
#define MVIC_IOWIN_MASK BIT(16)
|
|
|
|
#define MVIC_IOWIN_SUPPORTED_BITS_MASK (MVIC_IOWIN_MASK | \
|
|
|
|
MVIC_IOWIN_TRIGGER_LEVEL)
|
|
|
|
|
|
|
|
/* MVIC IOREGSEL register usage defines */
|
|
|
|
#define MVIC_LOW_NIBBLE_MASK 0x07
|
|
|
|
#define MVIC_HIGH_NIBBLE_MASK 0x18
|
|
|
|
|
|
|
|
#define MVIC_NUM_RTES 32
|
|
|
|
|
|
|
|
#define _IRQ_TRIGGER_EDGE MVIC_IOWIN_TRIGGER_EDGE
|
|
|
|
#define _IRQ_TRIGGER_LEVEL MVIC_IOWIN_TRIGGER_LEVEL
|
|
|
|
|
|
|
|
/* MVIC does not support IRQ_POLARITY_HIGH or IRQ_POLARITY_LOW,
|
|
|
|
* leave undefined
|
|
|
|
*/
|
2015-07-31 18:57:00 +08:00
|
|
|
|
|
|
|
#ifndef _ASMLANGUAGE
|
Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-19 23:32:08 +08:00
|
|
|
#include <zephyr/types.h>
|
2015-07-31 18:57:00 +08:00
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
/* Implementation of irq_controller.h interface */
|
|
|
|
|
|
|
|
#define __IRQ_CONTROLLER_VECTOR_MAPPING(irq) ((irq) + 32)
|
|
|
|
|
|
|
|
void __irq_controller_irq_config(unsigned int vector, unsigned int irq,
|
2017-04-21 23:55:34 +08:00
|
|
|
u32_t flags);
|
2016-08-03 03:05:08 +08:00
|
|
|
|
|
|
|
int __irq_controller_isr_vector_get(void);
|
|
|
|
|
2017-01-19 05:20:37 +08:00
|
|
|
static inline void __irq_controller_eoi(void)
|
|
|
|
{
|
|
|
|
*(volatile int *)(MVIC_EOI) = 0;
|
|
|
|
}
|
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
#else /* _ASMLANGUAGE */
|
|
|
|
|
2017-01-19 05:20:37 +08:00
|
|
|
.macro __irq_controller_eoi_macro
|
2016-08-03 03:05:08 +08:00
|
|
|
xorl %eax, %eax /* zeroes eax */
|
|
|
|
movl %eax, MVIC_EOI /* tell MVIC the IRQ is handled */
|
|
|
|
.endm
|
|
|
|
|
2015-07-31 18:57:00 +08:00
|
|
|
#endif
|
|
|
|
|
2016-08-03 03:05:08 +08:00
|
|
|
#endif /* MVIC_H */
|