annotate gsm-fw/bsp/armio.c @ 305:4dccc9d3305f

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