PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
propgcc
propeller-elf
include
propeller1.h
Go to the documentation of this file.
1
9
#ifndef _PROPELLER1_H_
10
#define _PROPELLER1_H_
11
12
#ifdef __cplusplus
13
extern
"C"
14
{
15
#endif
16
39
#define coginit(id, code, param) __builtin_propeller_coginit( \
40
(((uint32_t)(param) << 16) & 0xfffc0000) \
41
|(((uint32_t)(code) << 2) & 0x0003fff0) \
42
|(((id) ) & 0x0000000f))
43
53
#define getcnt() _CNT
54
66
static
__inline__
int
getpin
(
int
pin)
67
{
68
uint32_t mask = 1 << pin;
69
_OUTA &= ~mask;
70
return
_INA & mask ? 1 : 0;
71
}
72
85
static
__inline__
void
setpin
(
int
pin,
int
value)
86
{
87
uint32_t mask = 1 << pin;
88
if
(value)
89
_OUTA |= mask;
90
else
91
_OUTA &= ~mask;
92
_DIRA |= mask;
93
}
94
107
static
__inline__
void
togglepin
(
int
pin)
108
{
109
uint32_t mask = 1 << pin;
110
_OUTA ^= mask;
111
_DIRA |= mask;
112
}
113
131
#define shiftout(val, mask, port) \
132
__extension__({ \
133
unsigned int ret = val; \
134
__asm__ volatile( \
135
" shr %[_ret],#1 wc\n" \
136
" muxc %[_port], %[_mask]\n" \
137
:
/* outputs */
\
138
/* "+r" means a register operand that is both read and written */
\
139
[_ret] "+rC" (ret), \
140
[_port] "+rC" (port) \
141
:
/* inputs */
\
142
[_mask] "r" (mask) \
143
:
/* clobbered registers */
\
144
"cc"
/* only the condition codes */
\
145
); ret; })
146
147
149
#define PAR _PAR
150
#define CNT _CNT
152
#define INA _INA
154
#define INB _INB
156
#define OUTA _OUTA
158
#define OUTB _OUTB
160
#define DIRA _DIRA
162
#define DIRB _DIRB
164
#define CTRA _CTRA
166
#define CTRB _CTRB
168
#define FRQA _FRQA
170
#define FRQB _FRQB
172
#define PHSA _PHSA
174
#define PHSB _PHSB
176
#define VCFG _VCFG
178
#define VSCL _VSCL
180
182
#define RCFAST 0x00
183
#define RCSLOW 0x01
184
#define XINPUT 0x22
185
#define XTAL1 0x2a
186
#define XTAL2 0x32
187
#define XTAL3 0x3a
188
#define PLL1X 0x41
189
#define PLL2X 0x42
190
#define PLL4X 0x43
191
#define PLL8X 0x44
192
#define PLL16X 0x45
193
194
#ifdef __cplusplus
195
}
196
#endif
197
198
#endif
199
// _PROPELLER1_H_
getpin
static __inline__ int getpin(int pin)
getpin accessor used to read the state of a pin.
Definition:
propeller1.h:66
setpin
static __inline__ void setpin(int pin, int value)
setpin accessor used to write the state of a pin.
Definition:
propeller1.h:85
togglepin
static __inline__ void togglepin(int pin)
togglepin accessor used to toggle the state of a pin.
Definition:
propeller1.h:107
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17