From: kremlin Date: Sun, 24 Jan 2016 06:50:03 +0000 (+0000) Subject: add pru asm timer X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=020b576b049dcfee0cc914cf8d3de8ce0a3849e9;p=capstone.git add pru asm timer --- diff --git a/src/pru.S b/src/pru.S new file mode 100644 index 0000000..dcc5493 --- /dev/null +++ b/src/pru.S @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016, Ian Sutton + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +.origin 0 +.entrypoint START /* used by debugger only */ + +#define PRU0_R31_VEC_VALID (1<<5) +#define SIGNUM 3 /* corresponds to PRU_EVTOUT_0 */ + +#define DELAY_SECONDS 5 +#define CLOCK 200000000 +#define CLOCKS_PER_LOOP 2 +#define DELAYCOUNT DELAY_SECONDS * CLOCK / CLOCKS_PER_LOOP + +START: + MOV r1, DELAYCOUNT + +DELAY: + SUB r1, r1, 1 + QBNE DELAY, r1, 0 + + /* intr */ + MOV R31.b0, PRU0_R31_VEC_VALID | SIGNUM + HALT +