996
|
1 /*
|
|
2 * pick1.h - Compiler-dependent defines for PIC compilers
|
|
3 *
|
|
4 * This file allows porting of PIC-INTERCAL output files to different
|
|
5 * compilers. Most compilers will require this file to be modified;
|
|
6 * as written at the moment, it's ANSI C that invokes undefined
|
|
7 * behaviour (in a way that might plausibly produce correct
|
|
8 * results).
|
|
9 *
|
|
10 LICENSE TERMS
|
|
11 Copyright (C) 2006 Alex Smith
|
|
12
|
|
13 This program is free software; you can redistribute it and/or modify
|
|
14 it under the terms of the GNU General Public License as published by
|
|
15 the Free Software Foundation; either version 2 of the License, or
|
|
16 (at your option) any later version.
|
|
17
|
|
18 This program is distributed in the hope that it will be useful,
|
|
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21 GNU General Public License for more details.
|
|
22
|
|
23 You should have received a copy of the GNU General Public License
|
|
24 along with this program; if not, write to the Free Software
|
|
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
26 */
|
|
27
|
|
28 /* Place any headers, config fuse selection statements, and device
|
|
29 statements your compiler needs here. */
|
|
30 #include <stdint.h>
|
|
31
|
|
32 /* Define these constants to unsigned data types of the correct
|
|
33 bit width. (If your compiler doesn't use 1 bit variables, you
|
|
34 could substitute an 8 bit variable, but that would take up
|
|
35 extra RAM, which may or may not drive the program over the PIC's
|
|
36 RAM limit.) */
|
|
37 #define ICK_INT32 uint32_t
|
|
38 #define ICK_INT16 uint16_t
|
|
39 #define ICK_INT8 uint8_t
|
|
40 #define ICK_INT1 uint1_t
|
|
41
|
|
42 /* Define this to an error-handling procedure. You should ignore the
|
|
43 arguments, as they won't make too much sense in this context.
|
|
44 This should block the program; the SLEEP command is one possibility,
|
|
45 somehow getting the PIC to disconnect its own power supply and signal
|
|
46 an error is another. */
|
|
47 #define ick_lose(a,b,c) for(;;)
|
|
48
|
|
49 /* PORTA, PORTB, TRISA, and TRISB must be variables which, when read or
|
|
50 modified, read or modify the corresponding location in the PIC's RAM;
|
|
51 these are often at locations 0x05, 0x06, 0x85, and 0x86 respectively.
|
|
52 Place the code to do this here, if it isn't added by the header files
|
|
53 above. See the section below if your compiler doesn't recognize the
|
|
54 volatile keyword, but this code is otherwise correct. */
|
|
55 #define PORTA *(volatile ICK_INT8*)0x05
|
|
56 #define PORTB *(volatile ICK_INT8*)0x06
|
|
57 #define TRISA *(volatile ICK_INT8*)0x85
|
|
58 #define TRISB *(volatile ICK_INT8*)0x86
|
|
59
|
|
60 /* This is a hack for compilers that don't interpret volatile correctly.
|
|
61 The uncommented code assumes your compiler knows how to work it
|
|
62 correctly; use the replacement below if it doesn't. */
|
|
63 #define seq(a) a
|
|
64 /* You may need to use the commented-out code instead if your compiler
|
|
65 is confused about volatile.
|
|
66 ICK_INT8 seq(ICK_INT8 n)
|
|
67 {
|
|
68 return n;
|
|
69 }
|
|
70 */
|
|
71
|
|
72 void pickinit()
|
|
73 {
|
|
74 /* Place any initialization code that is needed here. */
|
|
75 }
|
|
76
|
|
77 /* If your implementation doesn't use function pointers, delete this and
|
|
78 don't write any code that uses operator-overloading. */
|
|
79 typedef struct ick_overop_t
|
|
80 {
|
|
81 ICK_INT32 (*get)(ICK_INT32);
|
|
82 void (*set)(ICK_INT32);
|
|
83 } ick_overop;
|
|
84
|
|
85 #define ick_type16 ICK_INT16
|
|
86 #define ick_type32 ICK_INT32
|