feat: add profiled DualSense PCM haptics experiment
This commit is contained in:
parent
3b1366067b
commit
0c626fb3b3
29 changed files with 4469 additions and 5 deletions
21
tests/haptics_transport_probe_native_stubs/btstack.h
Normal file
21
tests/haptics_transport_probe_native_stubs/btstack.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
constexpr uint8_t HCI_EVENT_PACKET = 4;
|
||||
constexpr uint8_t HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS = 0x13;
|
||||
using hci_con_handle_t = uint16_t;
|
||||
struct hci_connection_t {
|
||||
uint8_t num_packets_sent = 0;
|
||||
};
|
||||
struct btstack_packet_callback_registration_t {
|
||||
void* item = nullptr;
|
||||
void (*callback)(uint8_t, uint16_t, uint8_t*, uint16_t) = nullptr;
|
||||
};
|
||||
extern "C" {
|
||||
void btstack_run_loop_base_poll_data_sources();
|
||||
void btstack_run_loop_poll_data_sources_from_irq();
|
||||
void hci_add_event_handler(btstack_packet_callback_registration_t* registration);
|
||||
hci_connection_t* hci_connection_for_handle(hci_con_handle_t handle);
|
||||
int hci_number_free_acl_slots_for_handle(hci_con_handle_t handle);
|
||||
}
|
||||
13
tests/haptics_transport_probe_native_stubs/cyw43.h
Normal file
13
tests/haptics_transport_probe_native_stubs/cyw43.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int cyw43_bluetooth_hci_write(uint8_t* buffer, size_t length);
|
||||
int cyw43_bluetooth_hci_read(uint8_t* buffer, uint32_t capacity, uint32_t* length);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
|
||||
struct critical_section_t {
|
||||
bool initialized = false;
|
||||
};
|
||||
inline unsigned native_probe_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 && native_probe_lock_depth == 0);
|
||||
++native_probe_lock_depth;
|
||||
}
|
||||
inline void critical_section_exit(critical_section_t*) {
|
||||
assert(native_probe_lock_depth == 1);
|
||||
--native_probe_lock_depth;
|
||||
}
|
||||
4
tests/haptics_transport_probe_native_stubs/pico/stdlib.h
Normal file
4
tests/haptics_transport_probe_native_stubs/pico/stdlib.h
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
uint64_t time_us_64();
|
||||
19
tests/haptics_transport_probe_native_stubs/sdk.cpp
Normal file
19
tests/haptics_transport_probe_native_stubs/sdk.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <btstack.h>
|
||||
#include <cyw43.h>
|
||||
|
||||
extern int (*native_write)(uint8_t*, size_t);
|
||||
extern int (*native_read)(uint8_t*, uint32_t, uint32_t*);
|
||||
extern void (*native_poll)();
|
||||
|
||||
// Keep definitions separate from test callers, just like the real SDK. Tests
|
||||
// exercise GNU ld --wrap, not direct calls to the __wrap_ implementation.
|
||||
extern "C" int cyw43_bluetooth_hci_write(uint8_t* buffer, size_t length) {
|
||||
return native_write(buffer, length);
|
||||
}
|
||||
extern "C" int cyw43_bluetooth_hci_read(uint8_t* buffer, uint32_t capacity,
|
||||
uint32_t* length) {
|
||||
return native_read(buffer, capacity, length);
|
||||
}
|
||||
extern "C" void btstack_run_loop_base_poll_data_sources() {
|
||||
native_poll();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue