1*7315b7b4SJens Wiklander /* 2*7315b7b4SJens Wiklander * Copyright (c) 2016, Linaro Limited 3*7315b7b4SJens Wiklander * All rights reserved. 4*7315b7b4SJens Wiklander * 5*7315b7b4SJens Wiklander * Redistribution and use in source and binary forms, with or without 6*7315b7b4SJens Wiklander * modification, are permitted provided that the following conditions are met: 7*7315b7b4SJens Wiklander * 8*7315b7b4SJens Wiklander * 1. Redistributions of source code must retain the above copyright notice, 9*7315b7b4SJens Wiklander * this list of conditions and the following disclaimer. 10*7315b7b4SJens Wiklander * 11*7315b7b4SJens Wiklander * 2. Redistributions in binary form must reproduce the above copyright notice, 12*7315b7b4SJens Wiklander * this list of conditions and the following disclaimer in the documentation 13*7315b7b4SJens Wiklander * and/or other materials provided with the distribution. 14*7315b7b4SJens Wiklander * 15*7315b7b4SJens Wiklander * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16*7315b7b4SJens Wiklander * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*7315b7b4SJens Wiklander * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*7315b7b4SJens Wiklander * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19*7315b7b4SJens Wiklander * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20*7315b7b4SJens Wiklander * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21*7315b7b4SJens Wiklander * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22*7315b7b4SJens Wiklander * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23*7315b7b4SJens Wiklander * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24*7315b7b4SJens Wiklander * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25*7315b7b4SJens Wiklander * POSSIBILITY OF SUCH DAMAGE. 26*7315b7b4SJens Wiklander */ 27*7315b7b4SJens Wiklander #ifndef __KERNEL_INTERRUPT_H 28*7315b7b4SJens Wiklander #define __KERNEL_INTERRUPT_H 29*7315b7b4SJens Wiklander 30*7315b7b4SJens Wiklander #include <types_ext.h> 31*7315b7b4SJens Wiklander #include <sys/queue.h> 32*7315b7b4SJens Wiklander 33*7315b7b4SJens Wiklander #define ITRF_TRIGGER_LEVEL (1 << 0) 34*7315b7b4SJens Wiklander 35*7315b7b4SJens Wiklander struct itr_chip { 36*7315b7b4SJens Wiklander const struct itr_ops *ops; 37*7315b7b4SJens Wiklander }; 38*7315b7b4SJens Wiklander 39*7315b7b4SJens Wiklander struct itr_ops { 40*7315b7b4SJens Wiklander void (*add)(struct itr_chip *chip, size_t it, uint32_t flags); 41*7315b7b4SJens Wiklander void (*enable)(struct itr_chip *chip, size_t it); 42*7315b7b4SJens Wiklander void (*disable)(struct itr_chip *chip, size_t it); 43*7315b7b4SJens Wiklander }; 44*7315b7b4SJens Wiklander 45*7315b7b4SJens Wiklander enum itr_return { 46*7315b7b4SJens Wiklander ITRR_NONE, 47*7315b7b4SJens Wiklander ITRR_HANDLED, 48*7315b7b4SJens Wiklander }; 49*7315b7b4SJens Wiklander 50*7315b7b4SJens Wiklander struct itr_handler { 51*7315b7b4SJens Wiklander size_t it; 52*7315b7b4SJens Wiklander uint32_t flags; 53*7315b7b4SJens Wiklander enum itr_return (*handler)(struct itr_handler *h); 54*7315b7b4SJens Wiklander void *data; 55*7315b7b4SJens Wiklander SLIST_ENTRY(itr_handler) link; 56*7315b7b4SJens Wiklander }; 57*7315b7b4SJens Wiklander 58*7315b7b4SJens Wiklander void itr_init(struct itr_chip *data); 59*7315b7b4SJens Wiklander void itr_handle(size_t it); 60*7315b7b4SJens Wiklander 61*7315b7b4SJens Wiklander void itr_add(struct itr_handler *handler); 62*7315b7b4SJens Wiklander void itr_enable(struct itr_handler *handler); 63*7315b7b4SJens Wiklander void itr_disable(struct itr_handler *handler); 64*7315b7b4SJens Wiklander 65*7315b7b4SJens Wiklander #endif /*__KERNEL_INTERRUPT_H*/ 66