1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
static volatile bool setup_data_valid = false;
static volatile uint32_t setup_data[2];

int usb_drv_recv_setup(struct usb_ctrlrequest *req)
{
    while (!setup_data_valid)
        ;

backlight_off(); <- this one never hits

    memcpy(req, (void *)setup_data, sizeof(struct usb_ctrlrequest));
    setup_data_valid = false;
    return 0;
}

static void setup_irq_handler(void)
{

    /* copy setup data from packet */
    setup_data[0] = SETUP1;
    setup_data[1] = SETUP2;

    /* ack upper layer we have setup data */
    setup_data_valid = true;

// backlight_off(); <- this get hit when uncommented
}