Prusa MINI Firmware overview
|
Go to the documentation of this file.
28 #error "Never include address.h directly; include Usb.h instead"
33 #define USB_NAK_MAX_POWER 15 //NAK binary order maximum value
34 #define USB_NAK_DEFAULT 14 //default 32K-1 NAKs before giving up
35 #define USB_NAK_NOWAIT 1 //Single NAK stops transfer
36 #define USB_NAK_NONAK 0 //Do not count NAKs, stop retrying after USB Timeout
75 #define bmUSB_DEV_ADDR_ADDRESS 0x07
76 #define bmUSB_DEV_ADDR_PARENT 0x38
77 #define bmUSB_DEV_ADDR_HUB 0x40
96 #define ADDR_ERROR_INVALID_INDEX 0xFF
97 #define ADDR_ERROR_INVALID_ADDRESS 0xFF
99 template <const u
int8_t MAX_DEVICES_ALLOWED>
110 void InitEntry(
uint8_t index) {
114 thePool[index].
epinfo = &dev0ep;
120 for (
uint8_t i = 1;
i < MAX_DEVICES_ALLOWED;
i++)
130 for (
uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 :
start;
i < MAX_DEVICES_ALLOWED;
i++) {
139 void FreeAddressByIndex(
uint8_t index) {
141 if (index == 0)
return;
145 if (uda.
bmHub == 1) {
146 for (
uint8_t i = 1; (
i = FindChildIndex(uda,
i));)
147 FreeAddressByIndex(
i);
150 if (hubCounter == uda.
bmAddress) hubCounter--;
157 void InitAllAddresses() {
158 for (
uint8_t i = 1;
i < MAX_DEVICES_ALLOWED;
i++)
171 thePool[0].
epinfo = &dev0ep;
184 if (!addr)
return thePool;
185 uint8_t index = FindAddressIndex(addr);
186 return index ? thePool + index :
nullptr;
193 for (
uint8_t i = 1;
i < MAX_DEVICES_ALLOWED;
i++)
210 if (is_hub && hubCounter == 7)
return 0;
213 uint8_t index = FindAddressIndex(0);
215 if (!index)
return 0;
259 FreeAddressByIndex(FindAddressIndex(addr));
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
uint8_t bmSndToggle
Definition: address.h:46
Definition: address.h:100
bool lowspeed
Definition: address.h:83
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
uint8_t bmReserved
Definition: address.h:69
start
Definition: g29_auto.py:150
uint8_t i
Definition: screen_test_graph.c:72
uint8_t epAddr
Definition: address.h:39
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc)
Definition: address.h:191
uint8_t bmNakPower
Definition: address.h:48
virtual void FreeAddress(uint8_t addr)
Definition: address.h:253
uint8_t devAddress
Definition: address.h:71
#define USB_NAK_MAX_POWER
Definition: address.h:33
uint8_t bmParent
Definition: address.h:67
union UsbDeviceAddress::@30 __attribute__
void
Definition: png.h:1083
uint8_t bmRcvToggle
Definition: address.h:47
AddressPoolImpl()
Definition: address.h:166
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)
Definition: address.h:201
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)
Definition: address.h:183
uint8_t epAttribs
Definition: address.h:43
uint8_t epcount
Definition: address.h:82
UsbDeviceAddress address
Definition: address.h:81
const uint8_t[]
Definition: 404_html.c:3
UsbDeviceAddress address
Definition: address.h:202
void(* UsbDeviceHandleFunc)(UsbDevice *pdev)
Definition: address.h:94
virtual void FreeAddress(uint8_t addr)=0
uint8_t maxPktSize
Definition: address.h:40
uint8_t bmAddress
Definition: address.h:66
uint8_t bmHub
Definition: address.h:68
EpInfo * epinfo
Definition: address.h:80