Skip to content

usb_sound_card.c - line 290 "todo lie thru our teeth for now" #28

@Bram-Pl

Description

@Bram-Pl

Isochronous data with asynchronous USB transfer type

Line 290 states: todo lie thru our teeth for now in the _as_sync_packet' function. What exactly is meant by this? What does this function do?

Does this mean the asynchronous USB transfer type is not actually providing correct feedback to the USB Host and just spoofing the feedback loop to the host? The function can be seen below. When debugging I noticed that this function is called many times which is what could be expected for something that is used as feedback loop to a USB host device. I just do not comprehend where or when this feedback is returned to the USB host device.

static void _as_sync_packet(struct usb_endpoint *ep) {
    assert(ep->current_transfer);
    DEBUG_PINS_SET(audio_timing, 2);
    DEBUG_PINS_CLR(audio_timing, 2);
    struct usb_buffer *buffer = usb_current_in_packet_buffer(ep);
    assert(buffer->data_max >= 3);
    buffer->data_len = 3;

    // todo lie thru our teeth for now
    uint feedback = (audio_state.freq << 14u) / 1000u;

    buffer->data[0] = feedback;
    buffer->data[1] = feedback >> 8u;
    buffer->data[2] = feedback >> 16u;

    printf("_as_sync_packet function --> data[0]: %d, data[1]: %d, data[2]: %d\n\r");

    // keep on truckin'
    usb_grow_transfer(ep->current_transfer, 1);
    usb_packet_done(ep);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions