FreeCalypso > hg > fc-magnetite
annotate src/cs/drivers/drv_core/armio/armio.c @ 600:8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
This change eliminates the CONFIG_TARGET_FCDEV3B preprocessor symbol and
all preprocessor conditionals throughout the code base that tested for it,
replacing them with CONFIG_TARGET_FCFAM or CONFIG_TARGET_FCMODEM. These
new symbols are specified as follows:
CONFIG_TARGET_FCFAM is intended to cover all hardware designs created by
Mother Mychaela under the FreeCalypso trademark. This family will include
modem products (repackagings of the FCDEV3B, possibly with RFFE or even
RF transceiver changes), and also my desired FreeCalypso handset product.
CONFIG_TARGET_FCMODEM is intended to cover all FreeCalypso modem products
(which will be firmware-compatible with the FCDEV3B if they use TI Rita
transceiver, or will require a different fw build if we switch to one of
Silabs Aero transceivers), but not the handset product. Right now this
CONFIG_TARGET_FCMODEM preprocessor symbol is used to conditionalize
everything dealing with MCSI.
At the present moment the future of FC hardware evolution is still unknown:
it is not known whether we will ever have any beyond-FCDEV3B hardware at all
(contingent on uncertain funding), and if we do produce further FC hardware
designs, it is not known whether they will retain the same FIC modem core
(triband), if we are going to have a quadband design that still retains the
classic Rita transceiver, or if we are going to switch to Silabs Aero II
or some other transceiver. If we produce a quadband modem that still uses
Rita, it will run exactly the same fw as the FCDEV3B thanks to the way we
define TSPACT signals for the RF_FAM=12 && CONFIG_TARGET_FCFAM combination,
and the current fcdev3b build target will be renamed to fcmodem. OTOH, if
that putative quadband modem will be Aero-based, then it will require a
different fw build target, the fcdev3b target will stay as it is, and the
two targets will both define CONFIG_TARGET_FCFAM and CONFIG_TARGET_FCMODEM,
but will have different RF_FAM numbers. But no matter which way we are
going to evolve, it is not right to have conditionals on CONFIG_TARGET_FCDEV3B
in places like ACI, and the present change clears the way for future
evolution.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 01 Apr 2019 01:05:24 +0000 |
parents | 9b81b68e8e64 |
children | 92dbfa906f66 |
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" |
81
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
23 #include "fc-target.cfg" |
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 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #if (CHIPSET != 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 * AI_EnableBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 * 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
|
43 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 void AI_EnableBit(int bit) |
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 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) |= (1<<bit); |
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 |
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 * AI_DisableBit |
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 * 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
|
53 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 void AI_DisableBit(int bit) |
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 *((volatile SYS_UWORD16 *) CLKM_IO_CNTL) &= ~(1<<bit); |
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 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 #endif /* CHIPSET != 12 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
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 * AI_SetBit |
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 * Switch-on one bit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 void AI_SetBit(int bit) |
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 *((volatile SYS_UWORD16 *) ARMIO_OUT) |= (1<<bit); |
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 |
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 * AI_ResetBit |
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 * Switch-off one 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 void AI_ResetBit(int bit) |
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 *((volatile SYS_UWORD16 *) ARMIO_OUT) &= ~(1<<bit); |
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 |
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 * AI_ConfigBitAsOutput |
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 * Set this bit as an output |
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 void AI_ConfigBitAsOutput(int bit) |
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 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) &= ~(1<<bit); |
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 |
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 * AI_ConfigBitAsInput |
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 * Set this bit as an input |
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 void AI_ConfigBitAsInput(int bit) |
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 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) |= (1<<bit); |
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 |
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 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 * AI_ReadBit |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 * Read value in register |
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 SYS_BOOL AI_ReadBit(int bit) |
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 if ((*((volatile SYS_UWORD16 *) ARMIO_IN)) & (1<<bit)) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 return (1); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 else |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 return (0); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 } |
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 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 * AI_Power |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 * Switch-on or off the board |
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 * 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
|
121 * 0 to power-off |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * |
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 #if (OP_L1_STANDALONE == 0) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 void AI_Power(SYS_UWORD8 power) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 if (power == 0) |
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 ABB_Power_Off(); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
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 * AI_ResetIoConfig |
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 * Reset all default IO configurations |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 * |
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 void AI_ResetIoConfig(void) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 { |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
142 *((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
|
143 #if (CHIPSET != 12) |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
144 *((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
|
145 #endif /* CHIPSET != 12 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 * AI_ClockEnable |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 * Enable ARMIO clock module |
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 void AI_ClockEnable(void) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 *((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
|
158 } |
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 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 * AI_InitIOConfig |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 * 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
|
165 * of the C-Sample : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 * - 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
|
167 * - configure these IOs in output high. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 * - 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
|
169 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 void AI_InitIOConfig(void) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 // reset the IOs config |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 AI_ResetIoConfig(); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 // CLKM_IO_CNTL register configuration : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 // 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
|
177 AI_EnableBit(0); /* FreeCalypso addition */ |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 AI_EnableBit(2); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 AI_EnableBit(4); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
181 #ifdef CONFIG_TARGET_PIRELLI |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
182 AI_EnableBit(1); |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
183 AI_EnableBit(3); |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
184 #endif |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
185 |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 /* 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
|
187 /* 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
|
188 /* |
a6360ee05c47
armio.c: enable MCSI pin multiplexing on FCDEV3B
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
189 * 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
|
190 * 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
|
191 */ |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
192 #if defined(CONFIG_TARGET_FCMODEM) || defined(CONFIG_TARGET_PIRELLI) |
81
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
193 AI_DisableBit(5); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
194 AI_DisableBit(6); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
195 AI_DisableBit(7); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
196 AI_DisableBit(8); |
82
e3768114db59
armio.c: 2nd cleaning: removed some (CHIPSET != 12) noise
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
197 #else |
81
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
198 AI_EnableBit(5); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
199 AI_EnableBit(6); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
200 AI_EnableBit(7); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
201 AI_EnableBit(8); |
8e5096429fd3
armio.c: first cleaning step
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
202 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 AI_EnableBit(9); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 // ARMIO_OUT register configuration : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 // 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
|
208 // 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
|
209 |
534
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
210 #ifdef CONFIG_TARGET_C11X |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
211 /* 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
|
212 |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
213 /* GPIO out all zeros */ |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
214 *((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
|
215 |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
216 /* 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
|
217 *((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
|
218 |
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
219 #elif defined(CONFIG_TARGET_C139) |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
220 /* 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
|
221 |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
222 /* 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
|
223 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
224 |
534
6c96725718c3
armio.c: C11x GPIO setup properly separated from C139
Mychaela Falconia <falcon@freecalypso.org>
parents:
533
diff
changeset
|
225 /* 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
|
226 *((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
|
227 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
228 #elif defined(CONFIG_TARGET_C155) |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
229 /* 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
|
230 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
231 /* 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
|
232 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
233 |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
234 AI_ConfigBitAsOutput(1); /* LCD backlight control */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
235 AI_ConfigBitAsOutput(2); /* headset jack switch */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
236 AI_ConfigBitAsOutput(3); /* LCDA0 (?) */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
237 AI_ConfigBitAsOutput(8); /* MUSIC_A0 */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
238 AI_ConfigBitAsOutput(12); /* MUSIC_ON */ |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
239 |
588
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
240 #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
|
241 /* |
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
242 * 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
|
243 * 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
|
244 */ |
588
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
245 |
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
246 /* 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
|
247 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
248 |
589
9b81b68e8e64
armio.c: SE J100 GPIO config changed to new knowledge from disassembly
Mychaela Falconia <falcon@freecalypso.org>
parents:
588
diff
changeset
|
249 /* 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
|
250 *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2A59; |
588
f2e752052db5
beginning of SE J100 target support
Mychaela Falconia <falcon@freecalypso.org>
parents:
534
diff
changeset
|
251 |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
252 #elif defined(CONFIG_TARGET_PIRELLI) |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
253 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
254 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000; |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
255 |
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
256 AI_ConfigBitAsOutput(1); |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
257 AI_ConfigBitAsOutput(4); |
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
258 AI_ConfigBitAsOutput(7); |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
259 |
84
42d766231c46
armio.c: support for C139 and Pirelli targets
Mychaela Falconia <falcon@freecalypso.org>
parents:
83
diff
changeset
|
260 #else /* classic TI/Openmoko/FreeCalypso targets */ |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 // 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
|
262 // 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
|
263 // 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
|
264 // 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
|
265 // On the FCDEV3B it also controls 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
|
266 // For now we initialize it to low on all targets. |
6c3f68021c53
armio.c: GPIO directions restored to TI's original on the D-Sample
Mychaela Falconia <falcon@freecalypso.org>
parents:
377
diff
changeset
|
267 #if 1 |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F00; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 #else |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x3F02; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 // ARMIO_CNTL_REG register configuration : |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 // set IOs 1,2,5,7,9,14 and 15 as ouputs. |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
275 // bits conditionalized on CONFIG_TARGET_GTAMODEM or CONFIG_TARGET_FCFAM |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
276 // are FreeCalypso additions |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
277 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
278 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
|
279 #endif |
533
09afc37e8069
armio.c: added support for C155 target
Mychaela Falconia <falcon@freecalypso.org>
parents:
532
diff
changeset
|
280 AI_ConfigBitAsOutput(1); |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 AI_ConfigBitAsOutput(2); |
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
|
282 #ifdef CONFIG_TARGET_GTAMODEM |
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
|
283 AI_ConfigBitAsOutput(3); |
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
|
284 #endif |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
285 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
286 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
|
287 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 AI_ConfigBitAsOutput(5); |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
289 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
290 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
|
291 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 AI_ConfigBitAsOutput(7); |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
293 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
294 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
|
295 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 AI_ConfigBitAsOutput(9); |
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 #ifdef CONFIG_TARGET_GTAMODEM |
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
|
298 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
|
299 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
|
300 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
|
301 #endif |
600
8f50b202e81f
board preprocessor conditionals: prep for more FC hw in the future
Mychaela Falconia <falcon@freecalypso.org>
parents:
589
diff
changeset
|
302 #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCFAM) |
532
5c780d080afc
armio.c GPIO directions for classic targets: more explicit
Mychaela Falconia <falcon@freecalypso.org>
parents:
409
diff
changeset
|
303 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
|
304 #endif |
0
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 AI_ConfigBitAsOutput(14); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 AI_ConfigBitAsOutput(15); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 * AI_SelectIOForIT |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 * 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
|
314 * '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
|
315 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 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
|
320 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 #if (CHIPSET == 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 * 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
|
324 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 GPIO_INTERRUPT_LEVEL_REG = (Edge & 0x0001) << Pin; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 * 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
|
329 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 GPIO_INTERRUPT_MASK_REG = 1 << Pin; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 #else |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 * 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
|
334 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 *((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
|
337 #endif |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 #if (CHIPSET != 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 * AI_CheckITSource |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 * 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
|
345 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 * Output: 0: IT is not active |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 * 1: IT is active |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 * 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
|
352 * 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
|
353 * the register is read. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 int AI_CheckITSource (SYS_UWORD16 Source) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 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
|
359 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 * AI_UnmaskIT |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 * 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
|
365 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 void AI_UnmaskIT (SYS_UWORD16 Source) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 *((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_MASKIT) &= ~Source; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 /* |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 * AI_MaskIT |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 * 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
|
378 * |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 * Warning: parameters are not checked. |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 void AI_MaskIT (SYS_UWORD16 Source) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 *((volatile SYS_UWORD16 *) ARMIO_KBD_GPIO_MASKIT) |= Source; |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 } |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 #endif /* CHIPSET != 12 */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 #if (CHIPSET == 12) |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 void AI_MaskIT(SYS_UWORD16 d_io_number) { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 GPIO_INTERRUPT_MASK_REG |= (1 << d_io_number); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 } /* f_gpio_mask_it() */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 void AI_UnmaskIT(SYS_UWORD16 d_io_number) { |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 GPIO_INTERRUPT_MASK_REG &= ~(1 << d_io_number); |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 } /* f_gpio_unmask_it() */ |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 |
945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 #endif |