no-OS
no_os_irq.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef _NO_OS_IRQ_H_
41 #define _NO_OS_IRQ_H_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 
47 #include <stdint.h>
48 
49 /******************************************************************************/
50 /*************************** Types Declarations *******************************/
51 /******************************************************************************/
52 
65 };
66 
75 };
76 
83 };
84 
90 };
91 
98 
105  uint32_t irq_ctrl_id;
112  void *extra;
113 };
114 
121  uint32_t irq_ctrl_id;
128  void *extra;
129 };
130 
138  void (*callback)(void *context);
145  void (*legacy_callback)(void *ctx, uint32_t event,
146  void *extra); /* TODO: remove this. */
148  void *ctx;
150  void *legacy_config; /* TODO: remove this. */
156  void *handle;
157 };
158 
166  int32_t (*init)(struct no_os_irq_ctrl_desc **desc,
167  const struct no_os_irq_init_param *param);
169  int32_t (*register_callback)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id,
170  struct no_os_callback_desc *callback);
172  int32_t (*unregister_callback)(struct no_os_irq_ctrl_desc *desc,
173  uint32_t irq_id,
174  struct no_os_callback_desc *callback);
176  int32_t (*global_enable)(struct no_os_irq_ctrl_desc *desc);
178  int32_t (*global_disable)(struct no_os_irq_ctrl_desc *desc);
180  int32_t (*trigger_level_set)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id,
181  enum no_os_irq_trig_level trig);
183  int32_t (*enable)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
185  int32_t (*disable)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
187  int32_t (*set_priority)(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id,
188  uint32_t priority_level);
190  int32_t (*remove)(struct no_os_irq_ctrl_desc *desc);
191 };
192 
193 /******************************************************************************/
194 /************************ Functions Declarations ******************************/
195 /******************************************************************************/
196 
197 /* Initialize a interrupt controller peripheral. */
198 int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc,
199  const struct no_os_irq_init_param *param);
200 
201 /* Free the resources allocated by no_os_irq_ctrl_init(). */
202 int32_t no_os_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc);
203 
204 /* Register a callback to handle the irq events */
206  uint32_t irq_id,
207  struct no_os_callback_desc *callback_desc);
208 
209 /* Unregisters a generic IRQ handling function */
211  uint32_t irq_id,
212  struct no_os_callback_desc *callback_desc);
213 
214 /* Global interrupt enable */
215 int32_t no_os_irq_global_enable(struct no_os_irq_ctrl_desc *desc);
216 
217 /* Global interrupt disable */
218 int32_t no_os_irq_global_disable(struct no_os_irq_ctrl_desc *desc);
219 
220 /* Set interrupt trigger level. */
222  uint32_t irq_id,
223  enum no_os_irq_trig_level trig);
224 
225 /* Enable specific interrupt */
226 int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
227 
228 /* Disable specific interrupt */
229 int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id);
230 
232 int32_t no_os_irq_set_priority(struct no_os_irq_ctrl_desc *desc,
233  uint32_t irq_id,
234  uint32_t priority_level);
235 #endif // _NO_OS_IRQ_H_
NO_OS_EVT_UART_RX_COMPLETE
@ NO_OS_EVT_UART_RX_COMPLETE
Definition: no_os_irq.h:70
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:187
NO_OS_IRQ_WRITE_DONE
@ NO_OS_IRQ_WRITE_DONE
Definition: no_os_irq.h:60
NO_OS_IRQ_LEVEL_HIGH
@ NO_OS_IRQ_LEVEL_HIGH
Definition: no_os_irq.h:79
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:136
no_os_callback_desc::legacy_config
void * legacy_config
Definition: no_os_irq.h:150
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:82
NO_OS_IRQ_LEVEL_LOW
@ NO_OS_IRQ_LEVEL_LOW
Definition: no_os_irq.h:78
no_os_irq_peripheral
no_os_irq_peripheral
Definition: no_os_irq.h:85
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:166
NO_OS_IRQ_EDGE_FALLING
@ NO_OS_IRQ_EDGE_FALLING
Definition: no_os_irq.h:80
NO_OS_RTC_IRQ
@ NO_OS_RTC_IRQ
Definition: no_os_irq.h:88
no_os_irq_init_param::extra
void * extra
Definition: no_os_irq.h:112
no_os_callback_desc::peripheral
enum no_os_irq_peripheral peripheral
Definition: no_os_irq.h:154
NO_OS_EVT_UART_TX_COMPLETE
@ NO_OS_EVT_UART_TX_COMPLETE
Definition: no_os_irq.h:69
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:167
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:107
NO_OS_EVT_TIM_ELAPSED
@ NO_OS_EVT_TIM_ELAPSED
Definition: no_os_irq.h:74
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:116
no_os_callback_desc::ctx
void * ctx
Definition: no_os_irq.h:148
no_os_irq_uart_event_e
no_os_irq_uart_event_e
Possible events for uart interrupt.
Definition: no_os_irq.h:58
NO_OS_IRQ_READ_DONE
@ NO_OS_IRQ_READ_DONE
Definition: no_os_irq.h:62
no_os_irq_platform_ops::global_disable
int32_t(* global_disable)(struct no_os_irq_ctrl_desc *desc)
Definition: no_os_irq.h:178
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:96
no_os_irq_trig_level
no_os_irq_trig_level
Definition: no_os_irq.h:77
no_os_irq_init_param::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:105
no_os_irq_ctrl_desc::platform_ops
const struct no_os_irq_platform_ops * platform_ops
Definition: no_os_irq.h:123
NO_OS_TIM_IRQ
@ NO_OS_TIM_IRQ
Definition: no_os_irq.h:89
no_os_callback_desc::legacy_callback
void(* legacy_callback)(void *ctx, uint32_t event, void *extra)
Definition: no_os_irq.h:145
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:183
no_os_irq_init_param::platform_ops
const struct no_os_irq_platform_ops * platform_ops
Definition: no_os_irq.h:107
NO_OS_EVT_RTC
@ NO_OS_EVT_RTC
Definition: no_os_irq.h:72
NO_OS_EVT_XINT
@ NO_OS_EVT_XINT
Definition: no_os_irq.h:73
irq_id
irq_id
Interrupts IDs supported by the irq driver.
Definition: irq_extra.h:68
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:51
no_os_callback_desc::handle
void * handle
Definition: no_os_irq.h:156
no_os_callback_desc::callback
void(* callback)(void *context)
Definition: no_os_irq.h:138
no_os_callback_desc::event
enum no_os_irq_event event
Definition: no_os_irq.h:152
no_os_irq_platform_ops::remove
int32_t(* remove)(struct no_os_irq_ctrl_desc *desc)
Definition: no_os_irq.h:190
no_os_irq_platform_ops::global_enable
int32_t(* global_enable)(struct no_os_irq_ctrl_desc *desc)
Definition: no_os_irq.h:176
no_os_irq_ctrl_desc::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:121
NO_OS_EVT_GPIO
@ NO_OS_EVT_GPIO
Definition: no_os_irq.h:68
no_os_irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: no_os_irq.h:103
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:172
NO_OS_IRQ_EDGE_RISING
@ NO_OS_IRQ_EDGE_RISING
Definition: no_os_irq.h:81
NO_OS_UART_IRQ
@ NO_OS_UART_IRQ
Definition: no_os_irq.h:87
no_os_irq_event
no_os_irq_event
Definition: no_os_irq.h:67
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:70
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:144
NO_OS_EVT_UART_ERROR
@ NO_OS_EVT_UART_ERROR
Definition: no_os_irq.h:71
no_os_irq_platform_ops
Structure holding IRQ function pointers that point to the platform specific function.
Definition: no_os_irq.h:164
NO_OS_GPIO_IRQ
@ NO_OS_GPIO_IRQ
Definition: no_os_irq.h:86
NO_OS_IRQ_EDGE_BOTH
@ NO_OS_IRQ_EDGE_BOTH
Definition: no_os_irq.h:82
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:185
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:180
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:128
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:155
no_os_irq_ctrl_desc
Definition: no_os_irq.h:119
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:169
NO_OS_IRQ_ERROR
@ NO_OS_IRQ_ERROR
Definition: no_os_irq.h:64
no_os_irq_ctrl_desc::extra
void * extra
Definition: no_os_irq.h:128