Merge pull request #1072 from martinling/fix-stack-variables
Fix USB requests that were responding with data from the stack.
This commit is contained in:
@ -56,11 +56,11 @@ usb_request_status_t usb_vendor_request_read_version_string(
|
|||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static read_partid_serialno_t read_partid_serialno;
|
||||||
usb_request_status_t usb_vendor_request_read_partid_serialno(
|
usb_request_status_t usb_vendor_request_read_partid_serialno(
|
||||||
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
||||||
{
|
{
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
read_partid_serialno_t read_partid_serialno;
|
|
||||||
iap_cmd_res_t iap_cmd_res;
|
iap_cmd_res_t iap_cmd_res;
|
||||||
|
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP)
|
if (stage == USB_TRANSFER_STAGE_SETUP)
|
||||||
@ -101,4 +101,4 @@ usb_request_status_t usb_vendor_request_reset(
|
|||||||
usb_transfer_schedule_ack(endpoint->in);
|
usb_transfer_schedule_ack(endpoint->in);
|
||||||
}
|
}
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
uint8_t cpld_xsvf_buffer[512];
|
uint8_t cpld_xsvf_buffer[512];
|
||||||
volatile bool cpld_wait = false;
|
volatile bool cpld_wait = false;
|
||||||
@ -98,7 +99,8 @@ usb_request_status_t usb_vendor_request_cpld_checksum(
|
|||||||
}
|
}
|
||||||
|
|
||||||
length = (uint8_t)sizeof(cpld_crc);
|
length = (uint8_t)sizeof(cpld_crc);
|
||||||
usb_transfer_schedule_block(endpoint->in, &cpld_crc, length,
|
memcpy(endpoint->buffer, &cpld_crc, length);
|
||||||
|
usb_transfer_schedule_block(endpoint->in, endpoint->buffer, length,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,8 @@ usb_request_status_t usb_vendor_request_operacake_get_boards(
|
|||||||
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
||||||
{
|
{
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||||
uint8_t addresses[8];
|
operacake_get_boards(endpoint->buffer);
|
||||||
operacake_get_boards(addresses);
|
usb_transfer_schedule_block(endpoint->in, endpoint->buffer, 8, NULL, NULL);
|
||||||
usb_transfer_schedule_block(endpoint->in, addresses, 8, NULL, NULL);
|
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
}
|
}
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
|
@ -124,10 +124,9 @@ usb_request_status_t usb_vendor_request_read_spiflash(
|
|||||||
usb_request_status_t usb_vendor_request_spiflash_status(
|
usb_request_status_t usb_vendor_request_spiflash_status(
|
||||||
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage)
|
||||||
{
|
{
|
||||||
uint8_t data[2];
|
|
||||||
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
if (stage == USB_TRANSFER_STAGE_SETUP) {
|
||||||
w25q80bv_get_full_status(&spi_flash, data);
|
w25q80bv_get_full_status(&spi_flash, endpoint->buffer);
|
||||||
usb_transfer_schedule_block(endpoint->in, &data, 2, NULL, NULL);
|
usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 2, NULL, NULL);
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
} else if (stage == USB_TRANSFER_STAGE_DATA) {
|
} else if (stage == USB_TRANSFER_STAGE_DATA) {
|
||||||
usb_transfer_schedule_ack(endpoint->out);
|
usb_transfer_schedule_ack(endpoint->out);
|
||||||
@ -145,4 +144,4 @@ usb_request_status_t usb_vendor_request_spiflash_clear_status(
|
|||||||
usb_transfer_schedule_ack(endpoint->in);
|
usb_transfer_schedule_ack(endpoint->in);
|
||||||
}
|
}
|
||||||
return USB_REQUEST_STATUS_OK;
|
return USB_REQUEST_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user