Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
intc_esp32c3.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__
8#define ZEPHYR_INCLUDE_DRIVERS_ESP_INTR_ALLOC_H__
9
10#include <stdint.h>
11#include <stdbool.h>
12#include <soc.h>
13/*
14 * Interrupt allocation flags - These flags can be used to specify
15 * which interrupt qualities the code calling esp_intr_alloc* needs.
16 */
17
18/* Keep the LEVELx values as they are here; they match up with (1<<level) */
19#define ESP_INTR_FLAG_LEVEL1 (1<<1) /* Accept a Level 1 int vector, lowest priority */
20#define ESP_INTR_FLAG_LEVEL2 (1<<2) /* Accept a Level 2 int vector */
21#define ESP_INTR_FLAG_LEVEL3 (1<<3) /* Accept a Level 3 int vector */
22#define ESP_INTR_FLAG_LEVEL4 (1<<4) /* Accept a Level 4 int vector */
23#define ESP_INTR_FLAG_LEVEL5 (1<<5) /* Accept a Level 5 int vector */
24#define ESP_INTR_FLAG_LEVEL6 (1<<6) /* Accept a Level 6 int vector */
25#define ESP_INTR_FLAG_NMI (1<<7) /* Accept a Level 7 int vector, highest priority */
26#define ESP_INTR_FLAG_SHARED (1<<8) /* Interrupt can be shared between ISRs */
27#define ESP_INTR_FLAG_EDGE (1<<9) /* Edge-triggered interrupt */
28#define ESP_INTR_FLAG_IRAM (1<<10) /* ISR can be called if cache is disabled */
29#define ESP_INTR_FLAG_INTRDISABLED (1<<11) /* Return with this interrupt disabled */
30
31/* Low and medium prio interrupts. These can be handled in C. */
32#define ESP_INTR_FLAG_LOWMED (ESP_INTR_FLAG_LEVEL1|ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3)
33
34/* High level interrupts. Need to be handled in assembly. */
35#define ESP_INTR_FLAG_HIGH (ESP_INTR_FLAG_LEVEL4|ESP_INTR_FLAG_LEVEL5|ESP_INTR_FLAG_LEVEL6| \
36 ESP_INTR_FLAG_NMI)
37
38/* Mask for all level flags */
39#define ESP_INTR_FLAG_LEVELMASK (ESP_INTR_FLAG_LEVEL1|ESP_INTR_FLAG_LEVEL2|ESP_INTR_FLAG_LEVEL3| \
40 ESP_INTR_FLAG_LEVEL4|ESP_INTR_FLAG_LEVEL5|ESP_INTR_FLAG_LEVEL6| \
41 ESP_INTR_FLAG_NMI)
42
43/* Function prototype for interrupt handler function */
44typedef void (*isr_handler_t)(const void *arg);
45
50
76int esp_intr_alloc(int source,
77 int flags,
79 void *arg,
80 void **ret_handle);
81
90int esp_intr_disable(int source);
91
99int esp_intr_enable(int source);
100
108
109#endif
int esp_intr_alloc(int source, int flags, isr_handler_t handler, void *arg, void **ret_handle)
Allocate an interrupt with the given parameters.
int esp_intr_disable(int source)
Disable the interrupt associated with the source.
uint32_t esp_intr_get_enabled_intmask(int status_mask_number)
Gets the current enabled interrupts.
void(* isr_handler_t)(const void *arg)
Definition intc_esp32c3.h:44
void esp_intr_initialize(void)
Initializes interrupt table to its defaults.
int esp_intr_enable(int source)
Enable the interrupt associated with the source.
flags
Definition parser.h:96
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
static void handler(struct k_timer *timer)
Definition main.c:19