summaryrefslogtreecommitdiff
path: root/bsp/allwinner/libraries/sunxi-hal/include/osal/hal_interrupt.h
blob: 1f5739d08c42bcd692966dfd58c94ab05e6a992a (plain)
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
#ifndef SUNXI_HAL_INTERRUPT_H
#define SUNXI_HAL_INTERRUPT_H

#ifdef __cplusplus
extern "C"
{
#endif

#include <stdint.h>
#include <stddef.h>
#include "../../../libos/include/interrupt.h"

typedef enum hal_irqreturn {
    HAL_IRQ_OK      = (0 << 0),
    HAL_IRQ_ERR     = (1 << 0),
} hal_irqreturn_t;

#ifdef CONFIG_KERNEL_FREERTOS
enum irqreturn
{
    IRQ_NONE        = (0 << 0),
    IRQ_HANDLED     = (1 << 0),
    IRQ_WAKE_THREAD     = (1 << 1),
};
typedef enum irqreturn irqreturn_t;
typedef irqreturn_t (*irq_handler_t)(int, void *);

int request_irq(unsigned int irq, irq_handler_t handler,
        unsigned long flags, const char *name, void *dev);

void *free_irq(unsigned int irq, void *data);

void enable_irq(unsigned int irq);

void disable_irq(unsigned int irq);

#endif


void hal_interrupt_enable(void);
void hal_interrupt_disable(void);
uint32_t hal_interrupt_save(void);
void hal_interrupt_restore(uint32_t flag);

uint32_t hal_interrupt_get_nest(void);

#ifdef __cplusplus
}
#endif

#endif