XINU
device
gpio
gpiohandler.c
Go to the documentation of this file.
1
/* gpiohandler.c - gpiohandler */
2
3
#include <
xinu.h
>
4
5
/*------------------------------------------------------------------------
6
* gpiohandler - Handle an interrupt for a gpio device
7
*------------------------------------------------------------------------
8
*/
9
void
gpiohandler
(
10
uint32
xnum
/* IRQ number */
11
)
12
{
13
struct
gpio_csreg
*csrptr;
/* GPIO CSR pointer */
14
gpiointhook
gphookfn;
/* The inerrupt function */
15
16
/* Clear all interrupts */
17
18
if
(xnum ==
GPIO0_INT_A
) {
19
csrptr = (
struct
gpio_csreg
*)(
GPIO0_BASE
);
20
gphookfn =
gpiotab
[0].
gphookfn
;
21
if
(gphookfn !=
NULL
)
22
gphookfn(xnum, csrptr->
irqstatus0
);
23
csrptr->
irqstatus0
= 0xFFFFFFFF;
24
return
;
25
}
26
if
(xnum ==
GPIO0_INT_B
) {
27
csrptr = (
struct
gpio_csreg
*)(
GPIO0_BASE
);
28
gphookfn =
gpiotab
[0].
gphookfn
;
29
if
(gphookfn !=
NULL
)
30
gphookfn(xnum, csrptr->
irqstatus1
);
31
csrptr->
irqstatus1
= 0xFFFFFFFF;
32
return
;
33
}
34
35
if
(xnum ==
GPIO1_INT_A
) {
36
csrptr = (
struct
gpio_csreg
*)(
GPIO1_BASE
);
37
gphookfn =
gpiotab
[1].
gphookfn
;
38
if
(gphookfn !=
NULL
)
39
gphookfn(xnum, csrptr->
irqstatus0
);
40
csrptr->
irqstatus0
= 0xFFFFFFFF;
41
return
;
42
}
43
if
(xnum ==
GPIO1_INT_B
) {
44
csrptr = (
struct
gpio_csreg
*)(
GPIO1_BASE
);
45
gphookfn =
gpiotab
[1].
gphookfn
;
46
if
(gphookfn !=
NULL
)
47
gphookfn(xnum, csrptr->
irqstatus1
);
48
csrptr->
irqstatus1
= 0xFFFFFFFF;
49
return
;
50
}
51
52
if
(xnum ==
GPIO2_INT_A
) {
53
csrptr = (
struct
gpio_csreg
*)(
GPIO2_BASE
);
54
gphookfn =
gpiotab
[2].
gphookfn
;
55
if
(gphookfn !=
NULL
)
56
gphookfn(xnum, csrptr->
irqstatus0
);
57
csrptr->
irqstatus0
= 0xFFFFFFFF;
58
return
;
59
}
60
if
(xnum ==
GPIO2_INT_B
) {
61
csrptr = (
struct
gpio_csreg
*)(
GPIO2_BASE
);
62
gphookfn =
gpiotab
[2].
gphookfn
;
63
if
(gphookfn !=
NULL
)
64
gphookfn(xnum, csrptr->
irqstatus1
);
65
csrptr->
irqstatus1
= 0xFFFFFFFF;
66
return
;
67
}
68
69
if
(xnum ==
GPIO3_INT_A
) {
70
csrptr = (
struct
gpio_csreg
*)(
GPIO3_BASE
);
71
gphookfn =
gpiotab
[3].
gphookfn
;
72
if
(gphookfn !=
NULL
)
73
gphookfn(xnum, csrptr->
irqstatus0
);
74
csrptr->
irqstatus0
= 0xFFFFFFFF;
75
return
;
76
}
77
if
(xnum ==
GPIO3_INT_B
) {
78
csrptr = (
struct
gpio_csreg
*)(
GPIO3_BASE
);
79
gphookfn =
gpiotab
[3].
gphookfn
;
80
if
(gphookfn !=
NULL
)
81
gphookfn(xnum, csrptr->
irqstatus1
);
82
csrptr->
irqstatus1
= 0xFFFFFFFF;
83
return
;
84
}
85
}
NULL
#define NULL
連結リスト用のNULLポインタ
Definition:
kernel.h:68
GPIO0_BASE
#define GPIO0_BASE
Definition:
gpio.h:121
gpio_csreg
Definition:
gpio.h:12
gpiotab
struct gpiocblk gpiotab[]
Definition:
gpioinit.c:5
gpiohandler
void gpiohandler(uint32 xnum)
Definition:
gpiohandler.c:9
GPIO1_INT_B
#define GPIO1_INT_B
Definition:
gpio.h:131
xinu.h
全てのシステムヘッダファイルをインクルードする。
GPIO3_INT_B
#define GPIO3_INT_B
Definition:
gpio.h:135
GPIO0_INT_A
#define GPIO0_INT_A
Definition:
gpio.h:128
GPIO3_BASE
#define GPIO3_BASE
Definition:
gpio.h:124
gpiocblk::gphookfn
gpiointhook gphookfn
Definition:
gpio.h:49
GPIO2_INT_B
#define GPIO2_INT_B
Definition:
gpio.h:133
GPIO1_INT_A
#define GPIO1_INT_A
Definition:
gpio.h:130
GPIO2_BASE
#define GPIO2_BASE
Definition:
gpio.h:123
gpiointhook
void(* gpiointhook)(uint32, uint32)
Definition:
gpio.h:46
GPIO0_INT_B
#define GPIO0_INT_B
Definition:
gpio.h:129
GPIO1_BASE
#define GPIO1_BASE
Definition:
gpio.h:122
uint32
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition:
kernel.h:15
GPIO3_INT_A
#define GPIO3_INT_A
Definition:
gpio.h:134
gpio_csreg::irqstatus1
volatile uint32 irqstatus1
Definition:
gpio.h:21
GPIO2_INT_A
#define GPIO2_INT_A
Definition:
gpio.h:132
gpio_csreg::irqstatus0
volatile uint32 irqstatus0
Definition:
gpio.h:20
Generated by
1.8.13