1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17: 18:
19:
20: #include "kernel.h"
21: #include <tk/sysdef.h>
22: #include <tk/syslib.h>
23: #include <tm/tmonitor.h>
24: #include "tkdev_conf.h"
25:
26: 27: 28:
29: EXPORT ER tkdev_initialize( void )
30: {
31: static UINT giob[4] = { _L, _H, _HH, _HHH };
32: UINT gb;
33: INT i;
34:
35:
36: for ( i = 0; i < 4; ++i ) {
37: gb = giob[i];
38: out_w(GIO_IDS(gb), 0xffffffff);
39: out_w(GIO_IIA(gb), 0x00000000);
40: out_w(GIO_GSW(gb), 0x00000000);
41: }
42:
43:
44: out_w(IT0_IDSS0, 0xffffffff);
45: out_w(IT0_IDSS1, 0xffffffff);
46: out_w(IT0_IDSS2, 0xffffffff);
47: out_w(IT0_IDS0, 0xffffffff);
48: out_w(IT0_IDS1, 0xffffffff);
49: out_w(IT0_IDS2, 0xffffffff);
50: out_w(IT_PINV_CLR0, 0xffffffff);
51: out_w(IT_PINV_CLR1, 0xffffffff);
52: out_w(IT_PINV_CLR2, 0xffffffff);
53: out_w(IT_LIIR, 0xffffffff);
54: out_w(IT0_IIR, 0xffffffff);
55: out_w(IT0_FIE, 0x00000001);
56:
57:
58: out_w(IT0_IENS0, IRQM(26)|IRQM(27));
59: out_w(IT0_IENS1, IRQM(50)|IRQM(51)|IRQM(52)|IRQM(53));
60: out_w(IT0_IENS2, IRQM(79)|IRQM(80));
61: out_w(IT0_IEN0, IRQM(26)|IRQM(27));
62: out_w(IT0_IEN1, IRQM(50)|IRQM(51)|IRQM(52)|IRQM(53));
63: out_w(IT0_IEN2, IRQM(79)|IRQM(80));
64:
65:
66: SetIntMode(IV_GPIO(8), IM_ENA|IM_LEVEL|IM_HI);
67: EnableInt(IV_GPIO(8));
68:
69: return E_OK;
70: }
71:
72: 73: 74: 75: 76:
77: EXPORT void tkdev_exit( void )
78: {
79: disint();
80: tm_exit(0);
81:
82:
83: for ( ;; ) {
84: tm_monitor();
85: }
86: }