Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #ifndef __DAL_IRQ_SERVICE_H__
0027 #define __DAL_IRQ_SERVICE_H__
0028 
0029 #include "include/irq_service_interface.h"
0030 
0031 #include "irq_types.h"
0032 
0033 struct irq_service;
0034 struct irq_source_info;
0035 
0036 struct irq_source_info_funcs {
0037     bool (*set)(
0038         struct irq_service *irq_service,
0039         const struct irq_source_info *info,
0040         bool enable);
0041     bool (*ack)(
0042         struct irq_service *irq_service,
0043         const struct irq_source_info *info);
0044 };
0045 
0046 struct irq_source_info {
0047     uint32_t src_id;
0048     uint32_t ext_id;
0049     uint32_t enable_reg;
0050     uint32_t enable_mask;
0051     uint32_t enable_value[2];
0052     uint32_t ack_reg;
0053     uint32_t ack_mask;
0054     uint32_t ack_value;
0055     uint32_t status_reg;
0056     const struct irq_source_info_funcs *funcs;
0057 };
0058 
0059 struct irq_service_funcs {
0060     enum dc_irq_source (*to_dal_irq_source)(
0061             struct irq_service *irq_service,
0062             uint32_t src_id,
0063             uint32_t ext_id);
0064 };
0065 
0066 struct irq_service {
0067     struct dc_context *ctx;
0068     const struct irq_source_info *info;
0069     const struct irq_service_funcs *funcs;
0070 };
0071 
0072 void dal_irq_service_construct(
0073     struct irq_service *irq_service,
0074     struct irq_service_init_data *init_data);
0075 
0076 void dal_irq_service_ack_generic(
0077     struct irq_service *irq_service,
0078     const struct irq_source_info *info);
0079 
0080 void dal_irq_service_set_generic(
0081     struct irq_service *irq_service,
0082     const struct irq_source_info *info,
0083     bool enable);
0084 
0085 #endif