no-OS
no_os_irq.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef _NO_OS_IRQ_H_
35 #define _NO_OS_IRQ_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include <stdint.h>
42 
43 /******************************************************************************/
44 /*************************** Types Declarations *******************************/
45 /******************************************************************************/
46 
59 };
60 
74 };
75 
82 };
83 
94 };
95 
101 struct no_os_irq_platform_ops ;
102 
109  uint32_t irq_ctrl_id;
116  void *extra;
117 };
118 
125  uint32_t irq_ctrl_id;
128  /* Reference counter */
129  uint32_t ref;
134  void *extra;
135 };
136 
144  void (*callback)(void *context);
146  void *ctx;
152  void *handle;
153 };
154 
162  int32_t (*init)(struct no_os_irq_ctrl_desc **desc,
163  const struct no_os_irq_init_param *param);
165  int32_t (*register_callback)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id,
166  struct no_os_callback_desc *callback);
168  int32_t (*unregister_callback)(struct no_os_irq_ctrl_desc *desc,
169  uint32_t irq_id,
170  struct no_os_callback_desc *callback);
172  int32_t (*global_enable)(struct no_os_irq_ctrl_desc *desc);
174  int32_t (*global_disable)(struct no_os_irq_ctrl_desc *desc);
176  int32_t (*trigger_level_set)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id,
177  enum no_os_irq_trig_level trig);
179  int32_t (*enable)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
181  int32_t (*disable)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
183  int32_t (*set_priority)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id,
184  uint32_t priority_level);
186  int32_t (*remove)(struct no_os_irq_ctrl_desc *desc);
188  int32_t(*clear_pending)(struct no_os_irq_ctrl_desc* desc, uint32_t irq_id);
189 };
190 
191 /******************************************************************************/
192 /************************ Functions Declarations ******************************/
193 /******************************************************************************/
194 
195 /* Initialize a interrupt controller peripheral. */
196 int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc,
197  const struct no_os_irq_init_param *param);
198 
199 /* Free the resources allocated by no_os_irq_ctrl_init(). */
200 int32_t no_os_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc);
201 
202 /* Register a callback to handle the irq events */
204  uint32_t irq_id,
205  struct no_os_callback_desc *callback_desc);
206 
207 /* Unregisters a generic IRQ handling function */
209  uint32_t irq_id,
210  struct no_os_callback_desc *callback_desc);
211 
212 /* Global interrupt enable */
213 int32_t no_os_irq_global_enable(struct no_os_irq_ctrl_desc *desc);
214 
215 /* Global interrupt disable */
216 int32_t no_os_irq_global_disable(struct no_os_irq_ctrl_desc *desc);
217 
218 /* Set interrupt trigger level. */
220  uint32_t irq_id,
221  enum no_os_irq_trig_level trig);
222 
223 /* Enable specific interrupt */
224 int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
225 
226 /* Disable specific interrupt */
227 int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
228 
230 int32_t no_os_irq_set_priority(struct no_os_irq_ctrl_desc *desc,
231  uint32_t irq_id,
232  uint32_t priority_level);
233 
234 /* Clear the pending interrupts */
235 int32_t no_os_irq_clear_pending(struct no_os_irq_ctrl_desc* desc,
236  uint32_t irq_id);
237 #endif // _NO_OS_IRQ_H_
no_os_irq_platform_ops::clear_pending
int32_t(* clear_pending)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Definition: no_os_irq.h:188
NO_OS_EVT_UART_RX_COMPLETE
@ NO_OS_EVT_UART_RX_COMPLETE
Definition: no_os_irq.h:64
no_os_irq_platform_ops::set_priority
int32_t(* set_priority)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, uint32_t priority_level)
Definition: no_os_irq.h:183
NO_OS_IRQ_WRITE_DONE
@ NO_OS_IRQ_WRITE_DONE
Definition: no_os_irq.h:54
NO_OS_IRQ_LEVEL_HIGH
@ NO_OS_IRQ_LEVEL_HIGH
Definition: no_os_irq.h:78
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:142
no_os_irq_register_callback
int32_t no_os_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Register a callback to handle the irq events.
Definition: no_os_irq.c:92
NO_OS_IRQ_LEVEL_LOW
@ NO_OS_IRQ_LEVEL_LOW
Definition: no_os_irq.h:77
NO_OS_TIM_DMA_IRQ
@ NO_OS_TIM_DMA_IRQ
Definition: no_os_irq.h:90
NO_OS_EVT_TIM_PWM_PULSE_FINISHED
@ NO_OS_EVT_TIM_PWM_PULSE_FINISHED
Definition: no_os_irq.h:69
no_os_irq_peripheral
no_os_irq_peripheral
Definition: no_os_irq.h:84
NO_OS_EVT_USB
@ NO_OS_EVT_USB
Definition: no_os_irq.h:73
no_os_irq_platform_ops::init
int32_t(* init)(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Definition: no_os_irq.h:162
NO_OS_IRQ_EDGE_FALLING
@ NO_OS_IRQ_EDGE_FALLING
Definition: no_os_irq.h:79
NO_OS_TDM_DMA_IRQ
@ NO_OS_TDM_DMA_IRQ
Definition: no_os_irq.h:89
NO_OS_RTC_IRQ
@ NO_OS_RTC_IRQ
Definition: no_os_irq.h:87
no_os_irq_init_param::extra
void * extra
Definition: no_os_irq.h:116
no_os_callback_desc::peripheral
enum no_os_irq_peripheral peripheral
Definition: no_os_irq.h:150
NO_OS_EVT_UART_TX_COMPLETE
@ NO_OS_EVT_UART_TX_COMPLETE
Definition: no_os_irq.h:63
no_os_irq_set_priority
int32_t no_os_irq_set_priority(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, uint32_t priority_level)
Set the priority for an interrupt.
Definition: no_os_irq.c:216
no_os_irq_ctrl_desc::ref
uint32_t ref
Definition: no_os_irq.h:129
no_os_irq_global_enable
int32_t no_os_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable global interrupts.
Definition: no_os_irq.c:129
NO_OS_EVT_TIM_ELAPSED
@ NO_OS_EVT_TIM_ELAPSED
Definition: no_os_irq.h:68
no_os_irq_global_disable
int32_t no_os_irq_global_disable(struct no_os_irq_ctrl_desc *desc)
Disable global interrupts.
Definition: no_os_irq.c:144
NO_OS_USB_IRQ
@ NO_OS_USB_IRQ
Definition: no_os_irq.h:93
no_os_callback_desc::ctx
void * ctx
Definition: no_os_irq.h:146
NO_OS_SPI_DMA_IRQ
@ NO_OS_SPI_DMA_IRQ
Definition: no_os_irq.h:91
no_os_irq_uart_event_e
no_os_irq_uart_event_e
Possible events for uart interrupt.
Definition: no_os_irq.h:52
NO_OS_IRQ_READ_DONE
@ NO_OS_IRQ_READ_DONE
Definition: no_os_irq.h:56
no_os_irq_platform_ops::global_disable
int32_t(* global_disable)(struct no_os_irq_ctrl_desc *desc)
Definition: no_os_irq.h:174
no_os_irq_unregister_callback
int32_t no_os_irq_unregister_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Unregisters a generic IRQ handling function.
Definition: no_os_irq.c:112
no_os_irq_trig_level
no_os_irq_trig_level
Definition: no_os_irq.h:76
no_os_irq_init_param::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:109
no_os_irq_ctrl_desc::platform_ops
const struct no_os_irq_platform_ops * platform_ops
Definition: no_os_irq.h:127
NO_OS_TIM_IRQ
@ NO_OS_TIM_IRQ
Definition: no_os_irq.h:88
no_os_irq_platform_ops::enable
int32_t(* enable)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Definition: no_os_irq.h:179
no_os_irq_init_param::platform_ops
const struct no_os_irq_platform_ops * platform_ops
Definition: no_os_irq.h:111
NO_OS_EVT_RTC
@ NO_OS_EVT_RTC
Definition: no_os_irq.h:66
NO_OS_EVT_XINT
@ NO_OS_EVT_XINT
Definition: no_os_irq.h:67
no_os_irq_ctrl_init
int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialize the IRQ interrupts.
Definition: no_os_irq.c:45
no_os_callback_desc::handle
void * handle
Definition: no_os_irq.h:152
no_os_callback_desc::callback
void(* callback)(void *context)
Definition: no_os_irq.h:144
NO_OS_EVT_DMA_TX_COMPLETE
@ NO_OS_EVT_DMA_TX_COMPLETE
Definition: no_os_irq.h:72
irq_id
irq_id
Interrupts IDs supported by the irq driver.
Definition: aducm3029_irq.h:62
no_os_irq_clear_pending
int32_t no_os_irq_clear_pending(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Clear the pending interrupt.
Definition: no_os_irq.c:235
no_os_callback_desc::event
enum no_os_irq_event event
Definition: no_os_irq.h:148
no_os_irq_platform_ops::remove
int32_t(* remove)(struct no_os_irq_ctrl_desc *desc)
Definition: no_os_irq.h:186
NO_OS_EVT_DMA_RX_COMPLETE
@ NO_OS_EVT_DMA_RX_COMPLETE
Definition: no_os_irq.h:70
no_os_irq_platform_ops::global_enable
int32_t(* global_enable)(struct no_os_irq_ctrl_desc *desc)
Definition: no_os_irq.h:172
no_os_irq_ctrl_desc::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:125
NO_OS_EVT_GPIO
@ NO_OS_EVT_GPIO
Definition: no_os_irq.h:62
no_os_irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: no_os_irq.h:107
no_os_irq_platform_ops::unregister_callback
int32_t(* unregister_callback)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback)
Definition: no_os_irq.h:168
NO_OS_IRQ_EDGE_RISING
@ NO_OS_IRQ_EDGE_RISING
Definition: no_os_irq.h:80
NO_OS_UART_IRQ
@ NO_OS_UART_IRQ
Definition: no_os_irq.h:86
no_os_irq_event
no_os_irq_event
Definition: no_os_irq.h:61
no_os_irq_ctrl_remove
int32_t no_os_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by no_os_irq_ctrl_init().
Definition: no_os_irq.c:71
no_os_irq_enable
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:181
NO_OS_EVT_UART_ERROR
@ NO_OS_EVT_UART_ERROR
Definition: no_os_irq.h:65
no_os_irq_platform_ops
Structure holding IRQ function pointers that point to the platform specific function.
Definition: no_os_irq.h:160
NO_OS_GPIO_IRQ
@ NO_OS_GPIO_IRQ
Definition: no_os_irq.h:85
NO_OS_EVT_DMA_RX_HALF_COMPLETE
@ NO_OS_EVT_DMA_RX_HALF_COMPLETE
Definition: no_os_irq.h:71
NO_OS_IRQ_EDGE_BOTH
@ NO_OS_IRQ_EDGE_BOTH
Definition: no_os_irq.h:81
no_os_irq_platform_ops::disable
int32_t(* disable)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Definition: no_os_irq.h:181
no_os_irq_platform_ops::trigger_level_set
int32_t(* trigger_level_set)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level trig)
Definition: no_os_irq.h:176
no_os_irq_trigger_level_set
int32_t no_os_irq_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level trig)
Set interrupt trigger level.
Definition: no_os_irq.c:162
no_os_irq_disable
int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: no_os_irq.c:198
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
no_os_irq_platform_ops::register_callback
int32_t(* register_callback)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback)
Definition: no_os_irq.h:165
NO_OS_IRQ_ERROR
@ NO_OS_IRQ_ERROR
Definition: no_os_irq.h:58
no_os_irq_ctrl_desc::extra
void * extra
Definition: no_os_irq.h:134
NO_OS_DMA_IRQ
@ NO_OS_DMA_IRQ
Definition: no_os_irq.h:92