1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef __IRQ_PUBLIC_H_INCLUDED__ 8 #define __IRQ_PUBLIC_H_INCLUDED__ 9 10 #include <type_support.h> 11 #include "system_local.h" 12 13 /*! Write to a control register of IRQ[ID] 14 15 \param ID[in] IRQ identifier 16 \param reg[in] register index 17 \param value[in] The data to be written 18 19 \return none, IRQ[ID].ctrl[reg] = value 20 */ 21 STORAGE_CLASS_IRQ_H void irq_reg_store( 22 const irq_ID_t ID, 23 const unsigned int reg, 24 const hrt_data value); 25 26 /*! Read from a control register of IRQ[ID] 27 28 \param ID[in] IRQ identifier 29 \param reg[in] register index 30 \param value[in] The data to be written 31 32 \return IRQ[ID].ctrl[reg] 33 */ 34 STORAGE_CLASS_IRQ_H hrt_data irq_reg_load( 35 const irq_ID_t ID, 36 const unsigned int reg); 37 38 /*! Enable an IRQ channel of IRQ[ID] with a mode 39 40 \param ID[in] IRQ (device) identifier 41 \param irq[in] IRQ (channel) identifier 42 43 \return none, enable(IRQ[ID].channel[irq_ID]) 44 */ 45 void irq_enable_channel( 46 const irq_ID_t ID, 47 const unsigned int irq_ID); 48 49 /*! Enable pulse interrupts for IRQ[ID] with a mode 50 51 \param ID[in] IRQ (device) identifier 52 \param enable enable/disable pulse interrupts 53 54 \return none 55 */ 56 void irq_enable_pulse( 57 const irq_ID_t ID, 58 bool pulse); 59 60 /*! Disable an IRQ channel of IRQ[ID] 61 62 \param ID[in] IRQ (device) identifier 63 \param irq[in] IRQ (channel) identifier 64 65 \return none, disable(IRQ[ID].channel[irq_ID]) 66 */ 67 void irq_disable_channel( 68 const irq_ID_t ID, 69 const unsigned int irq); 70 71 /*! Clear the state of all IRQ channels of IRQ[ID] 72 73 \param ID[in] IRQ (device) identifier 74 75 \return none, clear(IRQ[ID].channel[]) 76 */ 77 void irq_clear_all( 78 const irq_ID_t ID); 79 80 /*! Return the ID of a signalling IRQ channel of IRQ[ID] 81 82 \param ID[in] IRQ (device) identifier 83 \param irq_id[out] active IRQ (channel) identifier 84 85 \Note: This function operates as strtok(), based on the return 86 state the user is informed if there are additional signalling 87 channels 88 89 \return state(IRQ[ID]) 90 */ 91 enum hrt_isp_css_irq_status irq_get_channel_id( 92 const irq_ID_t ID, 93 unsigned int *irq_id); 94 95 /*! Raise an interrupt on channel irq_id of device IRQ[ID] 96 97 \param ID[in] IRQ (device) identifier 98 \param irq_id[in] IRQ (channel) identifier 99 100 \return none, signal(IRQ[ID].channel[irq_id]) 101 */ 102 void irq_raise( 103 const irq_ID_t ID, 104 const irq_sw_channel_id_t irq_id); 105 106 /*! Test if any IRQ channel of the virtual super IRQ has raised a signal 107 108 \return any(VIRQ.channel[irq_ID] != 0) 109 */ 110 bool any_virq_signal(void); 111 112 /*! Enable an IRQ channel of the virtual super IRQ 113 114 \param irq[in] IRQ (channel) identifier 115 \param en[in] predicate channel enable 116 117 \return none, VIRQ.channel[irq_ID].enable = en 118 */ 119 void cnd_virq_enable_channel( 120 const enum virq_id irq_ID, 121 const bool en); 122 123 /*! Clear the state of all IRQ channels of the virtual super IRQ 124 125 \return none, clear(VIRQ.channel[]) 126 */ 127 void virq_clear_all(void); 128 129 /*! Clear the IRQ info state of the virtual super IRQ 130 131 \param irq_info[in/out] The IRQ (channel) state 132 133 \return none 134 */ 135 void virq_clear_info(struct virq_info *irq_info); 136 137 /*! Return the ID of a signalling IRQ channel of the virtual super IRQ 138 139 \param irq_id[out] active IRQ (channel) identifier 140 141 \Note: This function operates as strtok(), based on the return 142 state the user is informed if there are additional signalling 143 channels 144 145 \return state(IRQ[...]) 146 */ 147 enum hrt_isp_css_irq_status virq_get_channel_id( 148 enum virq_id *irq_id); 149 150 /*! Return the IDs of all signaling IRQ channels of the virtual super IRQ 151 152 \param irq_info[out] all active IRQ (channel) identifiers 153 154 \Note: Unlike "irq_get_channel_id()" this function returns all 155 channel signaling info. The new info is OR'd with the current 156 info state. N.B. this is the same as repeatedly calling the function 157 "irq_get_channel_id()" in a (non-blocked) handler routine 158 159 \return (error(state(IRQ[...])) 160 */ 161 enum hrt_isp_css_irq_status 162 virq_get_channel_signals(struct virq_info *irq_info); 163 164 #endif /* __IRQ_PUBLIC_H_INCLUDED__ */ 165