Skip to content
Browse files

Added PRUSS and PRU interfaces

  • Loading branch information...
1 parent d7bab59 commit 3d7dcee2a7f0b7ce6b4c9e5cab10713bb24b5455 @wz2b committed Mar 22, 2012
Showing with 228 additions and 1 deletion.
  1. +161 −0 Pru.hpp
  2. +65 −0 Pruss.hpp
  3. +2 −1 prude.bb
View
161 Pru.hpp
@@ -0,0 +1,161 @@
+/*
+ * PRU Debugger
+ * Copyright (C) 2012 Christopher Piggott
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PRU_HPP
+#define PRU_HPP
+
+class Pru {
+ /**
+ * Get the number of general purpose for a PRU
+ * @return number of general purpose registers for this PRU
+ */
+ virtual int getNumGpRegisters(void) = 0;
+
+ /**
+ * Get a block of registers
+ * @return number of registers retrieved, or -1 on error
+ */
+ virtual int getGpRegisters(int startReg, int count, u_int32_t [] dst) = 0;
+
+ /**
+ * Set some general purpose registers
+ * @return number of registers written, -1 on error
+ */
+ virtual int setGpRegisters(int startReg, int count, u_int3_t [] src) = 0;
+
+ /**
+ * Get size (in 32-bit words) of the instruction memory
+ * @return
+ */
+ virtual int getImemSize() = 0;
+
+ /**
+ * Get size (number of 32-bit words) of data memory
+ * @return
+ */
+ virtual int getDmemSize() = 0;
+
+ /**
+ * Get size (number of 32-bit words) of shared memory - that shared
+ * between all the PRUs in this PRUSS
+ * @return
+ */
+ virtual int getSharedDmemSize() = 0;
+
+
+ /**
+ * Get a block of instruction memory
+ * @return
+ */
+ virtual int getImem(int startAddr, int endAddr, u_int32_t [] dest) = 0;
+
+ /**
+ * Set a block of instruction memory
+ * @return
+ */
+ virtual int setImem(int startAddr, int endAddr, u_int32_t [] dest) = 0;
+
+ /**
+ * Get a block of data memory
+ * @return
+ */
+ virtual int getDmem(int pruNum, int startAddr, int endAddr, u_int32_t [] dest) = 0;
+
+ /**
+ * Set a block of data memory
+ * @return
+ */
+ virtual int setDmem(int startAddr, int endAddr, u_int32_t [] dest) = 0;
+
+
+ /**
+ * Get a block of shared data memory
+ * @return
+ */
+ virtual int getSharedDmem(int startAddr, int endAddr, u_int32_t [] dest) = 0;
+
+
+ /**
+ * Set a block of shared data memory
+ * @return
+ */
+ virtual int setSharedDmem(int startAddr, int endAddr, u_int32_t [] dest) = 0;
+
+
+ /**
+ * Start the PRU (releases it from reset)
+ * @return
+ */
+ virtual int start(void) =0;
+
+ /**
+ * Stop the PRU (puts it in reset, which resets the PC)
+ * @return
+ */
+ virtual int stop(void) =0;
+
+ /**
+ * Single step the CPU from the current PC
+ * @return
+ */
+ virtual int step(void) =0;
+
+ /**
+ * Reset the CPU
+ */
+ virtual int reset(void) =0;
+
+ /**
+ * Enable or disable counting mode
+ * @param counting
+ */
+ virtual void setCycleCountingMode(bool counting) =0;
+
+ /**
+ * Get whether or not counting mode is on
+ * @return
+ */
+ virtual bool getCycleCountingMode(void) =0;
+
+
+ /**
+ * Get the cycle count register
+ * @return
+ */
+ virtual u_int32_t getCycleCount(void) =0;
+
+ /**
+ * Get the current program counter
+ * @return
+ */
+ virtual u_int32_t getProgramCounter(void) =0;
+
+
+ /**
+ * Get the current value of the PRU status register. This may
+ * be broken out into multiple methods later.
+ * @return
+ */
+ virtual u_int32_t getStatus(void) =0;
+
+};
+
+
+#endif /* PRU_HPP */
+
View
65 Pruss.hpp
@@ -0,0 +1,65 @@
+/*
+ * PRU Debugger
+ * Copyright (C) 2012 Christopher Piggott
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PRUSS_HPP
+#define PRUSS_HPP
+
+#include <stdint.h>
+#include "Pru.hpp"
+
+/**
+ * Defines the interface to a PRU subsystem
+ */
+class Pruss {
+public:
+
+ /**
+ * Get the number of PRUs in this subsystem
+ * @return
+ */
+ virtual int getNumPrus() = 0;
+
+ /**
+ * Get object model for one PRU within the subsystem
+ * @param pruNum
+ * @return
+ */
+ Pru & getPru(int pruNum) =0;
+
+ /**
+ * Get the revision ID of the PRUSS
+ * @return
+ */
+ u_int32_t getRevId(void) =0;
+
+ /**
+ * Get the calue of the SYSCFG register
+ * I may break this out into individual pieces later
+ * @return
+ */
+ u_int32_t getSysConfig(void) =0;
+
+
+ /* There are other PRUSS_CFG registers I am ignoring for now. */
+
+};
+
+
+#endif /* PRUSS_HPP */
+
View
3 prude.bb
@@ -6,7 +6,8 @@ LIC_FILES_CHKSUM="file://LICENSE.TXT;md5=b234ee4d69f5fce4486a80fdaf4a4263"
DEPENDS="ncurses panel"
-SRCREV="7c860c58162f7119763988c1f241fe64a47f486e"
+# SRCREV="7c860c58162f7119763988c1f241fe64a47f486e"
+SRCREV="${AUTOREV}"
SRC_URI="git://github.com/wz2b/prude.git;branch=master"
S="${WORKDIR}/git"

0 comments on commit 3d7dcee

Please sign in to comment.
Something went wrong with that request. Please try again.