* support/regression/tests/zeropad.c: added TEST_G macro for alpha build
[fw/sdcc] / device / include / pic16 / pic18f252.h
1
2 /*
3  * pic18f252.h - 18F252 Device Library Header
4  *
5  * This file is part of the GNU PIC Library.
6  *
7  * January, 2004
8  * The GNU PIC Library is maintained by,
9  *      Vangelis Rokas <vrokas@otenet.gr>
10  *
11  * $Id$
12  *
13  */
14
15 #ifndef __PIC18F252_H__
16 #define __PIC18F252_H__
17
18 extern sfr at 0xf80 PORTA;
19 typedef union {
20         struct {
21                 unsigned RA0:1;
22                 unsigned RA1:1;
23                 unsigned RA2:1;
24                 unsigned RA3:1;
25                 unsigned RA4:1;
26                 unsigned RA5:1;
27                 unsigned RA6:1;
28                 unsigned :1;
29         };
30
31         struct {
32                 unsigned AN0:1;
33                 unsigned AN1:1;
34                 unsigned AN2:1;
35                 unsigned AN3:1;
36                 unsigned :1;
37                 unsigned AN4:1;
38                 unsigned OSC2:1;
39                 unsigned :1;
40         };
41
42         struct {
43                 unsigned :1;
44                 unsigned :1;
45                 unsigned VREFM:1;
46                 unsigned VREFP:1;
47                 unsigned T0CKI:1;
48                 unsigned SS:1;
49                 unsigned CLK0:1;
50                 unsigned :1;
51         };
52
53         struct {
54                 unsigned :1;
55                 unsigned :1;
56                 unsigned :1;
57                 unsigned :1;
58                 unsigned :1;
59                 unsigned LVDIN:1;
60                 unsigned :1;
61                 unsigned :1;
62         };
63 } PORTAbits_t;
64
65 extern volatile PORTAbits_t at 0xf80 PORTAbits;
66
67 extern sfr at 0xf81 PORTB;
68 typedef union {
69         struct {
70                 unsigned RB0:1;
71                 unsigned RB1:1;
72                 unsigned RB2:1;
73                 unsigned RB3:1;
74                 unsigned RB4:1;
75                 unsigned RB5:1;
76                 unsigned RB6:1;
77                 unsigned RB7:1;
78         };
79
80         struct {
81                 unsigned INT0:1;
82                 unsigned INT1:1;
83                 unsigned INT2:1;
84                 unsigned INT3:1;
85                 unsigned :1;
86                 unsigned :1;
87                 unsigned :1;
88                 unsigned :1;
89         };
90 } PORTBbits_t;
91
92 extern volatile PORTBbits_t at 0xf81 PORTBbits;
93
94 extern sfr at 0xf82 PORTC;
95 typedef union {
96         struct {
97                 unsigned RC0:1;
98                 unsigned RC1:1;
99                 unsigned RC2:1;
100                 unsigned RC3:1;
101                 unsigned RC4:1;
102                 unsigned RC5:1;
103                 unsigned RC6:1;
104                 unsigned RC7:1;
105         };
106
107         struct {
108                 unsigned T1OSO:1;
109                 unsigned T1OSI:1;
110                 unsigned :1;
111                 unsigned SCK:1;
112                 unsigned SDI:1;
113                 unsigned SDO:1;
114                 unsigned TX:1;
115                 unsigned RX:1;
116         };
117
118         struct {
119                 unsigned T1CKI:1;
120                 unsigned CCP2:1;
121                 unsigned CCP1:1;
122                 unsigned SCL:1;
123                 unsigned SDA:1;
124                 unsigned :1;
125                 unsigned CK:1;
126                 unsigned DT:1;
127         };
128 } PORTCbits_t;
129
130 extern volatile PORTCbits_t at 0xf82 PORTCbits;
131
132 extern sfr at 0xf89 LATA;
133 typedef union {
134         struct {
135                 unsigned LATA0:1;
136                 unsigned LATA1:1;
137                 unsigned LATA2:1;
138                 unsigned LATA3:1;
139                 unsigned LATA4:1;
140                 unsigned LATA5:1;
141                 unsigned LATA6:1;
142                 unsigned :1;
143         };
144 } LATAbits_t;
145
146 extern volatile LATAbits_t at 0xf89 LATAbits;
147
148 extern sfr at 0xf8a LATB;
149 typedef union {
150         struct {
151                 unsigned LATB0:1;
152                 unsigned LATB1:1;
153                 unsigned LATB2:1;
154                 unsigned LATB3:1;
155                 unsigned LATB4:1;
156                 unsigned LATB5:1;
157                 unsigned LATB6:1;
158                 unsigned LATB7:1;
159         };
160 } LATBbits_t;
161
162 extern volatile LATBbits_t at 0xf8a LATBbits;
163
164 extern sfr at 0xf8b LATC;
165 typedef union {
166         struct {
167                 unsigned LATC0:1;
168                 unsigned LATC1:1;
169                 unsigned LATC2:1;
170                 unsigned LATC3:1;
171                 unsigned LATC4:1;
172                 unsigned LATC5:1;
173                 unsigned LATC6:1;
174                 unsigned LATC7:1;
175         };
176 } LATCbits_t;
177
178 extern volatile LATCbits_t at 0xf8b LATCbits;
179
180 extern sfr at 0xf92 TRISA;
181 typedef union {
182         struct {
183                 unsigned TRISA0:1;
184                 unsigned TRISA1:1;
185                 unsigned TRISA2:1;
186                 unsigned TRISA3:1;
187                 unsigned TRISA4:1;
188                 unsigned TRISA5:1;
189                 unsigned TRISA6:1;
190                 unsigned :1;
191         };
192 } TRISAbits_t;
193
194 extern volatile TRISAbits_t at 0xf92 TRISAbits;
195
196 extern sfr at 0xf93 TRISB;
197 typedef union {
198         struct {
199                 unsigned TRISB0:1;
200                 unsigned TRISB1:1;
201                 unsigned TRISB2:1;
202                 unsigned TRISB3:1;
203                 unsigned TRISB4:1;
204                 unsigned TRISB5:1;
205                 unsigned TRISB6:1;
206                 unsigned TRISB7:1;
207         };
208 } TRISBbits_t;
209
210 extern volatile TRISBbits_t at 0xf93 TRISBbits;
211
212 extern sfr at 0xf94 TRISC;
213 typedef union {
214         struct {
215                 unsigned TRISC0:1;
216                 unsigned TRISC1:1;
217                 unsigned TRISC2:1;
218                 unsigned TRISC3:1;
219                 unsigned TRISC4:1;
220                 unsigned TRISC5:1;
221                 unsigned TRISC6:1;
222                 unsigned TRISC7:1;
223         };
224 } TRISCbits_t;
225
226 extern volatile TRISCbits_t at 0xf94 TRISCbits;
227
228 extern sfr at 0xf9d PIE1;
229 typedef union {
230         struct {
231                 unsigned TMR1IE:1;
232                 unsigned TMR2IE:1;
233                 unsigned CCP1IE:1;
234                 unsigned SSPIE:1;
235                 unsigned TXIE:1;
236                 unsigned RCIE:1;
237                 unsigned ADIE:1;
238                 unsigned PSPIE:1;
239         };
240 } PIE1bits_t;
241
242 extern volatile PIE1bits_t at 0xf9d PIE1bits;
243
244 extern sfr at 0xf9e PIR1;
245 typedef union {
246         struct {
247                 unsigned TMR1IF:1;
248                 unsigned TMR2IF:1;
249                 unsigned CCP1IF:1;
250                 unsigned SSPIF:1;
251                 unsigned TXIF:1;
252                 unsigned RCIF:1;
253                 unsigned ADIF:1;
254                 unsigned PSPIF:1;
255         };
256 } PIR1bits_t;
257
258 extern volatile PIR1bits_t at 0xf9e PIR1bits;
259
260 extern sfr at 0xf9f IPR1;
261 typedef union {
262         struct {
263                 unsigned TMR1IP:1;
264                 unsigned TMR2IP:1;
265                 unsigned CCP1IP:1;
266                 unsigned SSPIP:1;
267                 unsigned TXIP:1;
268                 unsigned RCIP:1;
269                 unsigned ADIP:1;
270                 unsigned PSPIP:1;
271         };
272 } IPR1bits_t;
273
274 extern volatile IPR1bits_t at 0xf9f IPR1bits;
275
276 extern sfr at 0xfa0 PIE2;
277 typedef union {
278         struct {
279                 unsigned CCP2IE:1;
280                 unsigned TMR3IE:1;
281                 unsigned LVDIE:1;
282                 unsigned BCLIE:1;
283                 unsigned EEIE:1;
284                 unsigned :1;
285                 unsigned :1;
286                 unsigned :1;
287         };
288 } PIE2bits_t;
289
290 extern volatile PIE2bits_t at 0xfa0 PIE2bits;
291
292 extern sfr at 0xfa1 PIR2;
293 typedef union {
294         struct {
295                 unsigned CCP2IF:1;
296                 unsigned TMR3IF:1;
297                 unsigned LVDIF:1;
298                 unsigned BCLIF:1;
299                 unsigned EEIF:1;
300                 unsigned :1;
301                 unsigned :1;
302                 unsigned :1;
303         };
304 } PIR2bits_t;
305
306 extern volatile PIR2bits_t at 0xfa1 PIR2bits;
307
308 extern sfr at 0xfa2 IPR2;
309 typedef union {
310         struct {
311                 unsigned CCP2IP:1;
312                 unsigned TMR3IP:1;
313                 unsigned LVDIP:1;
314                 unsigned BCLIP:1;
315                 unsigned EEIP:1;
316                 unsigned :1;
317                 unsigned :1;
318                 unsigned :1;
319         };
320 } IPR2bits_t;
321
322 extern volatile IPR2bits_t at 0xfa2 IPR2bits;
323
324 extern sfr at 0xfa6 EECON1;
325 typedef union {
326         struct {
327                 unsigned RD:1;
328                 unsigned WR:1;
329                 unsigned WREN:1;
330                 unsigned WRERR:1;
331                 unsigned FREE:1;
332                 unsigned :1;
333                 unsigned CFGS:1;
334                 unsigned EEPGD:1;
335         };
336 } EECON1bits_t;
337
338 extern volatile EECON1bits_t at 0xfa6 EECON1bits;
339
340 extern sfr at 0xfa7 EECON2;
341 extern sfr at 0xfa8 EEDATA;
342 extern sfr at 0xfa9 EEADR;
343 extern sfr at 0xfab RCSTA;
344 typedef union {
345         struct {
346                 unsigned RX9D:1;
347                 unsigned OERR:1;
348                 unsigned FERR:1;
349                 unsigned ADDEN:1;
350                 unsigned CREN:1;
351                 unsigned SREN:1;
352                 unsigned RX9:1;
353                 unsigned SPEN:1;
354         };
355 } RCSTAbits_t;
356
357 extern volatile RCSTAbits_t at 0xfab RCSTAbits;
358
359 extern sfr at 0xfac TXSTA;
360 typedef union {
361         struct {
362                 unsigned TX9D:1;
363                 unsigned TRMT:1;
364                 unsigned BRGH:1;
365                 unsigned :1;
366                 unsigned SYNC:1;
367                 unsigned TXEN:1;
368                 unsigned TX9:1;
369                 unsigned CSRC:1;
370         };
371 } TXSTAbits_t;
372
373 extern volatile TXSTAbits_t at 0xfac TXSTAbits;
374
375 extern sfr at 0xfad TXREG;
376 extern sfr at 0xfae RCREG;
377 extern sfr at 0xfaf SPBRG;
378 extern sfr at 0xfb1 T3CON;
379 typedef union {
380         struct {
381                 unsigned TMR3ON:1;
382                 unsigned TMR3CS:1;
383                 unsigned T3SYNC:1;
384                 unsigned T3CCP1:1;
385                 unsigned T3CKPS0:1;
386                 unsigned T3CKPS1:1;
387                 unsigned T3CCP2:1;
388                 unsigned RD16:1;
389         };
390 } T3CONbits_t;
391
392 extern volatile T3CONbits_t at 0xfb1 T3CONbits;
393
394 extern sfr at 0xfb2 TMR3L;
395 extern sfr at 0xfb3 TMR3H;
396 extern sfr at 0xfba CCP2CON;
397 typedef union {
398         struct {
399                 unsigned CCP2M0:1;
400                 unsigned CCP2M1:1;
401                 unsigned CCP2M2:1;
402                 unsigned CCP2M3:1;
403                 unsigned DCCP2Y:1;
404                 unsigned DCCP2X:1;
405                 unsigned :1;
406                 unsigned :1;
407         };
408 } CCP2CONbits_t;
409
410 extern volatile CCP2CONbits_t at 0xfba CCP2CONbits;
411
412 extern sfr at 0xfbb CCPR2L;
413 extern sfr at 0xfbc CCPR2H;
414 extern sfr at 0xfbd CCP1CON;
415 typedef union {
416         struct {
417                 unsigned CCP1M0:1;
418                 unsigned CCP1M1:1;
419                 unsigned CCP1M2:1;
420                 unsigned CCP1M3:1;
421                 unsigned DCCP1Y:1;
422                 unsigned DCCP1X:1;
423                 unsigned :1;
424                 unsigned :1;
425         };
426 } CCP1CONbits_t;
427
428 extern volatile CCP1CONbits_t at 0xfbd CCP1CONbits;
429
430 extern sfr at 0xfbe CCPR1L;
431 extern sfr at 0xfbf CCPR1H;
432 extern sfr at 0xfc1 ADCON1;
433 typedef union {
434         struct {
435                 unsigned PCFG0:1;
436                 unsigned PCFG1:1;
437                 unsigned PCFG2:1;
438                 unsigned PCFG3:1;
439                 unsigned :1;
440                 unsigned :1;
441                 unsigned ADCS2:1;
442                 unsigned ADFM:1;
443         };
444 } ADCON1bits_t;
445
446 extern volatile ADCON1bits_t at 0xfc1 ADCON1bits;
447
448 extern sfr at 0xfc2 ADCON0;
449 typedef union {
450         struct {
451                 unsigned ADON:1;
452                 unsigned :1;
453                 unsigned GO:1;
454                 unsigned CHS0:1;
455                 unsigned CHS1:1;
456                 unsigned CHS2:1;
457                 unsigned ADCS0:1;
458                 unsigned ADCS1:1;
459         };
460 } ADCON0bits_t;
461
462 extern volatile ADCON0bits_t at 0xfc2 ADCON0bits;
463
464 extern sfr at 0xfc3 ADRESL;
465 extern sfr at 0xfc4 ADRESH;
466 extern sfr at 0xfc5 SSPCON2;
467 typedef union {
468         struct {
469                 unsigned SEN:1;
470                 unsigned RSEN:1;
471                 unsigned PEN:1;
472                 unsigned RCEN:1;
473                 unsigned ACKEN:1;
474                 unsigned ACKDT:1;
475                 unsigned ACKSTAT:1;
476                 unsigned GCEN:1;
477         };
478 } SSPCON2bits_t;
479
480 extern volatile SSPCON2bits_t at 0xfc5 SSPCON2bits;
481
482 extern sfr at 0xfc6 SSPCON1;
483 typedef union {
484         struct {
485                 unsigned SSPM0:1;
486                 unsigned SSPM1:1;
487                 unsigned SSPM2:1;
488                 unsigned SSPM3:1;
489                 unsigned CKP:1;
490                 unsigned SSPEN:1;
491                 unsigned SSPOV:1;
492                 unsigned WCOL:1;
493         };
494 } SSPCON1bits_t;
495
496 extern volatile SSPCON1bits_t at 0xfc6 SSPCON1bits;
497
498 extern sfr at 0xfc7 SSPSTAT;
499 typedef union {
500         struct {
501                 unsigned BF:1;
502                 unsigned UA:1;
503                 unsigned R_W:1;
504                 unsigned S:1;
505                 unsigned P:1;
506                 unsigned D_A:1;
507                 unsigned CKE:1;
508                 unsigned SMP:1;
509         };
510 } SSPSTATbits_t;
511
512 extern volatile SSPSTATbits_t at 0xfc7 SSPSTATbits;
513
514 extern sfr at 0xfc8 SSPADD;
515 extern sfr at 0xfc9 SSPBUF;
516 extern sfr at 0xfca T2CON;
517 typedef union {
518         struct {
519                 unsigned T2CKPS0:1;
520                 unsigned T2CKPS1:1;
521                 unsigned TMR2ON:1;
522                 unsigned TOUTPS0:1;
523                 unsigned TOUTPS1:1;
524                 unsigned TOUTPS2:1;
525                 unsigned TOUTPS3:1;
526                 unsigned :1;
527         };
528 } T2CONbits_t;
529
530 extern volatile T2CONbits_t at 0xfca T2CONbits;
531
532 extern sfr at 0xfcb PR2;
533 extern sfr at 0xfcc TMR2;
534 extern sfr at 0xfcd T1CON;
535 typedef union {
536         struct {
537                 unsigned TMR1ON:1;
538                 unsigned TMR1CS:1;
539                 unsigned NOT_T1SYNC:1;
540                 unsigned T1OSCEN:1;
541                 unsigned T1CKPS0:1;
542                 unsigned T1CKPS1:1;
543                 unsigned :1;
544                 unsigned RD16:1;
545         };
546 } T1CONbits_t;
547
548 extern volatile T1CONbits_t at 0xfcd T1CONbits;
549
550 extern sfr at 0xfce TMR1L;
551 extern sfr at 0xfcf TMR1H;
552 extern sfr at 0xfd0 RCON;
553 typedef union {
554         struct {
555                 unsigned BOR:1;
556                 unsigned POR:1;
557                 unsigned PD:1;
558                 unsigned TO:1;
559                 unsigned RI:1;
560                 unsigned :1;
561                 unsigned :1;
562                 unsigned IPEN:1;
563         };
564 } RCONbits_t;
565
566 extern volatile RCONbits_t at 0xfd0 RCONbits;
567
568 extern sfr at 0xfd1 WDTCON;
569 typedef union {
570         struct {
571                 unsigned SWDTEN:1;
572                 unsigned :1;
573                 unsigned :1;
574                 unsigned :1;
575                 unsigned :1;
576                 unsigned :1;
577                 unsigned :1;
578                 unsigned :1;
579         };
580
581         struct {
582                 unsigned SWDTE:1;
583                 unsigned :1;
584                 unsigned :1;
585                 unsigned :1;
586                 unsigned :1;
587                 unsigned :1;
588                 unsigned :1;
589                 unsigned :1;
590         };
591 } WDTCONbits_t;
592
593 extern volatile WDTCONbits_t at 0xfd1 WDTCONbits;
594
595 extern sfr at 0xfd2 LVDCON;
596 typedef union {
597         struct {
598                 unsigned LVDL0:1;
599                 unsigned LVDL1:1;
600                 unsigned LVDL2:1;
601                 unsigned LVDL3:1;
602                 unsigned LVDEN:1;
603                 unsigned VRST:1;
604                 unsigned :1;
605                 unsigned :1;
606         };
607
608         struct {
609                 unsigned LVV0:1;
610                 unsigned LVV1:1;
611                 unsigned LVV2:1;
612                 unsigned LVV3:1;
613                 unsigned :1;
614                 unsigned BGST:1;
615                 unsigned :1;
616                 unsigned :1;
617         };
618 } LVDCONbits_t;
619
620 extern volatile LVDCONbits_t at 0xfd2 LVDCONbits;
621
622 extern sfr at 0xfd3 OSCCON;
623 typedef union {
624         struct {
625                 unsigned SCS:1;
626                 unsigned :1;
627                 unsigned :1;
628                 unsigned :1;
629                 unsigned :1;
630                 unsigned :1;
631                 unsigned :1;
632                 unsigned :1;
633         };
634 } OSCCONbits_t;
635
636 extern volatile OSCCONbits_t at 0xfd3 OSCCONbits;
637
638 extern sfr at 0xfd5 T0CON;
639 extern sfr at 0xfd6 TMR0L;
640 extern sfr at 0xfd7 TMR0H;
641 extern sfr at 0xfd8 STATUS;
642 typedef union {
643         struct {
644                 unsigned C:1;
645                 unsigned DC:1;
646                 unsigned Z:1;
647                 unsigned OV:1;
648                 unsigned N:1;
649                 unsigned :1;
650                 unsigned :1;
651                 unsigned :1;
652         };
653 } STATUSbits_t;
654
655 extern volatile STATUSbits_t at 0xfd8 STATUSbits;
656
657 extern sfr at 0xfd9 FSR2L;
658 extern sfr at 0xfda FSR2H;
659 extern sfr at 0xfdb PLUSW2;
660 extern sfr at 0xfdc PREINC2;
661 extern sfr at 0xfdd POSTDEC2;
662 extern sfr at 0xfde POSTINC2;
663 extern sfr at 0xfdf INDF2;
664 extern sfr at 0xfe0 BSR;
665 extern sfr at 0xfe1 FSR1L;
666 extern sfr at 0xfe2 FSR1H;
667 extern sfr at 0xfe3 PLUSW1;
668 extern sfr at 0xfe4 PREINC1;
669 extern sfr at 0xfe5 POSTDEC1;
670 extern sfr at 0xfe6 POSTINC1;
671 extern sfr at 0xfe7 INDF1;
672 extern sfr at 0xfe8 WREG;
673 extern sfr at 0xfe9 FSR0L;
674 extern sfr at 0xfea FSR0H;
675 extern sfr at 0xfeb PLUSW0;
676 extern sfr at 0xfec PREINC0;
677 extern sfr at 0xfed POSTDEC0;
678 extern sfr at 0xfee POSTINC0;
679 extern sfr at 0xfef INDF0;
680 extern sfr at 0xff0 INTCON3;
681 typedef union {
682         struct {
683                 unsigned INT1F:1;
684                 unsigned INT2F:1;
685                 unsigned :1;
686                 unsigned INT1E:1;
687                 unsigned INT2E:1;
688                 unsigned :1;
689                 unsigned INT1P:1;
690                 unsigned INT2P:1;
691         };
692
693         struct {
694                 unsigned INT1IF:1;
695                 unsigned INT2IF:1;
696                 unsigned :1;
697                 unsigned INT1IE:1;
698                 unsigned INT2IE:1;
699                 unsigned :1;
700                 unsigned INT1IP:1;
701                 unsigned INT2IP:1;
702         };
703 } INTCON3bits_t;
704
705 extern volatile INTCON3bits_t at 0xff0 INTCON3bits;
706
707 extern sfr at 0xff1 INTCON2;
708 typedef union {
709         struct {
710                 unsigned RBIP:1;
711                 unsigned :1;
712                 unsigned T0IP:1;
713                 unsigned :1;
714                 unsigned INTEDG2:1;
715                 unsigned INTEDG1:1;
716                 unsigned INTEDG0:1;
717                 unsigned RBPU:1;
718         };
719 } INTCON2bits_t;
720
721 extern volatile INTCON2bits_t at 0xff1 INTCON2bits;
722
723 extern sfr at 0xff2 INTCON;
724 typedef union {
725         struct {
726                 unsigned RBIF:1;
727                 unsigned INT0F:1;
728                 unsigned T0IF:1;
729                 unsigned RBIE:1;
730                 unsigned INT0E:1;
731                 unsigned T0IE:1;
732                 unsigned PEIE:1;
733                 unsigned GIE:1;
734         };
735 } INTCONbits_t;
736
737 extern volatile INTCONbits_t at 0xff2 INTCONbits;
738
739 extern sfr at 0xff3 PRODL;
740 extern sfr at 0xff4 PRODH;
741 extern sfr at 0xff5 TABLAT;
742 extern sfr at 0xff6 TBLPTRL;
743 extern sfr at 0xff7 TBLPTRH;
744 extern sfr at 0xff8 TBLPTRU;
745 extern sfr at 0xff9 PCL;
746 extern sfr at 0xffa PCLATH;
747 extern sfr at 0xffb PCLATU;
748 extern sfr at 0xffc STKPTR;
749 typedef union {
750         struct {
751                 unsigned STKPTR0:1;
752                 unsigned STKPTR1:1;
753                 unsigned STKPTR2:1;
754                 unsigned STKPTR3:1;
755                 unsigned STKPTR4:1;
756                 unsigned :1;
757                 unsigned STKUNF:1;
758                 unsigned STKFUL:1;
759         };
760 } STKPTRbits_t;
761
762 extern volatile STKPTRbits_t at 0xffc STKPTRbits;
763
764 extern sfr at 0xffd TOSL;
765 extern sfr at 0xffe TOSH;
766 extern sfr at 0xfff TOSU;
767
768
769 #endif
770