static
int
ep1_generic_commandl(
- usb_dev_handle *pHDev,
+ usb_dev_handle *pHDev_param,
size_t length,
...
) {
);
usb_ret = usb_bulk_write(
- pHDev,
+ pHDev_param,
USB_EP1OUT_ADDR,
(char *)usb_buffer, sizeof(usb_buffer),
USB_TIMEOUT_MS
static
ssize_t
ep1_memory_write(
- usb_dev_handle *pHDev,
+ usb_dev_handle *pHDev_param,
uint16_t addr,
size_t length,
uint8_t const *buffer
);
usb_ret = usb_bulk_write(
- pHDev, USB_EP1OUT_ADDR,
+ pHDev_param, USB_EP1OUT_ADDR,
(char *)usb_buffer, sizeof(usb_buffer),
USB_TIMEOUT_MS
);
static
int
dtc_load_from_buffer(
- usb_dev_handle *pHDev,
+ usb_dev_handle *pHDev_param,
const uint8_t *buffer,
size_t length
) {
/* Stop the DTC before loading anything. */
usb_err = ep1_generic_commandl(
- pHDev, 1,
+ pHDev_param, 1,
EP1_CMD_DTC_STOP
);
if (usb_err < 0) return(usb_err);
case DTCLOAD_LOAD:
/* Send the DTC program to ST7 RAM. */
usb_err = ep1_memory_write(
- pHDev,
+ pHDev_param,
DTC_LOAD_BUFFER,
header->length + 1, buffer
);
/* Load it into the DTC. */
usb_err = ep1_generic_commandl(
- pHDev, 3,
+ pHDev_param, 3,
EP1_CMD_DTC_LOAD,
(DTC_LOAD_BUFFER >> 8),
DTC_LOAD_BUFFER
case DTCLOAD_RUN:
usb_err = ep1_generic_commandl(
- pHDev, 3,
+ pHDev_param, 3,
EP1_CMD_DTC_CALL,
buffer[0],
EP1_CMD_DTC_WAIT
case DTCLOAD_LUT:
usb_err = ep1_memory_write(
- pHDev,
+ pHDev_param,
ST7_USB_BUF_EP0OUT + lut_start,
header->length + 1, buffer
);
static
int
dtc_run_download(
- usb_dev_handle *pHDev,
+ usb_dev_handle *pHDev_param,
uint8_t *command_buffer,
int command_buffer_size,
uint8_t *reply_buffer,
LOG_DEBUG(": %d/%d\n", command_buffer_size, reply_buffer_size);
usb_err = usb_bulk_write(
- pHDev,
+ pHDev_param,
USB_EP2OUT_ADDR,
(char *)command_buffer, USB_EP2BANK_SIZE,
USB_TIMEOUT_MS
/* Wait for DTC to finish running command buffer */
for (i = 10;;) {
usb_err = ep1_generic_commandl(
- pHDev, 4,
+ pHDev_param, 4,
EP1_CMD_MEMORY_READ,
DTC_STATUS_POLL_BYTE >> 8,
if (usb_err < 0) return(usb_err);
usb_err = usb_bulk_read(
- pHDev,
+ pHDev_param,
USB_EP1IN_ADDR,
(char *)ep2_buffer, 1,
USB_TIMEOUT_MS
if (!reply_buffer) reply_buffer_size = 0;
if (reply_buffer_size) {
usb_err = usb_bulk_read(
- pHDev,
+ pHDev_param,
USB_EP2IN_ADDR,
(char *)ep2_buffer, sizeof(ep2_buffer),
USB_TIMEOUT_MS