int _serial_tx(int c, unsigned int txmask, unsigned int bitcycles) { unsigned int waitcycles; int i, value; /* set output */ _OUTA |= txmask; _DIRA |= txmask; value = (c | 256) << 1; waitcycles = getcnt() + bitcycles; for (i = 0; i < 10; i++) { waitcycles = __builtin_propeller_waitcnt(waitcycles, bitcycles); if (value & 1) _OUTA |= txmask; else _OUTA &= ~txmask; value >>= 1; } // if we turn off DIRA, then some boards (like QuickStart) are left with // floating pins and garbage output; if we leave it on, we're left with // a high pin and other cogs cannot produce output on it // the solution is to use FullDuplexSerialDriver instead on applications // with multiple cogs //_DIRA &= ~txmask; return c; }
int main() { int n; unsigned char c; /* Read and store every number */ while (scanf("%d", &n) == 1) incr(arr, n); /* Print sorted result */ for (n = 0; n < MAXINT; n++) for (c = getcnt(arr, n); c > 0; c--) printf("%d\n", n); return 0; }
void btest005::pausems(uint32_t ms) { uint32_t tim; tim = ms * mscycles; waitcnt(tim + getcnt()); }