2015-04-11 07:44:37 +08:00
|
|
|
/* arch.h - ARC specific nanokernel interface header */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2015-10-21 00:42:33 +08:00
|
|
|
* DESCRIPTION
|
|
|
|
* This header contains the ARC specific nanokernel interface. It is
|
|
|
|
* included by the nanokernel interface architecture-abstraction header
|
|
|
|
* (nanokernel/cpu.h)
|
2015-07-02 05:22:39 +08:00
|
|
|
*/
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#ifndef _ARC_ARCH__H_
|
|
|
|
#define _ARC_ARCH__H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-06-02 01:39:43 +08:00
|
|
|
/* APIs need to support non-byte addressible architectures */
|
|
|
|
|
|
|
|
#define OCTET_TO_SIZEOFUNIT(X) (X)
|
|
|
|
#define SIZEOFUNIT_TO_OCTET(X) (X)
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#ifdef CONFIG_CPU_ARCV2
|
2015-05-29 01:56:47 +08: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 19:39:56 +08:00
|
|
|
#include <arch/arc/v2/asm_inline.h>
|
2015-10-30 04:20:28 +08:00
|
|
|
#include <arch/arc/v2/addr_types.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
#endif
|
|
|
|
|
2015-05-26 22:21:42 +08:00
|
|
|
#define STACK_ALIGN 4
|
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-11-19 01:48:24 +08:00
|
|
|
#ifndef _ASMLANGUAGE
|
|
|
|
struct irq_desc {
|
|
|
|
unsigned int irq;
|
|
|
|
unsigned int priority;
|
|
|
|
void (*isr)(void *);
|
|
|
|
void *parameter;
|
|
|
|
};
|
2015-10-03 06:22:36 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Connect a routine to interrupt number
|
|
|
|
*
|
|
|
|
* For the device @a device associates IRQ number @a irq with priority
|
|
|
|
* @a priority with the interrupt routine @a isr, that receives parameter
|
|
|
|
* @a parameter.
|
|
|
|
* IRQ connect static is currently not supported in ARC architecture.
|
|
|
|
* The macro is defined as empty for code compatibility with other
|
|
|
|
* architectures.
|
|
|
|
*
|
|
|
|
* @param device Device
|
2015-11-19 01:48:24 +08:00
|
|
|
* @param i IRQ number
|
|
|
|
* @param p IRQ Priority
|
|
|
|
* @param h Interrupt Service Routine
|
|
|
|
* @param pm ISR parameter
|
2015-11-26 07:21:18 +08:00
|
|
|
* @param f IRQ triggering options
|
2015-10-03 06:22:36 +08:00
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*
|
|
|
|
*/
|
2015-11-26 07:21:18 +08:00
|
|
|
#define IRQ_CONNECT_STATIC(device, i, p, h, pm, f) \
|
2015-11-19 01:48:24 +08:00
|
|
|
static struct irq_desc device##_irq_desc = { \
|
|
|
|
.irq = i, \
|
|
|
|
.priority = p, \
|
|
|
|
.isr = h, \
|
|
|
|
.parameter = pm, \
|
|
|
|
}
|
2015-10-03 06:22:36 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Configure interrupt for the device
|
|
|
|
*
|
|
|
|
* For the selected device, do the neccessary configuration
|
|
|
|
* steps to connect and enable the IRQ line with an ISR
|
|
|
|
* at the priority requested.
|
2015-11-19 01:48:24 +08:00
|
|
|
* @param device - Device name
|
|
|
|
* @param i IRQ number
|
|
|
|
* @param p Priority for the interruption
|
2015-10-03 06:22:36 +08:00
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*
|
|
|
|
*/
|
2015-11-19 01:48:24 +08:00
|
|
|
#define IRQ_CONFIG(device, i, p) \
|
|
|
|
irq_connect(device##_irq_desc.irq, device##_irq_desc.priority, \
|
|
|
|
device##_irq_desc.isr, device##_irq_desc.parameter, 0)
|
|
|
|
|
|
|
|
#endif
|
2015-10-03 06:22:36 +08:00
|
|
|
|
2015-04-11 07:44:37 +08:00
|
|
|
#endif /* _ARC_ARCH__H_ */
|