FreeCalypso > hg > fc-magnetite
annotate src/cs/drivers/drv_core/armio/armio.c @ 681:140a0d24a64c
Tango pinmux implemented
except for GPIO1 special outputs, which will be implemented later.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 25 Jun 2020 05:36:24 +0000 |
parents | ee3ac8c617cb |
children |
rev | line source |
---|---|
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * ARMIO.C |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * Control diagnostic bits |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * Reference : GCS207 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "l1sw.cfg" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "swconfig.cfg" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #ifdef BLUETOOTH_INCLUDED |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "btemobile.cfg" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #if (OP_L1_STANDALONE == 1) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "l1_macro.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "l1_confg.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #include "board.cfg" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "chipset.cfg" |
602
92dbfa906f66
fc-target.cfg config header renamed to more sensible fc-target.h
Mychaela Falconia <falcon@freecalypso.org>
parents:
600
diff
changeset
|
23 #include "fc-target.h" |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #if (OP_L1_STANDALONE == 0) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "main/sys_types.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #else |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #include "sys_types.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "memif/mem.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #include "inth/iq.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #include "armio/armio.h" |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "abb/abb.h" // for AI_Power function : to be removed, use ABB_Power_Off in abb.c file instead !!! |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
681
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
38 #ifdef CONFIG_TANGO_MODEM |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
39 #include "ffs/ffs_api.h" |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
40 |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
41 SYS_UWORD8 AI_Tango_pinmux[4]; |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
42 #endif |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
43 |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 #if (CHIPSET != 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 * AI_EnableBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 * Enable ARMIO input/output bit (see CLKM module specification) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 void AI_EnableBit(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) |= (1<<bit); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 * AI_DisableBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 * Disable ARMIO input/output bit (see CLKM module specification) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 void AI_DisableBit(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) &= ~(1<<bit); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 #endif /* CHIPSET != 12 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 * AI_SetBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * Switch-on one bit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 void AI_SetBit(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 *((volatile SYS_UWORD16 *) ARMIO_OUT) |= (1<<bit); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 * AI_ResetBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 * Switch-off one bit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 void AI_ResetBit(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 *((volatile SYS_UWORD16 *) ARMIO_OUT) &= ~(1<<bit); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 * AI_ConfigBitAsOutput |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 * Set this bit as an output |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 void AI_ConfigBitAsOutput(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) &= ~(1<<bit); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 * AI_ConfigBitAsInput |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 * Set this bit as an input |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 void AI_ConfigBitAsInput(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) |= (1<<bit); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 * AI_ReadBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 * Read value in register |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 SYS_BOOL AI_ReadBit(int bit) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 if ((*((volatile SYS_UWORD16 *) ARMIO_IN)) & (1<<bit)) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 return (1); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 else |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 return (0); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * AI_Power |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 * Switch-on or off the board |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 * Parameters : SYS_UWORD8 power: 1 to power-on (maintain power) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 * 0 to power-off |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 #if (OP_L1_STANDALONE == 0) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 void AI_Power(SYS_UWORD8 power) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 if (power == 0) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 ABB_Power_Off(); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 * AI_ResetIoConfig |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 * Reset all default IO configurations |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 void AI_ResetIoConfig(void) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 { |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
148 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0xFFFF; // all bits are inputs |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
149 #if (CHIPSET != 12) |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
150 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) = 0; // default config |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 #endif /* CHIPSET != 12 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 * AI_ClockEnable |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 * Enable ARMIO clock module |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 void AI_ClockEnable(void) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 *((volatile SYS_UWORD16 *) ARMIO_CNTL_REG) |= ARMIO_CLOCKEN; // set to 1 bit 5 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 * AI_InitIOConfig |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 * Configure all GPIOs at initialization in order to optimize the power consumption |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 * of the C-Sample : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 * - select IOs 8,9,10,11,12 and 13 on the pins instead of MCSI and MCUEN signals. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 * - configure these IOs in output high. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 * - configure the IOs 0 (Vibrator LED) and 1 (LCD_A0) in output low. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 void AI_InitIOConfig(void) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 // reset the IOs config |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 AI_ResetIoConfig(); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 // CLKM_IO_CNTL register configuration : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 // select IOs 6,8,9,10,11,12 and 13 on the pins instead of MCSI and MCUEN signals. |
83
cff89030b634
armio.c: drive some more unused pins as outputs
Mychaela Falconia <falcon@freecalypso.org>
parents:
82
diff
changeset
|
183 AI_EnableBit(0); /* FreeCalypso addition */ |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 AI_EnableBit(2); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 AI_EnableBit(4); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
187 #ifdef CONFIG_TARGET_PIRELLI |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
188 AI_EnableBit(1); |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
189 AI_EnableBit(3); |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
190 #endif |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
191 |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 /* Bits 5,6,7,8 are used to output I/O 9,10,11,12 or MCSI pins */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 /* If Bluetooth, IO should be disabled, outputting MCSI used for Bluetooth voice */ |
242
a6360ee05c47
armio.c: enable MCSI pin multiplexing on FCDEV3B
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
194 /* |
a6360ee05c47
armio.c: enable MCSI pin multiplexing on FCDEV3B
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
195 * FreeCalypso change: we don't have BT, our new criterion is |
a6360ee05c47
armio.c: enable MCSI pin multiplexing on FCDEV3B
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
196 * whether or not a given board is wired for MCSI. |
a6360ee05c47
armio.c: enable MCSI pin multiplexing on FCDEV3B
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
197 */ |
631
597869e59805
config: introduced new CONFIG_MCSI_MODEM preprocessor symbol
Mychaela Falconia <falcon@freecalypso.org>
parents:
630
diff
changeset
|
198 #if defined(CONFIG_MCSI_MODEM) || defined(CONFIG_TARGET_PIRELLI) |
81
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
199 AI_DisableBit(5); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
200 AI_DisableBit(6); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
201 AI_DisableBit(7); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
202 AI_DisableBit(8); |
82
e3768114db59
armio.c: 2nd cleaning: removed some (CHIPSET != 12) noise
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
203 #else |
81
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
204 AI_EnableBit(5); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
205 AI_EnableBit(6); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
206 AI_EnableBit(7); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
207 AI_EnableBit(8); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
208 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 AI_EnableBit(9); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 // ARMIO_OUT register configuration : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 // set IOs 8,9,10,11,12 and 13 as high |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 // set IOs 0 to 7 as low |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
215 |
534
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
216 #ifdef CONFIG_TARGET_C11X |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
217 /* C11x GPIO configuration mimics what the original fw sets */ |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
218 |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
219 /* GPIO out all zeros */ |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
220 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
221 |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
222 /* setting of GPIOs as outputs: register setting from the original fw */ |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
223 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2209; |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
224 |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
225 #elif defined(CONFIG_TARGET_C139) |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
226 /* C139 GPIO configuration mimics what the original fw sets */ |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
227 |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
228 /* GPIO out all zeros - the LCD backlight is OFF */ |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
229 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
230 |
534
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
231 /* setting of GPIOs as outputs: register setting from the original fw */ |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
232 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2A09; |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
233 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
234 #elif defined(CONFIG_TARGET_C155) |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
235 /* C155 GPIO config based on the available schematics */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
236 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
237 /* GPIO out all zeros - the LCD backlight is OFF */ |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
238 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
239 |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
240 AI_ConfigBitAsOutput(1); /* LCD backlight control */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
241 AI_ConfigBitAsOutput(2); /* headset jack switch */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
242 AI_ConfigBitAsOutput(3); /* LCDA0 (?) */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
243 AI_ConfigBitAsOutput(8); /* MUSIC_A0 */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
244 AI_ConfigBitAsOutput(12); /* MUSIC_ON */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
245 |
588
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
246 #elif defined(CONFIG_TARGET_J100) |
589
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
247 /* |
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
248 * GPIO config on this target is based on the disassembly of |
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
249 * Init_Target() and AI_InitIOConfig() functions in the official fw. |
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
250 */ |
588
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
251 |
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
252 /* GPIO out all zeros - the LCD backlight is OFF */ |
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
253 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
254 |
589
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
255 /* setting of GPIOs as outputs: register setting from the original fw */ |
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
256 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2A59; |
588
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
257 |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
258 #elif defined(CONFIG_TARGET_PIRELLI) |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
259 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
260 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
261 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
262 AI_ConfigBitAsOutput(1); |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
263 AI_ConfigBitAsOutput(4); |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
264 AI_ConfigBitAsOutput(7); |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
265 |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
266 #else /* classic TI/Openmoko/FreeCalypso targets */ |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 // set IOs 1 and 8 to 13 as high |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 // set IOs 0 and 2 to 7 as low |
409
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
269 // On D-Sample GPIO 1 must be set to high to enable the audio amplifier, |
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
270 // but on Openmoko's modem it is the interrupt to the AP. |
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
271 // On the FCDEV3B it also controls the audio amplifier. |
610
0cbe7438f974
armio.c: GPIO config for GTM900 and long-standing GPIO 1 fix
Mychaela Falconia <falcon@freecalypso.org>
parents:
602
diff
changeset
|
272 // On the GTM900 GPIOs 0 and 1 are RI and DSR outputs, respectively. |
0cbe7438f974
armio.c: GPIO config for GTM900 and long-standing GPIO 1 fix
Mychaela Falconia <falcon@freecalypso.org>
parents:
602
diff
changeset
|
273 // For targets other than GTM900, we enable the audio amplifier |
0cbe7438f974
armio.c: GPIO config for GTM900 and long-standing GPIO 1 fix
Mychaela Falconia <falcon@freecalypso.org>
parents:
602
diff
changeset
|
274 // if we are in an MMI!=0 build - for ACI builds use the AT@SPKR command. |
0cbe7438f974
armio.c: GPIO config for GTM900 and long-standing GPIO 1 fix
Mychaela Falconia <falcon@freecalypso.org>
parents:
602
diff
changeset
|
275 #ifdef CONFIG_TARGET_GTM900 |
680
ee3ac8c617cb
armio.c: set GPIO2 output high initially
Mychaela Falconia <falcon@freecalypso.org>
parents:
677
diff
changeset
|
276 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F05; |
632
d968a3216ba0
new tangomdm build target
Mychaela Falconia <falcon@freecalypso.org>
parents:
631
diff
changeset
|
277 #elif (MMI != 0) || defined(CONFIG_GPIO1_HIGH) |
680
ee3ac8c617cb
armio.c: set GPIO2 output high initially
Mychaela Falconia <falcon@freecalypso.org>
parents:
677
diff
changeset
|
278 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F06; |
610
0cbe7438f974
armio.c: GPIO config for GTM900 and long-standing GPIO 1 fix
Mychaela Falconia <falcon@freecalypso.org>
parents:
602
diff
changeset
|
279 #else |
680
ee3ac8c617cb
armio.c: set GPIO2 output high initially
Mychaela Falconia <falcon@freecalypso.org>
parents:
677
diff
changeset
|
280 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F04; |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 // ARMIO_CNTL_REG register configuration : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 // set IOs 1,2,5,7,9,14 and 15 as ouputs. |
677
91d9f8506420
GPIO046 dummy outputs on FCDEV3B, GTA0x and Tango
Mychaela Falconia <falcon@freecalypso.org>
parents:
637
diff
changeset
|
285 // all others are FreeCalypso additions |
91d9f8506420
GPIO046 dummy outputs on FCDEV3B, GTA0x and Tango
Mychaela Falconia <falcon@freecalypso.org>
parents:
637
diff
changeset
|
286 #if defined(CONFIG_GPIO046_OUTPUTS) || defined(CONFIG_TARGET_GTM900) |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
287 AI_ConfigBitAsOutput(0); |
409
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
288 #endif |
681
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
289 #ifndef CONFIG_TANGO_MODEM /* we do dynamic config on Tango instead */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
290 AI_ConfigBitAsOutput(1); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
291 #ifndef CONFIG_TARGET_LEONARDO /* GPIO 2 is an input on Leonardo! */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
292 AI_ConfigBitAsOutput(2); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
293 #endif |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
294 #ifdef CONFIG_GPIO3_OUTPUT |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
295 AI_ConfigBitAsOutput(3); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
296 #endif |
285
504c9dcbffb2
GTA0x target: GPIOs 3, 10, 11 and 12 are unconnected, so drive them as outputs
Mychaela Falconia <falcon@freecalypso.org>
parents:
242
diff
changeset
|
297 #endif |
677
91d9f8506420
GPIO046 dummy outputs on FCDEV3B, GTA0x and Tango
Mychaela Falconia <falcon@freecalypso.org>
parents:
637
diff
changeset
|
298 #ifdef CONFIG_GPIO046_OUTPUTS |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
299 AI_ConfigBitAsOutput(4); |
409
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
300 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 AI_ConfigBitAsOutput(5); |
677
91d9f8506420
GPIO046 dummy outputs on FCDEV3B, GTA0x and Tango
Mychaela Falconia <falcon@freecalypso.org>
parents:
637
diff
changeset
|
302 #ifdef CONFIG_GPIO046_OUTPUTS |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
303 AI_ConfigBitAsOutput(6); |
409
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
304 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 AI_ConfigBitAsOutput(7); |
629
3231dd9b38c1
armio.c: make GPIOs 8 & 13 outputs driving 1 on all "classic" targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
610
diff
changeset
|
306 #if 1 /* FreeCalypso addition for all targets */ |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
307 AI_ConfigBitAsOutput(8); |
409
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
308 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 AI_ConfigBitAsOutput(9); |
637
31d2824683cb
armio.c & targets/gtamodem.h: GPIO3 and MCSI dummy outputs generalized
Mychaela Falconia <falcon@freecalypso.org>
parents:
632
diff
changeset
|
310 #ifdef CONFIG_MCSI_UNUSED |
285
504c9dcbffb2
GTA0x target: GPIOs 3, 10, 11 and 12 are unconnected, so drive them as outputs
Mychaela Falconia <falcon@freecalypso.org>
parents:
242
diff
changeset
|
311 AI_ConfigBitAsOutput(10); |
504c9dcbffb2
GTA0x target: GPIOs 3, 10, 11 and 12 are unconnected, so drive them as outputs
Mychaela Falconia <falcon@freecalypso.org>
parents:
242
diff
changeset
|
312 AI_ConfigBitAsOutput(11); |
504c9dcbffb2
GTA0x target: GPIOs 3, 10, 11 and 12 are unconnected, so drive them as outputs
Mychaela Falconia <falcon@freecalypso.org>
parents:
242
diff
changeset
|
313 AI_ConfigBitAsOutput(12); |
504c9dcbffb2
GTA0x target: GPIOs 3, 10, 11 and 12 are unconnected, so drive them as outputs
Mychaela Falconia <falcon@freecalypso.org>
parents:
242
diff
changeset
|
314 #endif |
629
3231dd9b38c1
armio.c: make GPIOs 8 & 13 outputs driving 1 on all "classic" targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
610
diff
changeset
|
315 #if 1 /* FreeCalypso addition for all targets */ |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
316 AI_ConfigBitAsOutput(13); |
409
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
317 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 AI_ConfigBitAsOutput(14); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 AI_ConfigBitAsOutput(15); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 |
681
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
323 #ifdef CONFIG_TANGO_MODEM |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
324 void AI_Init_Tango_pinmux(void) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
325 { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
326 ffs_file_read("/etc/tango-pinmux", AI_Tango_pinmux, 4); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
327 /* apply this config */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
328 if (AI_Tango_pinmux[0] & 0x80) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
329 if (AI_Tango_pinmux[0] & 1) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
330 AI_SetBit(1); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
331 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
332 AI_ResetBit(1); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
333 AI_ConfigBitAsOutput(1); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
334 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
335 /* GPIO2 config */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
336 if (AI_Tango_pinmux[1] & 0x02) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
337 if (AI_Tango_pinmux[1] & 0x01) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
338 AI_SetBit(2); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
339 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
340 AI_ResetBit(2); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
341 AI_ConfigBitAsOutput(2); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
342 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
343 /* GPIO3 config */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
344 if (AI_Tango_pinmux[1] & 0x20) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
345 if (AI_Tango_pinmux[1] & 0x10) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
346 AI_SetBit(3); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
347 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
348 AI_ResetBit(3); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
349 AI_ConfigBitAsOutput(3); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
350 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
351 /* RESET_OUT/IO7 config */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
352 if (AI_Tango_pinmux[2] & 0x08) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
353 AI_EnableBit(3); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
354 if (AI_Tango_pinmux[2] & 0x02) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
355 if (AI_Tango_pinmux[2] & 0x01) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
356 AI_SetBit(7); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
357 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
358 AI_ResetBit(7); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
359 } else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
360 AI_ConfigBitAsInput(7); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
361 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
362 /* MCSI/GPIO config */ |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
363 if (AI_Tango_pinmux[2] & 0x80) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
364 if (AI_Tango_pinmux[3] & 0x10) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
365 if (AI_Tango_pinmux[3] & 0x01) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
366 AI_SetBit(9); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
367 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
368 AI_ResetBit(9); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
369 } else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
370 AI_ConfigBitAsInput(9); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
371 AI_EnableBit(5); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
372 AI_EnableBit(6); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
373 AI_EnableBit(7); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
374 AI_EnableBit(8); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
375 if (AI_Tango_pinmux[3] & 0x20) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
376 if (AI_Tango_pinmux[3] & 0x02) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
377 AI_SetBit(10); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
378 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
379 AI_ResetBit(10); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
380 AI_ConfigBitAsOutput(10); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
381 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
382 if (AI_Tango_pinmux[3] & 0x40) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
383 if (AI_Tango_pinmux[3] & 0x04) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
384 AI_SetBit(11); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
385 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
386 AI_ResetBit(11); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
387 AI_ConfigBitAsOutput(11); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
388 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
389 if (AI_Tango_pinmux[3] & 0x80) { |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
390 if (AI_Tango_pinmux[3] & 0x08) |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
391 AI_SetBit(12); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
392 else |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
393 AI_ResetBit(12); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
394 AI_ConfigBitAsOutput(12); |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
395 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
396 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
397 } |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
398 #endif |
140a0d24a64c
Tango pinmux implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
680
diff
changeset
|
399 |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 * AI_SelectIOForIT |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 * Select which IO will be used to generate an interrupt. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 * 'Edge' specifies if interrup must be detected on falling or rising edge. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 void AI_SelectIOForIT (SYS_UWORD16 Pin, SYS_UWORD16 Edge) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 #if (CHIPSET == 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 * Update INTERRUPT_LEVEL_REG with Edge configuration on Pin selection |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
414 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
415 GPIO_INTERRUPT_LEVEL_REG = (Edge & 0x0001) << Pin; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
417 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
418 * Update INTERRUPT_MASK_REG to enable interrupt generation on Pin selection |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
419 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
420 GPIO_INTERRUPT_MASK_REG = 1 << Pin; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
421 #else |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
422 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
423 * Bit SET_GPIO_EVENT_MODE (bit 0) is set to enable the GPIO event mode. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
424 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
425 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 *((volatile SYS_UWORD16 *) ARMIO_GPIO_EVENT_MODE) = (Pin << 1) + (Edge << 5) + 1; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
427 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
429 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
430 #if (CHIPSET != 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
431 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
432 * AI_CheckITSource |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
433 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
434 * Check if the interrupt specified by 'Source' is active or not. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
435 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
436 * Output: 0: IT is not active |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
437 * 1: IT is active |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
438 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
439 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
440 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
441 * Warning: If the keypad and GPIO interrupts may occur the GPIO interrupt |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
442 * must be checked first because the GPIO status bit is reset when |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
443 * the register is read. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
444 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
446 int AI_CheckITSource (SYS_UWORD16 Source) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
447 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
448 return (*((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_INT) & Source ? 1 : 0); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
449 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
450 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
451 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
452 * AI_UnmaskIT |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
453 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
454 * Unmask the IT specified by 'Source' (keyboard or GPIO). |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
455 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
456 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
457 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
458 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
459 void AI_UnmaskIT (SYS_UWORD16 Source) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
460 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
461 *((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_MASKIT) &= ~Source; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
462 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
463 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
464 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
465 * AI_MaskIT |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
466 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
467 * Mask the IT specified by 'Source' (keyboard or GPIO). |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
468 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
469 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
470 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
471 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
472 void AI_MaskIT (SYS_UWORD16 Source) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
473 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
474 *((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_MASKIT) |= Source; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
475 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
476 #endif /* CHIPSET != 12 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
477 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
478 #if (CHIPSET == 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
479 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
480 void AI_MaskIT(SYS_UWORD16 d_io_number) { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
481 GPIO_INTERRUPT_MASK_REG |= (1 << d_io_number); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
482 } /* f_gpio_mask_it() */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
483 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
484 void AI_UnmaskIT(SYS_UWORD16 d_io_number) { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
485 GPIO_INTERRUPT_MASK_REG &= ~(1 << d_io_number); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
486 } /* f_gpio_unmask_it() */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
487 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
488 #endif |