struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / device / non-free / include / pic14 / pic16c557.h
blob31bba7c7c29cb796bf7cb8d878766e86c3bb745c
1 /*
2 * This declarations of the PIC16C557 MCU.
4 * This file is part of the GNU PIC library for SDCC, originally
5 * created by Molnar Karoly <molnarkaroly@users.sf.net> 2016.
7 * This file is generated automatically by the cinc2h.pl, 2016-04-13 17:23:02 UTC.
9 * SDCC is licensed under the GNU Public license (GPL) v2. Note that
10 * this license covers the code to the compiler and other executables,
11 * but explicitly does not cover any code or objects generated by sdcc.
13 * For pic device libraries and header files which are derived from
14 * Microchip header (.inc) and linker script (.lkr) files Microchip
15 * requires that "The header files should state that they are only to be
16 * used with authentic Microchip devices" which makes them incompatible
17 * with the GPL. Pic device libraries and header files are located at
18 * non-free/lib and non-free/include directories respectively.
19 * Sdcc should be run with the --use-non-free command line option in
20 * order to include non-free header files and libraries.
22 * See http://sdcc.sourceforge.net/ for the latest information on sdcc.
25 #ifndef __PIC16C557_H__
26 #define __PIC16C557_H__
28 //==============================================================================
30 // Register Addresses
32 //==============================================================================
34 #ifndef NO_ADDR_DEFINES
36 #define INDF_ADDR 0x0000
37 #define TMR0_ADDR 0x0001
38 #define PCL_ADDR 0x0002
39 #define STATUS_ADDR 0x0003
40 #define FSR_ADDR 0x0004
41 #define PORTA_ADDR 0x0005
42 #define PORTB_ADDR 0x0006
43 #define PORTC_ADDR 0x0007
44 #define PCLATH_ADDR 0x000A
45 #define INTCON_ADDR 0x000B
46 #define OPTION_REG_ADDR 0x0081
47 #define TRISA_ADDR 0x0085
48 #define TRISB_ADDR 0x0086
49 #define TRISC_ADDR 0x0087
50 #define PCON_ADDR 0x008E
52 #endif // #ifndef NO_ADDR_DEFINES
54 //==============================================================================
56 // Register Definitions
58 //==============================================================================
60 extern __at(0x0000) __sfr INDF;
61 extern __at(0x0001) __sfr TMR0;
62 extern __at(0x0002) __sfr PCL;
64 //==============================================================================
65 // STATUS Bits
67 extern __at(0x0003) __sfr STATUS;
69 typedef union
71 struct
73 unsigned C : 1;
74 unsigned DC : 1;
75 unsigned Z : 1;
76 unsigned NOT_PD : 1;
77 unsigned NOT_TO : 1;
78 unsigned RP0 : 1;
79 unsigned RP1 : 1;
80 unsigned IRP : 1;
83 struct
85 unsigned : 5;
86 unsigned RP : 2;
87 unsigned : 1;
89 } __STATUSbits_t;
91 extern __at(0x0003) volatile __STATUSbits_t STATUSbits;
93 #define _C 0x01
94 #define _DC 0x02
95 #define _Z 0x04
96 #define _NOT_PD 0x08
97 #define _NOT_TO 0x10
98 #define _RP0 0x20
99 #define _RP1 0x40
100 #define _IRP 0x80
102 //==============================================================================
104 extern __at(0x0004) __sfr FSR;
106 //==============================================================================
107 // PORTA Bits
109 extern __at(0x0005) __sfr PORTA;
111 typedef union
113 struct
115 unsigned RA0 : 1;
116 unsigned RA1 : 1;
117 unsigned RA2 : 1;
118 unsigned RA3 : 1;
119 unsigned RA4 : 1;
120 unsigned : 1;
121 unsigned : 1;
122 unsigned : 1;
125 struct
127 unsigned RA : 5;
128 unsigned : 3;
130 } __PORTAbits_t;
132 extern __at(0x0005) volatile __PORTAbits_t PORTAbits;
134 #define _RA0 0x01
135 #define _RA1 0x02
136 #define _RA2 0x04
137 #define _RA3 0x08
138 #define _RA4 0x10
140 //==============================================================================
143 //==============================================================================
144 // PORTB Bits
146 extern __at(0x0006) __sfr PORTB;
148 typedef struct
150 unsigned RB0 : 1;
151 unsigned RB1 : 1;
152 unsigned RB2 : 1;
153 unsigned RB3 : 1;
154 unsigned RB4 : 1;
155 unsigned RB5 : 1;
156 unsigned RB6 : 1;
157 unsigned RB7 : 1;
158 } __PORTBbits_t;
160 extern __at(0x0006) volatile __PORTBbits_t PORTBbits;
162 #define _RB0 0x01
163 #define _RB1 0x02
164 #define _RB2 0x04
165 #define _RB3 0x08
166 #define _RB4 0x10
167 #define _RB5 0x20
168 #define _RB6 0x40
169 #define _RB7 0x80
171 //==============================================================================
174 //==============================================================================
175 // PORTC Bits
177 extern __at(0x0007) __sfr PORTC;
179 typedef struct
181 unsigned RC0 : 1;
182 unsigned RC1 : 1;
183 unsigned RC2 : 1;
184 unsigned RC3 : 1;
185 unsigned RC4 : 1;
186 unsigned RC5 : 1;
187 unsigned RC6 : 1;
188 unsigned RC7 : 1;
189 } __PORTCbits_t;
191 extern __at(0x0007) volatile __PORTCbits_t PORTCbits;
193 #define _RC0 0x01
194 #define _RC1 0x02
195 #define _RC2 0x04
196 #define _RC3 0x08
197 #define _RC4 0x10
198 #define _RC5 0x20
199 #define _RC6 0x40
200 #define _RC7 0x80
202 //==============================================================================
204 extern __at(0x000A) __sfr PCLATH;
206 //==============================================================================
207 // INTCON Bits
209 extern __at(0x000B) __sfr INTCON;
211 typedef union
213 struct
215 unsigned RBIF : 1;
216 unsigned INTF : 1;
217 unsigned T0IF : 1;
218 unsigned RBIE : 1;
219 unsigned INTE : 1;
220 unsigned T0IE : 1;
221 unsigned : 1;
222 unsigned GIE : 1;
225 struct
227 unsigned : 1;
228 unsigned : 1;
229 unsigned TMR0IF : 1;
230 unsigned : 1;
231 unsigned : 1;
232 unsigned TMR0IE : 1;
233 unsigned : 1;
234 unsigned : 1;
236 } __INTCONbits_t;
238 extern __at(0x000B) volatile __INTCONbits_t INTCONbits;
240 #define _RBIF 0x01
241 #define _INTF 0x02
242 #define _T0IF 0x04
243 #define _TMR0IF 0x04
244 #define _RBIE 0x08
245 #define _INTE 0x10
246 #define _T0IE 0x20
247 #define _TMR0IE 0x20
248 #define _GIE 0x80
250 //==============================================================================
253 //==============================================================================
254 // OPTION_REG Bits
256 extern __at(0x0081) __sfr OPTION_REG;
258 typedef union
260 struct
262 unsigned PS0 : 1;
263 unsigned PS1 : 1;
264 unsigned PS2 : 1;
265 unsigned PSA : 1;
266 unsigned T0SE : 1;
267 unsigned T0CS : 1;
268 unsigned INTEDG : 1;
269 unsigned NOT_RBPU : 1;
272 struct
274 unsigned PS : 3;
275 unsigned : 5;
277 } __OPTION_REGbits_t;
279 extern __at(0x0081) volatile __OPTION_REGbits_t OPTION_REGbits;
281 #define _PS0 0x01
282 #define _PS1 0x02
283 #define _PS2 0x04
284 #define _PSA 0x08
285 #define _T0SE 0x10
286 #define _T0CS 0x20
287 #define _INTEDG 0x40
288 #define _NOT_RBPU 0x80
290 //==============================================================================
293 //==============================================================================
294 // TRISA Bits
296 extern __at(0x0085) __sfr TRISA;
298 typedef union
300 struct
302 unsigned TRISA0 : 1;
303 unsigned TRISA1 : 1;
304 unsigned TRISA2 : 1;
305 unsigned TRISA3 : 1;
306 unsigned TRISA4 : 1;
307 unsigned : 1;
308 unsigned : 1;
309 unsigned : 1;
312 struct
314 unsigned TRISA : 5;
315 unsigned : 3;
317 } __TRISAbits_t;
319 extern __at(0x0085) volatile __TRISAbits_t TRISAbits;
321 #define _TRISA0 0x01
322 #define _TRISA1 0x02
323 #define _TRISA2 0x04
324 #define _TRISA3 0x08
325 #define _TRISA4 0x10
327 //==============================================================================
330 //==============================================================================
331 // TRISB Bits
333 extern __at(0x0086) __sfr TRISB;
335 typedef struct
337 unsigned TRISB0 : 1;
338 unsigned TRISB1 : 1;
339 unsigned TRISB2 : 1;
340 unsigned TRISB3 : 1;
341 unsigned TRISB4 : 1;
342 unsigned TRISB5 : 1;
343 unsigned TRISB6 : 1;
344 unsigned TRISB7 : 1;
345 } __TRISBbits_t;
347 extern __at(0x0086) volatile __TRISBbits_t TRISBbits;
349 #define _TRISB0 0x01
350 #define _TRISB1 0x02
351 #define _TRISB2 0x04
352 #define _TRISB3 0x08
353 #define _TRISB4 0x10
354 #define _TRISB5 0x20
355 #define _TRISB6 0x40
356 #define _TRISB7 0x80
358 //==============================================================================
361 //==============================================================================
362 // TRISC Bits
364 extern __at(0x0087) __sfr TRISC;
366 typedef struct
368 unsigned TRISC0 : 1;
369 unsigned TRISC1 : 1;
370 unsigned TRISC2 : 1;
371 unsigned TRISC3 : 1;
372 unsigned TRISC4 : 1;
373 unsigned TRISC5 : 1;
374 unsigned TRISC6 : 1;
375 unsigned TRISC7 : 1;
376 } __TRISCbits_t;
378 extern __at(0x0087) volatile __TRISCbits_t TRISCbits;
380 #define _TRISC0 0x01
381 #define _TRISC1 0x02
382 #define _TRISC2 0x04
383 #define _TRISC3 0x08
384 #define _TRISC4 0x10
385 #define _TRISC5 0x20
386 #define _TRISC6 0x40
387 #define _TRISC7 0x80
389 //==============================================================================
392 //==============================================================================
393 // PCON Bits
395 extern __at(0x008E) __sfr PCON;
397 typedef struct
399 unsigned : 1;
400 unsigned NOT_POR : 1;
401 unsigned : 1;
402 unsigned : 1;
403 unsigned : 1;
404 unsigned : 1;
405 unsigned : 1;
406 unsigned : 1;
407 } __PCONbits_t;
409 extern __at(0x008E) volatile __PCONbits_t PCONbits;
411 #define _NOT_POR 0x02
413 //==============================================================================
416 //==============================================================================
418 // Configuration Bits
420 //==============================================================================
422 #define _CONFIG1 0x2007
424 //----------------------------- CONFIG1 Options -------------------------------
426 #define _FOSC_LP 0x3FFC // LP oscillator.
427 #define _LP_OSC 0x3FFC // LP oscillator.
428 #define _FOSC_XT 0x3FFD // XT oscillator.
429 #define _XT_OSC 0x3FFD // XT oscillator.
430 #define _FOSC_HS 0x3FFE // HS oscillator.
431 #define _HS_OSC 0x3FFE // HS oscillator.
432 #define _FOSC_RC 0x3FFF // RC oscillator.
433 #define _RC_OSC 0x3FFF // RC oscillator.
434 #define _WDTE_OFF 0x3FFB // WDT disabled.
435 #define _WDT_OFF 0x3FFB // WDT disabled.
436 #define _WDTE_ON 0x3FFF // WDT enabled.
437 #define _WDT_ON 0x3FFF // WDT enabled.
438 #define _PWRTE_ON 0x3FF7 // PWRT enabled.
439 #define _PWRTE_OFF 0x3FFF // PWRT disabled.
440 #define _CP_ALL 0x00CF // 000h:7FFh code protected.
441 #define _CP_75 0x15DF // 0200h-07FFh code protected.
442 #define _CP_50 0x2AEF // 0400h-07FFh code protected.
443 #define _CP_OFF 0x3FFF // Program Memory code protection off.
445 //==============================================================================
447 #define _IDLOC0 0x2000
448 #define _IDLOC1 0x2001
449 #define _IDLOC2 0x2002
450 #define _IDLOC3 0x2003
452 //==============================================================================
454 #ifndef NO_BIT_DEFINES
456 #define RBIF INTCONbits.RBIF // bit 0
457 #define INTF INTCONbits.INTF // bit 1
458 #define T0IF INTCONbits.T0IF // bit 2, shadows bit in INTCONbits
459 #define TMR0IF INTCONbits.TMR0IF // bit 2, shadows bit in INTCONbits
460 #define RBIE INTCONbits.RBIE // bit 3
461 #define INTE INTCONbits.INTE // bit 4
462 #define T0IE INTCONbits.T0IE // bit 5, shadows bit in INTCONbits
463 #define TMR0IE INTCONbits.TMR0IE // bit 5, shadows bit in INTCONbits
464 #define GIE INTCONbits.GIE // bit 7
466 #define PS0 OPTION_REGbits.PS0 // bit 0
467 #define PS1 OPTION_REGbits.PS1 // bit 1
468 #define PS2 OPTION_REGbits.PS2 // bit 2
469 #define PSA OPTION_REGbits.PSA // bit 3
470 #define T0SE OPTION_REGbits.T0SE // bit 4
471 #define T0CS OPTION_REGbits.T0CS // bit 5
472 #define INTEDG OPTION_REGbits.INTEDG // bit 6
473 #define NOT_RBPU OPTION_REGbits.NOT_RBPU // bit 7
475 #define NOT_POR PCONbits.NOT_POR // bit 1
477 #define RA0 PORTAbits.RA0 // bit 0
478 #define RA1 PORTAbits.RA1 // bit 1
479 #define RA2 PORTAbits.RA2 // bit 2
480 #define RA3 PORTAbits.RA3 // bit 3
481 #define RA4 PORTAbits.RA4 // bit 4
483 #define RB0 PORTBbits.RB0 // bit 0
484 #define RB1 PORTBbits.RB1 // bit 1
485 #define RB2 PORTBbits.RB2 // bit 2
486 #define RB3 PORTBbits.RB3 // bit 3
487 #define RB4 PORTBbits.RB4 // bit 4
488 #define RB5 PORTBbits.RB5 // bit 5
489 #define RB6 PORTBbits.RB6 // bit 6
490 #define RB7 PORTBbits.RB7 // bit 7
492 #define RC0 PORTCbits.RC0 // bit 0
493 #define RC1 PORTCbits.RC1 // bit 1
494 #define RC2 PORTCbits.RC2 // bit 2
495 #define RC3 PORTCbits.RC3 // bit 3
496 #define RC4 PORTCbits.RC4 // bit 4
497 #define RC5 PORTCbits.RC5 // bit 5
498 #define RC6 PORTCbits.RC6 // bit 6
499 #define RC7 PORTCbits.RC7 // bit 7
501 #define C STATUSbits.C // bit 0
502 #define DC STATUSbits.DC // bit 1
503 #define Z STATUSbits.Z // bit 2
504 #define NOT_PD STATUSbits.NOT_PD // bit 3
505 #define NOT_TO STATUSbits.NOT_TO // bit 4
506 #define RP0 STATUSbits.RP0 // bit 5
507 #define RP1 STATUSbits.RP1 // bit 6
508 #define IRP STATUSbits.IRP // bit 7
510 #define TRISA0 TRISAbits.TRISA0 // bit 0
511 #define TRISA1 TRISAbits.TRISA1 // bit 1
512 #define TRISA2 TRISAbits.TRISA2 // bit 2
513 #define TRISA3 TRISAbits.TRISA3 // bit 3
514 #define TRISA4 TRISAbits.TRISA4 // bit 4
516 #define TRISB0 TRISBbits.TRISB0 // bit 0
517 #define TRISB1 TRISBbits.TRISB1 // bit 1
518 #define TRISB2 TRISBbits.TRISB2 // bit 2
519 #define TRISB3 TRISBbits.TRISB3 // bit 3
520 #define TRISB4 TRISBbits.TRISB4 // bit 4
521 #define TRISB5 TRISBbits.TRISB5 // bit 5
522 #define TRISB6 TRISBbits.TRISB6 // bit 6
523 #define TRISB7 TRISBbits.TRISB7 // bit 7
525 #define TRISC0 TRISCbits.TRISC0 // bit 0
526 #define TRISC1 TRISCbits.TRISC1 // bit 1
527 #define TRISC2 TRISCbits.TRISC2 // bit 2
528 #define TRISC3 TRISCbits.TRISC3 // bit 3
529 #define TRISC4 TRISCbits.TRISC4 // bit 4
530 #define TRISC5 TRISCbits.TRISC5 // bit 5
531 #define TRISC6 TRISCbits.TRISC6 // bit 6
532 #define TRISC7 TRISCbits.TRISC7 // bit 7
534 #endif // #ifndef NO_BIT_DEFINES
536 #endif // #ifndef __PIC16C557_H__