/* arch.h - ARC specific nanokernel interface header */ /* * Copyright (c) 2014 Wind River Systems, Inc. * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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. */ /* * DESCRIPTION * This header contains the ARC specific nanokernel interface. It is * included by the nanokernel interface architecture-abstraction header * (nanokernel/cpu.h) */ #ifndef _ARC_ARCH__H_ #define _ARC_ARCH__H_ #ifdef __cplusplus extern "C" { #endif /* APIs need to support non-byte addressible architectures */ #define OCTET_TO_SIZEOFUNIT(X) (X) #define SIZEOFUNIT_TO_OCTET(X) (X) #ifdef CONFIG_CPU_ARCV2 #include #include #include #include #include #include #include #include #include #endif #define STACK_ALIGN 4 #ifdef __cplusplus } #endif #ifndef _ASMLANGUAGE struct irq_desc { unsigned int irq; unsigned int priority; void (*isr)(void *); void *parameter; }; /** * @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 * @param i IRQ number * @param p IRQ Priority * @param h Interrupt Service Routine * @param pm ISR parameter * @param f IRQ triggering options * * @return N/A * */ #define IRQ_CONNECT_STATIC(device, i, p, h, pm, f) \ static struct irq_desc device##_irq_desc = { \ .irq = i, \ .priority = p, \ .isr = h, \ .parameter = pm, \ } /** * * @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. * @param device - Device name * @param i IRQ number * @param p Priority for the interruption * * @return N/A * */ #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 #endif /* _ARC_ARCH__H_ */