#16 Lots more refactoring.... doesn't work anymore... work in progress

This commit is contained in:
akuker
2020-08-09 20:11:52 -05:00
parent 484030a622
commit 15f36ecd30
15 changed files with 1578 additions and 1110 deletions

28
src/raspberrypi/os.cpp Normal file
View File

@@ -0,0 +1,28 @@
#include "os.h"
//---------------------------------------------------------------------------
//
// Pin the thread to a specific CPU
//
//---------------------------------------------------------------------------
void FixCpu(int cpu)
{
#ifndef BAREMETAL
cpu_set_t cpuset;
int cpus;
// Get the number of CPUs
CPU_ZERO(&cpuset);
sched_getaffinity(0, sizeof(cpu_set_t), &cpuset);
cpus = CPU_COUNT(&cpuset);
// Set the thread affinity
if (cpu < cpus) {
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
}
#else
return;
#endif
}