Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
Loading...
Searching...
No Matches
PruManager.h
1/*
2 * PruManager.h
3 *
4 * Support for interaction with PRU via
5 * (rproc+mmap) and/or (uio+libprussdrv)
6 *
7 * Created on: Jul 3, 2021
8 * Author: Dhruva Gole
9 */
10
11#include <string>
12
13#if ENABLE_PRU_UIO == 1
14#include <prussdrv.h>
15#endif
16
17#include <vector>
18#include "Mmap.h"
19
20class PruManager
21{
22protected:
23 unsigned int pruss;
24 unsigned int pruCore;
25 int verbose;
26 std::string pruStringId;
27public:
28 PruManager(unsigned int pruNum, int v);
29 virtual ~PruManager() = 0;
30 virtual int start(bool useMcaspIrq) = 0;
31 virtual int start(const std::string& path) = 0;
32 virtual void stop() = 0;
33 virtual void* getOwnMemory() = 0;
34 virtual void* getSharedMemory() = 0;
35};
36
37#if ENABLE_PRU_RPROC == 1
38class PruManagerRprocMmap : public PruManager
39{
40// use rproc for start/stop and mmap for memory sharing
41public:
42 PruManagerRprocMmap(unsigned int pruNum, int v);
43 void stop();
44 int start(bool useMcaspIrq);
45 int start(const std::string& path);
46 void* getOwnMemory();
47 void* getSharedMemory();
48private:
49 std::vector<uint32_t> prussAddresses;
50 std::string basePath;
51 std::string statePath;
52 std::string firmwarePath;
53 std::string firmware;
54 Mmap ownMemory;
55 Mmap sharedMemory;
56};
57#endif // ENABLE_PRU_RPROC
58
59#if ENABLE_PRU_UIO == 1
60class PruManagerUio : public PruManager
61{
62/* wrapper for libprussdrv for both start/stop and memory sharing
63 * It has the libprussdrv calls currently present in the codebase
64*/
65public:
66 PruManagerUio(unsigned int pruNum, int v);
67 int start(bool useMcaspIrq);
68 int start(const std::string& path);
69 void stop();
70 void* getOwnMemory();
71 void* getSharedMemory();
72};
73
74#endif // ENABLE_PRU_UIO
Definition Mmap.h:4
Definition PruManager.h:21