2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #ifndef __IRQ_PUBLIC_H_INCLUDED__
16 #define __IRQ_PUBLIC_H_INCLUDED__
18 #include <type_support.h>
19 #include "system_types.h"
21 /*! Read the control registers of IRQ[ID]
23 \param ID[in] IRQ identifier
24 \param state[out] irq controller state structure
26 \return none, state = IRQ[ID].state
28 extern void irq_controller_get_state(
30 irq_controller_state_t *state);
32 /*! Write to a control register of IRQ[ID]
34 \param ID[in] IRQ identifier
35 \param reg[in] register index
36 \param value[in] The data to be written
38 \return none, IRQ[ID].ctrl[reg] = value
40 STORAGE_CLASS_IRQ_H void irq_reg_store(
42 const unsigned int reg,
43 const hrt_data value);
45 /*! Read from a control register of IRQ[ID]
47 \param ID[in] IRQ identifier
48 \param reg[in] register index
49 \param value[in] The data to be written
51 \return IRQ[ID].ctrl[reg]
53 STORAGE_CLASS_IRQ_H hrt_data irq_reg_load(
55 const unsigned int reg);
57 /*! Enable an IRQ channel of IRQ[ID] with a mode
59 \param ID[in] IRQ (device) identifier
60 \param irq[in] IRQ (channel) identifier
62 \return none, enable(IRQ[ID].channel[irq_ID])
64 extern void irq_enable_channel(
66 const unsigned int irq_ID);
68 /*! Enable pulse interrupts for IRQ[ID] with a mode
70 \param ID[in] IRQ (device) identifier
71 \param enable enable/disable pulse interrupts
75 extern void irq_enable_pulse(
79 /*! Disable an IRQ channel of IRQ[ID]
81 \param ID[in] IRQ (device) identifier
82 \param irq[in] IRQ (channel) identifier
84 \return none, disable(IRQ[ID].channel[irq_ID])
86 extern void irq_disable_channel(
88 const unsigned int irq);
90 /*! Clear the state of all IRQ channels of IRQ[ID]
92 \param ID[in] IRQ (device) identifier
94 \return none, clear(IRQ[ID].channel[])
96 extern void irq_clear_all(
99 /*! Return the ID of a signalling IRQ channel of IRQ[ID]
101 \param ID[in] IRQ (device) identifier
102 \param irq_id[out] active IRQ (channel) identifier
104 \Note: This function operates as strtok(), based on the return
105 state the user is informed if there are additional signalling
108 \return state(IRQ[ID])
110 extern enum hrt_isp_css_irq_status irq_get_channel_id(
112 unsigned int *irq_id);
114 /*! Raise an interrupt on channel irq_id of device IRQ[ID]
116 \param ID[in] IRQ (device) identifier
117 \param irq_id[in] IRQ (channel) identifier
119 \return none, signal(IRQ[ID].channel[irq_id])
121 extern void irq_raise(
123 const irq_sw_channel_id_t irq_id);
125 /*! Test if any IRQ channel of the virtual super IRQ has raised a signal
127 \return any(VIRQ.channel[irq_ID] != 0)
129 extern bool any_virq_signal(void);
131 /*! Enable an IRQ channel of the virtual super IRQ
133 \param irq[in] IRQ (channel) identifier
134 \param en[in] predicate channel enable
136 \return none, VIRQ.channel[irq_ID].enable = en
138 extern void cnd_virq_enable_channel(
139 const virq_id_t irq_ID,
142 /*! Clear the state of all IRQ channels of the virtual super IRQ
144 \return none, clear(VIRQ.channel[])
146 extern void virq_clear_all(void);
148 /*! Clear the IRQ info state of the virtual super IRQ
150 \param irq_info[in/out] The IRQ (channel) state
154 extern void virq_clear_info(
155 virq_info_t *irq_info);
157 /*! Return the ID of a signalling IRQ channel of the virtual super IRQ
159 \param irq_id[out] active IRQ (channel) identifier
161 \Note: This function operates as strtok(), based on the return
162 state the user is informed if there are additional signalling
165 \return state(IRQ[...])
167 extern enum hrt_isp_css_irq_status virq_get_channel_id(
170 /*! Return the IDs of all signaling IRQ channels of the virtual super IRQ
172 \param irq_info[out] all active IRQ (channel) identifiers
174 \Note: Unlike "irq_get_channel_id()" this function returns all
175 channel signaling info. The new info is OR'd with the current
176 info state. N.B. this is the same as repeatedly calling the function
177 "irq_get_channel_id()" in a (non-blocked) handler routine
179 \return (error(state(IRQ[...]))
181 extern enum hrt_isp_css_irq_status virq_get_channel_signals(
182 virq_info_t *irq_info);
184 #endif /* __IRQ_PUBLIC_H_INCLUDED__ */