1#ifndef RP2040_COMMON_H_
2#define RP2040_COMMON_H_
4#if defined(RP2040_USB_HOST_MODE) && defined(RP2040_USB_DEVICE_MODE)
5#error TinyUSB device and host mode not supported at the same time
11#include "hardware/structs/usb.h"
12#include "hardware/irq.h"
13#include "hardware/resets.h"
14#include "hardware/timer.h"
16#if defined(PICO_RP2040_USB_DEVICE_ENUMERATION_FIX) && !defined(TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX)
17#define TUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX PICO_RP2040_USB_DEVICE_ENUMERATION_FIX
20#if defined(PICO_RP2040_USB_DEVICE_UFRAME_FIX) && !defined(TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX)
21#define TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX PICO_RP2040_USB_DEVICE_UFRAME_FIX
24#if TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX
25#undef PICO_RP2040_USB_FAST_IRQ
26#define PICO_RP2040_USB_FAST_IRQ 1
29#ifndef PICO_RP2040_USB_FAST_IRQ
30#define PICO_RP2040_USB_FAST_IRQ 0
33#if PICO_RP2040_USB_FAST_IRQ
34#define __tusb_irq_path_func(x) __no_inline_not_in_flash_func(x)
36#define __tusb_irq_path_func(x) x
39#define usb_hw_set ((usb_hw_t *) hw_set_alias_untyped(usb_hw))
40#define usb_hw_clear ((usb_hw_t *) hw_clear_alias_untyped(usb_hw))
42#define pico_info(...) TU_LOG(2, __VA_ARGS__)
43#define pico_trace(...) TU_LOG(3, __VA_ARGS__)
96#if TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX
138 return (uintptr_t) buf ^ (uintptr_t) usb_dpram;
static TU_ATTR_ALWAYS_INLINE uint32_t _hw_endpoint_buffer_control_get_value32(struct hw_endpoint *ep)
static TU_ATTR_ALWAYS_INLINE void _hw_endpoint_buffer_control_set_value32(struct hw_endpoint *ep, uint32_t value)
struct hw_endpoint hw_endpoint_t
void hw_endpoint_start_next_buffer(struct hw_endpoint *ep)
bool hw_endpoint_xfer_continue(struct hw_endpoint *ep)
static uintptr_t hw_data_offset(uint8_t *buf)
const char * ep_dir_string[]
volatile uint32_t e15_last_sof
void rp2040_usb_init(void)
static TU_ATTR_ALWAYS_INLINE void hw_endpoint_lock_update(__unused struct hw_endpoint *ep, __unused int delta)
static TU_ATTR_ALWAYS_INLINE void _hw_endpoint_buffer_control_set_mask32(struct hw_endpoint *ep, uint32_t value)
void _hw_endpoint_buffer_control_update32(struct hw_endpoint *ep, uint32_t and_mask, uint32_t or_mask)
static TU_ATTR_ALWAYS_INLINE void _hw_endpoint_buffer_control_clear_mask32(struct hw_endpoint *ep, uint32_t value)
void hw_endpoint_xfer_start(struct hw_endpoint *ep, uint8_t *buffer, uint16_t total_len)
void hw_endpoint_reset_transfer(struct hw_endpoint *ep)
io_rw_32 * endpoint_control
io_rw_32 * buffer_control