PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
cog.h
Go to the documentation of this file.
1 
42 #ifndef PROPELLER_COG_H_
43 #define PROPELLER_COG_H_
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
51 /* for variables that should go in cog memory */
52 #define _COGMEM __attribute__((cogmem))
53 
56 /* for functions that use cog "call/ret" calling (nonrecursive) */
57 #define _NATIVE __attribute__((native))
58 
61 /* for functions with no epilogue or prologue: these should never return */
62 #define _NAKED __attribute__((naked))
63 
65 #define _FCACHE __attribute__((fcache))
66 
67 /* useful variables */
68 
69 #ifdef __PROPELLER2__
70 extern _COGMEM volatile unsigned int _PINA __asm__("PINA");
71 extern _COGMEM volatile unsigned int _PINB __asm__("PINB");
72 extern _COGMEM volatile unsigned int _PINC __asm__("PINC");
73 extern _COGMEM volatile unsigned int _PIND __asm__("PIND");
74 extern _COGMEM volatile unsigned int _DIRA __asm__("DIRA");
75 extern _COGMEM volatile unsigned int _DIRB __asm__("DIRB");
76 extern _COGMEM volatile unsigned int _DIRC __asm__("DIRC");
77 extern _COGMEM volatile unsigned int _DIRD __asm__("DIRD");
78 #else
79 extern _COGMEM volatile unsigned int _PAR __asm__("PAR");
80 extern _COGMEM volatile unsigned int _CNT __asm__("CNT");
81 extern _COGMEM volatile unsigned int _INA __asm__("INA");
82 extern _COGMEM volatile unsigned int _INB __asm__("INB");
83 extern _COGMEM volatile unsigned int _OUTA __asm__("OUTA");
84 extern _COGMEM volatile unsigned int _OUTB __asm__("OUTB");
85 extern _COGMEM volatile unsigned int _DIRA __asm__("DIRA");
86 extern _COGMEM volatile unsigned int _DIRB __asm__("DIRB");
87 extern _COGMEM volatile unsigned int _CTRA __asm__("CTRA");
88 extern _COGMEM volatile unsigned int _CTRB __asm__("CTRB");
89 extern _COGMEM volatile unsigned int _FRQA __asm__("FRQA");
90 extern _COGMEM volatile unsigned int _FRQB __asm__("FRQB");
91 extern _COGMEM volatile unsigned int _PHSA __asm__("PHSA");
92 extern _COGMEM volatile unsigned int _PHSB __asm__("PHSB");
93 extern _COGMEM volatile unsigned int _VCFG __asm__("VCFG");
94 extern _COGMEM volatile unsigned int _VSCL __asm__("VSCL");
95 #endif
96 
97 /* boot parameters */
98 
100 extern unsigned int _clkfreq; /* in the spin boot code */
101 
103 #define _CLKFREQ _clkfreq
104 
106 extern unsigned char _clkmode; /* in the spin boot code */
107 
111 #define _CLKMODE _clkmode
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif
_clkfreq
unsigned int _clkfreq
_COGMEM
#define _COGMEM
Can be used in per-variable declarations to tell compiler that a variable should go in COG memory.
Definition: cog.h:52
_clkmode
unsigned char _clkmode