feat: add profiled DualSense PCM haptics experiment

This commit is contained in:
Joey Yakimowich-Payne 2026-09-05 12:03:34 -06:00
commit 0c626fb3b3
29 changed files with 4469 additions and 5 deletions

View file

@ -0,0 +1,23 @@
#pragma once
#include <cassert>
struct critical_section_t {
bool initialized = false;
};
inline unsigned native_haptics_lock_depth = 0;
inline void critical_section_init(critical_section_t* section) {
assert(!section->initialized);
section->initialized = true;
}
inline void critical_section_enter_blocking(critical_section_t* section) {
assert(section->initialized);
assert(native_haptics_lock_depth == 0);
++native_haptics_lock_depth;
}
inline void critical_section_exit(critical_section_t*) {
assert(native_haptics_lock_depth == 1);
--native_haptics_lock_depth;
}

View file

@ -0,0 +1,9 @@
#pragma once
#include <stdint.h>
uint64_t time_us_64();
// Match SDK section spelling so the RAM build compiles the real annotations.
#define __not_in_flash(group) __attribute__((section(".time_critical." group)))
#define __time_critical_func(name) __not_in_flash(#name) name