For the periodic schedule you want to link them in the way BenLunt described. Each vertex in his tree represents multiple QHs. Note that there are 128 vertices for 128 frame periods. However that does not mean that at most 128 endpoints are supported for this period as you can schedule multiple 128 frame period endpoints in the same frame. Note that you have to calculate the bandwidth requirements of each endpoint yourself. Not every possible schedule respects the USB bandwidth requirements; if you do not calculate those requirements you'll construct invalid schedules.
The asynchronous schedule is round-robin: At each frame the HCD executes as many transactions as possible until the next SOF. If a transaction NAKs the HCD just continues with the next one. The HCD remembers its position in the asynchronous schedule across (micro-)frame boundaries. It uses the "Head of Reclamation List" bit to detect empty schedules.
EDIT:
There is only a single QH1. There are two QH2, 4 QH4 and so on. The k-th QH_m is linked in frame i if i = k mod m. There are QHs for each period in every frame. Your image (with all QH_m identified) does not depict 32 frames but only part of a single frame (i.e. frame 32).BenLunt wrote:Also note that I started the frame numbers from 1, not zero. This is to show you that 1 is divisible by 1, so use QH1; 4 is divisible by 4, so use QH4, etc. Frame 6, (the 6th frame, or frame 5 if zero based) is only divisible by 2, so use QH2. Find the most significant 2 based divisor. You see the math?
Also note that QH1 is listed numerous times (as with others). There is only one Queue Head for QH1 in your schedule. Not 16 as shown above. The arrows point to the single queue head in the schedule of queue heads.
The real frame list is structured like this:
Code: Select all
Frame 0: 0th QH1024 -> 0th QH512 -> ... -> 0th QH4 -> 0th QH2 -> 0th QH1
Frame 1: 1st QH1024 -> 1th QH512 -> ... -> 1st QH4 -> 1st QH2 -> 0th QH1
Frame 2: 2nd QH1024 -> 2nd QH512 -> ... -> 2nd OH4 -> 0th QH2 -> 0th QH1
Frame 3: 3rd QH1024 -> 3rd QH512 -> ... -> 3rd OH4 -> 1st QH2 -> 0th QH1
Frame 4: 4th QH1024 -> 4th QH512 -> ... -> 0th OH4 -> 0th QH2 -> 0th QH1
...
Frame 512: 512th QH1024 -> 0th QH512 -> ... -> 0th OH4 -> 0th QH2 -> 0th QH1
...
Frame 1023: 1023th QH1024 -> 511th QH512 -> ... -> 3rd OH4 -> 1st QH2 -> 0th QH1