FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/bsp/armio.c @ 1025:4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Tue, 03 May 2016 23:46:54 +0000 |
parents | 383abdbc5d35 |
children |
rev | line source |
---|---|
93
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * ARMIO.C |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 * Control diagnostic bits |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 * Reference : GCS207 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "../include/config.h" |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 #include "../include/sys_types.h" |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 #include "mem.h" |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 #include "iq.h" |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 #include "armio.h" |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 #if 0 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 /* FreeCalypso: abb.h hasn't been integrated yet */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 #include "abb.h" // for AI_Power function : to be removed, use ABB_Power_Off in abb.c file instead !!! |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 #endif |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 #if (CHIPSET != 12) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 * AI_EnableBit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 * Enable ARMIO input/output bit (see CLKM module specification) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 void AI_EnableBit(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) |= (1<<bit); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 * AI_DisableBit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 * Disable ARMIO input/output bit (see CLKM module specification) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 void AI_DisableBit(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) &= ~(1<<bit); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 #endif /* CHIPSET != 12 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 * AI_SetBit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 * Switch-on one bit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 void AI_SetBit(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 *((volatile SYS_UWORD16 *) ARMIO_OUT) |= (1<<bit); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 * AI_ResetBit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 * Switch-off one bit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 void AI_ResetBit(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 *((volatile SYS_UWORD16 *) ARMIO_OUT) &= ~(1<<bit); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 * AI_ConfigBitAsOutput |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 * Set this bit as an output |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 void AI_ConfigBitAsOutput(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) &= ~(1<<bit); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 * AI_ConfigBitAsInput |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 * Set this bit as an input |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 void AI_ConfigBitAsInput(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) |= (1<<bit); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
89 * AI_ReadBit |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
90 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
91 * Read value in register |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
92 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
93 SYS_BOOL AI_ReadBit(int bit) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
94 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
95 if ((*((volatile SYS_UWORD16 *) ARMIO_IN)) & (1<<bit)) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 return (1); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 else |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 return (0); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 * AI_Power |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 * Switch-on or off the board |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 * Parameters : SYS_UWORD8 power: 1 to power-on (maintain power) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 * 0 to power-off |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 // #if (!OP_L1_STANDALONE) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 #if 0 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 void AI_Power(SYS_UWORD8 power) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 if (power == 0) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 ABB_Power_Off(); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 #endif |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 * AI_ResetIoConfig |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 * Reset all default IO configurations |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 void AI_ResetIoConfig(void) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0xFFFF; // all bits are inputs |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 #if (CHIPSET != 12) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) = 0; // default config |
110
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
132 #endif /* CHIPSET != 12 */ |
93
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 * AI_ClockEnable |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 * Enable ARMIO clock module |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 void AI_ClockEnable(void) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 *((volatile SYS_UWORD16 *) ARMIO_CNTL_REG) |= ARMIO_CLOCKEN; // set to 1 bit 5 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 /* |
110
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
148 * The AI_InitIOConfig() function is target-specific. |
93
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 |
110
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
151 #ifdef CONFIG_TARGET_GTAMODEM |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
152 /* version for the Openmoko GTA0x GSM modem */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
153 void AI_InitIOConfig(void) |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
154 { |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
155 // reset the IOs config |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
156 AI_ResetIoConfig(); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
157 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
158 /* |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
159 * The GTA0x Calypso block is a stripped-down version of the Leonardo, |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
160 * reduced to the absolute minimum that is needed for a slave modem. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
161 * Almost all of the unused interface pins are left unconnected, only |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
162 * a few are pulled externally to GND or VIO. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
163 * |
117
e40d8661ecab
nuc-fw: low-level serial code should be complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
110
diff
changeset
|
164 * We handle the unused pins the way TI's code does: configure them |
110
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
165 * as GPIOs, then as outputs driving a fixed value (high for GPIOs 8+, |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
166 * low for 0-7). |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
167 */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
168 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
169 /* I'll be brave and turn the unused TSPDI input into a GPIO4 output */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
170 AI_EnableBit(0); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
171 /* Don't want to do that for the IO5 pin though, as it's wired to SIM_IO |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
172 * through a resistor like on the Leonardo. */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
173 AI_DisableBit(1); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
174 /* |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
175 * The following 2 lines are straight from the Leonardo source: enable |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
176 * GPIO6 and GPIO8. GPIO6 takes the place of an ancient VEGA3(?) compat |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
177 * pin, and GPIO8 takes the place of MCUEN1 which no Leonardo-based |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
178 * design seems to use. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
179 * |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
180 * Note that GPIO7 is not enabled in this version, so that pin retains |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
181 * its meaning as nRESET_OUT - but it's an unused output, rather than |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
182 * a floating input, so we are fine. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
183 */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
184 AI_EnableBit(2); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
185 AI_EnableBit(4); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
186 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
187 /* |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
188 * The GTA0x modem has no Calypso-interfaced Bluetooth, nor any other |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
189 * use for MCSI, aka the DSP backdoor interface. So we turn these 4 pins |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
190 * into GPIOs driving high output state like TI's code does in the |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
191 * sans-BT configuration. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
192 */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
193 AI_EnableBit(5); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
194 AI_EnableBit(6); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
195 AI_EnableBit(7); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
196 AI_EnableBit(8); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
197 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
198 /* ditto for MCUEN2 turned GPIO 13 */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
199 AI_EnableBit(9); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
200 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
201 // ARMIO_OUT register configuration : |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
202 // set IOs 8,9,10,11,12 and 13 as high |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
203 // set IOs 0 to 7 as low |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
204 // Falcon's note: the BP->AP interrupt line gets set low as desired |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
205 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F00; |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
206 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
207 // ARMIO_CNTL_REG register configuration : |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
208 // set IOs 0,1,6,8,9,10,11,12 and 13 as outputs. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
209 // Falcon's addition: set 2, 3 and 4 as outputs too, |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
210 // as they are no-connects on the board. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
211 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
212 AI_ConfigBitAsOutput(0); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
213 AI_ConfigBitAsOutput(1); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
214 AI_ConfigBitAsOutput(2); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
215 AI_ConfigBitAsOutput(3); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
216 AI_ConfigBitAsOutput(4); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
217 AI_ConfigBitAsOutput(6); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
218 AI_ConfigBitAsOutput(8); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
219 AI_ConfigBitAsOutput(9); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
220 AI_ConfigBitAsOutput(10); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
221 AI_ConfigBitAsOutput(11); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
222 AI_ConfigBitAsOutput(12); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
223 AI_ConfigBitAsOutput(13); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
224 } |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
225 #endif |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
226 |
1025
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
227 #ifdef CONFIG_TARGET_FCDEV3B |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
228 /* version for the to-be-built FCDEV3B board */ |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
229 void AI_InitIOConfig(void) |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
230 { |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
231 // reset the IOs config |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
232 AI_ResetIoConfig(); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
233 |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
234 AI_EnableBit(0); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
235 AI_DisableBit(1); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
236 AI_EnableBit(2); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
237 AI_EnableBit(4); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
238 |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
239 /* |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
240 * The MCSI pins are brought out to a header with the intent of |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
241 * facilitating experimentation with this interface, so let's put them |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
242 * into the MCSI configuration. |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
243 */ |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
244 AI_DisableBit(5); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
245 AI_DisableBit(6); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
246 AI_DisableBit(7); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
247 AI_DisableBit(8); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
248 |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
249 AI_EnableBit(9); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
250 |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
251 // ARMIO_OUT register configuration: same as TI's code sets |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
252 // the loudspeaker PA is disabled on boot for the time being |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
253 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F00; |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
254 |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
255 // ARMIO_CNTL_REG register configuration: |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
256 // most of the pins are no-connects, make them outputs |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
257 |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
258 AI_ConfigBitAsOutput(0); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
259 AI_ConfigBitAsOutput(1); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
260 AI_ConfigBitAsOutput(2); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
261 AI_ConfigBitAsOutput(4); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
262 AI_ConfigBitAsOutput(6); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
263 AI_ConfigBitAsOutput(8); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
264 AI_ConfigBitAsOutput(9); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
265 AI_ConfigBitAsOutput(13); |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
266 } |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
267 #endif |
4c80a6e6723f
gsm-fw: added provisional support for FCDEV3B target ahead of the hardware
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
513
diff
changeset
|
268 |
110
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
269 #ifdef CONFIG_TARGET_PIRELLI |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
270 /* version for Pirelli DP-L10 */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
271 void AI_InitIOConfig(void) |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
272 { |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
273 // reset the IOs config |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
274 AI_ResetIoConfig(); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
275 |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
276 /* |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
277 * In the case of the Pirelli, our understanding of the hardware |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
278 * is severely crippled by the lack of schematics and the difficulty of |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
279 * reverse engineering from steve-m's PCB layer grind-down scans. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
280 * |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
281 * The folllowing ARMIO configuration has been copied from OsmocomBB. |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
282 */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
283 AI_EnableBit(0); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
284 AI_EnableBit(1); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
285 AI_EnableBit(2); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
286 AI_EnableBit(3); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
287 AI_EnableBit(4); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
288 AI_EnableBit(9); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
289 /* GPIO out all zeros */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
290 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
291 /* setup outputs like OsmocomBB does */ |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
292 AI_ConfigBitAsOutput(1); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
293 AI_ConfigBitAsOutput(4); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
294 AI_ConfigBitAsOutput(7); |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
295 } |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
296 #endif |
325bbadc0c9c
nuc-fw/bsp: per-target ARMIO init implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
297 |
513
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
298 #ifdef CONFIG_TARGET_COMPAL |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
299 /* same for all C1xx variants */ |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
300 void AI_InitIOConfig(void) |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
301 { |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
302 // reset the IOs config |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
303 AI_ResetIoConfig(); |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
304 |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
305 /* |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
306 * I don't feel like scrutinizing every Calypso signal on the C139 |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
307 * and C155 schematics right now, so for now we'll use a GPIO |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
308 * configuration based on OsmocomBB. |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
309 */ |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
310 /* GPIO out all zeros */ |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
311 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
312 /* make GPIOs 1 and 3 outputs */ |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
313 AI_ConfigBitAsOutput(1); |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
314 AI_ConfigBitAsOutput(3); |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
315 } |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
316 #endif |
383abdbc5d35
gsm-fw/bsp/armio.c: Compal configuration added
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
143
diff
changeset
|
317 |
93
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
318 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
319 * AI_SelectIOForIT |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
320 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
321 * Select which IO will be used to generate an interrupt. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
322 * 'Edge' specifies if interrup must be detected on falling or rising edge. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
323 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
324 * Warning: parameters are not checked. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
325 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
326 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
327 void AI_SelectIOForIT (SYS_UWORD16 Pin, SYS_UWORD16 Edge) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
328 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
329 #if (CHIPSET == 12) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
330 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
331 * Update INTERRUPT_LEVEL_REG with Edge configuration on Pin selection |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
332 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
333 GPIO_INTERRUPT_LEVEL_REG = (Edge & 0x0001) << Pin; |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
334 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
335 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
336 * Update INTERRUPT_MASK_REG to enable interrupt generation on Pin selection |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
337 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
338 GPIO_INTERRUPT_MASK_REG = 1 << Pin; |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
339 #else |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
340 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
341 * Bit SET_GPIO_EVENT_MODE (bit 0) is set to enable the GPIO event mode. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
342 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
343 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
344 *((volatile SYS_UWORD16 *) ARMIO_GPIO_EVENT_MODE) = (Pin << 1) + (Edge << 5) + 1; |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
345 #endif |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
346 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
347 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
348 #if (CHIPSET != 12) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
349 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
350 * AI_CheckITSource |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
351 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
352 * Check if the interrupt specified by 'Source' is active or not. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
353 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
354 * Output: 0: IT is not active |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
355 * 1: IT is active |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
356 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
357 * Warning: parameters are not checked. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
358 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
359 * Warning: If the keypad and GPIO interrupts may occur the GPIO interrupt |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
360 * must be checked first because the GPIO status bit is reset when |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
361 * the register is read. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
362 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
363 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
364 int AI_CheckITSource (SYS_UWORD16 Source) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
365 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
366 return (*((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_INT) & Source ? 1 : 0); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
367 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
368 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
369 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
370 * AI_UnmaskIT |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
371 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
372 * Unmask the IT specified by 'Source' (keyboard or GPIO). |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
373 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
374 * Warning: parameters are not checked. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
375 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
376 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
377 void AI_UnmaskIT (SYS_UWORD16 Source) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
378 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
379 *((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_MASKIT) &= ~Source; |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
380 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
381 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
382 /* |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
383 * AI_MaskIT |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
384 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
385 * Mask the IT specified by 'Source' (keyboard or GPIO). |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
386 * |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
387 * Warning: parameters are not checked. |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
388 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
389 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
390 void AI_MaskIT (SYS_UWORD16 Source) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
391 { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
392 *((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_MASKIT) |= Source; |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
393 } |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
394 #endif /* CHIPSET != 12 */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
395 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
396 #if (CHIPSET == 12) |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
397 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
398 void AI_MaskIT(SYS_UWORD16 d_io_number) { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
399 GPIO_INTERRUPT_MASK_REG |= (1 << d_io_number); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
400 } /* f_gpio_mask_it() */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
401 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
402 void AI_UnmaskIT(SYS_UWORD16 d_io_number) { |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
403 GPIO_INTERRUPT_MASK_REG &= ~(1 << d_io_number); |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
404 } /* f_gpio_unmask_it() */ |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
405 |
45911ad957fd
nuc-fw: beginning to integrate TI's BSP code
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
406 #endif |