2015-04-10 16:44:37 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-18 17:01:01 -08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-10 16:44:37 -07:00
|
|
|
*/
|
|
|
|
|
2015-12-04 10:09:39 -05:00
|
|
|
/**
|
|
|
|
* @file
|
2016-12-23 07:32:56 -05:00
|
|
|
* @brief ARC specific kernel interface header
|
2015-12-04 10:09:39 -05:00
|
|
|
*
|
2016-12-23 07:32:56 -05:00
|
|
|
* This header contains the ARC specific kernel interface. It is
|
|
|
|
* included by the kernel interface architecture-abstraction header
|
|
|
|
* include/arch/cpu.h)
|
2015-07-01 17:22:39 -04:00
|
|
|
*/
|
2015-04-10 16:44:37 -07:00
|
|
|
|
|
|
|
#ifndef _ARC_ARCH__H_
|
|
|
|
#define _ARC_ARCH__H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-06-01 13:39:43 -04:00
|
|
|
/* APIs need to support non-byte addressible architectures */
|
|
|
|
|
|
|
|
#define OCTET_TO_SIZEOFUNIT(X) (X)
|
|
|
|
#define SIZEOFUNIT_TO_OCTET(X) (X)
|
|
|
|
|
2015-11-24 17:02:50 -06:00
|
|
|
#include <sw_isr_table.h>
|
2015-04-10 16:44:37 -07:00
|
|
|
#ifdef CONFIG_CPU_ARCV2
|
2015-05-28 10:56:47 -07:00
|
|
|
#include <arch/arc/v2/exc.h>
|
|
|
|
#include <arch/arc/v2/irq.h>
|
|
|
|
#include <arch/arc/v2/ffs.h>
|
|
|
|
#include <arch/arc/v2/error.h>
|
|
|
|
#include <arch/arc/v2/misc.h>
|
|
|
|
#include <arch/arc/v2/aux_regs.h>
|
|
|
|
#include <arch/arc/v2/arcv2_irq_unit.h>
|
2015-08-25 14:39:56 +03:00
|
|
|
#include <arch/arc/v2/asm_inline.h>
|
2015-10-29 16:20:28 -04:00
|
|
|
#include <arch/arc/v2/addr_types.h>
|
2015-04-10 16:44:37 -07:00
|
|
|
#endif
|
|
|
|
|
2015-05-26 10:21:42 -04:00
|
|
|
#define STACK_ALIGN 4
|
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-11-18 09:48:24 -08:00
|
|
|
#ifndef _ASMLANGUAGE
|
2016-02-25 13:21:02 -08:00
|
|
|
#include <irq.h>
|
2015-10-02 17:22:36 -05:00
|
|
|
|
2016-01-27 10:07:31 -08:00
|
|
|
/* internal routine documented in C file, needed by IRQ_CONNECT() macro */
|
2016-07-25 11:34:34 -07:00
|
|
|
extern void _irq_priority_set(unsigned int irq, unsigned int prio,
|
|
|
|
uint32_t flags);
|
2016-01-08 00:46:14 -08:00
|
|
|
|
2015-10-02 17:22:36 -05:00
|
|
|
/**
|
2016-01-08 00:46:14 -08:00
|
|
|
* Configure a static interrupt.
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2016-09-22 11:20:26 -07:00
|
|
|
* All arguments must be computable by the compiler at build time.
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2016-01-08 00:46:14 -08:00
|
|
|
* Internally this function does a few things:
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2016-01-08 00:46:14 -08:00
|
|
|
* 1. The enum statement has no effect but forces the compiler to only
|
|
|
|
* accept constant values for the irq_p parameter, very important as the
|
|
|
|
* numerical IRQ line is used to create a named section.
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2017-01-25 14:32:53 -08:00
|
|
|
* 2. An instance of struct _isr_table_entry is created containing the ISR and
|
|
|
|
* its parameter. If you look at how _sw_isr_table is created, each entry in
|
|
|
|
* the array is in its own section named by the IRQ line number. What we are
|
|
|
|
* doing here is to override one of the default entries (which points to the
|
2016-01-08 00:46:14 -08:00
|
|
|
* spurious IRQ handler) with what was supplied here.
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2016-01-08 00:46:14 -08:00
|
|
|
* 3. The priority level for the interrupt is configured by a call to
|
|
|
|
* _irq_priority_set()
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2016-01-08 00:46:14 -08:00
|
|
|
* @param irq_p IRQ line number
|
2016-07-25 11:34:34 -07:00
|
|
|
* @param priority_p Interrupt priority, in range 0-13
|
2016-01-08 00:46:14 -08:00
|
|
|
* @param isr_p Interrupt service routine
|
|
|
|
* @param isr_param_p ISR parameter
|
2016-08-16 10:58:40 -07:00
|
|
|
* @param flags_p IRQ options (ignored for now)
|
2015-10-02 17:22:36 -05:00
|
|
|
*
|
2016-01-08 00:46:14 -08:00
|
|
|
* @return The vector assigned to this interrupt
|
2015-10-02 17:22:36 -05:00
|
|
|
*/
|
2016-02-25 13:21:02 -08:00
|
|
|
#define _ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
|
2016-01-08 00:46:14 -08:00
|
|
|
({ \
|
|
|
|
enum { IRQ = irq_p }; \
|
2017-01-25 14:32:53 -08:00
|
|
|
static struct _isr_table_entry _CONCAT(_isr_irq, irq_p) \
|
2016-01-08 00:46:14 -08:00
|
|
|
__attribute__ ((used)) \
|
|
|
|
__attribute__ ((section(STRINGIFY(_CONCAT(.gnu.linkonce.isr_irq, irq_p))))) = \
|
|
|
|
{isr_param_p, isr_p}; \
|
2016-07-25 11:34:34 -07:00
|
|
|
_irq_priority_set(irq_p, priority_p, flags_p); \
|
2016-01-08 00:46:14 -08:00
|
|
|
irq_p; \
|
|
|
|
})
|
2015-11-18 09:48:24 -08:00
|
|
|
|
|
|
|
#endif
|
2015-10-02 17:22:36 -05:00
|
|
|
|
2015-04-10 16:44:37 -07:00
|
|
|
#endif /* _ARC_ARCH__H_ */
|