Add persistent USB output mode selection
This commit is contained in:
parent
31a8cfb9d3
commit
ec9359bce8
35 changed files with 4136 additions and 217 deletions
9
tests/mode_native_stubs/hardware/structs/watchdog.h
Normal file
9
tests/mode_native_stubs/hardware/structs/watchdog.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct watchdog_hw_t {
|
||||
uint32_t scratch[8];
|
||||
};
|
||||
|
||||
extern watchdog_hw_t* watchdog_hw;
|
||||
5
tests/mode_native_stubs/hardware/watchdog.h
Normal file
5
tests/mode_native_stubs/hardware/watchdog.h
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void watchdog_reboot(uint32_t pc, uint32_t sp, uint32_t delay_ms);
|
||||
12
tests/mode_native_stubs/pico/time.h
Normal file
12
tests/mode_native_stubs/pico/time.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int32_t alarm_id_t;
|
||||
typedef uint64_t absolute_time_t;
|
||||
typedef int64_t (*alarm_callback_t)(alarm_id_t alarm_id, void* user_data);
|
||||
|
||||
absolute_time_t get_absolute_time();
|
||||
uint64_t to_ms_since_boot(absolute_time_t time);
|
||||
alarm_id_t add_alarm_in_ms(int64_t delay_ms, alarm_callback_t callback,
|
||||
void* user_data, bool fire_if_past);
|
||||
33
tests/mode_native_stubs/tusb.h
Normal file
33
tests/mode_native_stubs/tusb.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum {
|
||||
CONTROL_STAGE_SETUP = 0,
|
||||
CONTROL_STAGE_DATA = 1,
|
||||
CONTROL_STAGE_ACK = 2,
|
||||
TUSB_REQ_RCPT_DEVICE = 0,
|
||||
TUSB_DIR_OUT = 0,
|
||||
TUSB_REQ_TYPE_VENDOR = 2,
|
||||
TUSB_DIR_IN = 1,
|
||||
};
|
||||
|
||||
struct tusb_request_type_bits_t {
|
||||
uint8_t recipient;
|
||||
uint8_t type;
|
||||
uint8_t direction;
|
||||
};
|
||||
|
||||
struct tusb_control_request_t {
|
||||
tusb_request_type_bits_t bmRequestType_bit;
|
||||
uint8_t bRequest;
|
||||
uint16_t wValue;
|
||||
uint16_t wIndex;
|
||||
uint16_t wLength;
|
||||
};
|
||||
void tusb_init();
|
||||
|
||||
bool tud_control_xfer(uint8_t rhport,
|
||||
const tusb_control_request_t* request,
|
||||
void* buffer, uint16_t length);
|
||||
Loading…
Add table
Add a link
Reference in a new issue