aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h
blob: dfe2aa9ff2572cc9023aec685c6b9c066f3f2ad6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 * Support for Intel Camera Imaging ISP subsystem.
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */

#ifndef __IRQ_PUBLIC_H_INCLUDED__
#define __IRQ_PUBLIC_H_INCLUDED__

#include <type_support.h>
#include "system_types.h"

/*! Read the control registers of IRQ[ID]

 \param	ID[in]				IRQ identifier
 \param	state[out]			irq controller state structure

 \return none, state = IRQ[ID].state
 */
void irq_controller_get_state(
    const irq_ID_t				ID,
    irq_controller_state_t		*state);

/*! Write to a control register of IRQ[ID]

 \param	ID[in]				IRQ identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return none, IRQ[ID].ctrl[reg] = value
 */
STORAGE_CLASS_IRQ_H void irq_reg_store(
    const irq_ID_t		ID,
    const unsigned int	reg,
    const hrt_data		value);

/*! Read from a control register of IRQ[ID]

 \param	ID[in]				IRQ identifier
 \param	reg[in]				register index
 \param value[in]			The data to be written

 \return IRQ[ID].ctrl[reg]
 */
STORAGE_CLASS_IRQ_H hrt_data irq_reg_load(
    const irq_ID_t		ID,
    const unsigned int	reg);

/*! Enable an IRQ channel of IRQ[ID] with a mode

 \param	ID[in]				IRQ (device) identifier
 \param	irq[in]				IRQ (channel) identifier

 \return none, enable(IRQ[ID].channel[irq_ID])
 */
void irq_enable_channel(
    const irq_ID_t				ID,
    const unsigned int			irq_ID);

/*! Enable pulse interrupts for IRQ[ID] with a mode

 \param	ID[in]				IRQ (device) identifier
 \param	enable				enable/disable pulse interrupts

 \return none
 */
void irq_enable_pulse(
    const irq_ID_t	ID,
    bool			pulse);

/*! Disable an IRQ channel of IRQ[ID]

 \param	ID[in]				IRQ (device) identifier
 \param	irq[in]				IRQ (channel) identifier

 \return none, disable(IRQ[ID].channel[irq_ID])
 */
void irq_disable_channel(
    const irq_ID_t				ID,
    const unsigned int			irq);

/*! Clear the state of all IRQ channels of IRQ[ID]

 \param	ID[in]				IRQ (device) identifier

 \return none, clear(IRQ[ID].channel[])
 */
void irq_clear_all(
    const irq_ID_t				ID);

/*! Return the ID of a signalling IRQ channel of IRQ[ID]

 \param	ID[in]				IRQ (device) identifier
 \param irq_id[out]			active IRQ (channel) identifier

 \Note: This function operates as strtok(), based on the return
  state the user is informed if there are additional signalling
  channels

 \return state(IRQ[ID])
 */
enum hrt_isp_css_irq_status irq_get_channel_id(
    const irq_ID_t				ID,
    unsigned int				*irq_id);

/*! Raise an interrupt on channel irq_id of device IRQ[ID]

 \param	ID[in]				IRQ (device) identifier
 \param	irq_id[in]			IRQ (channel) identifier

 \return none, signal(IRQ[ID].channel[irq_id])
 */
void irq_raise(
    const irq_ID_t				ID,
    const irq_sw_channel_id_t	irq_id);

/*! Test if any IRQ channel of the virtual super IRQ has raised a signal

 \return any(VIRQ.channel[irq_ID] != 0)
 */
bool any_virq_signal(void);

/*! Enable an IRQ channel of the virtual super IRQ

 \param	irq[in]				IRQ (channel) identifier
 \param	en[in]				predicate channel enable

 \return none, VIRQ.channel[irq_ID].enable = en
 */
void cnd_virq_enable_channel(
    const virq_id_t				irq_ID,
    const bool					en);

/*! Clear the state of all IRQ channels of the virtual super IRQ

 \return none, clear(VIRQ.channel[])
 */
void virq_clear_all(void);

/*! Clear the IRQ info state of the virtual super IRQ

 \param irq_info[in/out]	The IRQ (channel) state

 \return none
 */
void virq_clear_info(
    virq_info_t					*irq_info);

/*! Return the ID of a signalling IRQ channel of the virtual super IRQ

 \param irq_id[out]			active IRQ (channel) identifier

 \Note: This function operates as strtok(), based on the return
  state the user is informed if there are additional signalling
  channels

 \return state(IRQ[...])
 */
enum hrt_isp_css_irq_status virq_get_channel_id(
    virq_id_t					*irq_id);

/*! Return the IDs of all signaling IRQ channels of the virtual super IRQ

 \param irq_info[out]		all active IRQ (channel) identifiers

 \Note: Unlike "irq_get_channel_id()" this function returns all
  channel signaling info. The new info is OR'd with the current
  info state. N.B. this is the same as repeatedly calling the function
  "irq_get_channel_id()" in a (non-blocked) handler routine

 \return (error(state(IRQ[...]))
 */
enum hrt_isp_css_irq_status virq_get_channel_signals(
    virq_info_t					*irq_info);

#endif /* __IRQ_PUBLIC_H_INCLUDED__ */