sdcc gets the lib path correct based on the model
[fw/altos] / target / timer / cc1111.h
1 /*-------------------------------------------------------------------------
2    Register Declarations for the ChipCon CC1111 Processor Range
3
4    Copyright © 2008 Keith Packard <keithp@keithp.com>
5   
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10   
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    General Public License for more details.
15   
16    You should have received a copy of the GNU General Public License along
17    with this program; if not, write to the Free Software Foundation, Inc.,
18    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19
20    Adapted from the Cygnal C8051F12x config file which is:
21  
22    Copyright (C) 2003 - Maarten Brock, sourceforge.brock@dse.nl
23
24    This library is free software; you can redistribute it and/or
25    modify it under the terms of the GNU Lesser General Public
26    License as published by the Free Software Foundation; either
27    version 2.1 of the License, or (at your option) any later version.
28
29    This library is distributed in the hope that it will be useful,
30    but WITHOUT ANY WARRANTY; without even the implied warranty of
31    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32    Lesser General Public License for more details.
33
34    You should have received a copy of the GNU Lesser General Public
35    License along with this library; if not, write to the Free Software
36    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
37 -------------------------------------------------------------------------*/
38
39 #ifndef _CC1111_H_
40 #define _CC1111_H_
41
42
43 /*  BYTE Registers  */
44
45 sfr at 0x80 P0       ;  /* PORT 0                                        */
46 sfr at 0x81 SP       ;  /* STACK POINTER                                 */
47 sfr at 0x82 DPL      ;  /* DATA POINTER - LOW BYTE                       */
48 sfr at 0x83 DPH      ;  /* DATA POINTER - HIGH BYTE                      */
49 sfr at 0x84 DPL1     ;  /* DATA POINTER 1 - LOW BYTE                     */
50 sfr at 0x85 DPH1     ;  /* DATA POINTER 1 - HIGH BYTE                    */
51 sfr at 0x86 U0CSR    ;  /* USART 0 Control and status                    */
52 sfr at 0x87 PCON     ;  /* POWER CONTROL                                 */
53 sfr at 0x88 TCON     ;  /* TIMER CONTROL                                 */
54 sfr at 0x89 P0IFG    ;  /* TIMER MODE                                    */
55 sfr at 0x8A P1IFG    ;  /* TIMER 0 - LOW BYTE                            */
56 sfr at 0x8B P2IFG    ;  /* TIMER 1 - LOW BYTE                            */
57 sfr at 0x8C PICTL    ;  /* TIMER 0 - HIGH BYTE                           */
58 sfr at 0x8D P1IEN    ;  /* TIMER 1 - HIGH BYTE                           */
59
60 sfr at 0x8F P0INP    ;  /* FLASH WRITE/ERASE CONTROL                     */
61 sfr at 0x90 P1       ;  /* PORT 1                                        */
62 sfr at 0x91 RFIM     ;  /* UART 0 STATUS                                 */
63 sfr at 0x92 DPS      ;  /* */
64 sfr at 0x93 MPAGE    ;  /* */
65 sfr at 0x94 _SFR94_  ;  /* */
66 sfr at 0x95 ENDIAN   ;  /* */
67 sfr at 0x96 _SFR96_  ;  /* */
68 sfr at 0x97 _SFR97_  ;  /* */
69 sfr at 0x98 S0CON    ;  /* UART 0 CONTROL                                */
70 sfr at 0x99 _SFR99_  ;  /* UART 0 BUFFER                                 */
71 sfr at 0x9A IEN2     ;  /* SPI 0 CONFIGURATION                           */
72 sfr at 0x9B S1CON    ;  /* SPI 0 DATA                                    */
73 sfr at 0x9C T2CT     ;  /* SPI 0 DATA                                    */
74 sfr at 0x9D T2PR     ;  /* SPI 0 CLOCK RATE CONTROL                      */
75 sfr at 0x9E T2CTL    ;  /* SPI 0 CLOCK RATE CONTROL                      */
76 sfr at 0x9F _SFR9F_  ;  /* SPI 0 CLOCK RATE CONTROL                      */
77 sfr at 0xA0 P2       ;  /* PORT 2                                        */
78 sfr at 0xA1 WORIRQ   ;  /* EMIF TIMING CONTROL                           */
79 sfr at 0xA2 WORCTRL  ;  /* EMIF CONTROL                                  */
80 sfr at 0xA3 WOREVT0  ;  /* EMIF CONFIGURATION                            */
81 sfr at 0xA4 WOREVT1  ;  /* EMIF CONFIGURATION                            */
82 sfr at 0xA5 WORTIME0 ;  /* EMIF CONFIGURATION                            */
83 sfr at 0xA6 WORTIME1 ;  /* EMIF CONFIGURATION                            */
84 sfr at 0xA7 _SFRA7_  ;  /* EMIF CONFIGURATION                            */
85 sfr at 0xA8 IEN0     ;  /* INTERRUPT ENABLE                              */
86 sfr at 0xA9 IP0      ;  /* UART 0 SLAVE ADDRESS                          */
87 sfr at 0xAA _SFRAA_  ;  /*                                               */
88 sfr at 0xAB FWT      ;  /*                                               */
89 sfr at 0xAC FADDRL   ;  /*                                               */
90 sfr at 0xAD FADDRH   ;  /*                                               */
91 sfr at 0xAE FCTL     ;  /*                                               */
92 sfr at 0xAF FWDATA   ;  /*                                               */
93 sfr at 0xB0 _SFRB0_  ;  /*                                               */
94 sfr at 0xB1 ENCDI    ;  /* FLASH BANK SELECT                             */
95 sfr at 0xB2 ENCDO    ;  /*                                               */
96 sfr at 0xB3 ENCCS    ;  /*                                               */
97 sfr at 0xB4 ADCCON1  ;  /*                                               */
98 sfr at 0xB5 ADCCON2  ;  /*                                               */
99 sfr at 0xB6 ADCCON3  ;  /*                                               */
100 sfr at 0xB8 IEN1     ;  /* INTERRUPT PRIORITY                            */
101 sfr at 0xB9 IP1      ;  /*                                               */
102 sfr at 0xBA ADCL     ;  /*                                               */
103 sfr at 0xBB ADCH     ;  /*                                               */
104 sfr at 0xBC RNDL     ;  /*                                               */
105 sfr at 0xBD RNDH     ;  /*                                               */
106 sfr at 0xBE SLEEP    ;  /*                                               */
107 sfr at 0xC0 IRCON    ;  /*                                               */
108 sfr at 0xC1 U0DBUF   ;  /*                                               */
109 sfr at 0xC2 U0BAUD   ;  /*                                               */
110 sfr at 0xC4 U0UCR    ;  /*                                               */
111 sfr at 0xC5 U0GCR    ;  /*                                               */
112 sfr at 0xC6 CLKCON   ;  /*                                               */
113 sfr at 0xC7 MEMCTR   ;  /*                                               */
114 sfr at 0xC9 WDCTL    ;  /*                                               */
115 sfr at 0xCA T3CNT    ;  /*                                               */
116 sfr at 0xCB T3CTL    ;  /*                                               */
117 sfr at 0xCC T3CCTL0  ;  /*                                               */
118 sfr at 0xCD T3CC0    ;  /*                                               */
119 sfr at 0xCE T3CCTL1  ;  /*                                               */
120 sfr at 0xCF T3CC1    ;  /*                                               */
121 sfr at 0xD0 PSW      ;  /*                                               */
122 sfr at 0xD1 DMAIRQ   ;  /*                                               */
123 sfr at 0xD2 DMA1CFGL ;  /*                                               */
124 sfr at 0xD3 DMA1CFGH ;  /*                                               */
125 sfr at 0xD4 DMA0CFGL ;  /*                                               */
126 sfr at 0xD5 DMA0CFGH ;  /*                                               */
127 sfr at 0xD6 DMAARM   ;  /*                                               */
128 sfr at 0xD7 DMAREQ   ;  /*                                               */
129 sfr at 0xD8 TIMIF    ;  /*                                               */
130 sfr at 0xD9 RFD      ;  /*                                               */
131 sfr at 0xDA T1CC0L   ;  /*                                               */
132 sfr at 0xDB T1CC0H   ;  /*                                               */
133 sfr at 0xDC T1CC1L   ;  /*                                               */
134 sfr at 0xDD T1CC1H   ;  /*                                               */
135 sfr at 0xDE T1CC2L   ;  /*                                               */
136 sfr at 0xDF T1CC2H   ;  /*                                               */
137 sfr at 0xE0 ACC      ;  /* ACCUMULATOR                                   */
138 sfr at 0xE1 RFST     ;  /*                                               */ 
139 sfr at 0xE2 T1CNTL   ;  /*                                               */ 
140 sfr at 0xE3 T1CNTH   ;  /*                                               */ 
141 sfr at 0xE4 T1CTL    ;  /*                                               */ 
142 sfr at 0xE5 T1CCTL0  ;  /*                                               */ 
143 sfr at 0xE6 T1CCTL1  ;  /*                                               */ 
144 sfr at 0xE7 T1CCTL2  ;  /*                                               */ 
145 sfr at 0xE8 IRCON2   ;  /*                                               */ 
146 sfr at 0xE9 RFIF     ;  /*                                               */ 
147 sfr at 0xEA T4CNT    ;  /*                                               */ 
148 sfr at 0xEB T4CTL    ;  /*                                               */ 
149 sfr at 0xEC T4CCTL0  ;  /*                                               */ 
150 sfr at 0xED T4CC0    ;  /*                                               */ 
151 sfr at 0xEE T4CCTL1  ;  /*                                               */ 
152 sfr at 0xEF T4CC1    ;  /*                                               */ 
153 sfr at 0xF0 B        ;  /*                                               */ 
154 sfr at 0xF1 PERCFG   ;  /*                                               */ 
155 sfr at 0xF2 ADCCFG   ;  /*                                               */ 
156 sfr at 0xF3 P0SEL    ;  /*                                               */ 
157 sfr at 0xF4 P1SEL    ;  /*                                               */ 
158 sfr at 0xF5 P2SEL    ;  /*                                               */ 
159 sfr at 0xF6 P1INP    ;  /*                                               */ 
160 sfr at 0xF7 P2INP    ;  /*                                               */ 
161 sfr at 0xF8 U1CSR    ;  /*                                               */ 
162 sfr at 0xF9 U1DBUF   ;  /*                                               */ 
163 sfr at 0xFA U1BAUD   ;  /*                                               */ 
164 sfr at 0xFB U1UCR    ;  /*                                               */ 
165 sfr at 0xFC U1GCR    ;  /*                                               */ 
166 sfr at 0xFD P0DIR    ;  /*                                               */ 
167 sfr at 0xFE P1DIR    ;  /*                                               */ 
168 sfr at 0xFF P2DIR    ;  /*                                               */ 
169
170 /*  BIT Registers  */
171
172 /*  P0  0x80 */
173 sbit at 0x80 P0_0    ;
174 sbit at 0x81 P0_1    ;
175 sbit at 0x82 P0_2    ;
176 sbit at 0x83 P0_3    ;
177 sbit at 0x84 P0_4    ;
178 sbit at 0x85 P0_5    ;
179 sbit at 0x86 P0_6    ;
180 sbit at 0x87 P0_7    ;
181
182 /*  TCON  0x88 */
183 sbit at 0x89 RFTXRXIF;  /*                                               */
184 sbit at 0x8B URX0IF  ;  /*                                               */
185 sbit at 0x8D ADCIF   ;  /*                                               */
186 sbit at 0x8F URX1IF  ;  /*                                               */
187 sbit at 0x8F I2SRXIF ;  /*                                               */
188
189 /*  SCON0  0x98 */
190 sbit at 0x98 ENCIF_0 ;  /* UART 0 RX INTERRUPT FLAG                      */
191 sbit at 0x99 ENCIF_1 ;  /* UART 0 RX INTERRUPT FLAG                      */
192
193 /*  IEN0  0xA8 */
194 sbit at 0xA8 RFTXRXIE;  /* RF TX/RX done interrupt enable                */
195 sbit at 0xA9 ADCIE   ;  /* ADC interrupt enable                          */
196 sbit at 0xAA URX0IE  ;  /* USART0 RX interrupt enable                    */
197 sbit at 0xAB URX1IE  ;  /* USART1 RX interrupt enable                    */
198 sbit at 0xAB I2SRXIE ;  /* I2S RX interrupt enable                       */
199 sbit at 0xAC ENCIE   ;  /* AES interrupt enable                          */
200 sbit at 0xAD STIE    ;  /* Sleep Timer interrupt enable                  */
201 sbit at 0xAF EA      ;  /* GLOBAL INTERRUPT ENABLE                       */
202
203 /*  IEN1  0xB8 */
204 sbit at 0xB8 DMAIE   ;  /* DMA transfer interrupt enable                 */
205 sbit at 0xB9 T1IE    ;  /* Timer 1 interrupt enable                      */
206 sbit at 0xBA T2IE    ;  /* Timer 2 interrupt enable                      */
207 sbit at 0xBB T3IE    ;  /* Timer 3 interrupt enable                      */
208 sbit at 0xBC T4IE    ;  /* Timer 4 interrupt enable                      */
209 sbit at 0xBD P0IE    ;  /* Port 0 interrupt enable                       */
210
211 /* IRCON 0xC0 */
212 sbit at 0xC0 DMAIF   ;  /*                                               */
213 sbit at 0xC1 T1IF    ;  /*                                               */
214 sbit at 0xC2 T2IF    ;  /*                                               */
215 sbit at 0xC3 T3IF    ;  /*                                               */
216 sbit at 0xC4 T4IF    ;  /*                                               */
217 sbit at 0xC5 P0IF    ;  /*                                               */
218 sbit at 0xC7 STIF    ;  /*                                               */
219
220 /*  PSW  0xD0 */
221 sbit at 0xD0 P       ;  /* ACCUMULATOR PARITY FLAG                       */
222 sbit at 0xD1 F1      ;  /* USER FLAG 1                                   */
223 sbit at 0xD2 OV      ;  /* OVERFLOW FLAG                                 */
224 sbit at 0xD3 RS0     ;  /* REGISTER BANK SELECT 0                        */
225 sbit at 0xD4 RS1     ;  /* REGISTER BANK SELECT 1                        */
226 sbit at 0xD5 F0      ;  /* USER FLAG 0                                   */
227 sbit at 0xD6 AC      ;  /* AUXILIARY CARRY FLAG                          */
228 sbit at 0xD7 CY      ;  /* CARRY FLAG                                    */
229
230 /* TIMIF D8H */
231 sbit at 0xD8 T3OVFIF ;  /*                                               */
232 sbit at 0xD9 T3CH0IF ;  /*                                               */
233 sbit at 0xDA T3CH1IF ;  /*                                               */
234 sbit at 0xDB T4OVFIF ;  /*                                               */
235 sbit at 0xDC T4CH0IF ;  /*                                               */
236 sbit at 0xDD T4CH1IF ;  /*                                               */
237 sbit at 0xDE OVFIM   ;  /*                                               */
238
239 /* IRCON2  E8H */
240 sbit at 0xE8 P2IF    ;  /*                                               */
241 sbit at 0xE8 USBIF   ;  /*                                               */
242 sbit at 0xE9 UTX0IF  ;  /*                                               */
243 sbit at 0xEA UTX1IF  ;  /*                                               */
244 sbit at 0xEA I2STXIF ;  /*                                               */
245 sbit at 0xEB P1IF    ;  /*                                               */
246 sbit at 0xEC WDTIF   ;  /*                                               */
247
248 /* U1CSR F8H */
249 sbit at 0xF8 U1_ACTIVE  ;  /*                                               */
250 sbit at 0xF9 U1_TX_BYTE ;  /*                                               */
251 sbit at 0xFA U1_RX_BYTE ;  /*                                               */
252 sbit at 0xFB U1_ERR     ;  /*                                               */
253 sbit at 0xFC U1_FE      ;  /*                                               */
254 sbit at 0xFD U1_SLAVE   ;  /*                                               */
255 sbit at 0xFE U1_RE      ;  /*                                               */
256 sbit at 0xFF U1_MODE    ;  /*                                               */
257
258 #define T1CTL_MODE_SUSPENDED    (0 << 0)
259 #define T1CTL_MODE_FREE         (1 << 0)
260 #define T1CTL_MODE_MODULO       (2 << 0)
261 #define T1CTL_MODE_UP_DOWN      (3 << 0)
262 #define T1CTL_MODE_MASK         (3 << 0)
263 #define T1CTL_DIV_1             (0 << 2)
264 #define T1CTL_DIV_8             (1 << 2)
265 #define T1CTL_DIV_32            (2 << 2)
266 #define T1CTL_DIV_128           (3 << 2)
267 #define T1CTL_DIV_MASK          (3 << 2)
268 #define T1CTL_OVFIF             (1 << 4)
269 #define T1CTL_CH0IF             (1 << 5)
270 #define T1CTL_CH1IF             (1 << 6)
271 #define T1CTL_CH2IF             (1 << 7)
272
273 #define T1CCTL_NO_CAPTURE       (0 << 0)
274 #define T1CCTL_CAPTURE_RISING   (1 << 0)
275 #define T1CCTL_CAPTURE_FALLING  (2 << 0)
276 #define T1CCTL_CAPTURE_BOTH     (3 << 0)
277 #define T1CCTL_CAPTURE_MASK     (3 << 0)
278
279 #define T1CCTL_MODE_CAPTURE     (0 << 2)
280 #define T1CCTL_MODE_COMPARE     (1 << 2)
281
282 #define T1CTL_CMP_SET           (0 << 3)
283 #define T1CTL_CMP_CLEAR         (1 << 3)
284 #define T1CTL_CMP_TOGGLE        (2 << 3)
285 #define T1CTL_CMP_SET_CLEAR     (3 << 3)
286 #define T1CTL_CMP_CLEAR_SET     (4 << 3)
287
288 #define T1CTL_IM_DISABLED       (0 << 6)
289 #define T1CTL_IM_ENABLED        (1 << 6)
290
291 #define T1CTL_CPSEL_NORMAL      (0 << 7)
292 #define T1CTL_CPSEL_RF          (1 << 7)
293
294 #endif